Browse code

Merge commit '5a70a783f04919514efec7751d710b64d8975fd7'

* commit '5a70a783f04919514efec7751d710b64d8975fd7':
hls: Add an option to prepend a baseurl to the playlist entries

Conflicts:
doc/muxers.texi
libavformat/hlsenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2014/04/29 23:37:22
Showing 2 changed files
... ...
@@ -233,6 +233,10 @@ to @var{wrap}.
233 233
 Start the playlist sequence number from @var{number}. Default value is
234 234
 0.
235 235
 
236
+@item hls_base_url @var{baseurl}
237
+Append @var{baseurl} to every entry in the playlist.
238
+Useful to generate playlists with absolute paths.
239
+
236 240
 Note that the playlist sequence number must be unique for each segment
237 241
 and it is not to be confused with the segment filename sequence number
238 242
 which can be cyclic, for example if the @option{wrap} option is
... ...
@@ -55,6 +55,7 @@ typedef struct HLSContext {
55 55
     ListEntry *list;
56 56
     ListEntry *end_list;
57 57
     char *basename;
58
+    char *baseurl;
58 59
     AVIOContext *pb;
59 60
 } HLSContext;
60 61
 
... ...
@@ -149,6 +150,8 @@ static int hls_window(AVFormatContext *s, int last)
149 149
 
150 150
     for (en = hls->list; en; en = en->next) {
151 151
         avio_printf(hls->pb, "#EXTINF:%f,\n", en->duration);
152
+        if (hls->baseurl)
153
+            avio_printf(hls->pb, "%s", hls->baseurl);
152 154
         avio_printf(hls->pb, "%s\n", en->name);
153 155
     }
154 156
 
... ...
@@ -325,6 +328,7 @@ static const AVOption options[] = {
325 325
     {"hls_time",      "set segment length in seconds",           OFFSET(time),    AV_OPT_TYPE_FLOAT,  {.dbl = 2},     0, FLT_MAX, E},
326 326
     {"hls_list_size", "set maximum number of playlist entries",  OFFSET(size),    AV_OPT_TYPE_INT,    {.i64 = 5},     0, INT_MAX, E},
327 327
     {"hls_wrap",      "set number after which the index wraps",  OFFSET(wrap),    AV_OPT_TYPE_INT,    {.i64 = 0},     0, INT_MAX, E},
328
+    {"hls_base_url",  "url to prepend to each playlist entry",   OFFSET(baseurl), AV_OPT_TYPE_STRING, {.str = NULL},  0, 0,       E},
328 329
     { NULL },
329 330
 };
330 331