[FFmpeg-cvslog] hlsenc: Add parameter -hls_allow_cache
Joakim Roubert
git at videolan.org
Fri Oct 3 21:53:58 CEST 2014
ffmpeg | branch: master | Joakim Roubert <jokke at df.lth.se> | Fri Sep 19 10:01:28 2014 +0200| [55f03d872640175a00bfa262da4652b7312b905f] | committer: Martin Storsjö
hlsenc: Add parameter -hls_allow_cache
The -hls_allow_cache parameter enables explicitly setting the
EXT-X-ALLOW-CACHE tag in the manifest file. That tag indicates
whether the client MAY or MUST NOT cache downloaded media
segments for later replay.
Valid values are 1 (=YES) or 0 (=NO) and the EXT-X-ALLOW-CACHE
will not show in the manifest for other values (or if
-hls_allow_cache is not used.
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=55f03d872640175a00bfa262da4652b7312b905f
---
doc/muxers.texi | 2 ++
libavformat/hlsenc.c | 5 +++++
libavformat/version.h | 2 +-
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/doc/muxers.texi b/doc/muxers.texi
index 54109c7..032c036 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -117,6 +117,8 @@ 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.
+ at item -hls_allow_cache @var{allowcache}
+Explicitly set whether the client MAY (1) or MUST NOT (0) cache media segments
@end table
@anchor{image2}
diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index aa38d05..5d18d13 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -47,6 +47,7 @@ typedef struct HLSContext {
float time; // Set by a private option.
int size; // Set by a private option.
int wrap; // Set by a private option.
+ int allowcache;
int64_t recording_time;
int has_video;
int64_t start_pts;
@@ -145,6 +146,9 @@ static int hls_window(AVFormatContext *s, int last)
avio_printf(hls->pb, "#EXTM3U\n");
avio_printf(hls->pb, "#EXT-X-VERSION:3\n");
+ if (hls->allowcache == 0 || hls->allowcache == 1) {
+ avio_printf(hls->pb, "#EXT-X-ALLOW-CACHE:%s\n", hls->allowcache == 0 ? "NO" : "YES");
+ }
avio_printf(hls->pb, "#EXT-X-TARGETDURATION:%d\n", target_duration);
avio_printf(hls->pb, "#EXT-X-MEDIA-SEQUENCE:%"PRId64"\n", sequence);
@@ -325,6 +329,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_allow_cache", "explicitly set whether the client MAY (1) or MUST NOT (0) cache media segments", OFFSET(allowcache), AV_OPT_TYPE_INT, {.i64 = -1}, INT_MIN, 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 },
};
diff --git a/libavformat/version.h b/libavformat/version.h
index 688c84a..bc956d5 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
#define LIBAVFORMAT_VERSION_MAJOR 56
#define LIBAVFORMAT_VERSION_MINOR 5
-#define LIBAVFORMAT_VERSION_MICRO 0
+#define LIBAVFORMAT_VERSION_MICRO 1
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
LIBAVFORMAT_VERSION_MINOR, \
More information about the ffmpeg-cvslog
mailing list