]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/segafilmenc.c
Merge commit 'bb515e3a735f526ccb1068031e289eb5aeb69e22'
[ffmpeg] / libavformat / segafilmenc.c
index 86c0ab0d1c4e0bc69c1dfa73709eef1f5c9d33e0..524230e461c769a67566543dea71be3fe6970915 100644 (file)
@@ -69,7 +69,7 @@ static int film_write_packet_to_header(AVFormatContext *format_context, FILMPack
         info1 = pkt->pts;
         info2 = pkt->duration;
         /* The top bit being set indicates a key frame */
-        if (pkt->keyframe)
+        if (!pkt->keyframe)
             info1 |= (1 << 31);
     }
 
@@ -121,12 +121,12 @@ static int film_write_packet(AVFormatContext *format_context, AVPacket *pkt)
         if (encoded_buf_size != pkt->size && (pkt->size % encoded_buf_size) != 0) {
             avio_write(pb, pkt->data, pkt->size);
         } else {
+            uint8_t padding[2] = {0, 0};
             /* In Sega Cinepak, the reported size in the Cinepak header is
              * 8 bytes too short. However, the size in the STAB section of the header
              * is correct, taking into account the extra two bytes. */
             AV_WB24(&pkt->data[1], pkt->size - 8 + 2);
             metadata->size += 2;
-            uint8_t padding[2] = {0, 0};
 
             avio_write(pb, pkt->data, 10);
             avio_write(pb, padding, 2);
@@ -158,6 +158,7 @@ static int get_audio_codec_id(enum AVCodecID codec_id)
 
 static int film_init(AVFormatContext *format_context)
 {
+    AVStream *audio = NULL;
     FILMOutputContext *film = format_context->priv_data;
     film->audio_index = -1;
     film->video_index = -1;
@@ -165,7 +166,6 @@ static int film_init(AVFormatContext *format_context)
     film->packet_count = 0;
     film->start = NULL;
     film->last = NULL;
-    AVStream *audio = NULL;
 
     for (int i = 0; i < format_context->nb_streams; i++) {
         AVStream *st = format_context->streams[i];