aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-08 13:11:11 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-08 13:11:11 +0200
commit43c157f4a46cb76739f07782d23d1e4ff8da3253 (patch)
treef74dfcbb6a16498524fa2185ac3160cd224b5c04 /libavcodec/utils.c
parentd7a473926504e2acfa6ae3bead0938e1f4e03441 (diff)
parent7b556be6735371d1040c7076547b8198d9fadd34 (diff)
downloadffmpeg-43c157f4a46cb76739f07782d23d1e4ff8da3253.tar.gz
Merge remote-tracking branch 'qatar/master'
* qatar/master: af_resample: avoid conversion of identical sample formats for 1 channel avcodec: allow either planar or interleaved sample format when encoding mono adpcmenc: ensure calls to adpcm_ima_compress_sample() are in the right order timefilter: De-doxygenize normal code comments and drop silly ones gxf: Include the right header for the avpriv_frame_rate_tab declaration Conflicts: libavcodec/adpcmenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 36ac878540..be86fa0a6f 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -947,9 +947,16 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
if (av_codec_is_encoder(avctx->codec)) {
int i;
if (avctx->codec->sample_fmts) {
- for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++)
+ for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) {
if (avctx->sample_fmt == avctx->codec->sample_fmts[i])
break;
+ if (avctx->channels == 1 &&
+ av_get_planar_sample_fmt(avctx->sample_fmt) ==
+ av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) {
+ avctx->sample_fmt = avctx->codec->sample_fmts[i];
+ break;
+ }
+ }
if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) {
av_log(avctx, AV_LOG_ERROR, "Specified sample_fmt is not supported.\n");
ret = AVERROR(EINVAL);