diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2011-09-12 02:12:31 +0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2011-09-12 02:12:31 +0400 |
commit | e448df8301bc2512aa173331e07bddb08b50783b (patch) | |
tree | c0a53314720e7f8aa670dfb9e72596d3f442f7e5 /src/opus_multistream.c | |
parent | 5257e3fee8838e0198a3e4888e4742319a204053 (diff) |
Properly implementing the multistream decoder ctl()s
Not tested
Diffstat (limited to 'src/opus_multistream.c')
-rw-r--r-- | src/opus_multistream.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/src/opus_multistream.c b/src/opus_multistream.c index b02636a7..2d279fac 100644 --- a/src/opus_multistream.c +++ b/src/opus_multistream.c @@ -710,26 +710,49 @@ int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...) ptr = (char*)st + align(sizeof(OpusMSDecoder)); switch (request) { - default: + case OPUS_GET_BANDWIDTH_REQUEST: + case OPUS_GET_FINAL_RANGE_REQUEST: { int s; /* This only works for int32* params, but that's all we have right now */ opus_uint32 *value = va_arg(ap, opus_uint32*); for (s=0;s<st->layout.nb_streams;s++) { - OpusDecoder *enc; + OpusDecoder *dec; + + dec = (OpusDecoder*)ptr; + if (s < st->layout.nb_coupled_streams) + ptr += align(coupled_size); + else + ptr += align(mono_size); + ret = opus_decoder_ctl(dec, request, value); + if (ret < 0) + break; + } + } + break; + case OPUS_RESET_STATE: + { + int s; + /* This only works for int32* params, but that's all we have right now */ + for (s=0;s<st->layout.nb_streams;s++) + { + OpusDecoder *dec; - enc = (OpusDecoder*)ptr; + dec = (OpusDecoder*)ptr; if (s < st->layout.nb_coupled_streams) ptr += align(coupled_size); else ptr += align(mono_size); - ret = opus_decoder_ctl(enc, request, value); + ret = opus_decoder_ctl(dec, OPUS_RESET_STATE); if (ret < 0) break; } } break; + default: + ret = OPUS_UNIMPLEMENTED; + break; } va_end(ap); |