]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
throw error if unsupported resolution is used with h261
authorbcoudurier <bcoudurier@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 16 Nov 2006 09:58:34 +0000 (09:58 +0000)
committerbcoudurier <bcoudurier@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Thu, 16 Nov 2006 09:58:34 +0000 (09:58 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@7097 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavcodec/h261.c
libavcodec/mpegvideo.c
libavcodec/mpegvideo.h

index b21d324c9c8cd05b2cc0449cf6517d6e524a78ad..8d4ca08cd42f165050a97d883868b4bfc6d2b75a 100644 (file)
@@ -77,7 +77,7 @@ void ff_h261_loop_filter(MpegEncContext *s){
     s->dsp.h261_loop_filter(dest_cr, uvlinesize);
 }
 
-static int ff_h261_get_picture_format(int width, int height){
+int ff_h261_get_picture_format(int width, int height){
     // QCIF
     if (width == 176 && height == 144)
         return 0;
index fda536c06896ed660aec04cdb89379e01dc5122d..2fac26d5ebcc87ff1fc6e4ab86dfd3888478d749 100644 (file)
@@ -1208,6 +1208,10 @@ int MPV_encode_init(AVCodecContext *avctx)
         s->low_delay=1;
         break;
     case CODEC_ID_H261:
+        if (ff_h261_get_picture_format(s->width, s->height) < 0) {
+            av_log(avctx, AV_LOG_ERROR, "The specified picture size of %dx%d is not valid for the H.261 codec.\nValid sizes are 176x144, 352x288\n", s->width, s->height);
+            return -1;
+        }
         s->out_format = FMT_H261;
         avctx->delay=0;
         s->low_delay=1;
index fe53311116389d5d0b24071d403390ba0b61f56a..011678a42d506c7be92e6f3851b290e1cfdf6a1c 100644 (file)
@@ -824,6 +824,7 @@ void ff_h261_encode_mb(MpegEncContext *s,
                     int motion_x, int motion_y);
 void ff_h261_encode_picture_header(MpegEncContext * s, int picture_number);
 void ff_h261_encode_init(MpegEncContext *s);
+int ff_h261_get_picture_format(int width, int height);
 
 
 /* h263.c, h263dec.c */