diff options
author | Karthick J <kjeyapal@akamai.com> | 2019-02-19 09:31:32 +0300 |
---|---|---|
committer | Karthick J <kjeyapal@akamai.com> | 2019-02-25 09:10:47 +0300 |
commit | ca5ec4cbbcf3fd6ede75a8dd4cbb5fff051899ec (patch) | |
tree | aaafb3edba87921b3282fda8b8ce8af29883c0a3 | |
parent | a2c7702ccf5e023c40a18c92e3182e24fefab691 (diff) |
avformat/dashenc: Added option to repeatedly publish master playlist
The master playlist can be published at a specified interval with this option
-rw-r--r-- | doc/muxers.texi | 3 | ||||
-rw-r--r-- | libavformat/dashenc.c | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/doc/muxers.texi b/doc/muxers.texi index 36010cf2d1..372fab2f92 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -315,6 +315,9 @@ This option will also try to comply with the above open spec, till Apple's spec Applicable only when @var{streaming} and @var{hls_playlist} options are enabled. This is an experimental feature. +@item -master_m3u8_publish_rate @var{master_m3u8_publish_rate} +Publish master playlist repeatedly every after specified number of segment intervals. + @end table @anchor{framecrc} diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 37a7547b12..a0b44a0ec3 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -141,6 +141,7 @@ typedef struct DASHContext { SegmentType segment_type_option; /* segment type as specified in options */ int ignore_io_errors; int lhls; + int master_publish_rate; } DASHContext; static struct codec_string { @@ -965,13 +966,18 @@ static int write_manifest(AVFormatContext *s, int final) return ret; } - if (c->hls_playlist && !c->master_playlist_created) { + if (c->hls_playlist) { char filename_hls[1024]; const char *audio_group = "A1"; char audio_codec_str[128] = "\0"; int is_default = 1; int max_audio_bitrate = 0; + // Publish master playlist only the configured rate + if (c->master_playlist_created && (!c->master_publish_rate || + c->streams[0].segment_index % c->master_publish_rate)) + return 0; + if (*c->dirname) snprintf(filename_hls, sizeof(filename_hls), "%smaster.m3u8", c->dirname); else @@ -1798,6 +1804,7 @@ static const AVOption options[] = { { "webm", "make segment file in WebM format", 0, AV_OPT_TYPE_CONST, {.i64 = SEGMENT_TYPE_WEBM }, 0, UINT_MAX, E, "segment_type"}, { "ignore_io_errors", "Ignore IO errors during open and write. Useful for long-duration runs with network output", OFFSET(ignore_io_errors), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E }, { "lhls", "Enable Low-latency HLS(Experimental). Adds #EXT-X-PREFETCH tag with current segment's URI", OFFSET(lhls), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E }, + { "master_m3u8_publish_rate", "Publish master playlist every after this many segment intervals", OFFSET(master_publish_rate), AV_OPT_TYPE_INT, {.i64 = 0}, 0, UINT_MAX, E}, { NULL }, }; |