pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/audio/libaudiofile Debian has integrated a fix for ADP...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/265ff4261f46
branches:  trunk
changeset: 568002:265ff4261f46
user:      drochner <drochner%pkgsrc.org@localhost>
date:      Tue Dec 01 10:44:02 2009 +0000

description:
Debian has integrated a fix for ADPCM decoding problems which is
similar to our one, and added additional sanity checks
(see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=510205#59)
use their version to ease further maintainance, bump PKGREVISION

diffstat:

 audio/libaudiofile/Makefile         |    4 +-
 audio/libaudiofile/distinfo         |    6 +-
 audio/libaudiofile/patches/patch-ac |    9 +-
 audio/libaudiofile/patches/patch-ad |  112 +++++++++++++++++++++++++++++++----
 4 files changed, 108 insertions(+), 23 deletions(-)

diffs (190 lines):

diff -r 2e28389ba661 -r 265ff4261f46 audio/libaudiofile/Makefile
--- a/audio/libaudiofile/Makefile       Tue Dec 01 10:38:04 2009 +0000
+++ b/audio/libaudiofile/Makefile       Tue Dec 01 10:44:02 2009 +0000
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.43 2009/01/21 15:19:27 drochner Exp $
+# $NetBSD: Makefile,v 1.44 2009/12/01 10:44:02 drochner Exp $
 
 DISTNAME=              audiofile-0.2.6
 PKGNAME=               lib${DISTNAME}
-PKGREVISION=           2
+PKGREVISION=           3
 CATEGORIES=            audio
 MASTER_SITES=          http://www.68k.org/~michael/audiofile/ \
                        ${MASTER_SITE_GNOME:=sources/audiofile/0.2/}
diff -r 2e28389ba661 -r 265ff4261f46 audio/libaudiofile/distinfo
--- a/audio/libaudiofile/distinfo       Tue Dec 01 10:38:04 2009 +0000
+++ b/audio/libaudiofile/distinfo       Tue Dec 01 10:44:02 2009 +0000
@@ -1,9 +1,9 @@
-$NetBSD: distinfo,v 1.12 2009/01/21 15:19:27 drochner Exp $
+$NetBSD: distinfo,v 1.13 2009/12/01 10:44:02 drochner Exp $
 
 SHA1 (audiofile-0.2.6.tar.gz) = 94a6ab8e5122bc1971cf186e5a52d032811c9bc5
 RMD160 (audiofile-0.2.6.tar.gz) = b61fbc856768a5838ca5c0fad602f35205e8d037
 Size (audiofile-0.2.6.tar.gz) = 374688 bytes
 SHA1 (patch-aa) = 7c498a63fe055f1f7e16f45f655341a9b6708f71
 SHA1 (patch-ab) = cd292a827aa18b9839305b2c62c3dbd526384430
-SHA1 (patch-ac) = 7f3f10988bb198a1d673147098fee89de3dbcde4
-SHA1 (patch-ad) = 0986c009c104c18c5a85c847c53213756cf0c8a5
+SHA1 (patch-ac) = fd2b8bb374b263b34a0e724c3e7de498f3ff2b7c
+SHA1 (patch-ad) = 3558f3f83e322efcf2c2a4e7afbc144b084e99f6
diff -r 2e28389ba661 -r 265ff4261f46 audio/libaudiofile/patches/patch-ac
--- a/audio/libaudiofile/patches/patch-ac       Tue Dec 01 10:38:04 2009 +0000
+++ b/audio/libaudiofile/patches/patch-ac       Tue Dec 01 10:44:02 2009 +0000
@@ -1,4 +1,4 @@
-$NetBSD: patch-ac,v 1.1 2009/01/21 15:19:27 drochner Exp $
+$NetBSD: patch-ac,v 1.2 2009/12/01 10:44:02 drochner Exp $
 
 --- libaudiofile/modules/msadpcm.c.orig        2004-03-06 07:39:23.000000000 +0100
 +++ libaudiofile/modules/msadpcm.c
@@ -8,17 +8,18 @@
        /* Calculate the number of bytes needed for decoded data. */
 -      outputLength = msadpcm->samplesPerBlock * sizeof (int16_t) *
 -              msadpcm->track->f.channelCount;
-+      outputLength = msadpcm->samplesPerBlock * sizeof (int16_t);
++      outputLength = msadpcm->samplesPerBlock * sizeof (int16_t);
  
        channelCount = msadpcm->track->f.channelCount;
  
-@@ -180,8 +179,7 @@ static int ms_adpcm_decode_block (ms_adp
+@@ -180,8 +179,8 @@ static int ms_adpcm_decode_block (ms_adp
                The first two samples have already been 'decoded' in
                the block header.
        */
 -      samplesRemaining = (msadpcm->samplesPerBlock - 2) *
 -              msadpcm->track->f.channelCount;
-+      samplesRemaining = msadpcm->samplesPerBlock - (2 * channelCount);
++      samplesRemaining = msadpcm->samplesPerBlock
++              - 2 * msadpcm->track->f.channelCount;
  
        while (samplesRemaining > 0)
        {
diff -r 2e28389ba661 -r 265ff4261f46 audio/libaudiofile/patches/patch-ad
--- a/audio/libaudiofile/patches/patch-ad       Tue Dec 01 10:38:04 2009 +0000
+++ b/audio/libaudiofile/patches/patch-ad       Tue Dec 01 10:44:02 2009 +0000
@@ -1,27 +1,111 @@
-$NetBSD: patch-ad,v 1.1 2009/01/21 15:19:27 drochner Exp $
+$NetBSD: patch-ad,v 1.2 2009/12/01 10:44:02 drochner Exp $
 
 --- libaudiofile/wave.c.orig   2004-03-06 07:39:23.000000000 +0100
 +++ libaudiofile/wave.c
-@@ -220,7 +220,8 @@ static status ParseFormat (AFfilehandle 
+@@ -199,11 +199,13 @@ static status ParseFormat (AFfilehandle 
+               case WAVE_FORMAT_ADPCM:
+               {
+                       u_int16_t       bitsPerSample, extraByteCount,
+-                                      samplesPerBlock, numCoefficients;
++                                      samplesPerBlock, numCoefficients,
++                                      framesPerBlock;
+                       int             i;
+                       AUpvlist        pv;
+                       long            l;
+                       void            *v;
++                      int             minBlockLength;
+ 
+                       if (track->f.channelCount != 1 &&
+                               track->f.channelCount != 2)
+@@ -216,11 +218,33 @@ static status ParseFormat (AFfilehandle 
+                       af_fread(&bitsPerSample, 1, 2, fp);
+                       bitsPerSample = LENDIAN_TO_HOST_INT16(bitsPerSample);
+ 
++                      if (bitsPerSample != 4)
++                      {
++                              _af_error(AF_BAD_WIDTH,
++                                      "bad sample width of %hd bits",
++                                      bitsPerSample);
++                              return AF_FAIL;
++                      }
++
+                       af_fread(&extraByteCount, 1, 2, fp);
                        extraByteCount = LENDIAN_TO_HOST_INT16(extraByteCount);
  
-                       af_fread(&samplesPerBlock, 1, 2, fp);
+-                      af_fread(&samplesPerBlock, 1, 2, fp);
 -                      samplesPerBlock = LENDIAN_TO_HOST_INT16(samplesPerBlock);
-+                      samplesPerBlock = LENDIAN_TO_HOST_INT16(samplesPerBlock)
-+                              * track->f.channelCount;
++                      af_fread(&framesPerBlock, 1, 2, fp);
++                      framesPerBlock = LENDIAN_TO_HOST_INT16(framesPerBlock);
++
++                      minBlockLength = 7 * channelCount; /* header */
++                      if (framesPerBlock > 2)
++                              minBlockLength += ( ( framesPerBlock - 2 ) * channelCount + 1) / 2;
++
++                      if (blockAlign < minBlockLength)
++                      {
++                              _af_error(AF_BAD_FRAMECNT,
++                                      "blockAlign %hd too small for %hd samplesPerBlock",
++                                      blockAlign, samplesPerBlock);
++                              return AF_FAIL;
++                      }
++
++                      samplesPerBlock = framesPerBlock *channelCount;
  
                        af_fread(&numCoefficients, 1, 2, fp);
                        numCoefficients = LENDIAN_TO_HOST_INT16(numCoefficients);
-@@ -281,6 +282,12 @@ static status ParseFormat (AFfilehandle 
-                       u_int16_t       bitsPerSample, extraByteCount,
-                                       samplesPerBlock;
+@@ -242,6 +266,7 @@ static status ParseFormat (AFfilehandle 
+                               wave->msadpcmCoefficients[i][1] = a1;
+                       }
  
-+                      if (track->f.channelCount != 1) {
-+                              _af_error(AF_BAD_CHANNELS,
-+                                      "WAVE file with IMA compression: "
-+                                      "can only handle 1 channel");
-+                      }
-+
++
+                       track->f.sampleWidth = 16;
+                       track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP;
+                       track->f.compressionType = AF_COMPRESSION_MS_ADPCM;
+@@ -277,18 +302,44 @@ static status ParseFormat (AFfilehandle 
+               {
+                       AUpvlist        pv;
+                       long            l;
++                      int             minBlockLength;
+ 
+                       u_int16_t       bitsPerSample, extraByteCount,
+-                                      samplesPerBlock;
++                                      samplesPerBlock, framesPerBlock;
+ 
                        af_fread(&bitsPerSample, 1, 2, fp);
                        bitsPerSample = LENDIAN_TO_HOST_INT16(bitsPerSample);
  
++                      if (bitsPerSample != 4)
++                      {
++                              _af_error(AF_BAD_WIDTH,
++                                      "bad sample width of %hd bits",
++                                      bitsPerSample);
++                              return AF_FAIL;
++                      }
++
+                       af_fread(&extraByteCount, 1, 2, fp);
+                       extraByteCount = LENDIAN_TO_HOST_INT16(extraByteCount);
+ 
+-                      af_fread(&samplesPerBlock, 1, 2, fp);
+-                      samplesPerBlock = LENDIAN_TO_HOST_INT16(samplesPerBlock);
++                      af_fread(&framesPerBlock, 1, 2, fp);
++                      framesPerBlock = LENDIAN_TO_HOST_INT16(framesPerBlock);
++                      samplesPerBlock = framesPerBlock * channelCount;
++
++                      /* per channel, ima has blocks of len 4, the 1st has 1st sample, the others
++                       * up to 8 samples per block,
++                       * so number of later blocks is (nsamp-1 + 7)/8, total blocks/chan is
++                       * (nsamp-1+7)/8 + 1 = (nsamp+14)/8
++                       */
++
++                      minBlockLength = ( framesPerBlock + 14 )/8 * 4 * channelCount;
++
++                      if (blockAlign < minBlockLength)
++                      {
++                              _af_error(AF_BAD_FRAMECNT,
++                                      "blockAlign %hd too small for %hd samplesPerBlock",
++                                      blockAlign, samplesPerBlock);
++                              return AF_FAIL;
++                      }
+ 
+                       track->f.sampleWidth = 16;
+                       track->f.sampleFormat = AF_SAMPFMT_TWOSCOMP;



Home | Main Index | Thread Index | Old Index