f8cf459c1008fe9731d9eaaaf253fd1be6710af9
[paraslash.git] / opus_common.h
1 /* Copyright (C) 2013 Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */
2
3 /**
4  * \file opus_common.h
5  * Common declarations for the opus decoder and audio format handler.
6  */
7
8 /** Various bits stored in the header of an opus stream. */
9 struct opus_header {
10         /** lower 4 bits of the version byte, must be 0. */
11         int version;
12         /** 1..255 */
13         int channels;
14         /** Number of bytes to skip from the beginning. */
15         uint16_t preskip;
16         /** Sample rate of the input stream, used by the audio format handler. */
17         uint32_t input_sample_rate;
18         /** In dB, should be zero whenever possible. */
19         uint16_t gain;
20         /** Number of logical streams (usually 1). */
21         int nb_streams;
22         /** Number of streams to decode as 2 channel streams. */
23         int nb_coupled;
24         /** Mapping from coded channels to output channels. */
25         unsigned char stream_map[255];
26 };
27
28 int opus_parse_header(const char *packet, int len, struct opus_header *h);