23#include "config_components.h"
37#define AC3_HEADER_SIZE 7
41static const uint8_t eac3_blocks[4] = {
49static const uint8_t center_levels[4] = { 4, 5, 6, 5 };
55static const uint8_t surround_levels[4] = { 4, 6, 7, 6 };
61 for (
i = 1;
i < buf_size;
i += 2) {
62 if (buf[
i] == 0x77 || buf[
i] == 0x0B) {
63 if ((buf[
i] ^ buf[
i-1]) == (0x77 ^ 0x0B)) {
66 }
else if ((buf[
i] ^ buf[
i+1]) == (0x77 ^ 0x0B)) {
154 for (
int i = 0;
i < 16;
i++)
203 int mix_data_size = (
get_bits(gbc, 5) + 2) << 3;
269 for (
int i = 0;
i < addbsil + 1;
i++) {
292 memset(hdr, 0,
sizeof(*hdr));
321 if(frame_size_code > 37)
335 hdr-> center_mix_level = center_levels[
get_bits(gbc, 2)];
349 int ret = ac3_parse_header(gbc, hdr);
385 int ret = eac3_parse_header(gbc, hdr);
444static int ac3_sync(uint64_t
state,
int *need_next_header,
int *new_frame_start)
454 if (
tmp.u8[1] == 0x77 &&
tmp.u8[2] == 0x0b) {
484 .
init = ac3_parse_init,
int ff_aac_ac3_parse(AVCodecParserContext *s1, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
const uint16_t ff_ac3_channel_layout_tab[8]
Map audio coding mode (acmod) to channel layout mask.
int av_ac3_parse_header(const uint8_t *buf, size_t size, uint8_t *bitstream_id, uint16_t *frame_size)
Extract the bitstream ID and the frame size from AC-3 data.
int avpriv_ac3_parse_header(AC3HeaderInfo **phdr, const uint8_t *buf, size_t size)
int ff_ac3_find_syncword(const uint8_t *buf, int buf_size)
@ AC3_PARSE_ERROR_FRAME_TYPE
@ AC3_PARSE_ERROR_SAMPLE_RATE
@ AC3_PARSE_ERROR_CHANNEL_MAP
@ AC3_PARSE_ERROR_FRAME_SIZE
int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
Parse AC-3 frame header.
#define EAC3_MAX_CHANNELS
maximum number of channels in EAC3
@ EAC3_FRAME_TYPE_DEPENDENT
@ EAC3_FRAME_TYPE_INDEPENDENT
@ EAC3_FRAME_TYPE_RESERVED
@ EAC3_FRAME_TYPE_AC3_CONVERT
#define EAC3_SR_CODE_REDUCED
@ AC3_DSURMOD_NOTINDICATED
const uint8_t ff_ac3_channels_tab[8]
Map audio coding mode (acmod) to number of full-bandwidth channels.
const uint16_t ff_ac3_bitrate_tab[19]
const int ff_ac3_sample_rate_tab[]
const uint16_t ff_ac3_frame_size_tab[38][3]
Possible frame sizes.
const uint64_t ff_eac3_custom_channel_map_locations[16][2]
static int parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
static av_cold void close(AVCodecParserContext *s)
static const uint8_t channel_map[8][8]
#define i(width, name, range_min, range_max)
Public libavutil channel layout APIs header.
int(* init)(AVBSFContext *ctx)
static struct @346255127015250356166251341105367306144006377143 state
static const uint8_t frame_size[4]
bitstream reader API header.
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static unsigned int get_bits1(GetBitContext *s)
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
static int get_bits_count(const GetBitContext *s)
static void skip_bits1(GetBitContext *s)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
#define AV_CH_LOW_FREQUENCY
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define FFSWAP(type, a, b)
Memory handling functions.
av_cold void ff_parse_close(AVCodecParserContext *s)
#define PARSER_CODEC_LIST(...)
const FFCodecParser ff_ac3_parser