FFmpeg
Data Structures | Macros | Functions | Variables
dca_parser.c File Reference
#include "dca.h"
#include "dca_core.h"
#include "dca_exss.h"
#include "dca_lbr.h"
#include "dca_syncwords.h"
#include "get_bits.h"
#include "parser.h"

Go to the source code of this file.

Data Structures

struct  DCAParseContext
 

Macros

#define IS_CORE_MARKER(state)
 
#define IS_EXSS_MARKER(state)   ((state & 0xFFFFFFFF) == DCA_SYNCWORD_SUBSTREAM)
 
#define IS_MARKER(state)   (IS_CORE_MARKER(state) || IS_EXSS_MARKER(state))
 
#define CORE_MARKER(state)   ((state >> 16) & 0xFFFFFFFF)
 
#define EXSS_MARKER(state)   (state & 0xFFFFFFFF)
 
#define STATE_LE(state)   (((state & 0xFF00FF00) >> 8) | ((state & 0x00FF00FF) << 8))
 
#define STATE_14(state)   (((state & 0x3FFF0000) >> 8) | ((state & 0x00003FFF) >> 6))
 
#define CORE_FRAMESIZE(state)   (((state >> 4) & 0x3FFF) + 1)
 
#define EXSS_FRAMESIZE(state)
 

Functions

static int dca_find_frame_end (DCAParseContext *pc1, const uint8_t *buf, int buf_size)
 Find the end of the current frame in the bitstream. More...
 
static av_cold int dca_parse_init (AVCodecParserContext *s)
 
static int dca_parse_params (DCAParseContext *pc1, const uint8_t *buf, int buf_size, int *duration, int *sample_rate, int *profile)
 
static int dca_parse (AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
 

Variables

AVCodecParser ff_dca_parser
 

Macro Definition Documentation

◆ IS_CORE_MARKER

#define IS_CORE_MARKER (   state)
Value:
(((state & 0xFFFFFFFFF0FF) == (((uint64_t)DCA_SYNCWORD_CORE_14B_LE << 16) | 0xF007)) || \
((state & 0xFFFFFFFFFFF0) == (((uint64_t)DCA_SYNCWORD_CORE_14B_BE << 16) | 0x07F0)) || \
((state & 0xFFFFFFFF00FC) == (((uint64_t)DCA_SYNCWORD_CORE_LE << 16) | 0x00FC)) || \
((state & 0xFFFFFFFFFC00) == (((uint64_t)DCA_SYNCWORD_CORE_BE << 16) | 0xFC00)))

Definition at line 43 of file dca_parser.c.

◆ IS_EXSS_MARKER

#define IS_EXSS_MARKER (   state)    ((state & 0xFFFFFFFF) == DCA_SYNCWORD_SUBSTREAM)

Definition at line 49 of file dca_parser.c.

◆ IS_MARKER

#define IS_MARKER (   state)    (IS_CORE_MARKER(state) || IS_EXSS_MARKER(state))

Definition at line 51 of file dca_parser.c.

◆ CORE_MARKER

#define CORE_MARKER (   state)    ((state >> 16) & 0xFFFFFFFF)

Definition at line 53 of file dca_parser.c.

◆ EXSS_MARKER

#define EXSS_MARKER (   state)    (state & 0xFFFFFFFF)

Definition at line 54 of file dca_parser.c.

◆ STATE_LE

#define STATE_LE (   state)    (((state & 0xFF00FF00) >> 8) | ((state & 0x00FF00FF) << 8))

Definition at line 56 of file dca_parser.c.

◆ STATE_14

#define STATE_14 (   state)    (((state & 0x3FFF0000) >> 8) | ((state & 0x00003FFF) >> 6))

Definition at line 57 of file dca_parser.c.

◆ CORE_FRAMESIZE

#define CORE_FRAMESIZE (   state)    (((state >> 4) & 0x3FFF) + 1)

Definition at line 59 of file dca_parser.c.

◆ EXSS_FRAMESIZE

#define EXSS_FRAMESIZE (   state)
Value:
((state & 0x2000000000) ? \
((state >> 5) & 0xFFFFF) + 1 : \
((state >> 13) & 0x0FFFF) + 1)

Definition at line 60 of file dca_parser.c.

Function Documentation

◆ dca_find_frame_end()

static int dca_find_frame_end ( DCAParseContext pc1,
const uint8_t buf,
int  buf_size 
)
static

Find the end of the current frame in the bitstream.

Returns
the position of the first byte of the next frame, or -1

Definition at line 68 of file dca_parser.c.

Referenced by dca_parse().

◆ dca_parse_init()

static av_cold int dca_parse_init ( AVCodecParserContext s)
static

Definition at line 184 of file dca_parser.c.

◆ dca_parse_params()

static int dca_parse_params ( DCAParseContext pc1,
const uint8_t buf,
int  buf_size,
int duration,
int sample_rate,
int profile 
)
static

Definition at line 193 of file dca_parser.c.

Referenced by dca_parse().

◆ dca_parse()

static int dca_parse ( AVCodecParserContext s,
AVCodecContext avctx,
const uint8_t **  poutbuf,
int poutbuf_size,
const uint8_t buf,
int  buf_size 
)
static

Definition at line 306 of file dca_parser.c.

Variable Documentation

◆ ff_dca_parser

AVCodecParser ff_dca_parser
Initial value:
= {
.codec_ids = { AV_CODEC_ID_DTS },
.priv_data_size = sizeof(DCAParseContext),
.parser_init = dca_parse_init,
.parser_parse = dca_parse,
.parser_close = ff_parse_close,
}

Definition at line 346 of file dca_parser.c.

DCA_SYNCWORD_CORE_14B_BE
#define DCA_SYNCWORD_CORE_14B_BE
Definition: dca_syncwords.h:24
ff_parse_close
void ff_parse_close(AVCodecParserContext *s)
Definition: parser.c:315
state
static struct @313 state
DCA_SYNCWORD_CORE_BE
#define DCA_SYNCWORD_CORE_BE
Definition: dca_syncwords.h:22
AV_CODEC_ID_DTS
@ AV_CODEC_ID_DTS
Definition: avcodec.h:568
DCA_SYNCWORD_CORE_14B_LE
#define DCA_SYNCWORD_CORE_14B_LE
Definition: dca_syncwords.h:25
dca_parse
static int dca_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
Definition: dca_parser.c:306
DCAParseContext
Definition: dca_parser.c:33
DCA_SYNCWORD_CORE_LE
#define DCA_SYNCWORD_CORE_LE
Definition: dca_syncwords.h:23
dca_parse_init
static av_cold int dca_parse_init(AVCodecParserContext *s)
Definition: dca_parser.c:184