return 1;
}
-static int read_uint16(struct packet *p, ogg_uint16_t *val)
+static int read_uint16(struct packet *p, uint16_t *val)
{
if (p->pos > p->maxlen - 2)
return 0;
char str[9];
struct packet p;
unsigned char ch, channel_mapping;
- ogg_uint16_t shortval;
p.data = packet;
p.maxlen = len;
if (h->channels == 0)
return -E_OPUS_HEADER;
- if (!read_uint16(&p, &shortval))
+ if (!read_uint16(&p, &h->preskip))
return -E_OPUS_HEADER;
- h->preskip = shortval;
if (!read_uint32(&p, &h->input_sample_rate))
return -E_OPUS_HEADER;
- if (!read_uint16(&p, &shortval))
+ if (!read_uint16(&p, &h->gain))
return -E_OPUS_HEADER;
- h->gain = (short)shortval;
if (!read_chars(&p, &ch, 1))
return -E_OPUS_HEADER;
/** 1..255 */
int channels;
/** Number of bytes to skip from the beginning. */
- int preskip;
+ uint16_t preskip;
/** Sample rate of the input stream, used by the audio format handler. */
ogg_uint32_t input_sample_rate;
/** In dB, should be zero whenever possible. */
- int gain;
+ uint16_t gain;
/** Number of logical streams (usually 1). */
int nb_streams;
/** Number of streams to decode as 2 channel streams. */
ogg_page ogg_page;
bool eos;
int channels;
- int preskip;
+ uint16_t preskip;
bool have_opus_stream;
bool have_more;
ogg_int32_t opus_serialno;
static void opusdec_add_output(short *pcm, int frames_available,
struct btr_node *btrn, struct opusdec_context *ctx)
{
- int tmp_skip, num_frames, bytes;
+ int num_frames, bytes;
+ uint16_t tmp_skip;
- tmp_skip = PARA_MIN(ctx->preskip, frames_available);
+ tmp_skip = PARA_MIN((int)ctx->preskip, frames_available);
ctx->preskip -= tmp_skip;
num_frames = frames_available - tmp_skip;
if (num_frames <= 0)