diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-04-09 22:48:20 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-04-09 23:02:33 +0200 |
commit | 6bfb3042b3158f0a87629ab0c126cccb269c3d5a (patch) | |
tree | 08699d0bcef99f30b084db2980759af901f8af91 /libavcodec/utils.c | |
parent | 7f66912f1a303a369f6ac435d630971d74310a81 (diff) | |
parent | 679a973e9701576b1c3c6d71838c45c10ac20564 (diff) | |
download | ffmpeg-6bfb3042b3158f0a87629ab0c126cccb269c3d5a.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
avconv: use default alignment for audio buffer
avcodec: use align == 0 for default alignment in avcodec_fill_audio_frame()
avutil: use align == 0 for default alignment in audio sample buffer functions
avutil: allow NULL linesize in av_samples_fill_arrays() and av_samples_alloc()
avconv: remove OutputStream.picref.
avconv: only set SAR once on the decoded frame.
avcodec: validate the channel layout vs. channel count for decoders
audioconvert: make av_get_channel_layout accept composite names.
avutil: add av_get_packed_sample_fmt() and av_get_planar_sample_fmt()
Conflicts:
doc/APIchanges
ffmpeg.c
libavcodec/utils.c
libavcodec/version.h
libavutil/audioconvert.c
libavutil/audioconvert.h
libavutil/avutil.h
libavutil/samplefmt.c
libavutil/samplefmt.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index ab34b40c62..f6c9466fbc 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -319,7 +319,7 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) buf_size = av_samples_get_buffer_size(NULL, avctx->channels, frame->nb_samples, avctx->sample_fmt, - 32); + 0); if (buf_size < 0) return AVERROR(EINVAL); @@ -361,7 +361,7 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) } if ((ret = avcodec_fill_audio_frame(frame, avctx->channels, avctx->sample_fmt, buf->data[0], - buf->audio_data_size, 32))) + buf->audio_data_size, 0))) return ret; if (frame->extended_data == frame->data) @@ -913,10 +913,18 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD } } - if (av_codec_is_decoder(avctx->codec) && !avctx->bit_rate) - avctx->bit_rate = get_bit_rate(avctx); - ret=0; + + if (av_codec_is_decoder(avctx->codec)) { + if (!avctx->bit_rate) + avctx->bit_rate = get_bit_rate(avctx); + /* validate channel layout from the decoder */ + if (avctx->channel_layout && + av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels) { + av_log(avctx, AV_LOG_WARNING, "channel layout does not match number of channels\n"); + avctx->channel_layout = 0; + } + } end: entangled_thread_counter--; |