diff mbox series

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

Message ID 20200610111436.30043-1-przemyslaw.sobala@gmail.com
State Accepted
Commit 9d80f3ec4b08815719ce554c0a08ed27e671d6dc
Headers show
Series [FFmpeg-devel] avformat/dashenc: Add hls_master_name option
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Przemysław Sobala June 10, 2020, 11:14 a.m. UTC
---
 doc/muxers.texi       | 4 +++-
 libavformat/dashenc.c | 8 +++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

Comments

Przemysław Sobala June 14, 2020, 3:13 p.m. UTC | #1
Any comments about that?

--
Best regards
Przemysław Sobala

On Wed, Jun 10, 2020 at 1:15 PM Przemysław Sobala <
przemyslaw.sobala@gmail.com> wrote:

> ---
>  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.
> +@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 },
> --
> 2.25.4
>
>
Jeyapal, Karthick June 15, 2020, 7:37 a.m. UTC | #2
On 6/14/20 8:43 PM, Przemysław Sobala wrote:
> Any comments about that?
>
> --
> Best regards
> Przemysław Sobala
>
> On Wed, Jun 10, 2020 at 1:15 PM Przemysław Sobala <
> przemyslaw.sobala@gmail.com> wrote:
>
>> ---
>>  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.
>> +@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 },
>> --
>> 2.25.4
>>
>>
Pushed. Thanks.

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://urldefense.proofpoint.com/v2/url?u=https-3A__ffmpeg.org_mailman_listinfo_ffmpeg-2Ddevel&d=DwIGaQ&c=96ZbZZcaMF4w0F4jpN6LZg&r=xOoesbz-6ff1GPXp5Lg4jf1ZG99yp4a1qhxVn_YOwRU&m=J4ur_c-YVlnfJvWviasMhbv_AZhB63VFkaL4Afm5XyI&s=Jgwmj43pX8S5nR_4ipFwPcgt1e7vg4UJoNUjqVKDN9E&e= 
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

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.
+@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 },