[FFmpeg-cvslog] hls: Add an option to prepend a baseurl to the playlist entries

Luca Barbato git at videolan.org
Tue Apr 29 17:06:18 CEST 2014


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Tue Mar 18 21:19:00 2014 +0100| [5a70a783f04919514efec7751d710b64d8975fd7] | committer: Luca Barbato

hls: Add an option to prepend a baseurl to the playlist entries

Useful to generate playlists with absolute paths.

Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

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

 doc/muxers.texi      |    3 +++
 libavformat/hlsenc.c |    4 ++++
 2 files changed, 7 insertions(+)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 09ce4b9..e1c0383 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -114,6 +114,9 @@ Set the maximum number of playlist entries.
 Set the number after which index wraps.
 @item -start_number @var{number}
 Start the sequence from @var{number}.
+ at item -hls_base_url @var{baseurl}
+Append @var{baseurl} to every entry in the playlist.
+Useful to generate playlists with absolute paths.
 @end table
 
 @anchor{image2}
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index f9e9678..6d6caa1 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -55,6 +55,7 @@ typedef struct HLSContext {
     ListEntry *list;
     ListEntry *end_list;
     char *basename;
+    char *baseurl;
     AVIOContext *pb;
 } HLSContext;
 
@@ -148,6 +149,8 @@ static int hls_window(AVFormatContext *s, int last)
 
     for (en = hls->list; en; en = en->next) {
         avio_printf(hls->pb, "#EXTINF:%d,\n", en->duration);
+        if (hls->baseurl)
+            avio_printf(hls->pb, "%s", hls->baseurl);
         avio_printf(hls->pb, "%s\n", en->name);
     }
 
@@ -319,6 +322,7 @@ static const AVOption options[] = {
     {"hls_time",      "segment length in seconds",               OFFSET(time),    AV_OPT_TYPE_FLOAT,  {.dbl = 2},     0, FLT_MAX, E},
     {"hls_list_size", "maximum number of playlist entries",      OFFSET(size),    AV_OPT_TYPE_INT,    {.i64 = 5},     0, INT_MAX, E},
     {"hls_wrap",      "number after which the index wraps",      OFFSET(wrap),    AV_OPT_TYPE_INT,    {.i64 = 0},     0, INT_MAX, E},
+    {"hls_base_url",  "url to prepend to each playlist entry",   OFFSET(baseurl), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,       E},
     { NULL },
 };
 



More information about the ffmpeg-cvslog mailing list