]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/blobdiff - libavdevice/v4l.c
frsh: Print error messages
[frescor/ffmpeg.git] / libavdevice / v4l.c
index 4a5328ade49db3242bfbde4ee7ef8cad581d4769..3382cdb0ae0da179aa640ee79b19bdee93285045 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Linux video grab interface
- * Copyright (c) 2000,2001 Fabrice Bellard.
+ * Copyright (c) 2000,2001 Fabrice Bellard
  *
  * This file is part of FFmpeg.
  *
@@ -84,11 +84,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
     }
     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(AVFormatContext *s1, AVFormatParameters *ap)
         }
     }
 
+    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++) {
@@ -181,7 +179,10 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
         s->video_win.chromakey = -1;
         s->video_win.flags = 0;
 
-        ioctl(video_fd, VIDIOCSWIN, s->video_win);
+        if (ioctl(video_fd, VIDIOCSWIN, s->video_win) < 0) {
+            av_log(s1, AV_LOG_ERROR, "VIDIOCSWIN: %s\n", strerror(errno));
+            goto fail;
+        }
 
         s->frame_format = pict.palette;
 
@@ -214,7 +215,7 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
         if (ioctl(video_fd, VIDIOCMCAPTURE, &s->gb_buf) < 0) {
             if (errno != EAGAIN) {
             fail1:
-                av_log(s1, AV_LOG_ERROR, "Fatal: grab device does not support suitable format\n");
+                av_log(s1, AV_LOG_ERROR, "VIDIOCMCAPTURE: %s\n", strerror(errno));
             } else {
                 av_log(s1, AV_LOG_ERROR, "Fatal: grab device does not receive any video signal\n");
             }
@@ -339,7 +340,7 @@ static int grab_read_close(AVFormatContext *s1)
 
 AVInputFormat v4l_demuxer = {
     "video4linux",
-    NULL_IF_CONFIG_SMALL("video grab"),
+    NULL_IF_CONFIG_SMALL("Video4Linux device grab"),
     sizeof(VideoData),
     NULL,
     grab_read_header,