[xiph-commits] r15355 - trunk/theora/lib/enc

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Tue Sep 30 00:04:09 PDT 2008


Author: xiphmont
Date: 2008-09-30 00:04:09 -0700 (Tue, 30 Sep 2008)
New Revision: 15355

Modified:
   trunk/theora/lib/enc/encoder_toplevel.c
Log:
Implement TH_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE ctl in encoder.  Tested.

Note that this call has some bitrate engine side effects as the frame
size metrics don't expect it to change.  The current encoder is
proofed against faults from using the ctl, but it's probably best not
leaned on heavily until Thusnelda.



Modified: trunk/theora/lib/enc/encoder_toplevel.c
===================================================================
--- trunk/theora/lib/enc/encoder_toplevel.c	2008-09-30 04:47:37 UTC (rev 15354)
+++ trunk/theora/lib/enc/encoder_toplevel.c	2008-09-30 07:04:09 UTC (rev 15355)
@@ -1367,6 +1367,20 @@
   pbi = &cpi->pb;
 
   switch(req) {
+    case TH_ENCCTL_SET_KEYFRAME_FREQUENCY_FORCE:
+      {
+	ogg_uint32_t keyframe_frequency_force;
+	if( (buf==NULL) || (buf_sz!=sizeof(ogg_uint32_t))) return TH_EINVAL;
+	keyframe_frequency_force=*(ogg_uint32_t *)buf;
+	
+	keyframe_frequency_force=
+	  OC_MINI(keyframe_frequency_force,
+		  1U<<cpi->pb.keyframe_granule_shift);
+	cpi->pb.info.keyframe_frequency_force=
+	  OC_MAXI(1,keyframe_frequency_force);
+	*(ogg_uint32_t *)buf=cpi->pb.info.keyframe_frequency_force;
+	return 0;
+      }
     case TH_ENCCTL_SET_QUANT_PARAMS:
       if( ( buf==NULL&&buf_sz!=0 )
            || ( buf!=NULL&&buf_sz!=sizeof(th_quant_info) )



More information about the commits mailing list