[FFmpeg-cvslog] tests: allow passing dimensions to videogen

Christophe Gisquet git at videolan.org
Thu May 29 21:44:05 CEST 2014


ffmpeg | branch: master | Christophe Gisquet <christophe.gisquet at gmail.com> | Thu May 29 18:48:39 2014 +0200| [bf7e9cc82a8482ae2811bfb86408026967acecdb] | committer: Michael Niedermayer

tests: allow passing dimensions to videogen

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bf7e9cc82a8482ae2811bfb86408026967acecdb
---

 tests/videogen.c |   22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/tests/videogen.c b/tests/videogen.c
index 94e6e77..91da8b5 100644
--- a/tests/videogen.c
+++ b/tests/videogen.c
@@ -141,23 +141,37 @@ static void gen_image(int num, int w, int h)
     }
 }
 
+void print_help(const char* name)
+{
+    printf("usage: %s file|dir [w=%i] [h=%i]\n"
+            "generate a test video stream\n",
+            name, DEFAULT_WIDTH, DEFAULT_HEIGHT);
+    exit(1);
+}
+
 int main(int argc, char **argv)
 {
     int w, h, i;
     char buf[1024];
     int isdir = 0;
 
-    if (argc != 2) {
-        printf("usage: %s file|dir\n"
-               "generate a test video stream\n", argv[0]);
-        exit(1);
+    if (argc < 2 || argc > 4) {
+        print_help(argv[0]);
     }
 
     if (!freopen(argv[1], "wb", stdout))
         isdir = 1;
 
     w = DEFAULT_WIDTH;
+    if(argc > 2) {
+        w = atoi(argv[2]);
+        if (w < 1) print_help(argv[0]);
+    }
     h = DEFAULT_HEIGHT;
+    if(argc > 3) {
+        h = atoi(argv[3]);
+        if (h < 1) print_help(argv[0]);
+    }
 
     rgb_tab = malloc(w * h * 3);
     wrap    = w * 3;



More information about the ffmpeg-cvslog mailing list