[FFmpeg-cvslog] r16370 - in trunk/libavdevice: v4l.c v4l2.c

stefano subversion
Sun Dec 28 15:41:19 CET 2008


Author: stefano
Date: Sun Dec 28 15:41:19 2008
New Revision: 16370

Log:
Use avcodec_check_dimensions() for checking the frame size validity.
The v4l.c check is moved after the eventual automatic size detection,
so the check in that case is performed on the new set values.

Modified:
   trunk/libavdevice/v4l.c
   trunk/libavdevice/v4l2.c

Modified: trunk/libavdevice/v4l.c
==============================================================================
--- trunk/libavdevice/v4l.c	Sun Dec 28 06:59:11 2008	(r16369)
+++ trunk/libavdevice/v4l.c	Sun Dec 28 15:41:19 2008	(r16370)
@@ -84,11 +84,6 @@ static int grab_read_header(AVFormatCont
     }
     s->time_base = ap->time_base;
 
-    if((unsigned)ap->width > 32767 || (unsigned)ap->height > 32767) {
-        av_log(s1, AV_LOG_ERROR, "Capture size is out of range: %dx%d\n",
-            ap->width, ap->height);
-        return -1;
-    }
     s->video_win.width = ap->width;
     s->video_win.height = ap->height;
 
@@ -121,6 +116,9 @@ static int grab_read_header(AVFormatCont
         }
     }
 
+    if(avcodec_check_dimensions(s1, s->video_win.width, s->video_win.height) < 0)
+        return -1;
+
     desired_palette = -1;
     desired_depth = -1;
     for (j = 0; j < vformat_num; j++) {

Modified: trunk/libavdevice/v4l2.c
==============================================================================
--- trunk/libavdevice/v4l2.c	Sun Dec 28 06:59:11 2008	(r16369)
+++ trunk/libavdevice/v4l2.c	Sun Dec 28 15:41:19 2008	(r16370)
@@ -526,11 +526,8 @@ static int v4l2_read_header(AVFormatCont
     frame_rate = ap->time_base.den;
     frame_rate_base = ap->time_base.num;
 
-    if((unsigned)width > 32767 || (unsigned)height > 32767) {
-        av_log(s1, AV_LOG_ERROR, "Wrong size (%dx%d)\n", width, height);
-
+    if(avcodec_check_dimensions(s1, ap->width, ap->height) < 0)
         return -1;
-    }
 
     st = av_new_stream(s1, 0);
     if (!st) {




More information about the ffmpeg-cvslog mailing list