summaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo_enc.c
diff options
context:
space:
mode:
authorPiotr Bandurski <ami_stuff@o2.pl>2012-05-13 03:31:52 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-13 19:30:32 +0200
commit6108e1be2fb97bdfa63e8f9a039b8daff3caec3d (patch)
treec659fa5709f5981f7d76c12367822a423819c967 /libavcodec/mpegvideo_enc.c
parentca297513f034198029084b4af33ac4c29ab83bce (diff)
wmvenc: check if width is multiple of 2
The width of wmv1/2 video must be multiple of 2 or win32 codec will fail to decode it (WMP displays black screen). Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r--libavcodec/mpegvideo_enc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c
index 88b177740c..631316898e 100644
--- a/libavcodec/mpegvideo_enc.c
+++ b/libavcodec/mpegvideo_enc.c
@@ -508,6 +508,14 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "MPEG-2 does not support resolutions above 16383x16383\n");
return -1;
}
+
+ if ((s->codec_id == CODEC_ID_WMV1 ||
+ s->codec_id == CODEC_ID_WMV2) &&
+ avctx->width & 1) {
+ av_log(avctx, AV_LOG_ERROR, "width must be multiple of 2\n");
+ return -1;
+ }
+
if ((s->flags & (CODEC_FLAG_INTERLACED_DCT | CODEC_FLAG_INTERLACED_ME)) &&
s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG2VIDEO) {
av_log(avctx, AV_LOG_ERROR, "interlacing not supported by codec\n");