Implements OPUS_MULTISTREAM_{EN|DE}CODER_GET_STATE
Untested
This commit is contained in:
parent
c63cc12232
commit
af50ce9200
2 changed files with 47 additions and 2 deletions
|
@ -443,6 +443,25 @@ int opus_multistream_encoder_ctl(OpusMSEncoder *st, int request, ...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST:
|
||||||
|
{
|
||||||
|
int s;
|
||||||
|
opus_int32 stream_id;
|
||||||
|
OpusEncoder **value;
|
||||||
|
stream_id = va_arg(ap, opus_int32);
|
||||||
|
if (stream_id<0 || stream_id >= st->layout.nb_streams)
|
||||||
|
ret = OPUS_BAD_ARG;
|
||||||
|
value = va_arg(ap, OpusEncoder**);
|
||||||
|
for (s=0;s<stream_id;s++)
|
||||||
|
{
|
||||||
|
if (s < st->layout.nb_coupled_streams)
|
||||||
|
ptr += align(coupled_size);
|
||||||
|
else
|
||||||
|
ptr += align(mono_size);
|
||||||
|
}
|
||||||
|
*value = (OpusEncoder*)ptr;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
ret = OPUS_UNIMPLEMENTED;
|
ret = OPUS_UNIMPLEMENTED;
|
||||||
break;
|
break;
|
||||||
|
@ -728,7 +747,6 @@ int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...)
|
||||||
case OPUS_GET_FINAL_RANGE_REQUEST:
|
case OPUS_GET_FINAL_RANGE_REQUEST:
|
||||||
{
|
{
|
||||||
int s;
|
int s;
|
||||||
/* This only works for int32* params, but that's all we have right now */
|
|
||||||
opus_uint32 *value = va_arg(ap, opus_uint32*);
|
opus_uint32 *value = va_arg(ap, opus_uint32*);
|
||||||
for (s=0;s<st->layout.nb_streams;s++)
|
for (s=0;s<st->layout.nb_streams;s++)
|
||||||
{
|
{
|
||||||
|
@ -748,7 +766,6 @@ int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...)
|
||||||
case OPUS_RESET_STATE:
|
case OPUS_RESET_STATE:
|
||||||
{
|
{
|
||||||
int s;
|
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++)
|
for (s=0;s<st->layout.nb_streams;s++)
|
||||||
{
|
{
|
||||||
OpusDecoder *dec;
|
OpusDecoder *dec;
|
||||||
|
@ -764,6 +781,25 @@ int opus_multistream_decoder_ctl(OpusMSDecoder *st, int request, ...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST:
|
||||||
|
{
|
||||||
|
int s;
|
||||||
|
opus_int32 stream_id;
|
||||||
|
OpusDecoder **value;
|
||||||
|
stream_id = va_arg(ap, opus_int32);
|
||||||
|
if (stream_id<0 || stream_id >= st->layout.nb_streams)
|
||||||
|
ret = OPUS_BAD_ARG;
|
||||||
|
value = va_arg(ap, OpusDecoder**);
|
||||||
|
for (s=0;s<stream_id;s++)
|
||||||
|
{
|
||||||
|
if (s < st->layout.nb_coupled_streams)
|
||||||
|
ptr += align(coupled_size);
|
||||||
|
else
|
||||||
|
ptr += align(mono_size);
|
||||||
|
}
|
||||||
|
*value = (OpusDecoder*)ptr;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
ret = OPUS_UNIMPLEMENTED;
|
ret = OPUS_UNIMPLEMENTED;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -38,6 +38,15 @@
|
||||||
typedef struct OpusMSEncoder OpusMSEncoder;
|
typedef struct OpusMSEncoder OpusMSEncoder;
|
||||||
typedef struct OpusMSDecoder OpusMSDecoder;
|
typedef struct OpusMSDecoder OpusMSDecoder;
|
||||||
|
|
||||||
|
#define __opus_check_encstate_ptr(ptr) ((ptr) + ((ptr) - (OpusEncoder**)(ptr)))
|
||||||
|
#define __opus_check_decstate_ptr(ptr) ((ptr) + ((ptr) - (OpusDecoder**)(ptr)))
|
||||||
|
|
||||||
|
#define OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST 5120
|
||||||
|
#define OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST 5122
|
||||||
|
|
||||||
|
#define OPUS_MULTISTREAM_GET_ENCODER_STATE(x,y) OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST, __opus_check_int(x), __opus_check_encstate_ptr(y)
|
||||||
|
#define OPUS_MULTISTREAM_GET_DECODER_STATE(x,y) OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST, __opus_check_int(x), __opus_check_decstate_ptr(y)
|
||||||
|
|
||||||
OPUS_EXPORT OpusMSEncoder *opus_multistream_encoder_create(
|
OPUS_EXPORT OpusMSEncoder *opus_multistream_encoder_create(
|
||||||
opus_int32 Fs, /**< Sampling rate of input signal (Hz) */
|
opus_int32 Fs, /**< Sampling rate of input signal (Hz) */
|
||||||
int channels, /**< Number of channels (1/2) in input signal */
|
int channels, /**< Number of channels (1/2) in input signal */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue