Go to the documentation of this file.
23 #include "config_components.h"
36 #define AC3_HEADER_SIZE 7
40 static const uint8_t eac3_blocks[4] = {
48 static const uint8_t center_levels[4] = { 4, 5, 6, 5 };
54 static const uint8_t surround_levels[4] = { 4, 6, 7, 6 };
60 for (
i = 1;
i < buf_size;
i += 2) {
61 if (buf[
i] == 0x77 || buf[
i] == 0x0B) {
62 if ((buf[
i] ^ buf[
i-1]) == (0x77 ^ 0x0B)) {
65 }
else if ((buf[
i] ^ buf[
i+1]) == (0x77 ^ 0x0B)) {
153 for (
int i = 0;
i < 16;
i++)
202 int mix_data_size = (
get_bits(gbc, 5) + 2) << 3;
268 for (
int i = 0;
i < addbsil + 1;
i++) {
291 memset(hdr, 0,
sizeof(*hdr));
320 if(frame_size_code > 37)
334 hdr-> center_mix_level = center_levels[
get_bits(gbc, 2)];
348 int ret = ac3_parse_header(gbc, hdr);
384 int ret = eac3_parse_header(gbc, hdr);
443 static int ac3_sync(uint64_t
state,
int *need_next_header,
int *new_frame_start)
453 if (
tmp.u8[1] == 0x77 &&
tmp.u8[2] == 0x0b) {
483 .parser_init = ac3_parse_init,
#define EAC3_SR_CODE_REDUCED
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
const uint16_t ff_ac3_channel_layout_tab[8]
Map audio coding mode (acmod) to channel layout mask.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static int get_bits_count(const GetBitContext *s)
void ff_parse_close(AVCodecParserContext *s)
const uint8_t ff_ac3_channels_tab[8]
Map audio coding mode (acmod) to number of full-bandwidth channels.
@ EAC3_FRAME_TYPE_RESERVED
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
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.
static void skip_bits(GetBitContext *s, int n)
@ AC3_PARSE_ERROR_FRAME_TYPE
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
@ EAC3_FRAME_TYPE_DEPENDENT
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
#define AV_CH_LOW_FREQUENCY
@ EAC3_FRAME_TYPE_INDEPENDENT
static const uint8_t channel_map[8][8]
int ff_aac_ac3_parse(AVCodecParserContext *s1, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
const AVCodecParser ff_ac3_parser
static unsigned int get_bits1(GetBitContext *s)
@ AC3_DSURMOD_NOTINDICATED
const uint64_t ff_eac3_custom_channel_map_locations[16][2]
@ EAC3_FRAME_TYPE_AC3_CONVERT
@ AC3_PARSE_ERROR_CHANNEL_MAP
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
static void skip_bits1(GetBitContext *s)
const int ff_ac3_sample_rate_tab[]
#define i(width, name, range_min, range_max)
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)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
const uint16_t ff_ac3_frame_size_tab[38][3]
Possible frame sizes.
#define FFSWAP(type, a, b)
int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
Parse AC-3 frame header.
#define AV_INPUT_BUFFER_PADDING_SIZE
#define EAC3_MAX_CHANNELS
maximum number of channels in EAC3
const uint16_t ff_ac3_bitrate_tab[19]
@ AC3_PARSE_ERROR_SAMPLE_RATE
@ AC3_PARSE_ERROR_FRAME_SIZE
#define AVERROR_INVALIDDATA
Invalid data found when processing input.