Commit 5a70a783 authored by Luca Barbato's avatar Luca Barbato

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

Useful to generate playlists with absolute paths.
Signed-off-by: 's avatarLuca Barbato <lu_zero@gentoo.org>
parent 5c08ae4f
...@@ -114,6 +114,9 @@ Set the maximum number of playlist entries. ...@@ -114,6 +114,9 @@ Set the maximum number of playlist entries.
Set the number after which index wraps. Set the number after which index wraps.
@item -start_number @var{number} @item -start_number @var{number}
Start the sequence from @var{number}. Start the sequence from @var{number}.
@item -hls_base_url @var{baseurl}
Append @var{baseurl} to every entry in the playlist.
Useful to generate playlists with absolute paths.
@end table @end table
@anchor{image2} @anchor{image2}
......
...@@ -55,6 +55,7 @@ typedef struct HLSContext { ...@@ -55,6 +55,7 @@ typedef struct HLSContext {
ListEntry *list; ListEntry *list;
ListEntry *end_list; ListEntry *end_list;
char *basename; char *basename;
char *baseurl;
AVIOContext *pb; AVIOContext *pb;
} HLSContext; } HLSContext;
...@@ -148,6 +149,8 @@ static int hls_window(AVFormatContext *s, int last) ...@@ -148,6 +149,8 @@ static int hls_window(AVFormatContext *s, int last)
for (en = hls->list; en; en = en->next) { for (en = hls->list; en; en = en->next) {
avio_printf(hls->pb, "#EXTINF:%d,\n", en->duration); 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); avio_printf(hls->pb, "%s\n", en->name);
} }
...@@ -319,6 +322,7 @@ static const AVOption options[] = { ...@@ -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_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_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_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 }, { NULL },
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment