]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/electronicarts.c
avcodec/xan: fix style issue
[ffmpeg] / libavformat / electronicarts.c
index 515b70fecb950d4bc39de6a57f4b000361cd4d0e..9000f7f60563a7133410ed81727d55ee2af8626c 100644 (file)
@@ -412,14 +412,18 @@ static int process_ea_header(AVFormatContext *s)
         case pQGT_TAG:
         case TGQs_TAG:
             ea->video_codec = AV_CODEC_ID_TGQ;
+            ea->time_base   = (AVRational) { 1, 15 };
             break;
 
         case pIQT_TAG:
             ea->video_codec = AV_CODEC_ID_TQI;
+            ea->time_base   = (AVRational) { 1, 15 };
             break;
 
         case MADk_TAG:
             ea->video_codec = AV_CODEC_ID_MAD;
+            avio_skip(pb, 6);
+            ea->time_base = (AVRational) { avio_rl16(pb), 1000 };
             break;
 
         case MVhd_TAG:
@@ -552,7 +556,7 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt)
     while (!packet_read || partial_packet) {
         chunk_type = avio_rl32(pb);
         chunk_size = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb);
-        if (chunk_size <= 8)
+        if (chunk_size < 8)
             return AVERROR_INVALIDDATA;
         chunk_size -= 8;
 
@@ -577,11 +581,16 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt)
                 avio_skip(pb, 8);
                 chunk_size -= 12;
             }
+
             if (partial_packet) {
                 avpriv_request_sample(s, "video header followed by audio packet");
                 av_free_packet(pkt);
                 partial_packet = 0;
             }
+
+            if (!chunk_size)
+                continue;
+
             ret = av_get_packet(pb, pkt, chunk_size);
             if (ret < 0)
                 return ret;
@@ -642,6 +651,9 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt)
             goto get_video_packet;
 
         case mTCD_TAG:
+            if (chunk_size < 8)
+                return AVERROR_INVALIDDATA;
+
             avio_skip(pb, 8);               // skip ea DCT header
             chunk_size -= 8;
             goto get_video_packet;
@@ -652,6 +664,9 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt)
             key = AV_PKT_FLAG_KEY;
         case MV0F_TAG:
 get_video_packet:
+            if (!chunk_size)
+                continue;
+
             if (partial_packet) {
                 ret = av_append_packet(pb, pkt, chunk_size);
             } else