[xiph-cvs] cvs commit: ices/src encode.c config.c

Michael Smith msmith at xiph.org
Fri Jul 5 00:55:03 PDT 2002



msmith      02/07/05 00:55:03

  Modified:    src      encode.c config.c
  Log:
  More encode options (e.g. bitrate selection without using management.)

Revision  Changes    Path
1.8       +12 -5     ices/src/encode.c

Index: encode.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/encode.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- encode.c	2002/07/05 07:40:47	1.7
+++ encode.c	2002/07/05 07:55:02	1.8
@@ -1,7 +1,7 @@
 /* encode.c
  * - runtime encoding of PCM data.
  *
- * $Id: encode.c,v 1.7 2002/07/05 07:40:47 msmith Exp $
+ * $Id: encode.c,v 1.8 2002/07/05 07:55:02 msmith Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -55,10 +55,18 @@
 
         vorbis_info_init(&s->vi);
 
-    if(managed)
-	    vorbis_encode_init(&s->vi, channels, rate, max_br, nom_br, min_br);
+    if(min_br < 0 && max_br < 0 && nom_br < 0)
+        vorbis_encode_setup_vbr(&s->vi, channels, rate, quality*0.1);
     else
-        vorbis_encode_init_vbr(&s->vi, channels, rate, quality*0.1);
+        vorbis_encode_setup_managed(&s->vi, channels, rate, max_br, nom_br, 
+                min_br);
+
+    if(managed && nom_br < 0)
+        vorbis_encode_ctl(&s->vi, OV_ECTL_RATEMANAGE_AVG, NULL);
+    else if(!managed)
+        vorbis_encode_ctl(&s->vi, OV_ECTL_RATEMANAGE_SET, NULL);
+    
+    vorbis_encode_setup_init(&s->vi);
 
         vorbis_analysis_init(&s->vd, &s->vi);
         vorbis_block_init(&s->vd, &s->vb);
@@ -197,7 +205,6 @@
 
 void encode_finish(encoder_state *s)
 {
-    int ret;
         ogg_packet op;
         vorbis_analysis_wrote(&s->vd, 0);
 

<p><p>1.8       +3 -5      ices/src/config.c

Index: config.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/config.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- config.c	2002/07/04 03:49:35	1.7
+++ config.c	2002/07/05 07:55:02	1.8
@@ -1,7 +1,7 @@
 /* config.c
  * - config file reading code, plus default settings.
  *
- * $Id: config.c,v 1.7 2002/07/04 03:49:35 msmith Exp $
+ * $Id: config.c,v 1.8 2002/07/05 07:55:02 msmith Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -155,12 +155,10 @@
                         SET_INT(instance->samplerate);
                 else if (strcmp(node->name, "channels") == 0)
                         SET_INT(instance->channels);
+        else if (strcmp(node->name, "managed") == 0)
+            SET_INT(instance->managed);
         } while ((node = node->next));
 
-    if(instance->nom_br > 0 || instance->min_br > 0 || instance->max_br > 0)
-        instance->managed = 1;
-    else
-        instance->managed = 0;
 }
 
 

<p><p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list