diff options
author | clsid2 <clsid2@3b938f2f-1a1a-0410-8054-a526ea5ff92c> | 2011-03-07 00:08:34 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-04-03 22:52:58 +0200 |
commit | 0e09997fa452565e59bfbdf81a96917b3c503470 (patch) | |
tree | 51148224344500d4342cdd2da8ea65952d07688e /libavcodec/dca.c | |
parent | 361fa0ed40a042393a2691e3dba9bd7c4bcfe188 (diff) | |
download | ffmpeg-streaming-0e09997fa452565e59bfbdf81a96917b3c503470.zip ffmpeg-streaming-0e09997fa452565e59bfbdf81a96917b3c503470.tar.gz |
Libavcodec AC3/E-AC3/DTS decoders now output floating point data.
git-svn-id: https://ffdshow-tryout.svn.sourceforge.net/svnroot/ffdshow-tryout@3769 3b938f2f-1a1a-0410-8054-a526ea5ff92c
Diffstat (limited to 'libavcodec/dca.c')
-rw-r--r-- | libavcodec/dca.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/libavcodec/dca.c b/libavcodec/dca.c index 14b0b2d..2053121 100644 --- a/libavcodec/dca.c +++ b/libavcodec/dca.c @@ -1626,7 +1626,12 @@ static int dca_decode_frame(AVCodecContext * avctx, int lfe_samples; int num_core_channels = 0; int i; + /* ffdshow custom code */ +#if CONFIG_AUDIO_FLOAT + float *samples = data; +#else int16_t *samples = data; +#endif DCAContext *s = avctx->priv_data; int channels; int core_ss_end; @@ -1812,9 +1817,10 @@ static int dca_decode_frame(AVCodecContext * avctx, return -1; } - if (*data_size < (s->sample_blocks / 8) * 256 * sizeof(int16_t) * channels) + /* ffdshow custom code */ + if (*data_size < (s->sample_blocks / 8) * 256 * sizeof(samples[0]) * channels) return -1; - *data_size = 256 / 8 * s->sample_blocks * sizeof(int16_t) * channels; + *data_size = 256 / 8 * s->sample_blocks * sizeof(samples[0]) * channels; /* filter to get final output */ for (i = 0; i < (s->sample_blocks / 8); i++) { @@ -1833,7 +1839,13 @@ static int dca_decode_frame(AVCodecContext * avctx, } } + /* interleave samples */ +#if CONFIG_AUDIO_FLOAT + /* ffdshow custom code */ + float_interleave(samples, s->samples_chanptr, 256, channels); +#else s->fmt_conv.float_to_int16_interleave(samples, s->samples_chanptr, 256, channels); +#endif samples += 256 * channels; } @@ -1870,7 +1882,12 @@ static av_cold int dca_decode_init(AVCodecContext * avctx) for (i = 0; i < DCA_PRIM_CHANNELS_MAX+1; i++) s->samples_chanptr[i] = s->samples + i * 256; + /* ffdshow custom code */ +#if CONFIG_AUDIO_FLOAT + avctx->sample_fmt = AV_SAMPLE_FMT_FLT; +#else avctx->sample_fmt = AV_SAMPLE_FMT_S16; +#endif s->scale_bias = 1.0; |