You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avformat/hls: relay format options to segment demuxer
Signed-off-by: Gyan Doshi <ffmpeg@gyani.pro> Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
This commit is contained in:
@@ -347,6 +347,9 @@ Enabled by default for HTTP/1.1 servers.
|
|||||||
@item http_seekable
|
@item http_seekable
|
||||||
Use HTTP partial requests for downloading HTTP segments.
|
Use HTTP partial requests for downloading HTTP segments.
|
||||||
0 = disable, 1 = enable, -1 = auto, Default is auto.
|
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 pairs separated by @code{:}.
|
||||||
@end table
|
@end table
|
||||||
|
|
||||||
@section image2
|
@section image2
|
||||||
|
@@ -207,6 +207,7 @@ typedef struct HLSContext {
|
|||||||
int64_t cur_timestamp;
|
int64_t cur_timestamp;
|
||||||
AVIOInterruptCB *interrupt_callback;
|
AVIOInterruptCB *interrupt_callback;
|
||||||
AVDictionary *avio_opts;
|
AVDictionary *avio_opts;
|
||||||
|
AVDictionary *seg_format_opts;
|
||||||
char *allowed_extensions;
|
char *allowed_extensions;
|
||||||
int max_reload;
|
int max_reload;
|
||||||
int http_persistent;
|
int http_persistent;
|
||||||
@@ -1959,6 +1960,7 @@ static int hls_read_header(AVFormatContext *s)
|
|||||||
struct playlist *pls = c->playlists[i];
|
struct playlist *pls = c->playlists[i];
|
||||||
const AVInputFormat *in_fmt = NULL;
|
const AVInputFormat *in_fmt = NULL;
|
||||||
char *url;
|
char *url;
|
||||||
|
AVDictionary *seg_format_opts = NULL;
|
||||||
|
|
||||||
if (!(pls->ctx = avformat_alloc_context())) {
|
if (!(pls->ctx = avformat_alloc_context())) {
|
||||||
ret = AVERROR(ENOMEM);
|
ret = AVERROR(ENOMEM);
|
||||||
@@ -2017,7 +2019,10 @@ static int hls_read_header(AVFormatContext *s)
|
|||||||
if ((ret = ff_copy_whiteblacklists(pls->ctx, s)) < 0)
|
if ((ret = ff_copy_whiteblacklists(pls->ctx, s)) < 0)
|
||||||
goto fail;
|
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)
|
if (ret < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
@@ -2403,6 +2408,8 @@ static const AVOption hls_options[] = {
|
|||||||
OFFSET(http_multiple), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, FLAGS},
|
OFFSET(http_multiple), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, FLAGS},
|
||||||
{"http_seekable", "Use HTTP partial requests, 0 = disable, 1 = enable, -1 = auto",
|
{"http_seekable", "Use HTTP partial requests, 0 = disable, 1 = enable, -1 = auto",
|
||||||
OFFSET(http_seekable), AV_OPT_TYPE_BOOL, { .i64 = -1}, -1, 1, FLAGS},
|
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}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user