Message ID | 20210529100228.10591-1-ffmpeg@gyani.pro |
---|---|
State | Accepted |
Headers | show |
Series | [FFmpeg-devel] avformat/hls: relay format options to segment demuxer | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
> 2021年5月29日 下午6:02,Gyan Doshi <ffmpeg@gyani.pro> 写道: > > --- > doc/demuxers.texi | 3 +++ > libavformat/hls.c | 9 ++++++++- > 2 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/doc/demuxers.texi b/doc/demuxers.texi > index 13fe17ff4f..f79faff92b 100644 > --- a/doc/demuxers.texi > +++ b/doc/demuxers.texi > @@ -347,6 +347,9 @@ Enabled by default for HTTP/1.1 servers. > @item http_seekable > Use HTTP partial requests for downloading HTTP segments. > 0 = disable, 1 = enable, -1 = auto, Default is auto. > + > +@item seg_format_options > +Set options for the demuxer of media segments using a list of key=value couples separated by @code{:}. > @end table > > @section image2 > diff --git a/libavformat/hls.c b/libavformat/hls.c > index 8fc6924c90..c2ca23e973 100644 > --- a/libavformat/hls.c > +++ b/libavformat/hls.c > @@ -207,6 +207,7 @@ typedef struct HLSContext { > int64_t cur_timestamp; > AVIOInterruptCB *interrupt_callback; > AVDictionary *avio_opts; > + AVDictionary *seg_format_opts; > char *allowed_extensions; > int max_reload; > int http_persistent; > @@ -1959,6 +1960,7 @@ static int hls_read_header(AVFormatContext *s) > struct playlist *pls = c->playlists[i]; > const AVInputFormat *in_fmt = NULL; > char *url; > + AVDictionary *seg_format_opts = NULL; > > if (!(pls->ctx = avformat_alloc_context())) { > ret = AVERROR(ENOMEM); > @@ -2017,7 +2019,10 @@ static int hls_read_header(AVFormatContext *s) > if ((ret = ff_copy_whiteblacklists(pls->ctx, s)) < 0) > goto fail; > > - ret = avformat_open_input(&pls->ctx, pls->segments[0]->url, in_fmt, NULL); > + av_dict_copy(&seg_format_opts, c->seg_format_opts, 0); > + > + ret = avformat_open_input(&pls->ctx, pls->segments[0]->url, in_fmt, &seg_format_opts); > + av_dict_free(&seg_format_opts); > if (ret < 0) > goto fail; > > @@ -2403,6 +2408,8 @@ static const AVOption hls_options[] = { > OFFSET(http_multiple), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, FLAGS}, > {"http_seekable", "Use HTTP partial requests, 0 = disable, 1 = enable, -1 = auto", > OFFSET(http_seekable), AV_OPT_TYPE_BOOL, { .i64 = -1}, -1, 1, FLAGS}, > + {"seg_format_options", "Set options for segment demuxer", > + OFFSET(seg_format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS}, > {NULL} > }; > > -- > 2.31.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 Liu
> > +@item seg_format_options > > +Set options for the demuxer of media segments using a list of key=value > > couples separated by @code{:}. @end table "couples" is an unusual expression in this context. Perhaps something like: Set options for the demuxer of media segments using a list of key-value pairs separated by @code{:}. Brad
On 2021-05-30 09:18, Brad Hards wrote: >>> +@item seg_format_options >>> +Set options for the demuxer of media segments using a list of key=value >>> couples separated by @code{:}. @end table > "couples" is an unusual expression in this context. Perhaps something like: > > Set options for the demuxer of media segments using a list of key-value pairs > separated by @code{:}. Yes, pairs is more natural. I copied the clause from similar entries. Thanks, Gyan
Pushed as 51f1194edae2020ec99b816bd045a29db0e469f8 Thanks, Gyan On 2021-05-30 09:07, Steven Liu wrote: > >> 2021年5月29日 下午6:02,Gyan Doshi <ffmpeg@gyani.pro> 写道: >> >> --- >> doc/demuxers.texi | 3 +++ >> libavformat/hls.c | 9 ++++++++- >> 2 files changed, 11 insertions(+), 1 deletion(-) >> >> diff --git a/doc/demuxers.texi b/doc/demuxers.texi >> index 13fe17ff4f..f79faff92b 100644 >> --- a/doc/demuxers.texi >> +++ b/doc/demuxers.texi >> @@ -347,6 +347,9 @@ Enabled by default for HTTP/1.1 servers. >> @item http_seekable >> Use HTTP partial requests for downloading HTTP segments. >> 0 = disable, 1 = enable, -1 = auto, Default is auto. >> + >> +@item seg_format_options >> +Set options for the demuxer of media segments using a list of key=value couples separated by @code{:}. >> @end table >> >> @section image2 >> diff --git a/libavformat/hls.c b/libavformat/hls.c >> index 8fc6924c90..c2ca23e973 100644 >> --- a/libavformat/hls.c >> +++ b/libavformat/hls.c >> @@ -207,6 +207,7 @@ typedef struct HLSContext { >> int64_t cur_timestamp; >> AVIOInterruptCB *interrupt_callback; >> AVDictionary *avio_opts; >> + AVDictionary *seg_format_opts; >> char *allowed_extensions; >> int max_reload; >> int http_persistent; >> @@ -1959,6 +1960,7 @@ static int hls_read_header(AVFormatContext *s) >> struct playlist *pls = c->playlists[i]; >> const AVInputFormat *in_fmt = NULL; >> char *url; >> + AVDictionary *seg_format_opts = NULL; >> >> if (!(pls->ctx = avformat_alloc_context())) { >> ret = AVERROR(ENOMEM); >> @@ -2017,7 +2019,10 @@ static int hls_read_header(AVFormatContext *s) >> if ((ret = ff_copy_whiteblacklists(pls->ctx, s)) < 0) >> goto fail; >> >> - ret = avformat_open_input(&pls->ctx, pls->segments[0]->url, in_fmt, NULL); >> + av_dict_copy(&seg_format_opts, c->seg_format_opts, 0); >> + >> + ret = avformat_open_input(&pls->ctx, pls->segments[0]->url, in_fmt, &seg_format_opts); >> + av_dict_free(&seg_format_opts); >> if (ret < 0) >> goto fail; >> >> @@ -2403,6 +2408,8 @@ static const AVOption hls_options[] = { >> OFFSET(http_multiple), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, FLAGS}, >> {"http_seekable", "Use HTTP partial requests, 0 = disable, 1 = enable, -1 = auto", >> OFFSET(http_seekable), AV_OPT_TYPE_BOOL, { .i64 = -1}, -1, 1, FLAGS}, >> + {"seg_format_options", "Set options for segment demuxer", >> + OFFSET(seg_format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS}, >> {NULL} >> }; >> >> -- >> 2.31.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 Liu > > > > _______________________________________________ > 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".
diff --git a/doc/demuxers.texi b/doc/demuxers.texi index 13fe17ff4f..f79faff92b 100644 --- a/doc/demuxers.texi +++ b/doc/demuxers.texi @@ -347,6 +347,9 @@ Enabled by default for HTTP/1.1 servers. @item http_seekable Use HTTP partial requests for downloading HTTP segments. 0 = disable, 1 = enable, -1 = auto, Default is auto. + +@item seg_format_options +Set options for the demuxer of media segments using a list of key=value couples separated by @code{:}. @end table @section image2 diff --git a/libavformat/hls.c b/libavformat/hls.c index 8fc6924c90..c2ca23e973 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -207,6 +207,7 @@ typedef struct HLSContext { int64_t cur_timestamp; AVIOInterruptCB *interrupt_callback; AVDictionary *avio_opts; + AVDictionary *seg_format_opts; char *allowed_extensions; int max_reload; int http_persistent; @@ -1959,6 +1960,7 @@ static int hls_read_header(AVFormatContext *s) struct playlist *pls = c->playlists[i]; const AVInputFormat *in_fmt = NULL; char *url; + AVDictionary *seg_format_opts = NULL; if (!(pls->ctx = avformat_alloc_context())) { ret = AVERROR(ENOMEM); @@ -2017,7 +2019,10 @@ static int hls_read_header(AVFormatContext *s) if ((ret = ff_copy_whiteblacklists(pls->ctx, s)) < 0) goto fail; - ret = avformat_open_input(&pls->ctx, pls->segments[0]->url, in_fmt, NULL); + av_dict_copy(&seg_format_opts, c->seg_format_opts, 0); + + ret = avformat_open_input(&pls->ctx, pls->segments[0]->url, in_fmt, &seg_format_opts); + av_dict_free(&seg_format_opts); if (ret < 0) goto fail; @@ -2403,6 +2408,8 @@ static const AVOption hls_options[] = { OFFSET(http_multiple), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, FLAGS}, {"http_seekable", "Use HTTP partial requests, 0 = disable, 1 = enable, -1 = auto", OFFSET(http_seekable), AV_OPT_TYPE_BOOL, { .i64 = -1}, -1, 1, FLAGS}, + {"seg_format_options", "Set options for segment demuxer", + OFFSET(seg_format_opts), AV_OPT_TYPE_DICT, {.str = NULL}, 0, 0, FLAGS}, {NULL} };