aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-07-13 16:18:06 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-07-13 16:23:31 +0200
commit4cdb42b428ef425aceeee548af1ee1a8798a02a2 (patch)
treecd767301f2e6467d5af4efba02f751ed47c3fe69
parent786b0968dd2969bc6319ead96ed44e856198c704 (diff)
downloadffmpeg-4cdb42b428ef425aceeee548af1ee1a8798a02a2.tar.gz
avcodec/012v: improve stride selection
Fixes decoding some files Fixes Ticket2126 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavcodec/012v.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/012v.c b/libavcodec/012v.c
index 58e3cd6fbd..f694769089 100644
--- a/libavcodec/012v.c
+++ b/libavcodec/012v.c
@@ -49,6 +49,12 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data,
av_log(avctx, AV_LOG_ERROR, "Width 1 not supported.\n");
return AVERROR_INVALIDDATA;
}
+
+ if ( avctx->codec_tag == MKTAG('0', '1', '2', 'v')
+ && avpkt->size % avctx->height == 0
+ && avpkt->size / avctx->height * 3 >= width * 8)
+ stride = avpkt->size / avctx->height;
+
if (avpkt->size < avctx->height * stride) {
av_log(avctx, AV_LOG_ERROR, "Packet too small: %d instead of %d\n",
avpkt->size, avctx->height * stride);