mirror of
https://github.com/xiph/opus.git
synced 2025-06-01 16:17:42 +00:00
encode_size() moved out of opus_encoder.c
This commit is contained in:
parent
6696a1443b
commit
9f555bc4e7
3 changed files with 17 additions and 12 deletions
14
src/opus.c
14
src/opus.c
|
@ -30,11 +30,25 @@
|
|||
#endif
|
||||
|
||||
#include "opus.h"
|
||||
#include "opus_private.h"
|
||||
|
||||
#ifndef OPUS_VERSION
|
||||
#define OPUS_VERSION "unknown"
|
||||
#endif
|
||||
|
||||
int encode_size(int size, unsigned char *data)
|
||||
{
|
||||
if (size < 252)
|
||||
{
|
||||
data[0] = size;
|
||||
return 1;
|
||||
} else {
|
||||
data[0] = 252+(size&0x3);
|
||||
data[1] = (size-(int)data[0])>>2;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
const char *opus_strerror(int error)
|
||||
{
|
||||
static const char *error_strings[8] = {
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#ifndef OPUS_PRIVATE_H
|
||||
#define OPUS_PRIVATE_H
|
||||
|
||||
int encode_size(int size, unsigned char *data);
|
||||
|
||||
/* Make sure everything's aligned to 4 bytes (this may need to be increased
|
||||
on really weird architectures) */
|
||||
static inline int align(int i)
|
||||
|
|
|
@ -42,18 +42,7 @@ struct OpusRepacketizer {
|
|||
int framesize;
|
||||
};
|
||||
|
||||
static int encode_size(int size, unsigned char *data)
|
||||
{
|
||||
if (size < 252)
|
||||
{
|
||||
data[0] = size;
|
||||
return 1;
|
||||
} else {
|
||||
data[0] = 252+(size&0x3);
|
||||
data[1] = (size-(int)data[0])>>2;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int opus_repacketizer_get_size(void)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue