Merge commit '556a5090f2b0a20fd9998e1a327875f5b0c8d1d5' into release/2.4
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 18 Jan 2015 00:10:43 +0000 (01:10 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 18 Jan 2015 00:10:56 +0000 (01:10 +0100)
* commit '556a5090f2b0a20fd9998e1a327875f5b0c8d1d5':
  mp3dec: fix reading the Xing tag

Conflicts:
libavformat/mp3dec.c

See: 19ff479f694ddccc1fd1fa00eff94f96ca82671b
Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavformat/mp3dec.c

@@@ -151,25 -162,15 +152,25 @@@ static void mp3_parse_info_tag(AVFormat
      if (v & XING_FLAG_FRAMES)
          mp3->frames = avio_rb32(s->pb);
      if (v & XING_FLAG_SIZE)
 -        mp3->size = avio_rb32(s->pb);
 -    if (v & XING_FLAG_TOC && mp3->frames)
 -        read_xing_toc(s, mp3->size, av_rescale_q(mp3->frames,
 +        mp3->header_filesize = avio_rb32(s->pb);
 +    if (fsize && mp3->header_filesize) {
 +        uint64_t min, delta;
 +        min = FFMIN(fsize, mp3->header_filesize);
 +        delta = FFMAX(fsize, mp3->header_filesize) - min;
 +        if (fsize > mp3->header_filesize && delta > min >> 4) {
 +            mp3->frames = 0;
 +        } else if (delta > min >> 4) {
 +            av_log(s, AV_LOG_WARNING,
 +                   "filesize and duration do not match (growing file?)\n");
 +        }
 +    }
 +    if (v & XING_FLAG_TOC)
 +        read_xing_toc(s, mp3->header_filesize, av_rescale_q(mp3->frames,
                                         (AVRational){spf, c->sample_rate},
                                         st->time_base));
 -
      /* VBR quality */
-     if(v & 8)
-         avio_skip(s->pb, 4);
+     if (v & XING_FLAC_QSCALE)
+         avio_rb32(s->pb);
  
      /* Encoder short version string */
      memset(version, 0, sizeof(version));