[xiph-commits] r9863 - experimental/derf/theora-exp/examples

tterribe at svn.xiph.org tterribe at svn.xiph.org
Tue Aug 30 11:12:48 PDT 2005


Author: tterribe
Date: 2005-08-30 11:12:46 -0700 (Tue, 30 Aug 2005)
New Revision: 9863

Modified:
   experimental/derf/theora-exp/examples/dump_video.c
Log:
Fix -r to not require an argument.


Modified: experimental/derf/theora-exp/examples/dump_video.c
===================================================================
--- experimental/derf/theora-exp/examples/dump_video.c	2005-08-30 00:30:30 UTC (rev 9862)
+++ experimental/derf/theora-exp/examples/dump_video.c	2005-08-30 18:12:46 UTC (rev 9863)
@@ -42,10 +42,11 @@
 
 
 
-const char *optstring = "or:";
+const char *optstring = "o:r";
 struct option options [] = {
   {"output",required_argument,NULL,'o'},
-  {"raw",required_argument, NULL, 'r'}, /*  Disable YUV4MPEG2 headers if set */
+  /*Disable YUV4MPEG2 headers:*/
+  {"raw",no_argument, NULL,'r'},
   {NULL,0,NULL,0}
 };
 
@@ -140,8 +141,7 @@
   /*Uncomment the following to do normal, non-striped decoding.
   theora_ycbcr_buffer ycbcr;
   theora_decode_ycbcr_out(td,ycbcr);*/
-  if(!raw)
-    fprintf(outfile, "FRAME\n");
+  if(!raw)fprintf(outfile, "FRAME\n");
 
   for(pli=0;pli<3;pli++){
     for(i=0;i<ycbcr[pli].height;i++){
@@ -196,14 +196,11 @@
         exit(1);
       }
       break;
-      
+
       case 'r':
-      if(sscanf(optarg, "%u", &raw) != 1) {
-          fprintf(stderr, "Invalid option, assuming YUV4MPEG4 output\n");
-          raw = 0;
-      }
+      raw=1;
       break;
-      
+
       default:
         usage();
     }
@@ -322,10 +319,11 @@
   /* open video */
   if(theora_p)open_video();
 
- if(!raw)
-     fprintf(outfile, "YUV4MPEG2 W%d H%d F%d:%d I%c A%d:%d\n",
-           ti.pic_width, ti.pic_height, ti.fps_numerator, ti.fps_denominator, 'p', 
-           ti.aspect_numerator, ti.aspect_denominator);
+  if(!raw){
+    fprintf(outfile, "YUV4MPEG2 W%d H%d F%d:%d I%c A%d:%d\n",
+     ti.pic_width,ti.pic_height,ti.fps_numerator,ti.fps_denominator,'p',
+     ti.aspect_numerator,ti.aspect_denominator);
+  }
 
   /* install signal handler */
   signal (SIGINT, sigint_handler);



More information about the commits mailing list