FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
ac3_parser.c File Reference
#include "libavutil/channel_layout.h"
#include "parser.h"
#include "ac3_parser.h"
#include "aac_ac3_parser.h"
#include "get_bits.h"

Go to the source code of this file.

Macros

#define AC3_HEADER_SIZE   7
 

Functions

int avpriv_ac3_parse_header (GetBitContext *gbc, AC3HeaderInfo **phdr)
 Parse AC-3 frame header. More...
 
static int ac3_sync (uint64_t state, AACAC3ParseContext *hdr_info, int *need_next_header, int *new_frame_start)
 
static av_cold int ac3_parse_init (AVCodecParserContext *s1)
 

Variables

static const uint8_t eac3_blocks [4]
 
static const uint8_t center_levels [4] = { 4, 5, 6, 5 }
 Table for center mix levels reference: Section 5.4.2.4 cmixlev. More...
 
static const uint8_t surround_levels [4] = { 4, 6, 7, 6 }
 Table for surround mix levels reference: Section 5.4.2.5 surmixlev. More...
 
AVCodecParser ff_ac3_parser
 

Macro Definition Documentation

#define AC3_HEADER_SIZE   7

Definition at line 30 of file ac3_parser.c.

Referenced by ac3_parse_init(), ac3_sync(), and avpriv_ac3_parse_header().

Function Documentation

int avpriv_ac3_parse_header ( GetBitContext gbc,
AC3HeaderInfo **  hdr 
)

Parse AC-3 frame header.

Parse the header up to the lfeon element, which is the first 52 or 54 bits depending on the audio coding mode.

Parameters
[in]gbcBitContext containing the first 54 bits of the frame.
[out]hdrPointer to Pointer to struct where header info is written. will be allocated if NULL
Returns
Returns 0 on success, -1 if there is a sync word mismatch, -2 if the bsid (version) element is invalid, -3 if the fscod (sample rate) element is invalid, or -4 if the frmsizecod (bit rate) element is invalid.

Definition at line 50 of file ac3_parser.c.

Referenced by ac3_eac3_probe(), ac3_sync(), ffat_create_decoder(), and parse_frame_header().

static int ac3_sync ( uint64_t  state,
AACAC3ParseContext hdr_info,
int need_next_header,
int new_frame_start 
)
static

Definition at line 154 of file ac3_parser.c.

Referenced by ac3_parse_init().

static av_cold int ac3_parse_init ( AVCodecParserContext s1)
static

Definition at line 189 of file ac3_parser.c.

Variable Documentation

const uint8_t eac3_blocks[4]
static
Initial value:
= {
1, 2, 3, 6
}

Definition at line 33 of file ac3_parser.c.

Referenced by avpriv_ac3_parse_header().

const uint8_t center_levels[4] = { 4, 5, 6, 5 }
static

Table for center mix levels reference: Section 5.4.2.4 cmixlev.

Definition at line 41 of file ac3_parser.c.

Referenced by avpriv_ac3_parse_header().

const uint8_t surround_levels[4] = { 4, 6, 7, 6 }
static

Table for surround mix levels reference: Section 5.4.2.5 surmixlev.

Definition at line 47 of file ac3_parser.c.

Referenced by avpriv_ac3_parse_header().

AVCodecParser ff_ac3_parser
Initial value:
= {
.codec_ids = { AV_CODEC_ID_AC3, AV_CODEC_ID_EAC3 },
.priv_data_size = sizeof(AACAC3ParseContext),
.parser_init = ac3_parse_init,
.parser_parse = ff_aac_ac3_parse,
.parser_close = ff_parse_close,
}
void ff_parse_close(AVCodecParserContext *s)
Definition: parser.c:327
static av_cold int ac3_parse_init(AVCodecParserContext *s1)
Definition: ac3_parser.c:189
int ff_aac_ac3_parse(AVCodecParserContext *s1, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)

Definition at line 198 of file ac3_parser.c.