[FFmpeg-cvslog] avformat/dashenc: Add hls_master_name option

Przemysław Sobala git at videolan.org
Mon Jun 15 10:09:05 EEST 2020


ffmpeg | branch: master | Przemysław Sobala <przemyslaw.sobala at gmail.com> | Wed Jun 10 13:14:36 2020 +0200| [9d80f3ec4b08815719ce554c0a08ed27e671d6dc] | committer: Karthick J

avformat/dashenc: Add hls_master_name option

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9d80f3ec4b08815719ce554c0a08ed27e671d6dc
---

 doc/muxers.texi       | 4 +++-
 libavformat/dashenc.c | 8 +++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index d6f9de3702..b1389a3227 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -267,8 +267,10 @@ Override User-Agent field in HTTP header. Applicable only for HTTP output.
 @item http_persistent @var{http_persistent}
 Use persistent HTTP connections. Applicable only for HTTP output.
 @item hls_playlist @var{hls_playlist}
-Generate HLS playlist files as well. The master playlist is generated with the filename master.m3u8.
+Generate HLS playlist files as well. The master playlist is generated with the filename @var{hls_master_name}.
 One media playlist file is generated for each stream with filenames media_0.m3u8, media_1.m3u8, etc.
+ at item hls_master_name @var{file_name}
+HLS master playlist name. Default is "master.m3u8".
 @item streaming @var{streaming}
 Enable (1) or disable (0) chunk streaming mode of output. In chunk streaming
 mode, each frame will be a moof fragment which forms a chunk.
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 00a37b175d..3e587acdff 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -171,6 +171,7 @@ typedef struct DASHContext {
     const char *user_agent;
     AVDictionary *http_opts;
     int hls_playlist;
+    const char *hls_master_name;
     int http_persistent;
     int master_playlist_created;
     AVIOContext *mpd_out;
@@ -1261,9 +1262,9 @@ static int write_manifest(AVFormatContext *s, int final)
             return 0;
 
         if (*c->dirname)
-            snprintf(filename_hls, sizeof(filename_hls), "%smaster.m3u8", c->dirname);
+            snprintf(filename_hls, sizeof(filename_hls), "%s%s", c->dirname, c->hls_master_name);
         else
-            snprintf(filename_hls, sizeof(filename_hls), "master.m3u8");
+            snprintf(filename_hls, sizeof(filename_hls), "%s", c->hls_master_name);
 
         snprintf(temp_filename, sizeof(temp_filename), use_rename ? "%s.tmp" : "%s", filename_hls);
 
@@ -2292,7 +2293,7 @@ static int dash_write_trailer(AVFormatContext *s)
 
         if (c->hls_playlist && c->master_playlist_created) {
             char filename[1024];
-            snprintf(filename, sizeof(filename), "%smaster.m3u8", c->dirname);
+            snprintf(filename, sizeof(filename), "%s%s", c->dirname, c->hls_master_name);
             dashenc_delete_file(s, filename);
         }
     }
@@ -2349,6 +2350,7 @@ static const AVOption options[] = {
     { "http_user_agent", "override User-Agent field in HTTP header", OFFSET(user_agent), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, E},
     { "http_persistent", "Use persistent HTTP connections", OFFSET(http_persistent), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, E },
     { "hls_playlist", "Generate HLS playlist files(master.m3u8, media_%d.m3u8)", OFFSET(hls_playlist), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },
+    { "hls_master_name", "HLS master playlist name", OFFSET(hls_master_name), AV_OPT_TYPE_STRING, {.str = "master.m3u8"}, 0, 0, E },
     { "streaming", "Enable/Disable streaming mode of output. Each frame will be moof fragment", OFFSET(streaming), 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 },
     { "index_correction", "Enable/Disable segment index correction logic", OFFSET(index_correction), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, E },



More information about the ffmpeg-cvslog mailing list