]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/hlsplaylist.c
avformat/hls: avformat_find_stream_info when the audio list in the variant
[ffmpeg] / libavformat / hlsplaylist.c
index 0537049a978515dac3cf5bc48ffa36cd35f01e63..e8b566789c9e9db40e7084221c3729f3fd7fd510 100644 (file)
@@ -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;