Message ID | 20190626165854.94244-1-derek.buitenhuis@gmail.com |
---|---|
State | Accepted |
Commit | 025fcee6fa208dd484a419ecf29c3e70038a5e34 |
Headers | show |
Derek Buitenhuis <derek.buitenhuis@gmail.com> 于2019年6月27日周四 上午1:04写道: > > Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> > --- > Onward and upward with the never-ending quest to manually forward > all the HTTP options to the subcontexts in every meta-muxer! > --- > doc/muxers.texi | 3 +++ > libavformat/hlsenc.c | 4 ++++ > 2 files changed, 7 insertions(+) > > diff --git a/doc/muxers.texi b/doc/muxers.texi > index 6c5b4bb637..59c93bc687 100644 > --- a/doc/muxers.texi > +++ b/doc/muxers.texi > @@ -1089,6 +1089,9 @@ Set timeout for socket I/O operations. Applicable only for HTTP output. > @item -ignore_io_errors > Ignore IO errors during open, write and delete. Useful for long-duration runs with network output. > > +@item headers > +Set custom HTTP headers, can override built in default headers. Applicable only for HTTP output. > + > @end table > > @anchor{ico} > diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c > index 9f5eee5491..37ae128f4f 100644 > --- a/libavformat/hlsenc.c > +++ b/libavformat/hlsenc.c > @@ -237,6 +237,7 @@ typedef struct HLSContext { > AVIOContext *sub_m3u8_out; > int64_t timeout; > int ignore_io_errors; > + char *headers; > int has_default_key; /* has DEFAULT field of var_stream_map */ > int has_video_m3u8; /* has video stream m3u8 list */ > } HLSContext; > @@ -294,6 +295,8 @@ static void set_http_options(AVFormatContext *s, AVDictionary **options, HLSCont > av_dict_set_int(options, "multiple_requests", 1, 0); > if (c->timeout >= 0) > av_dict_set_int(options, "timeout", c->timeout, 0); > + if (c->headers) > + av_dict_set(options, "headers", c->headers, 0); > } > > static void write_codec_attr(AVStream *st, VariantStream *vs) { > @@ -3029,6 +3032,7 @@ static const AVOption options[] = { > {"http_persistent", "Use persistent HTTP connections", OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E }, > {"timeout", "set timeout for socket I/O operations", OFFSET(timeout), AV_OPT_TYPE_DURATION, { .i64 = -1 }, -1, INT_MAX, .flags = E }, > {"ignore_io_errors", "Ignore IO errors for stable long-duration runs with network output", OFFSET(ignore_io_errors), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E }, > + {"headers", "set custom HTTP headers, can override built in default headers", OFFSET(headers), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E }, > { NULL }, > }; > > -- > 2.20.1 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". LGTM Thanks Steven
On 27/06/2019 05:16, Steven Liu wrote: > LGTM > Pushed. Thanks! - Derek
diff --git a/doc/muxers.texi b/doc/muxers.texi index 6c5b4bb637..59c93bc687 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -1089,6 +1089,9 @@ Set timeout for socket I/O operations. Applicable only for HTTP output. @item -ignore_io_errors Ignore IO errors during open, write and delete. Useful for long-duration runs with network output. +@item headers +Set custom HTTP headers, can override built in default headers. Applicable only for HTTP output. + @end table @anchor{ico} diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 9f5eee5491..37ae128f4f 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -237,6 +237,7 @@ typedef struct HLSContext { AVIOContext *sub_m3u8_out; int64_t timeout; int ignore_io_errors; + char *headers; int has_default_key; /* has DEFAULT field of var_stream_map */ int has_video_m3u8; /* has video stream m3u8 list */ } HLSContext; @@ -294,6 +295,8 @@ static void set_http_options(AVFormatContext *s, AVDictionary **options, HLSCont av_dict_set_int(options, "multiple_requests", 1, 0); if (c->timeout >= 0) av_dict_set_int(options, "timeout", c->timeout, 0); + if (c->headers) + av_dict_set(options, "headers", c->headers, 0); } static void write_codec_attr(AVStream *st, VariantStream *vs) { @@ -3029,6 +3032,7 @@ static const AVOption options[] = { {"http_persistent", "Use persistent HTTP connections", OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E }, {"timeout", "set timeout for socket I/O operations", OFFSET(timeout), AV_OPT_TYPE_DURATION, { .i64 = -1 }, -1, INT_MAX, .flags = E }, {"ignore_io_errors", "Ignore IO errors for stable long-duration runs with network output", OFFSET(ignore_io_errors), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E }, + {"headers", "set custom HTTP headers, can override built in default headers", OFFSET(headers), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E }, { NULL }, };
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com> --- Onward and upward with the never-ending quest to manually forward all the HTTP options to the subcontexts in every meta-muxer! --- doc/muxers.texi | 3 +++ libavformat/hlsenc.c | 4 ++++ 2 files changed, 7 insertions(+)