vpxenc: require width and height for raw streams
authorJohn Koleszar <jkoleszar@google.com>
Wed, 3 Nov 2010 17:58:40 +0000 (13:58 -0400)
committerJohn Koleszar <jkoleszar@google.com>
Wed, 3 Nov 2010 17:58:44 +0000 (13:58 -0400)
Defaulting to 320x240 for raw streams is arbitrary and error-prone.
Instead, require that the width and height be set manually if they
can't be parsed from the input file.

Change-Id: Ic61979857e372eed0779c2677247e894f9fd6160

vpxenc.c

index 4cdadb6..45ec7e5 100644 (file)
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -1190,6 +1190,12 @@ int main(int argc, const char **argv_)
      */
     cfg.g_timebase.den = 1000;
 
+    /* Never use the library's default resolution, require it be parsed
+     * from the file or set on the command line.
+     */
+    cfg.g_w = 0;
+    cfg.g_h = 0;
+
     /* Now parse the remainder of the parameters. */
     for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step)
     {
@@ -1399,6 +1405,14 @@ int main(int argc, const char **argv_)
             file_type = FILE_TYPE_RAW;
             detect.valid = 1;
         }
+
+        if(!cfg.g_w || !cfg.g_h)
+        {
+            fprintf(stderr, "Specify stream dimensions with --width (-w) "
+                            " and --height (-h).\n");
+            return EXIT_FAILURE;
+        }
+
 #define SHOW(field) fprintf(stderr, "    %-28s = %d\n", #field, cfg.field)
 
         if (verbose && pass == 0)