1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Merge commit '72025ac36c740f031d7e413041fdfe97087c83c4'

* commit '72025ac36c740f031d7e413041fdfe97087c83c4':
  lavc: add libdcadec decoder

Conflicts:
	Changelog
	configure
	libavcodec/Makefile
	libavcodec/allcodecs.c
	libavcodec/libdcadec.c

See: 519868de7d
Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2015-03-29 12:47:10 +02:00
commit 93704e09c7
3 changed files with 14 additions and 4 deletions

View File

@ -6,7 +6,7 @@ version <next>:
- TDSC decoder - TDSC decoder
- DTS lossless extension (XLL) decoding (not lossless, disabled by default) - DTS lossless extension (XLL) decoding (not lossless, disabled by default)
- showwavespic filter - showwavespic filter
- libdcadec wrapper - DTS decoding through libdcadec
- Drop support for nvenc API before 5.0 - Drop support for nvenc API before 5.0
- nvenc H265 encoder - nvenc H265 encoder
- Detelecine filter - Detelecine filter

View File

@ -736,7 +736,7 @@ OBJS-$(CONFIG_ELBG_FILTER) += elbg.o
# external codec libraries # external codec libraries
OBJS-$(CONFIG_LIBAACPLUS_ENCODER) += libaacplus.o OBJS-$(CONFIG_LIBAACPLUS_ENCODER) += libaacplus.o
OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o
OBJS-$(CONFIG_LIBDCADEC_DECODER) += libdcadec.o OBJS-$(CONFIG_LIBDCADEC_DECODER) += libdcadec.o dca.o
OBJS-$(CONFIG_LIBFAAC_ENCODER) += libfaac.o OBJS-$(CONFIG_LIBFAAC_ENCODER) += libfaac.o
OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o
OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o

View File

@ -25,6 +25,7 @@
#include "libavutil/channel_layout.h" #include "libavutil/channel_layout.h"
#include "libavutil/common.h" #include "libavutil/common.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "avcodec.h" #include "avcodec.h"
#include "dca.h" #include "dca.h"
#include "dca_syncwords.h" #include "dca_syncwords.h"
@ -48,6 +49,10 @@ static int dcadec_decode_frame(AVCodecContext *avctx, void *data,
int input_size = avpkt->size; int input_size = avpkt->size;
/* convert bytestream syntax to RAW BE format if required */ /* convert bytestream syntax to RAW BE format if required */
if (input_size < 8) {
av_log(avctx, AV_LOG_ERROR, "Input size too small\n");
return AVERROR_INVALIDDATA;
}
mrk = AV_RB32(input); mrk = AV_RB32(input);
if (mrk != DCA_SYNCWORD_CORE_BE && mrk != DCA_SYNCWORD_SUBSTREAM) { if (mrk != DCA_SYNCWORD_CORE_BE && mrk != DCA_SYNCWORD_SUBSTREAM) {
s->buffer = av_fast_realloc(s->buffer, &s->buffer_size, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); s->buffer = av_fast_realloc(s->buffer, &s->buffer_size, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE);
@ -75,11 +80,16 @@ static int dcadec_decode_frame(AVCodecContext *avctx, void *data,
avctx->channel_layout = channel_mask; avctx->channel_layout = channel_mask;
avctx->sample_rate = sample_rate; avctx->sample_rate = sample_rate;
av_assert0(bits_per_sample >= 16 && bits_per_sample <= 24); av_assert0(bits_per_sample >= 16);
if (bits_per_sample == 16) if (bits_per_sample == 16)
avctx->sample_fmt = AV_SAMPLE_FMT_S16P; avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
else else if (bits_per_sample <= 24)
avctx->sample_fmt = AV_SAMPLE_FMT_S32P; avctx->sample_fmt = AV_SAMPLE_FMT_S32P;
else {
av_log(avctx, AV_LOG_ERROR, "Unsupported number of bits per sample: %d\n",
bits_per_sample);
return AVERROR(ENOSYS);
}
avctx->bits_per_raw_sample = bits_per_sample; avctx->bits_per_raw_sample = bits_per_sample;