Unverified Commit b69ccee4 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Implement OPE_GET_* ctl() calls

parent d96417df
......@@ -112,7 +112,7 @@ extern "C" {
#define OPE_SET_SERIALNO_REQUEST 14006
#define OPE_GET_SERIALNO_REQUEST 14007
#define OPE_SET_PACKET_CALLBACK_REQUEST 14008
#define OPE_GET_PACKET_CALLBACK_REQUEST 14009
/*#define OPE_GET_PACKET_CALLBACK_REQUEST 14009*/
#define OPE_SET_HEADER_GAIN_REQUEST 14010
#define OPE_GET_HEADER_GAIN_REQUEST 14011
......@@ -134,7 +134,7 @@ extern "C" {
#define OPE_GET_SERIALNO(x) OPE_GET_SERIALNO_REQUEST, __opus_check_int_ptr(x)
/* FIXME: Add type-checking macros to these. */
#define OPE_SET_PACKET_CALLBACK(x,u) OPE_SET_PACKET_CALLBACK_REQUEST, (x), (u)
#define OPE_GET_PACKET_CALLBACK(x,u) OPE_GET_PACKET_CALLBACK_REQUEST, (x), (u)
/*#define OPE_GET_PACKET_CALLBACK(x,u) OPE_GET_PACKET_CALLBACK_REQUEST, (x), (u)*/
#define OPE_SET_HEADER_GAIN(x,u) OPE_SET_HEADER_GAIN_REQUEST, __opus_check_int(x)
#define OPE_GET_HEADER_GAIN(x,u) OPE_GET_HEADER_GAIN_REQUEST, __opus_check_int_ptr(x)
/*@}*/
......
......@@ -663,6 +663,7 @@ int ope_encoder_ctl(OggOpusEnc *enc, int request, ...) {
va_list ap;
if (enc->unrecoverable) return OPE_UNRECOVERABLE;
va_start(ap, request);
ret = OPE_OK;
switch (request) {
case OPUS_SET_APPLICATION_REQUEST:
case OPUS_SET_BITRATE_REQUEST:
......@@ -753,7 +754,12 @@ int ope_encoder_ctl(OggOpusEnc *enc, int request, ...) {
break;
}
enc->decision_delay = value;
ret = OPE_OK;
}
break;
case OPE_GET_DECISION_DELAY_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
*value = enc->decision_delay;
}
break;
case OPE_SET_MUXING_DELAY_REQUEST:
......@@ -765,7 +771,12 @@ int ope_encoder_ctl(OggOpusEnc *enc, int request, ...) {
}
enc->max_ogg_delay = value;
oggp_set_muxing_delay(enc->oggp, enc->max_ogg_delay);
ret = OPE_OK;
}
break;
case OPE_GET_MUXING_DELAY_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
*value = enc->max_ogg_delay;
}
break;
case OPE_SET_COMMENT_PADDING_REQUEST:
......@@ -779,6 +790,12 @@ int ope_encoder_ctl(OggOpusEnc *enc, int request, ...) {
ret = OPE_OK;
}
break;
case OPE_GET_COMMENT_PADDING_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
*value = enc->comment_padding;
}
break;
case OPE_SET_SERIALNO_REQUEST:
{
opus_int32 value = va_arg(ap, opus_int32);
......@@ -791,6 +808,12 @@ int ope_encoder_ctl(OggOpusEnc *enc, int request, ...) {
ret = OPE_OK;
}
break;
case OPE_GET_SERIALNO_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
*value = enc->last_stream->serialno;
}
break;
case OPE_SET_PACKET_CALLBACK_REQUEST:
{
ope_packet_func value = va_arg(ap, ope_packet_func);
......@@ -811,6 +834,12 @@ int ope_encoder_ctl(OggOpusEnc *enc, int request, ...) {
ret = OPE_OK;
}
break;
case OPE_GET_HEADER_GAIN_REQUEST:
{
opus_int32 *value = va_arg(ap, opus_int32*);
*value = enc->header.gain;
}
break;
default:
ret = OPE_UNIMPLEMENTED;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment