Merge commit '4d6c5152849e23a4cc0f6a6ac2880c01ebcd301b'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 22 Aug 2014 17:01:26 +0000 (19:01 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 22 Aug 2014 17:01:26 +0000 (19:01 +0200)
* commit '4d6c5152849e23a4cc0f6a6ac2880c01ebcd301b':
  electronicarts: do not fail on zero-sized chunks

Conflicts:
libavformat/electronicarts.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/electronicarts.c

@@@ -549,10 -519,10 +549,10 @@@ static int ea_read_packet(AVFormatConte
      int ret = 0, packet_read = 0, key = 0;
      int av_uninit(num_samples);
  
 -    while (!packet_read) {
 +    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;
  
                  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;
              key = AV_PKT_FLAG_KEY;
          case MV0F_TAG:
  get_video_packet:
 -            ret = av_get_packet(pb, pkt, chunk_size);
 -            if (ret < 0)
 -                return ret;
+             if (!chunk_size)
+                 continue;
 +            if (partial_packet) {
 +                ret = av_append_packet(pb, pkt, chunk_size);
 +            } else
 +                ret = av_get_packet(pb, pkt, chunk_size);
 +            if (ret < 0) {
 +                packet_read = 1;
 +                break;
 +            }
 +            partial_packet = chunk_type == MVIh_TAG;
              pkt->stream_index = ea->video_stream_index;
              pkt->flags       |= key;
              packet_read       = 1;