37 #define IS_MARKER(state, i, buf, buf_size) \
38 ((state == DCA_MARKER_14B_LE && (i < buf_size-2) && (buf[i+1] & 0xF0) == 0xF0 && buf[i+2] == 0x07) \
39 || (state == DCA_MARKER_14B_BE && (i < buf_size-2) && buf[i+1] == 0x07 && (buf[i+2] & 0xF0) == 0xF0) \
40 || state == DCA_MARKER_RAW_LE || state == DCA_MARKER_RAW_BE)
58 for (i = 0; i < buf_size; i++) {
59 state = (state << 8) | buf[i];
75 for (; i < buf_size; i++) {
77 state = (state << 8) | buf[i];
104 int *sample_rate,
int *framesize)
108 int ret, sample_blocks, sr_code;
119 sample_blocks =
get_bits(&gb, 7) + 1;
120 if (sample_blocks < 8)
122 *duration = 256 * (sample_blocks / 8);
131 if (*sample_rate == 0)
139 const uint8_t ** poutbuf,
int *poutbuf_size,
140 const uint8_t * buf,
int buf_size)
166 *poutbuf_size = buf_size;
static av_cold int dca_parse_init(AVCodecParserContext *s)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static void skip_bits_long(GetBitContext *s, int n)
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.
int ff_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, int max_size)
Convert bitstream to one representation based on sync marker.
int duration
Duration of the current frame.
#define DCA_HD_MARKER
DCA-HD specific block starts with this marker.
bitstream reader API header.
AVCodecParser ff_dca_parser
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
Combine the (truncated) bitstream to a complete frame.
#define PARSER_FLAG_COMPLETE_FRAMES
#define IS_MARKER(state, i, buf, buf_size)
void ff_parse_close(AVCodecParserContext *s)
#define FF_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
const uint32_t avpriv_dca_sample_rates[16]
static int dca_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
int sample_rate
samples per second
main external API structure.
uint32_t state
contains the last few bytes in MSB order
static void skip_bits(GetBitContext *s, int n)
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
static int dca_parse_params(const uint8_t *buf, int buf_size, int *duration, int *sample_rate, int *framesize)