avformat/segafilm - fix keyframe detection and set packet flags
authorGyan Doshi <gyandoshi@gmail.com>
Wed, 21 Mar 2018 13:29:33 +0000 (18:59 +0530)
committerJames Almer <jamrial@gmail.com>
Mon, 26 Mar 2018 19:03:13 +0000 (16:03 -0300)
Streams from a Segafilm cpk file can't be streamcopied because
keyframe flag isn't correctly set in stream index and
said flag is never conveyed to the packet

Fixes #7091

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
libavformat/segafilm.c

index 1fdef50..4c0cca0 100644 (file)
@@ -239,7 +239,7 @@ static int film_read_header(AVFormatContext *s)
         } else {
             film->sample_table[i].stream = film->video_stream_index;
             film->sample_table[i].pts = AV_RB32(&scratch[8]) & 0x7FFFFFFF;
-            film->sample_table[i].keyframe = (scratch[8] & 0x80) ? 0 : 1;
+            film->sample_table[i].keyframe = (scratch[8] & 0x80) ? AVINDEX_KEYFRAME : 0;
             video_frame_counter++;
             if (film->video_type)
                 av_add_index_entry(s->streams[film->video_stream_index],
@@ -286,6 +286,7 @@ static int film_read_packet(AVFormatContext *s,
 
     pkt->stream_index = sample->stream;
     pkt->pts = sample->pts;
+    pkt->flags |= sample->keyframe ? AV_PKT_FLAG_KEY : 0;
 
     film->current_sample++;