changeset 5298:e00f7048c50c libavcodec

Make "channels" variable mean the number of channels, not the number of channels minus one
author vitor
date Fri, 13 Jul 2007 00:06:46 +0000
parents fc46b3f5de1a
children 4623928e3b9e
files alac.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/alac.c	Thu Jul 12 22:55:35 2007 +0000
+++ b/alac.c	Fri Jul 13 00:06:46 2007 +0000
@@ -487,7 +487,7 @@
 
     init_get_bits(&alac->gb, inbuffer, input_buffer_size * 8);
 
-    channels = get_bits(&alac->gb, 3);
+    channels = get_bits(&alac->gb, 3) + 1;
 
         /* 2^result = something to do with output waiting.
          * perhaps matters if we read > 1 frame in a pass?
@@ -510,10 +510,10 @@
             outputsamples = alac->setinfo_max_samples_per_frame;
 
         *outputsize = outputsamples * alac->bytespersample;
-        readsamplesize = alac->setinfo_sample_size - (wasted_bytes * 8) + channels;
+        readsamplesize = alac->setinfo_sample_size - (wasted_bytes * 8) + channels - 1;
 
     switch(channels) {
-    case 0: { /* 1 channel */
+    case 1: { /* 1 channel */
         int ricemodifier;
 
         if (!isnotcompressed) {
@@ -624,7 +624,7 @@
         }
         break;
     }
-    case 1: { /* 2 channels */
+    case 2: { /* 2 channels */
         uint8_t interlacing_shift;
         uint8_t interlacing_leftweight;