diff options
author | Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> | 2011-11-23 17:49:58 +0000 |
---|---|---|
committer | Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> | 2011-11-24 13:40:34 +0000 |
commit | 5da03cd2a4ea2666e7b810f4864322a1f5f5cafe (patch) | |
tree | 120ca918bd5dbe14e6cecbeef8fadb2664a32530 /ext/opus/gstopusdec.c | |
parent | 745cc8d4e463eab33a89f4e7a3e18d00645ea370 (diff) | |
download | gstreamer-plugins-bad-5da03cd2a4ea2666e7b810f4864322a1f5f5cafe.tar.gz |
opus: switch to multistream API
It's very similar to the basic API, and is a superset ot it,
which will allow encoding and decoding more than 2 channels.
Diffstat (limited to 'ext/opus/gstopusdec.c')
-rw-r--r-- | ext/opus/gstopusdec.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/ext/opus/gstopusdec.c b/ext/opus/gstopusdec.c index 7ac2bda27..f8b39ba08 100644 --- a/ext/opus/gstopusdec.c +++ b/ext/opus/gstopusdec.c @@ -150,7 +150,7 @@ gst_opus_dec_reset (GstOpusDec * dec) { dec->packetno = 0; if (dec->state) { - opus_decoder_destroy (dec->state); + opus_multistream_decoder_destroy (dec->state); dec->state = NULL; } @@ -228,6 +228,16 @@ gst_opus_dec_parse_header (GstOpusDec * dec, GstBuffer * buf) "Found pre-skip of %u samples, R128 gain %d (volume %f)", dec->pre_skip, dec->r128_gain, dec->r128_gain_volume); + dec->channel_mapping_family = GST_BUFFER_DATA (buf)[18]; + if (dec->channel_mapping_family != 0) { + GST_ELEMENT_ERROR (dec, STREAM, DECODE, + ("Decoding error: unsupported channel nmapping family %d", + dec->channel_mapping_family), (NULL)); + return GST_FLOW_ERROR; + } + dec->channel_mapping[0] = 0; + dec->channel_mapping[1] = 1; + return GST_FLOW_OK; } @@ -298,7 +308,8 @@ opus_dec_chain_parse_data (GstOpusDec * dec, GstBuffer * buffer) GST_DEBUG_OBJECT (dec, "Creating decoder with %d channels, %d Hz", dec->n_channels, dec->sample_rate); - dec->state = opus_decoder_create (dec->sample_rate, dec->n_channels, &err); + dec->state = opus_multistream_decoder_create (dec->sample_rate, + dec->n_channels, 1, 1, dec->channel_mapping, &err); if (!dec->state || err != OPUS_OK) goto creation_failed; } @@ -350,14 +361,16 @@ opus_dec_chain_parse_data (GstOpusDec * dec, GstBuffer * buffer) if (dec->use_inband_fec) { if (dec->last_buffer) { /* normal delayed decode */ - n = opus_decode (dec->state, data, size, out_data, samples, 0); + n = opus_multistream_decode (dec->state, data, size, out_data, samples, + 0); } else { /* FEC reconstruction decode */ - n = opus_decode (dec->state, data, size, out_data, samples, 1); + n = opus_multistream_decode (dec->state, data, size, out_data, samples, + 1); } } else { /* normal decode */ - n = opus_decode (dec->state, data, size, out_data, samples, 0); + n = opus_multistream_decode (dec->state, data, size, out_data, samples, 0); } if (n < 0) { |