Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2011-09-12 03:51:44 +0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2011-09-12 03:51:44 +0400
commitc63cc1223207d71d22283b964ddbd812010c0def (patch)
tree8029664ae39062a9bca963370ac7e19d4f731a4a /src/opus_multistream.c
parente448df8301bc2512aa173331e07bddb08b50783b (diff)
Implements multi-stream encoder requests the best we can
Diffstat (limited to 'src/opus_multistream.c')
-rw-r--r--src/opus_multistream.c54
1 files changed, 34 insertions, 20 deletions
diff --git a/src/opus_multistream.c b/src/opus_multistream.c
index 2d279fac..16c11182 100644
--- a/src/opus_multistream.c
+++ b/src/opus_multistream.c
@@ -370,7 +370,7 @@ int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...)
case OPUS_SET_BITRATE_REQUEST:
{
int chan, s;
- opus_uint32 value = va_arg(ap, opus_uint32);
+ opus_int32 value = va_arg(ap, opus_int32);
chan = st->layout.nb_streams + st->layout.nb_coupled_streams;
value /= chan;
for (s=0;s<st->layout.nb_streams;s++)
@@ -381,8 +381,21 @@ int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...)
}
}
break;
- /* FIXME: Add missing ones */
case OPUS_GET_BITRATE_REQUEST:
+ {
+ int s;
+ opus_int32 *value = va_arg(ap, opus_int32*);
+ *value = 0;
+ for (s=0;s<st->layout.nb_streams;s++)
+ {
+ opus_int32 rate;
+ OpusEncoder *enc;
+ enc = (OpusEncoder*)ptr;
+ opus_encoder_ctl(enc, request, &rate);
+ *value += rate;
+ }
+ }
+ break;
case OPUS_GET_VBR_REQUEST:
case OPUS_GET_APPLICATION_REQUEST:
case OPUS_GET_BANDWIDTH_REQUEST:
@@ -393,30 +406,28 @@ int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...)
case OPUS_GET_VBR_CONSTRAINT_REQUEST:
case OPUS_GET_SIGNAL_REQUEST:
case OPUS_GET_LOOKAHEAD_REQUEST:
+ case OPUS_GET_INBAND_FEC_REQUEST:
{
- int s;
- /* This works for int32* params */
- opus_uint32 *value = va_arg(ap, opus_uint32*);
- for (s=0;s<st->layout.nb_streams;s++)
- {
- OpusEncoder *enc;
-
- enc = (OpusEncoder*)ptr;
- if (s < st->layout.nb_coupled_streams)
- ptr += align(coupled_size);
- else
- ptr += align(mono_size);
- ret = opus_encoder_ctl(enc, request, value);
- if (ret < 0)
- break;
- }
+ OpusEncoder *enc;
+ /* For int32* GET params, just query the first stream */
+ opus_int32 *value = va_arg(ap, opus_int32*);
+ enc = (OpusEncoder*)ptr;
+ ret = opus_encoder_ctl(enc, request, value);
}
break;
- default:
+ case OPUS_SET_COMPLEXITY_REQUEST:
+ case OPUS_SET_VBR_REQUEST:
+ case OPUS_SET_VBR_CONSTRAINT_REQUEST:
+ case OPUS_SET_BANDWIDTH_REQUEST:
+ case OPUS_SET_SIGNAL_REQUEST:
+ case OPUS_SET_APPLICATION_REQUEST:
+ case OPUS_SET_INBAND_FEC_REQUEST:
+ case OPUS_SET_PACKET_LOSS_PERC_REQUEST:
+ case OPUS_SET_DTX_REQUEST:
{
int s;
/* This works for int32 params */
- opus_uint32 value = va_arg(ap, opus_uint32);
+ opus_int32 value = va_arg(ap, opus_int32);
for (s=0;s<st->layout.nb_streams;s++)
{
OpusEncoder *enc;
@@ -432,6 +443,9 @@ int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...)
}
}
break;
+ default:
+ ret = OPUS_UNIMPLEMENTED;
+ break;
}
va_end(ap);