gst-libs/gst/audio/gstbaseaudiosink.c: Add some more info in a WARNING.
authorWim Taymans <wim.taymans@gmail.com>
Wed, 27 Sep 2006 13:52:14 +0000 (13:52 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Wed, 27 Sep 2006 13:52:14 +0000 (13:52 +0000)
Original commit message from CVS:
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render):
Add some more info in a WARNING.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_create):
Handle PAUSE in create function, use new -core addition to
wait for playing. Fixes pausing and resuming capture from an
audiosrc.
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_commit),
(gst_ring_buffer_read):
Constify some more.
Caller supports interrupted reads now.

ChangeLog
gst-libs/gst/audio/gstbaseaudiosink.c
gst-libs/gst/audio/gstbaseaudiosrc.c
gst-libs/gst/audio/gstringbuffer.c

index 9b1ac58..9284616 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2006-09-27  Wim Taymans  <wim@fluendo.com>
+
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+       (gst_base_audio_sink_render):
+       Add some more info in a WARNING.
+
+       * gst-libs/gst/audio/gstbaseaudiosrc.c:
+       (gst_base_audio_src_create):
+       Handle PAUSE in create function, use new -core addition to
+       wait for playing. Fixes pausing and resuming capture from an
+       audiosrc.
+
+       * gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_commit),
+       (gst_ring_buffer_read):
+       Constify some more.
+       Caller supports interrupted reads now.
+
 2006-09-27  Tim-Philipp Müller  <tim at centricular dot net>
 
        * tests/check/Makefile.am:
index d7de64d..ed7dd55 100644 (file)
@@ -649,6 +649,7 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
   }
 
 no_align:
+  /* crate contains diff against the clock we are using in the pipeline. */
   crate =
       gst_guint64_to_gdouble (crate_num) / gst_guint64_to_gdouble (crate_denom);
   GST_DEBUG_OBJECT (sink,
index 6f6410e..7cc750c 100644 (file)
@@ -449,10 +449,10 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
   GstBuffer *buf;
   guchar *data;
   guint samples;
-  guint res;
   guint64 sample;
   gint bps;
   GstRingBuffer *ringbuffer;
+  guint read;
 
   ringbuffer = src->ringbuffer;
 
@@ -488,10 +488,22 @@ gst_base_audio_src_create (GstBaseSrc * bsrc, guint64 offset, guint length,
   buf = gst_buffer_new_and_alloc (length);
   data = GST_BUFFER_DATA (buf);
 
-  /* read the sample */
-  res = gst_ring_buffer_read (ringbuffer, sample, data, samples);
-  if (G_UNLIKELY (res == -1))
-    goto stopped;
+  do {
+    read = gst_ring_buffer_read (ringbuffer, sample, data, samples);
+    GST_DEBUG_OBJECT (src, "read %u of %u", read, samples);
+    /* if we read all, we're done */
+    if (read == samples)
+      break;
+
+    /* else something interrupted us and we wait for playing again. */
+    if (gst_base_src_wait_playing (bsrc) != GST_FLOW_OK)
+      goto stopped;
+
+    /* read next samples */
+    sample += read;
+    samples -= read;
+    data += read * bps;
+  } while (TRUE);
 
   /* mark discontinuity if needed */
   if (G_UNLIKELY (sample != src->next_sample) && src->next_sample != -1) {
index ea20c3a..fb2c799 100644 (file)
@@ -134,8 +134,8 @@ gst_ring_buffer_finalize (GObject * object)
 
 typedef struct
 {
-  GstBufferFormat format;
-  guint8 silence[4];
+  const GstBufferFormat format;
+  const guint8 silence[4];
 } FormatDef;
 
 static const FormatDef linear_defs[4 * 2 * 2] = {
@@ -1387,8 +1387,7 @@ gst_ring_buffer_read (GstRingBuffer * buf, guint64 sample, guchar * data,
 not_started:
   {
     GST_DEBUG_OBJECT (buf, "stopped processing");
-    /* FIXME, return len - to_read after fixing caller */
-    return -1;
+    return len - to_read;
   }
 }