[xiph-commits] r14515 - trunk/vorbis-tools/oggenc

ivo at svn.xiph.org ivo at svn.xiph.org
Thu Feb 14 20:57:36 PST 2008


Author: ivo
Date: 2008-02-14 20:57:33 -0800 (Thu, 14 Feb 2008)
New Revision: 14515

Modified:
   trunk/vorbis-tools/oggenc/encode.c
Log:
Patch with basic ifdefs to make sure it compiles even when a pre-1.1.1 libvorbis is installed.

Modified: trunk/vorbis-tools/oggenc/encode.c
===================================================================
--- trunk/vorbis-tools/oggenc/encode.c	2008-02-15 04:56:21 UTC (rev 14514)
+++ trunk/vorbis-tools/oggenc/encode.c	2008-02-15 04:57:33 UTC (rev 14515)
@@ -51,6 +51,7 @@
 static void set_advanced_encoder_options(adv_opt *opts, int count,
         vorbis_info *vi)
 {
+#ifdef OV_ECTL_RATEMANAGE2_GET
     int manage = 0;
     struct ovectl_ratemanage2_arg ai;
     int i;
@@ -107,9 +108,12 @@
 
     if(manage) {
         if(vorbis_encode_ctl(vi, OV_ECTL_RATEMANAGE2_SET, &ai)) {
-            fprintf(stderr, "Failed to set advanced rate management parameters\n");
+            fprintf(stderr, _("Failed to set advanced rate management parameters\n"));
         }
     }
+#else
+    fprintf(stderr,_( "This version of libvorbisenc cannot set advanced rate management parameters\n"));
+#endif
 }
 
 void add_fishead_packet (ogg_stream_state *os) {
@@ -200,6 +204,7 @@
 
         /* do we have optional hard bitrate restrictions? */
         if(opt->max_bitrate > 0 || opt->min_bitrate > 0){
+#ifdef OV_ECTL_RATEMANAGE2_GET
             long bitrate;
             struct ovectl_ratemanage2_arg ai;
 
@@ -243,6 +248,10 @@
                 vorbis_info_clear(&vi);
                 return 1;
             }
+#else
+            fprintf(stderr, _("This version of libvorbisenc cannot set advanced rate management parameters\n"));
+            return 1;
+#endif
         }
 
 
@@ -257,6 +266,7 @@
         }
     }
 
+#ifdef OV_ECTL_RATEMANAGE2_SET
     if(opt->managed && opt->bitrate < 0)
     {
       struct ovectl_ratemanage2_arg ai;
@@ -269,6 +279,7 @@
         /* Turn off management entirely (if it was turned on). */
         vorbis_encode_ctl(&vi, OV_ECTL_RATEMANAGE2_SET, NULL);
     }
+#endif
 
     set_advanced_encoder_options(opt->advopt, opt->advopt_count, &vi);
 



More information about the commits mailing list