Implements OPUS_GET_LAST_FRAME_DURATION decoder ctl()

This commit is contained in:
Jean-Marc Valin 2012-12-04 14:13:46 -05:00
parent a5bd440931
commit 512d849c24
4 changed files with 27 additions and 4 deletions

View file

@ -64,6 +64,7 @@ struct OpusDecoder {
int prev_mode;
int frame_size;
int prev_redundancy;
int last_packet_duration;
opus_uint32 rangeFinal;
};
@ -813,6 +814,7 @@ int opus_decode_native(OpusDecoder *st, const unsigned char *data,
}
if (packet_offset != NULL)
*packet_offset = tot_offset;
st->last_packet_duration = nb_samples;
return nb_samples;
}
@ -966,6 +968,12 @@ int opus_decoder_ctl(OpusDecoder *st, int request, ...)
st->decode_gain = value;
}
break;
case OPUS_GET_LAST_PACKET_DURATION_REQUEST:
{
opus_uint32 *value = va_arg(ap, opus_uint32*);
*value = st->last_packet_duration;
}
break;
default:
/*fprintf(stderr, "unknown opus_decoder_ctl() request: %d", request);*/
ret = OPUS_UNIMPLEMENTED;