diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2014-01-30 20:29:35 +0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2014-01-30 20:29:35 +0400 |
commit | b347696a21ba26113e5a8d356347fdac1a02bced (patch) | |
tree | 4581e8f620f6a849611381ad4c2bb1f06e29c11d /src | |
parent | ad7b28ff19f2074ddd171ddea07222db1414a5f0 (diff) |
Moves opus_packet_get_samples_per_frame() to opus.c
Diffstat (limited to 'src')
-rw-r--r-- | src/opus.c | 21 | ||||
-rw-r--r-- | src/opus_decoder.c | 21 |
2 files changed, 21 insertions, 21 deletions
@@ -166,6 +166,27 @@ static int parse_size(const unsigned char *data, opus_int32 len, opus_int16 *siz } } +int opus_packet_get_samples_per_frame(const unsigned char *data, + opus_int32 Fs) +{ + int audiosize; + if (data[0]&0x80) + { + audiosize = ((data[0]>>3)&0x3); + audiosize = (Fs<<audiosize)/400; + } else if ((data[0]&0x60) == 0x60) + { + audiosize = (data[0]&0x08) ? Fs/50 : Fs/100; + } else { + audiosize = ((data[0]>>3)&0x3); + if (audiosize == 3) + audiosize = Fs*60/1000; + else + audiosize = (Fs<<audiosize)/100; + } + return audiosize; +} + int opus_packet_parse_impl(const unsigned char *data, opus_int32 len, int self_delimited, unsigned char *out_toc, const unsigned char *frames[48], opus_int16 size[48], diff --git a/src/opus_decoder.c b/src/opus_decoder.c index 09ffdbeb..2624e760 100644 --- a/src/opus_decoder.c +++ b/src/opus_decoder.c @@ -934,27 +934,6 @@ int opus_packet_get_bandwidth(const unsigned char *data) return bandwidth; } -int opus_packet_get_samples_per_frame(const unsigned char *data, - opus_int32 Fs) -{ - int audiosize; - if (data[0]&0x80) - { - audiosize = ((data[0]>>3)&0x3); - audiosize = (Fs<<audiosize)/400; - } else if ((data[0]&0x60) == 0x60) - { - audiosize = (data[0]&0x08) ? Fs/50 : Fs/100; - } else { - audiosize = ((data[0]>>3)&0x3); - if (audiosize == 3) - audiosize = Fs*60/1000; - else - audiosize = (Fs<<audiosize)/100; - } - return audiosize; -} - int opus_packet_get_nb_channels(const unsigned char *data) { return (data[0]&0x4) ? 2 : 1; |