shithub: libvpx

Download patch

ref: 5329189a331c6bfc8e8350f4706a5ff9add63147
parent: 933d44b8180f8552fafcbc6563c009dae1ba1626
author: John Koleszar <jkoleszar@google.com>
date: Fri Oct 22 10:48:21 EDT 2010

vpxenc: specify output file with -o

Requiring the output file to be specified with the -o option opens up
the possibility of supporting multiple input files in the future.

Change-Id: I14c9b75e9b21184b47081e1ccf30cf4c91315964

--- a/vpxenc.c
+++ b/vpxenc.c
@@ -740,6 +740,8 @@
 
 #include "args.h"
 
+static const arg_def_t outputfile = ARG_DEF("o", "output", 1,
+        "Output filename");
 static const arg_def_t use_yv12 = ARG_DEF(NULL, "yv12", 0,
                                   "Input file is YV12 ");
 static const arg_def_t use_i420 = ARG_DEF(NULL, "i420", 0,
@@ -772,7 +774,8 @@
         "Output IVF (default is WebM)");
 static const arg_def_t *main_args[] =
 {
-    &codecarg, &passes, &pass_arg, &fpf_name, &limit, &deadline, &best_dl, &good_dl, &rt_dl,
+    &outputfile, &codecarg, &passes, &pass_arg, &fpf_name, &limit, &deadline,
+    &best_dl, &good_dl, &rt_dl,
     &verbosearg, &psnrarg, &use_ivf, &framerate,
     NULL
 };
@@ -907,7 +910,8 @@
 {
     int i;
 
-    fprintf(stderr, "Usage: %s <options> src_filename dst_filename\n", exec_name);
+    fprintf(stderr, "Usage: %s <options> -o dst_filename src_filename \n",
+            exec_name);
 
     fprintf(stderr, "\nOptions:\n");
     arg_show_usage(stdout, main_args);
@@ -1046,6 +1050,8 @@
         }
         else if (arg_match(&arg, &use_ivf, argi))
             write_webm = 0;
+        else if (arg_match(&arg, &outputfile, argi))
+            out_fn = arg.val;
         else
             argj++;
     }
@@ -1210,10 +1216,12 @@
 
     /* Handle non-option arguments */
     in_fn = argv[0];
-    out_fn = argv[1];
 
-    if (!in_fn || !out_fn)
+    if (!in_fn)
         usage_exit();
+
+    if(!out_fn)
+        die("Error: Output file is required (specify with -o)\n");
 
     memset(&stats, 0, sizeof(stats));