summaryrefslogtreecommitdiff
path: root/libavformat/hlsplaylist.c
diff options
context:
space:
mode:
authorSteven Liu <lq@chinaffmpeg.org>2019-06-02 22:03:17 +0800
committerSteven Liu <lq@chinaffmpeg.org>2019-06-14 10:53:23 +0800
commitfa7a6dbd7607ba34fba696b6b5a16a7b137ca96f (patch)
tree6133c5e65a8547298ac44fd9c0392c647b6fd422 /libavformat/hlsplaylist.c
parent4208b428c4730f86438ec777642c6e455845b670 (diff)
downloadffmpeg-fa7a6dbd7607ba34fba696b6b5a16a7b137ca96f.tar.gz
avformat/hlsenc: add EXT-X-I-FRAMES-ONLY tag support
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Diffstat (limited to 'libavformat/hlsplaylist.c')
-rw-r--r--libavformat/hlsplaylist.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libavformat/hlsplaylist.c b/libavformat/hlsplaylist.c
index 0537049a97..e8b566789c 100644
--- a/libavformat/hlsplaylist.c
+++ b/libavformat/hlsplaylist.c
@@ -76,7 +76,7 @@ void ff_hls_write_stream_info(AVStream *st, AVIOContext *out,
void ff_hls_write_playlist_header(AVIOContext *out, int version, int allowcache,
int target_duration, int64_t sequence,
- uint32_t playlist_type) {
+ uint32_t playlist_type, int iframe_mode) {
if (!out)
return;
ff_hls_write_playlist_version(out, version);
@@ -92,6 +92,9 @@ void ff_hls_write_playlist_header(AVIOContext *out, int version, int allowcache,
} else if (playlist_type == PLAYLIST_TYPE_VOD) {
avio_printf(out, "#EXT-X-PLAYLIST-TYPE:VOD\n");
}
+ if (iframe_mode) {
+ avio_printf(out, "#EXT-X-I-FRAMES-ONLY\n");
+ }
}
void ff_hls_write_init_file(AVIOContext *out, char *filename,
@@ -108,7 +111,8 @@ int ff_hls_write_file_entry(AVIOContext *out, int insert_discont,
double duration, int round_duration,
int64_t size, int64_t pos, //Used only if HLS_SINGLE_FILE flag is set
char *baseurl, //Ignored if NULL
- char *filename, double *prog_date_time) {
+ char *filename, double *prog_date_time,
+ int64_t video_keyframe_size, int64_t video_keyframe_pos, int iframe_mode) {
if (!out || !filename)
return AVERROR(EINVAL);
@@ -120,7 +124,8 @@ int ff_hls_write_file_entry(AVIOContext *out, int insert_discont,
else
avio_printf(out, "#EXTINF:%f,\n", duration);
if (byterange_mode)
- avio_printf(out, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n", size, pos);
+ avio_printf(out, "#EXT-X-BYTERANGE:%"PRId64"@%"PRId64"\n", iframe_mode ? video_keyframe_size : size,
+ iframe_mode ? video_keyframe_pos : pos);
if (prog_date_time) {
time_t tt, wrongsecs;