[FFmpeg-cvslog] Merge commit '0638b99cdba52554691fc668d9e477bc184c7a33'

Matthieu Bouron git at videolan.org
Fri Mar 17 13:47:40 EET 2017


ffmpeg | branch: master | Matthieu Bouron <matthieu.bouron at gmail.com> | Fri Mar 17 13:31:03 2017 +0100| [e2adbcbd97de1595b26a116ca22475b6f9acdf07] | committer: Matthieu Bouron

Merge commit '0638b99cdba52554691fc668d9e477bc184c7a33'

* commit '0638b99cdba52554691fc668d9e477bc184c7a33':
aiff: Skip padding byte for odd-sized chunks

Also removes to odd-size checks from get_aiff_header and get_meta to use
the generic path introduced by the original commit.

Merged-by: Matthieu Bouron <matthieu.bouron at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e2adbcbd97de1595b26a116ca22475b6f9acdf07
---

 libavformat/aiffdec.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index 9e7a39c..3bbe4a0 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -330,10 +330,14 @@ static int aiff_read_header(AVFormatContext *s)
             if (offset > 0 && st->codecpar->block_align) // COMM && SSND
                 goto got_sound;
         default: /* Jump */
-            if (size & 1)   /* Always even aligned */
-                size++;
             avio_skip(pb, size);
         }
+
+        /* Skip required padding byte for odd-sized chunks. */
+        if (size & 1) {
+            filesize--;
+            avio_skip(pb, 1);
+        }
     }
 
 got_sound:


======================================================================

diff --cc libavformat/aiffdec.c
index 9e7a39c,3c45c61..3bbe4a0
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@@ -299,41 -260,21 +299,45 @@@ static int aiff_read_header(AVFormatCon
          case MKTAG('w', 'a', 'v', 'e'):
              if ((uint64_t)size > (1<<30))
                  return -1;
 -            st->codecpar->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
 -            if (!st->codecpar->extradata)
 +            if (ff_get_extradata(s, st->codecpar, pb, size) < 0)
                  return AVERROR(ENOMEM);
 -            st->codecpar->extradata_size = size;
 -            avio_read(pb, st->codecpar->extradata, size);
 +            if (   (st->codecpar->codec_id == AV_CODEC_ID_QDMC || st->codecpar->codec_id == AV_CODEC_ID_QDM2)
 +                && size>=12*4 && !st->codecpar->block_align) {
 +                st->codecpar->block_align = AV_RB32(st->codecpar->extradata+11*4);
 +                aiff->block_duration = AV_RB32(st->codecpar->extradata+9*4);
 +            } else if (st->codecpar->codec_id == AV_CODEC_ID_QCELP) {
 +                char rate = 0;
 +                if (size >= 25)
 +                    rate = st->codecpar->extradata[24];
 +                switch (rate) {
 +                case 'H': // RATE_HALF
 +                    st->codecpar->block_align = 17;
 +                    break;
 +                case 'F': // RATE_FULL
 +                default:
 +                    st->codecpar->block_align = 35;
 +                }
 +                aiff->block_duration = 160;
 +                st->codecpar->bit_rate = (int64_t)st->codecpar->sample_rate * (st->codecpar->block_align << 3) /
 +                                         aiff->block_duration;
 +            }
              break;
 +        case MKTAG('C','H','A','N'):
 +            if(ff_mov_read_chan(s, pb, st, size) < 0)
 +                return AVERROR_INVALIDDATA;
 +            break;
 +        case 0:
 +            if (offset > 0 && st->codecpar->block_align) // COMM && SSND
 +                goto got_sound;
          default: /* Jump */
-             if (size & 1)   /* Always even aligned */
-                 size++;
              avio_skip(pb, size);
          }
+ 
+         /* Skip required padding byte for odd-sized chunks. */
+         if (size & 1) {
+             filesize--;
+             avio_skip(pb, 1);
+         }
      }
  
  got_sound:



More information about the ffmpeg-cvslog mailing list