Currently this option is bound to the container format requesting global
headers or not, in a number of situation global headers and and repeated
headers are not mutually exclusive.
---
 libavcodec/libx264.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 6f68e8f..3c19752 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -70,6 +70,7 @@ typedef struct X264Context {
     int slice_max_size;
     char *stats;
     int nal_hrd;
+    int repeat_headers;
 } X264Context;
 
 static void X264_log(void *p, int level, const char *fmt, va_list args)
@@ -407,6 +408,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
     if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER)
         x4->params.b_repeat_headers = 0;
 
+    if (x4->repeat_headers != -1)
+        x4->params.b_repeat_headers = x4->repeat_headers;
+
     // update AVCodecContext with x264 parameters
     avctx->has_b_frames = x4->params.i_bframe ?
         x4->params.i_bframe_pyramid ? 2 : 1 : 0;
@@ -527,6 +531,7 @@ static const AVOption options[] = {
     { "none",          NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_NONE}, 
INT_MIN, INT_MAX, VE, "nal-hrd" },
     { "vbr",           NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_VBR},  
INT_MIN, INT_MAX, VE, "nal-hrd" },
     { "cbr",           NULL, 0, AV_OPT_TYPE_CONST, {.i64 = X264_NAL_HRD_CBR},  
INT_MIN, INT_MAX, VE, "nal-hrd" },
+    { "repeat-headers", "Repeat headers (needed by mpegts)",              
OFFSET(repeat_headers),AV_OPT_TYPE_INT,    { .i64 = -1 }, -1, 1, VE },
     { NULL },
 };
 
-- 
1.7.12

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to