[xiph-cvs] cvs commit: ices/src audio.c encode.c stream.c stream_shared.c

Michael Smith msmith at xiph.org
Fri Aug 16 22:17:57 PDT 2002



msmith      02/08/17 01:17:57

  Modified:    src      audio.c encode.c stream.c stream_shared.c
  Log:
  Resampling should now work on live encode in combination with downmixing.

Revision  Changes    Path
1.5       +7 -2      ices/src/audio.c

Index: audio.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/audio.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- audio.c	11 Aug 2002 21:47:03 -0000	1.4
+++ audio.c	17 Aug 2002 05:17:57 -0000	1.5
@@ -2,7 +2,7 @@
  * stereo->mono downmixing
  * resampling
  *
- * $Id: audio.c,v 1.4 2002/08/11 21:47:03 msmith Exp $
+ * $Id: audio.c,v 1.5 2002/08/17 05:17:57 msmith Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -180,7 +180,12 @@
 
 void resample_finish(resample_state *s)
 {
-    int ret = res_drain(&s->resampler, s->buffers);
+    int ret;
+
+    if(!s->buffers[0])
+        return;
+
+    ret = res_drain(&s->resampler, s->buffers);
 
     if(ret > s->bufsize) {
         LOG_ERROR0("Fatal error in resampler: buffers too small");

<p><p>1.12      +1 -7      ices/src/encode.c

Index: encode.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/encode.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- encode.c	9 Aug 2002 04:20:27 -0000	1.11
+++ encode.c	17 Aug 2002 05:17:57 -0000	1.12
@@ -1,7 +1,7 @@
 /* encode.c
  * - runtime encoding of PCM data.
  *
- * $Id: encode.c,v 1.11 2002/08/09 04:20:27 msmith Exp $
+ * $Id: encode.c,v 1.12 2002/08/17 05:17:57 msmith Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -258,12 +258,6 @@
 int encode_flush(encoder_state *s, ogg_page *og)
 {
         int result = ogg_stream_pageout(&s->os, og);
-
-	if(s->in_header)
-	{
-		LOG_ERROR0("Unhandled case: flushing stream before headers have been "
-				  "output. Behaviour may be unpredictable.");
-	}
 
         if(result<=0)
                 return 0;

<p><p>1.22      +3 -3      ices/src/stream.c

Index: stream.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/stream.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- stream.c	16 Aug 2002 15:47:36 -0000	1.21
+++ stream.c	17 Aug 2002 05:17:57 -0000	1.22
@@ -1,7 +1,7 @@
 /* stream.c
  * - Core streaming functions/main loop.
  *
- * $Id: stream.c,v 1.21 2002/08/16 15:47:36 msmith Exp $
+ * $Id: stream.c,v 1.22 2002/08/17 05:17:57 msmith Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -156,13 +156,13 @@
                         return NULL;
                 }
 
-    /* FIXME: For now, only on encoding, not reencoding */
-    if(stream->downmix && encoding && stream->channels == 2) {
+    if(stream->downmix && encoding && stream->channels == 1) {
         stream->channels = 1;
         sdsc->downmix = downmix_initialise();
     }
 
     if(stream->resampleinrate && stream->resampleoutrate && encoding) {
+        stream->samplerate = stream->resampleoutrate;
         sdsc->resamp = resample_initialise(stream->channels, 
                 stream->resampleinrate, stream->resampleoutrate);
     }

<p><p>1.12      +5 -5      ices/src/stream_shared.c

Index: stream_shared.c
===================================================================
RCS file: /usr/local/cvsroot/ices/src/stream_shared.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- stream_shared.c	13 Aug 2002 14:03:20 -0000	1.11
+++ stream_shared.c	17 Aug 2002 05:17:57 -0000	1.12
@@ -1,7 +1,7 @@
 /* stream_shared.c
  * - Stream utility functions.
  *
- * $Id: stream_shared.c,v 1.11 2002/08/13 14:03:20 msmith Exp $
+ * $Id: stream_shared.c,v 1.12 2002/08/17 05:17:57 msmith Exp $
  *
  * Copyright (c) 2001 Michael Smith <msmith at labyrinth.net.au>
  *
@@ -186,10 +186,10 @@
                        buffer->len/4);
         }
         else if(sdsc->resamp) {
-                resample_buffer(sdsc->resamp, (signed char *)buffer->buf, 
-                        buffer->len, be);
-                encode_data_float(sdsc->enc, sdsc->resamp->buffers,
-                        sdsc->resamp->buffill);
+            resample_buffer(sdsc->resamp, (signed char *)buffer->buf, 
+                    buffer->len, be);
+            encode_data_float(sdsc->enc, sdsc->resamp->buffers,
+                    sdsc->resamp->buffill);
         }
         else {
                     encode_data(sdsc->enc, (signed char *)(buffer->buf), 

<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