shithub: opus

Download patch

ref: bdd0280293a0e0d87a1a30f95c29e49da4ea7e8e
parent: 0d28aa99c03f97f8de82b9d57b6abf90b2b8c1fd
author: Jean-Marc Valin <[email protected]>
date: Thu Feb 14 10:21:01 EST 2008

setting nb channels automatically from the mode.

--- a/tools/celtdec.c
+++ b/tools/celtdec.c
@@ -296,11 +296,14 @@
    celt_header_from_packet((char*)op->packet, op->bytes, &header);
       
    if (header.mode==0)
+   {
       mode = celt_mono;
-   else if (header.mode==1)
-      mode = celt_stereo;
-   else
+      *channels = 1;
+   } else if (header.mode==1)
    {
+      mode = celt_stereo;
+      *channels = 2;
+   } else {
       fprintf (stderr, "Invalid mode: %d\n", header.mode);
       return NULL;
    }
@@ -321,9 +324,6 @@
 
    *nframes = 1;
 
-   if (*channels==-1)
-      *channels = header.nb_channels;
-   
    if (!quiet)
    {
       fprintf (stderr, "Decoding %d Hz audio in", *rate);