shithub: opus

Download patch

ref: 3ce277ca1fc2ad9b4105f0697a153a90eb457ebc
parent: eb1476c7919a214aa0b3f114f636e8bef42dca3d
author: Jean-Marc Valin <[email protected]>
date: Mon Jan 31 06:34:57 EST 2011

Some initial work on stereo support (not complete)

--- a/src/opus.h
+++ b/src/opus.h
@@ -77,7 +77,7 @@
 typedef struct OpusEncoder OpusEncoder;
 typedef struct OpusDecoder OpusDecoder;
 
-OpusEncoder *opus_encoder_create(int Fs);
+OpusEncoder *opus_encoder_create(int Fs, int channels);
 
 int opus_encode(OpusEncoder *st, const short *pcm, int frame_size,
 		unsigned char *data, int bytes_per_packet);
@@ -86,7 +86,7 @@
 
 void opus_encoder_ctl(OpusEncoder *st, int request, ...);
 
-OpusDecoder *opus_decoder_create(int Fs);
+OpusDecoder *opus_decoder_create(int Fs, int channels);
 
 int opus_decode(OpusDecoder *st, const unsigned char *data, int len,
 		short *pcm, int frame_size);
--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -42,7 +42,7 @@
 #include "SKP_Silk_SDK_API.h"
 
 
-OpusDecoder *opus_decoder_create(int Fs)
+OpusDecoder *opus_decoder_create(int Fs, int channels)
 {
     char *raw_state;
 	int ret, silkDecSizeBytes, celtDecSizeBytes;
@@ -68,7 +68,7 @@
     }
 
 	/* Initialize CELT decoder */
-	st->celt_dec = celt_decoder_init(st->celt_dec, 48000, 1, NULL);
+	st->celt_dec = celt_decoder_init(st->celt_dec, 48000, channels, NULL);
 
 	return st;
 
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -41,7 +41,7 @@
 #include "modes.h"
 #include "SKP_Silk_SDK_API.h"
 
-OpusEncoder *opus_encoder_create(int Fs)
+OpusEncoder *opus_encoder_create(int Fs, int channels)
 {
     char *raw_state;
 	OpusEncoder *st;
@@ -73,7 +73,7 @@
 
     /* Create CELT encoder */
 	/* Initialize CELT encoder */
-	st->celt_enc = celt_encoder_init(st->celt_enc, Fs, 1, NULL);
+	st->celt_enc = celt_encoder_init(st->celt_enc, Fs, channels, NULL);
 
 	st->mode = MODE_HYBRID;
 	st->bandwidth = BANDWIDTH_FULLBAND;
--- a/src/test_opus.c
+++ b/src/test_opus.c
@@ -105,8 +105,8 @@
       return 1;
    }
 
-   enc = opus_encoder_create(rate);
-   dec = opus_decoder_create(rate);
+   enc = opus_encoder_create(rate, channels);
+   dec = opus_decoder_create(rate, channels);
 
    mode = MODE_HYBRID;
    opus_encoder_ctl(enc, OPUS_SET_BANDWIDTH(BANDWIDTH_FULLBAND));