changeset 1012:9a88a1f43ea9 libavformat

Tell the user why video capture is failing
author lucabe
date Mon, 13 Mar 2006 09:47:37 +0000
parents a149521570f8
children 4abfc175a5d7
files grab.c
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/grab.c	Sun Mar 12 23:55:34 2006 +0000
+++ b/grab.c	Mon Mar 13 09:47:37 2006 +0000
@@ -68,16 +68,24 @@
     const char *video_device;
     int j;
 
-    if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0)
+    if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) {
+        av_log(s1, AV_LOG_ERROR, "Bad capture size (%dx%d) or wrong time base (%d)\n",
+            ap->width, ap->height, ap->time_base.den);
+
         return -1;
+    }
 
     width = ap->width;
     height = ap->height;
     frame_rate      = ap->time_base.den;
     frame_rate_base = ap->time_base.num;
 
-    if((unsigned)width > 32767 || (unsigned)height > 32767)
+    if((unsigned)width > 32767 || (unsigned)height > 32767) {
+        av_log(s1, AV_LOG_ERROR, "Capture size is out of range: %dx%d\n",
+            width, height);
+
         return -1;
+    }
 
     st = av_new_stream(s1, 0);
     if (!st)