diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2014-03-18 21:19:00 +0100 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2014-04-29 12:14:11 +0200 |
commit | 5a70a783f04919514efec7751d710b64d8975fd7 (patch) | |
tree | 18ec3d189ccd45ef48f4e56630cbfe699596f3e1 | |
parent | 5c08ae4f37281441188447cd04dcaf7cd7ce031f (diff) | |
download | ffmpeg-5a70a783f04919514efec7751d710b64d8975fd7.tar.gz |
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@gentoo.org>
-rw-r--r-- | doc/muxers.texi | 3 | ||||
-rw-r--r-- | libavformat/hlsenc.c | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/doc/muxers.texi b/doc/muxers.texi index 09ce4b9f1f..e1c0383eac 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}. +@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 f9e96780c2..6d6caa1013 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 }, }; |