diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-09-21 09:04:12 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-09-24 12:31:24 +0200 |
commit | b437cec143924eb2a7bbcbb7a7ec320d75d2edac (patch) | |
tree | b0448c9a5d700fbad687d836d8cb4794d222e02d /libavcodec | |
parent | 2bc0de385840466602341b9b151918fcf0934774 (diff) | |
download | ffmpeg-streaming-b437cec143924eb2a7bbcbb7a7ec320d75d2edac.zip ffmpeg-streaming-b437cec143924eb2a7bbcbb7a7ec320d75d2edac.tar.gz |
lavc: ensure extended_data is set properly on decoding
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/utils.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 63ea77f..c2e16c4 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1291,6 +1291,10 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi } else ret = 0; + /* many decoders assign whole AVFrames, thus overwriting extended_data; + * make sure it's set correctly */ + picture->extended_data = picture->data; + return ret; } @@ -1347,6 +1351,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, int *got_frame_ptr, AVPacket *avpkt) { + int planar, channels; int ret = 0; *got_frame_ptr = 0; @@ -1369,6 +1374,15 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, frame->format = avctx->sample_fmt; } } + + /* many decoders assign whole AVFrames, thus overwriting extended_data; + * make sure it's set correctly; assume decoders that actually use + * extended_data are doing it correctly */ + planar = av_sample_fmt_is_planar(frame->format); + channels = av_get_channel_layout_nb_channels(frame->channel_layout); + if (!(planar && channels > AV_NUM_DATA_POINTERS)) + frame->extended_data = frame->data; + return ret; } |