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

tterribe at motherfish-iii.xiph.org tterribe at motherfish-iii.xiph.org
Tue Apr 26 09:55:49 PDT 2005


Author: tterribe
Date: 2005-04-26 09:55:47 -0700 (Tue, 26 Apr 2005)
New Revision: 9188

Modified:
   experimental/derf/theora-exp/examples/encoder_example.c
Log:
Add command-line switch to the encoder to enable VP3 compatibility.


Modified: experimental/derf/theora-exp/examples/encoder_example.c
===================================================================
--- experimental/derf/theora-exp/examples/encoder_example.c	2005-04-26 16:32:54 UTC (rev 9187)
+++ experimental/derf/theora-exp/examples/encoder_example.c	2005-04-26 16:55:47 UTC (rev 9188)
@@ -49,7 +49,7 @@
 }
 #endif
 
-const char *optstring = "o:a:A:v:V:s:S:f:F:";
+const char *optstring = "o:a:A:v:V:s:S:f:F:c";
 struct option options [] = {
   {"output",required_argument,NULL,'o'},
   {"audio-rate-target",required_argument,NULL,'A'},
@@ -60,6 +60,7 @@
   {"aspect-denominator",optional_argument,NULL,'S'},
   {"framerate-numerator",optional_argument,NULL,'f'},
   {"framerate-denominator",optional_argument,NULL,'F'},
+  {"vp3-compatible",0,NULL,'c'},
   {NULL,0,NULL,0}
 };
 
@@ -73,6 +74,7 @@
 
 float audio_q=.1F;
 int audio_r=-1;
+int vp3_compatible=0;
 
 int frame_w=0;
 int frame_h=0;
@@ -1152,6 +1154,10 @@
       video_fps_d=(int)rint(atof(optarg));
       break;
 
+    case 'c':
+      vp3_compatible=1;
+      break;
+
     default:
       usage();
     }
@@ -1207,6 +1213,19 @@
   td=theora_encode_alloc(&ti);
   theora_info_clear(&ti);
 
+  if(vp3_compatible){
+    ret=theora_encode_ctl(td,OC_ENCCTL_SET_VP3_COMPATIBLE,&vp3_compatible,
+     sizeof(vp3_compatible));
+    if(ret<0||!vp3_compatible){
+      fprintf(stderr,"Could not enable strict VP3 compatibility.\n");
+      if(ret>=0){
+        fprintf(stderr,"Ensure your source format is supported by VP3.\n");
+        fprintf(stderr,
+         "(4:2:0 pixel format, width and height multiples of 16).\n");
+      }
+    }
+  }
+
   /* initialize Vorbis too, assuming we have audio to compress. */
   if(audio){
     vorbis_info_init(&vi);



More information about the commits mailing list