[xiph-cvs] cvs commit: ices/src in_vorbis.c setup.c

Brendan brendan at xiph.org
Thu Jul 3 22:25:12 PDT 2003



brendan     03/07/04 01:25:12

  Modified:    conf     ices.conf.dist.in
               src      in_vorbis.c setup.c
  Log:
  Handle chained bitstreams
  Cosmetics in ices.conf.dist

Revision  Changes    Path
1.10      +4 -1      ices/conf/ices.conf.dist.in

Index: ices.conf.dist.in
===================================================================
RCS file: /cvs/ice/ices/conf/ices.conf.dist.in,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -p -u -r1.9 -r1.10
--- ices.conf.dist.in	5 Mar 2003 16:15:44 -0000	1.9
+++ ices.conf.dist.in	4 Jul 2003 05:25:12 -0000	1.10
@@ -40,7 +40,7 @@
     </Server>
 
     <!-- The name of the mountpoint on the icecast server -->
-    <Mountpoint>ices</Mountpoint>
+    <Mountpoint>/ices</Mountpoint>
     <!-- The name of the dumpfile on the server for your stream. DO NOT set
          this unless you know what you're doing.
     <Dumpfile>ices.dump</Dumpfile>
@@ -65,6 +65,9 @@
          ices will reencode the stream on the fly to the stream bitrate. -->
     <Reencode>0</Reencode>
     <!-- Number of channels to reencode to, 1 for mono or 2 for stereo -->
+    <!-- Sampe rate to reencode to in Hz. Leave out for LAME's best choice
+    <Samplerate>44100</Samplerate>
+    -->
     <Channels>2</Channels>
   </Stream>
 </ices:Configuration>

<p><p>1.10      +32 -13    ices/src/in_vorbis.c

Index: in_vorbis.c
===================================================================
RCS file: /cvs/ice/ices/src/in_vorbis.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -p -u -r1.9 -r1.10
--- in_vorbis.c	20 Jun 2003 03:28:25 -0000	1.9
+++ in_vorbis.c	4 Jul 2003 05:25:12 -0000	1.10
@@ -37,6 +37,7 @@
 typedef struct {
   OggVorbis_File* vf;
   vorbis_info* info;
+  int link;
   int16_t buf[2048];
   size_t samples;
   int offset;
@@ -46,6 +47,7 @@ typedef struct {
 static int ices_vorbis_readpcm (input_stream_t* self, size_t len,
                                 int16_t* left, int16_t* right);
 static int ices_vorbis_close (input_stream_t* self);
+static void in_vorbis_parse (input_stream_t* self);
 static void in_vorbis_set_metadata (ices_vorbis_in_t* vorbis_data);
 
 /* try to open a vorbis file for decoding. Returns:
@@ -115,18 +117,9 @@ ices_vorbis_open (input_stream_t* self, 
     return -1;
   }
 
-  self->bitrate = vorbis_data->info->bitrate_nominal / 1000;
-  if (! self->bitrate)
-    self->bitrate = ov_bitrate (vf, -1) / 1000;
-  self->samplerate = (unsigned int) vorbis_data->info->rate;
-  self->channels = vorbis_data->info->channels;
-
-  ices_log_debug("Ogg vorbis file found, version %d, %d kbps, %d channels, %ld Hz",
-                 vorbis_data->info->version, self->bitrate, vorbis_data->info->channels,
-		 self->samplerate);
-
   vorbis_data->vf = vf;
   vorbis_data->samples = 0;
+  vorbis_data->link = -1;
 
   self->type = ICES_INPUT_VORBIS;
   self->data = vorbis_data;
@@ -135,7 +128,7 @@ ices_vorbis_open (input_stream_t* self, 
   self->readpcm = ices_vorbis_readpcm;
   self->close = ices_vorbis_close;
 
-  in_vorbis_set_metadata (vorbis_data);
+  in_vorbis_parse (self);
   
   return 0;
 }
@@ -145,7 +138,7 @@ ices_vorbis_readpcm (input_stream_t* sel
                      int16_t* right)
 {
   ices_vorbis_in_t* vorbis_data = (ices_vorbis_in_t*) self->data;
-  int pos;
+  int link;
   int len;
   int i;
 
@@ -154,7 +147,7 @@ ices_vorbis_readpcm (input_stream_t* sel
     vorbis_data->offset = 0;
     do {
       if ((len = ov_read (vorbis_data->vf, (char*) vorbis_data->buf,
-			  sizeof (vorbis_data->buf), ICES_OV_BE, SAMPLESIZE, 1, &pos)) <= 0) {
+			  sizeof (vorbis_data->buf), ICES_OV_BE, SAMPLESIZE, 1, &link)) <= 0) {
         if (len == OV_HOLE) {
           ices_log_error ("Skipping bad vorbis data");
         } else
@@ -162,6 +155,16 @@ ices_vorbis_readpcm (input_stream_t* sel
       }
     } while (len <= 0);
 
+    if (vorbis_data->link == -1)
+      vorbis_data->link = link;
+    else if (vorbis_data->link != link) {
+      vorbis_data->link = link;
+      ices_log_debug("New Ogg link found in bitstream");
+      in_vorbis_parse (self);
+      ices_reencode_reset (self);
+      ices_metadata_update (0);
+    }
+
     vorbis_data->samples = len / SAMPLESIZE;
     if (vorbis_data->info->channels > 1)
       vorbis_data->samples /= vorbis_data->info->channels;
@@ -198,6 +201,22 @@ ices_vorbis_close (input_stream_t* self)
   free (vorbis_data);
 
   return 0;
+}
+
+static void in_vorbis_parse(input_stream_t* self) {
+  ices_vorbis_in_t* vorbis_data = (ices_vorbis_in_t*) self->data;
+
+  vorbis_data->info = ov_info(vorbis_data->vf, vorbis_data->link);
+  self->bitrate = vorbis_data->info->bitrate_nominal / 1000;
+  if (! self->bitrate)
+    self->bitrate = ov_bitrate (vorbis_data->vf, vorbis_data->link) / 1000;
+  self->samplerate = (unsigned int) vorbis_data->info->rate;
+  self->channels = vorbis_data->info->channels;
+
+  ices_log_debug("Ogg vorbis file found, version %d, %d kbps, %d channels, %ld Hz",
+                 vorbis_data->info->version, self->bitrate, vorbis_data->info->channels,
+		 self->samplerate);
+  in_vorbis_set_metadata (vorbis_data);
 }
 
 static void

<p><p>1.45      +3 -0      ices/src/setup.c

Index: setup.c
===================================================================
RCS file: /cvs/ice/ices/src/setup.c,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -p -u -r1.44 -r1.45
--- setup.c	19 Jun 2003 22:17:27 -0000	1.44
+++ setup.c	4 Jul 2003 05:25:12 -0000	1.45
@@ -554,6 +554,9 @@ ices_setup_version (void)
 #ifdef HAVE_LIBXML
   "libxml "
 #endif
+#ifdef HAVE_LIBVORBISFILE
+  "Vorbis "
+#endif
   "\n"
   "System configuration file: " ICES_ETCDIR "/ices.conf\n"
 #if defined (HAVE_LIBPERL) || defined (HAVE_LIBPYTHON)

<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