summaryrefslogtreecommitdiff
path: root/opus_common.h
blob: 0df10b8392154a7ba7656cb8cad2bb080b4976c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* SPDX-License-Identifier: GPL-2.0 */

/**
 * \file opus_common.h
 * Common declarations for the opus decoder and audio format handler.
 */

/** Various bits stored in the header of an opus stream. */
struct opus_header {
	/** lower 4 bits of the version byte, must be 0. */
	int version;
	/** 1..255 */
	int channels;
	/** Number of bytes to skip from the beginning. */
	uint16_t preskip;
	/** Sample rate of the input stream, used by the audio format handler. */
	uint32_t input_sample_rate;
	/** In dB, should be zero whenever possible. */
	uint16_t gain;
	/** Number of logical streams (usually 1). */
	int nb_streams;
	/** Number of streams to decode as 2 channel streams. */
	int nb_coupled;
	/** Mapping from coded channels to output channels. */
	unsigned char stream_map[255];
};

int opus_parse_header(const char *packet, int len, struct opus_header *h);