Add lookahead getter

This commit is contained in:
Mathew Velasquez 2016-10-08 05:23:54 -04:00 committed by Tad Hardesty
parent 9a0430620f
commit b0377c9506
No known key found for this signature in database
GPG Key ID: AEFCC915C75ACC47

View File

@ -35,6 +35,7 @@ const OPUS_SET_INBAND_FEC: c_int = 4012; // in i32
const OPUS_GET_INBAND_FEC: c_int = 4013; // out *i32 const OPUS_GET_INBAND_FEC: c_int = 4013; // out *i32
const OPUS_SET_PACKET_LOSS_PERC: c_int = 4014; // in i32 const OPUS_SET_PACKET_LOSS_PERC: c_int = 4014; // in i32
const OPUS_GET_PACKET_LOSS_PERC: c_int = 4015; // out *i32 const OPUS_GET_PACKET_LOSS_PERC: c_int = 4015; // out *i32
const OPUS_GET_LOOKAHEAD: c_int = 4027; // out *i32
// Bitrate // Bitrate
const OPUS_AUTO: c_int = -1000; const OPUS_AUTO: c_int = -1000;
@ -271,6 +272,14 @@ impl Encoder {
Ok(value) Ok(value)
} }
/// Gets the total samples of delay added by the entire codec.
pub fn get_lookahead(&mut self) -> Result<i32> {
let mut value: i32 = 0;
let result = unsafe { ffi::opus_encoder_ctl(self.ptr, OPUS_GET_LOOKAHEAD, &mut value) };
try!(check("opus_encoder_ctl(OPUS_GET_LOOKAHEAD)", result));
Ok(value)
}
// TODO: Encoder-specific CTLs // TODO: Encoder-specific CTLs
} }