aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/dca.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-03-06 03:56:25 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-03-06 06:03:32 +0100
commitf095391a140ed3f379e1fb16605fac821c3e6660 (patch)
tree6b0be38bffb002457cba26183c57e56d5d464551 /libavcodec/dca.c
parent01606d10e600c4794d89490e731c321fb73a5141 (diff)
parent632eb1bbae473f7105e0ec6556cb040ea6d30910 (diff)
downloadffmpeg-f095391a140ed3f379e1fb16605fac821c3e6660.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: (31 commits) cdxl demux: do not create packets with uninitialized data at EOF. Replace computations of remaining bits with calls to get_bits_left(). amrnb/amrwb: Remove get_bits usage. cosmetics: reindent avformat: do not require a pixel/sample format if there is no decoder avformat: do not fill-in audio packet duration in compute_pkt_fields() lavf: Use av_get_audio_frame_duration() in get_audio_frame_size() dca_parser: parse the sample rate and frame durations libspeexdec: do not set AVCodecContext.frame_size libopencore-amr: do not set AVCodecContext.frame_size alsdec: do not set AVCodecContext.frame_size siff: do not set AVCodecContext.frame_size amr demuxer: do not set AVCodecContext.frame_size. aiffdec: do not set AVCodecContext.frame_size mov: do not set AVCodecContext.frame_size ape: do not set AVCodecContext.frame_size. rdt: remove workaround for infinite loop with aac avformat: do not require frame_size in avformat_find_stream_info() for CELT avformat: do not require frame_size in avformat_find_stream_info() for MP1/2/3 avformat: do not require frame_size in avformat_find_stream_info() for AAC ... Conflicts: doc/APIchanges libavcodec/Makefile libavcodec/avcodec.h libavcodec/h264.c libavcodec/h264_ps.c libavcodec/utils.c libavcodec/version.h libavcodec/x86/dsputil_mmx.c libavformat/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/dca.c')
-rw-r--r--libavcodec/dca.c47
1 files changed, 3 insertions, 44 deletions
diff --git a/libavcodec/dca.c b/libavcodec/dca.c
index 315826371c..21df38a187 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"
@@ -1382,47 +1383,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)
@@ -1709,8 +1669,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;
@@ -1724,7 +1684,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;