diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2012-02-27 13:58:01 -0500 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2012-03-05 13:08:17 -0500 |
commit | 11ac796f7ab2738eff19ea18847355363c8cc797 (patch) | |
tree | 350b9316d20d7b04cbb6a43e2acfd92bc36e4fc2 /libavcodec/dca.c | |
parent | 85469f1c9eb1e678f9d7135dd6bcc1df68072e29 (diff) | |
download | ffmpeg-11ac796f7ab2738eff19ea18847355363c8cc797.tar.gz |
dca_parser: parse the sample rate and frame durations
Diffstat (limited to 'libavcodec/dca.c')
-rw-r--r-- | libavcodec/dca.c | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/libavcodec/dca.c b/libavcodec/dca.c index 3f62c1e342..71c18002bf 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -38,6 +38,7 @@ #include "dcadata.h" #include "dcahuff.h" #include "dca.h" +#include "dca_parser.h" #include "synth_filter.h" #include "dcadsp.h" #include "fmtconvert.h" @@ -1361,47 +1362,6 @@ static int dca_decode_block(DCAContext *s, int base_channel, int block_index) } /** - * Convert bitstream to one representation based on sync marker - */ -static int dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, - int max_size) -{ - uint32_t mrk; - int i, tmp; - const uint16_t *ssrc = (const uint16_t *) src; - uint16_t *sdst = (uint16_t *) dst; - PutBitContext pb; - - if ((unsigned) src_size > (unsigned) max_size) { -// av_log(NULL, AV_LOG_ERROR, "Input frame size larger than DCA_MAX_FRAME_SIZE!\n"); -// return -1; - src_size = max_size; - } - - mrk = AV_RB32(src); - switch (mrk) { - case DCA_MARKER_RAW_BE: - memcpy(dst, src, src_size); - return src_size; - case DCA_MARKER_RAW_LE: - for (i = 0; i < (src_size + 1) >> 1; i++) - *sdst++ = av_bswap16(*ssrc++); - return src_size; - case DCA_MARKER_14B_BE: - case DCA_MARKER_14B_LE: - init_put_bits(&pb, dst, max_size); - for (i = 0; i < (src_size + 1) >> 1; i++, src += 2) { - tmp = ((mrk == DCA_MARKER_14B_BE) ? AV_RB16(src) : AV_RL16(src)) & 0x3FFF; - put_bits(&pb, 14, tmp); - } - flush_put_bits(&pb); - return (put_bits_count(&pb) + 7) >> 3; - default: - return AVERROR_INVALIDDATA; - } -} - -/** * Return the number of channels in an ExSS speaker mask (HD) */ static int dca_exss_mask2count(int mask) @@ -1688,8 +1648,8 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data, s->xch_present = 0; - s->dca_buffer_size = dca_convert_bitstream(buf, buf_size, s->dca_buffer, - DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE); + s->dca_buffer_size = ff_dca_convert_bitstream(buf, buf_size, s->dca_buffer, + DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE); if (s->dca_buffer_size == AVERROR_INVALIDDATA) { av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n"); return AVERROR_INVALIDDATA; @@ -1703,7 +1663,6 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data, //set AVCodec values with parsed data avctx->sample_rate = s->sample_rate; avctx->bit_rate = s->bit_rate; - avctx->frame_size = s->sample_blocks * 32; s->profile = FF_PROFILE_DTS; |