[xiph-commits] r16396 - branches/theora-thusnelda/examples

tterribe at svn.xiph.org tterribe at svn.xiph.org
Sat Aug 1 18:15:33 PDT 2009


Author: tterribe
Date: 2009-08-01 18:15:32 -0700 (Sat, 01 Aug 2009)
New Revision: 16396

Modified:
   branches/theora-thusnelda/examples/encoder_example.c
Log:
Add comments elucidating the reason that buffer delay is set after two-pass
 mode is enabled.


Modified: branches/theora-thusnelda/examples/encoder_example.c
===================================================================
--- branches/theora-thusnelda/examples/encoder_example.c	2009-08-01 23:48:06 UTC (rev 16395)
+++ branches/theora-thusnelda/examples/encoder_example.c	2009-08-02 01:15:32 UTC (rev 16396)
@@ -1576,7 +1576,12 @@
       fflush(twopass_file);
     }
     if(passno==2){
-      /* enable second pass here, actual data feeding comes later */
+      /*Enable the second pass here.
+        We make this call just to set the encoder into 2-pass mode, because
+         by default enabling two-pass sets the buffer delay to the whole file
+         (because there's no way to explicitly request that behavior).
+        If we waited until we were actually encoding, it would overwite our
+         settings.*/
       if(th_encode_ctl(td,TH_ENCCTL_2PASS_IN,NULL,0)<0){
         fprintf(stderr,"Could not set up the second pass of two-pass mode.\n");
         exit(1);
@@ -1595,6 +1600,8 @@
         frames=0;
       }
     }
+    /*Now we can set the buffer delay if the user requested a non-default one
+       (this has to be done after two-pass is enabled).*/
     if(passno!=1&&buf_delay>=0){
       ret=th_encode_ctl(td,TH_ENCCTL_SET_RATE_BUFFER,
        &buf_delay,sizeof(buf_delay));



More information about the commits mailing list