update for ringbuffer change

This commit is contained in:
Wim Taymans 2011-11-11 11:24:00 +01:00
parent 3a1acca583
commit 1ad11e307a
8 changed files with 109 additions and 105 deletions

View file

@ -21,7 +21,7 @@
/**
* SECTION:element-jackaudiosink
* @see_also: #GstBaseAudioSink, #GstRingBuffer
* @see_also: #GstBaseAudioSink, #GstAudioRingBuffer
*
* A Sink that outputs data to Jack ports.
*
@ -147,7 +147,7 @@ gst_jack_ring_buffer_get_type (void)
(GInstanceInitFunc) gst_jack_ring_buffer_init,
NULL
};
GType tmp = g_type_register_static (GST_TYPE_RING_BUFFER,
GType tmp = g_type_register_static (GST_TYPE_AUDIO_RING_BUFFER,
"GstJackAudioSinkRingBuffer", &ringbuffer_info, 0);
g_once_init_leave (&ringbuffer_type, tmp);
}
@ -158,9 +158,9 @@ gst_jack_ring_buffer_get_type (void)
static void
gst_jack_ring_buffer_class_init (GstJackRingBufferClass * klass)
{
GstRingBufferClass *gstringbuffer_class;
GstAudioRingBufferClass *gstringbuffer_class;
gstringbuffer_class = (GstRingBufferClass *) klass;
gstringbuffer_class = (GstAudioRingBufferClass *) klass;
ring_parent_class = g_type_class_peek_parent (klass);
@ -186,13 +186,13 @@ static int
jack_process_cb (jack_nframes_t nframes, void *arg)
{
GstJackAudioSink *sink;
GstRingBuffer *buf;
GstAudioRingBuffer *buf;
gint readseg, len;
guint8 *readptr;
gint i, j, flen, channels;
sample_t *data;
buf = GST_RING_BUFFER_CAST (arg);
buf = GST_AUDIO_RING_BUFFER_CAST (arg);
sink = GST_JACK_AUDIO_SINK (GST_OBJECT_PARENT (buf));
channels = GST_AUDIO_INFO_CHANNELS (&buf->spec.info);
@ -203,7 +203,7 @@ jack_process_cb (jack_nframes_t nframes, void *arg)
(sample_t *) jack_port_get_buffer (sink->ports[i], nframes);
}
if (gst_ring_buffer_prepare_read (buf, &readseg, &readptr, &len)) {
if (gst_audio_ring_buffer_prepare_read (buf, &readseg, &readptr, &len)) {
flen = len / channels;
/* the number of samples must be exactly the segment size */
@ -223,10 +223,10 @@ jack_process_cb (jack_nframes_t nframes, void *arg)
}
/* clear written samples in the ringbuffer */
gst_ring_buffer_clear (buf, readseg);
gst_audio_ring_buffer_clear (buf, readseg);
/* we wrote one segment */
gst_ring_buffer_advance (buf, 1);
gst_audio_ring_buffer_advance (buf, 1);
} else {
GST_DEBUG_OBJECT (sink, "write %d frames silence", nframes);
/* We are not allowed to read from the ringbuffer, write silence to all
@ -319,7 +319,7 @@ gst_jack_ring_buffer_init (GstJackRingBuffer * buf,
/* the _open_device method should make a connection with the server
*/
static gboolean
gst_jack_ring_buffer_open_device (GstRingBuffer * buf)
gst_jack_ring_buffer_open_device (GstAudioRingBuffer * buf)
{
GstJackAudioSink *sink;
jack_status_t status = 0;
@ -363,7 +363,7 @@ could_not_open:
/* close the connection with the server
*/
static gboolean
gst_jack_ring_buffer_close_device (GstRingBuffer * buf)
gst_jack_ring_buffer_close_device (GstAudioRingBuffer * buf)
{
GstJackAudioSink *sink;
@ -390,7 +390,8 @@ gst_jack_ring_buffer_close_device (GstRingBuffer * buf)
* received for some reason, we fail here.
*/
static gboolean
gst_jack_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
gst_jack_ring_buffer_acquire (GstAudioRingBuffer * buf,
GstAudioRingBufferSpec * spec)
{
GstJackAudioSink *sink;
GstJackRingBuffer *abuf;
@ -521,7 +522,7 @@ cannot_connect:
/* function is called with LOCK */
static gboolean
gst_jack_ring_buffer_release (GstRingBuffer * buf)
gst_jack_ring_buffer_release (GstAudioRingBuffer * buf)
{
GstJackAudioSink *sink;
GstJackRingBuffer *abuf;
@ -551,7 +552,7 @@ gst_jack_ring_buffer_release (GstRingBuffer * buf)
}
static gboolean
gst_jack_ring_buffer_start (GstRingBuffer * buf)
gst_jack_ring_buffer_start (GstAudioRingBuffer * buf)
{
GstJackAudioSink *sink;
@ -563,7 +564,7 @@ gst_jack_ring_buffer_start (GstRingBuffer * buf)
}
static gboolean
gst_jack_ring_buffer_pause (GstRingBuffer * buf)
gst_jack_ring_buffer_pause (GstAudioRingBuffer * buf)
{
GstJackAudioSink *sink;
@ -575,7 +576,7 @@ gst_jack_ring_buffer_pause (GstRingBuffer * buf)
}
static gboolean
gst_jack_ring_buffer_stop (GstRingBuffer * buf)
gst_jack_ring_buffer_stop (GstAudioRingBuffer * buf)
{
GstJackAudioSink *sink;
@ -588,7 +589,7 @@ gst_jack_ring_buffer_stop (GstRingBuffer * buf)
#if defined (HAVE_JACK_0_120_1) || defined(HAVE_JACK_1_9_7)
static guint
gst_jack_ring_buffer_delay (GstRingBuffer * buf)
gst_jack_ring_buffer_delay (GstAudioRingBuffer * buf)
{
GstJackAudioSink *sink;
guint i, res = 0;
@ -608,7 +609,7 @@ gst_jack_ring_buffer_delay (GstRingBuffer * buf)
}
#else /* !(defined (HAVE_JACK_0_120_1) || defined(HAVE_JACK_1_9_7)) */
static guint
gst_jack_ring_buffer_delay (GstRingBuffer * buf)
gst_jack_ring_buffer_delay (GstAudioRingBuffer * buf)
{
GstJackAudioSink *sink;
guint i, res = 0;
@ -669,8 +670,8 @@ static void gst_jack_audio_sink_get_property (GObject * object, guint prop_id,
static GstCaps *gst_jack_audio_sink_getcaps (GstBaseSink * bsink,
GstCaps * filter);
static GstRingBuffer *gst_jack_audio_sink_create_ringbuffer (GstBaseAudioSink *
sink);
static GstAudioRingBuffer
* gst_jack_audio_sink_create_ringbuffer (GstBaseAudioSink * sink);
static void
gst_jack_audio_sink_class_init (GstJackAudioSinkClass * klass)
@ -855,10 +856,10 @@ no_client:
}
}
static GstRingBuffer *
static GstAudioRingBuffer *
gst_jack_audio_sink_create_ringbuffer (GstBaseAudioSink * sink)
{
GstRingBuffer *buffer;
GstAudioRingBuffer *buffer;
buffer = g_object_new (GST_TYPE_JACK_RING_BUFFER, NULL);
GST_DEBUG_OBJECT (sink, "created ringbuffer @%p", buffer);

View file

@ -42,7 +42,7 @@
/**
* SECTION:element-jackaudiosrc
* @see_also: #GstBaseAudioSrc, #GstRingBuffer
* @see_also: #GstBaseAudioSrc, #GstAudioRingBuffer
*
* A Src that inputs data from Jack ports.
*
@ -165,7 +165,7 @@ gst_jack_ring_buffer_get_type (void)
(GInstanceInitFunc) gst_jack_ring_buffer_init,
NULL
};
GType tmp = g_type_register_static (GST_TYPE_RING_BUFFER,
GType tmp = g_type_register_static (GST_TYPE_AUDIO_RING_BUFFER,
"GstJackAudioSrcRingBuffer", &ringbuffer_info, 0);
g_once_init_leave (&ringbuffer_type, tmp);
}
@ -176,9 +176,9 @@ gst_jack_ring_buffer_get_type (void)
static void
gst_jack_ring_buffer_class_init (GstJackRingBufferClass * klass)
{
GstRingBufferClass *gstringbuffer_class;
GstAudioRingBufferClass *gstringbuffer_class;
gstringbuffer_class = (GstRingBufferClass *) klass;
gstringbuffer_class = (GstAudioRingBufferClass *) klass;
ring_parent_class = g_type_class_peek_parent (klass);
@ -205,14 +205,14 @@ static int
jack_process_cb (jack_nframes_t nframes, void *arg)
{
GstJackAudioSrc *src;
GstRingBuffer *buf;
GstAudioRingBuffer *buf;
gint len;
guint8 *writeptr;
gint writeseg;
gint channels, i, j, flen;
sample_t *data;
buf = GST_RING_BUFFER_CAST (arg);
buf = GST_AUDIO_RING_BUFFER_CAST (arg);
src = GST_JACK_AUDIO_SRC (GST_OBJECT_PARENT (buf));
channels = GST_AUDIO_INFO_CHANNELS (&buf->spec.info);
@ -222,7 +222,7 @@ jack_process_cb (jack_nframes_t nframes, void *arg)
src->buffers[i] =
(sample_t *) jack_port_get_buffer (src->ports[i], nframes);
if (gst_ring_buffer_prepare_read (buf, &writeseg, &writeptr, &len)) {
if (gst_audio_ring_buffer_prepare_read (buf, &writeseg, &writeptr, &len)) {
flen = len / channels;
/* the number of samples must be exactly the segment size */
@ -240,7 +240,7 @@ jack_process_cb (jack_nframes_t nframes, void *arg)
len / channels, channels);
/* we wrote one segment */
gst_ring_buffer_advance (buf, 1);
gst_audio_ring_buffer_advance (buf, 1);
}
return 0;
@ -326,7 +326,7 @@ gst_jack_ring_buffer_init (GstJackRingBuffer * buf,
/* the _open_device method should make a connection with the server
*/
static gboolean
gst_jack_ring_buffer_open_device (GstRingBuffer * buf)
gst_jack_ring_buffer_open_device (GstAudioRingBuffer * buf)
{
GstJackAudioSrc *src;
jack_status_t status = 0;
@ -370,7 +370,7 @@ could_not_open:
/* close the connection with the server
*/
static gboolean
gst_jack_ring_buffer_close_device (GstRingBuffer * buf)
gst_jack_ring_buffer_close_device (GstAudioRingBuffer * buf)
{
GstJackAudioSrc *src;
@ -398,7 +398,8 @@ gst_jack_ring_buffer_close_device (GstRingBuffer * buf)
* received for some reason, we fail here.
*/
static gboolean
gst_jack_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
gst_jack_ring_buffer_acquire (GstAudioRingBuffer * buf,
GstAudioRingBufferSpec * spec)
{
GstJackAudioSrc *src;
GstJackRingBuffer *abuf;
@ -533,7 +534,7 @@ cannot_connect:
/* function is called with LOCK */
static gboolean
gst_jack_ring_buffer_release (GstRingBuffer * buf)
gst_jack_ring_buffer_release (GstAudioRingBuffer * buf)
{
GstJackAudioSrc *src;
GstJackRingBuffer *abuf;
@ -563,7 +564,7 @@ gst_jack_ring_buffer_release (GstRingBuffer * buf)
}
static gboolean
gst_jack_ring_buffer_start (GstRingBuffer * buf)
gst_jack_ring_buffer_start (GstAudioRingBuffer * buf)
{
GstJackAudioSrc *src;
@ -575,7 +576,7 @@ gst_jack_ring_buffer_start (GstRingBuffer * buf)
}
static gboolean
gst_jack_ring_buffer_pause (GstRingBuffer * buf)
gst_jack_ring_buffer_pause (GstAudioRingBuffer * buf)
{
GstJackAudioSrc *src;
@ -587,7 +588,7 @@ gst_jack_ring_buffer_pause (GstRingBuffer * buf)
}
static gboolean
gst_jack_ring_buffer_stop (GstRingBuffer * buf)
gst_jack_ring_buffer_stop (GstAudioRingBuffer * buf)
{
GstJackAudioSrc *src;
@ -600,7 +601,7 @@ gst_jack_ring_buffer_stop (GstRingBuffer * buf)
#if defined (HAVE_JACK_0_120_1) || defined(HAVE_JACK_1_9_7)
static guint
gst_jack_ring_buffer_delay (GstRingBuffer * buf)
gst_jack_ring_buffer_delay (GstAudioRingBuffer * buf)
{
GstJackAudioSrc *src;
guint i, res = 0;
@ -620,7 +621,7 @@ gst_jack_ring_buffer_delay (GstRingBuffer * buf)
}
#else /* !(defined (HAVE_JACK_0_120_1) || defined(HAVE_JACK_1_9_7)) */
static guint
gst_jack_ring_buffer_delay (GstRingBuffer * buf)
gst_jack_ring_buffer_delay (GstAudioRingBuffer * buf)
{
GstJackAudioSrc *src;
guint i, res = 0;
@ -687,8 +688,8 @@ static void gst_jack_audio_src_get_property (GObject * object, guint prop_id,
static GstCaps *gst_jack_audio_src_getcaps (GstBaseSrc * bsrc,
GstCaps * filter);
static GstRingBuffer *gst_jack_audio_src_create_ringbuffer (GstBaseAudioSrc *
src);
static GstAudioRingBuffer *gst_jack_audio_src_create_ringbuffer (GstBaseAudioSrc
* src);
/* GObject vmethod implementations */
@ -878,10 +879,10 @@ no_client:
}
}
static GstRingBuffer *
static GstAudioRingBuffer *
gst_jack_audio_src_create_ringbuffer (GstBaseAudioSrc * src)
{
GstRingBuffer *buffer;
GstAudioRingBuffer *buffer;
buffer = g_object_new (GST_TYPE_JACK_RING_BUFFER, NULL);
GST_DEBUG_OBJECT (src, "created ringbuffer @%p", buffer);

View file

@ -58,7 +58,7 @@ typedef struct _GstJackRingBufferClass GstJackRingBufferClass;
struct _GstJackRingBuffer
{
GstRingBuffer object;
GstAudioRingBuffer object;
gint sample_rate;
gint buffer_size;
@ -67,22 +67,22 @@ struct _GstJackRingBuffer
struct _GstJackRingBufferClass
{
GstRingBufferClass parent_class;
GstAudioRingBufferClass parent_class;
};
static void gst_jack_ring_buffer_class_init(GstJackRingBufferClass * klass);
static void gst_jack_ring_buffer_init(GstJackRingBuffer * ringbuffer,
GstJackRingBufferClass * klass);
static GstRingBufferClass *ring_parent_class = NULL;
static GstAudioRingBufferClass *ring_parent_class = NULL;
static gboolean gst_jack_ring_buffer_open_device(GstRingBuffer * buf);
static gboolean gst_jack_ring_buffer_close_device(GstRingBuffer * buf);
static gboolean gst_jack_ring_buffer_acquire(GstRingBuffer * buf,GstRingBufferSpec * spec);
static gboolean gst_jack_ring_buffer_release(GstRingBuffer * buf);
static gboolean gst_jack_ring_buffer_start(GstRingBuffer * buf);
static gboolean gst_jack_ring_buffer_pause(GstRingBuffer * buf);
static gboolean gst_jack_ring_buffer_stop(GstRingBuffer * buf);
static guint gst_jack_ring_buffer_delay(GstRingBuffer * buf);
static gboolean gst_jack_ring_buffer_open_device(GstAudioRingBuffer * buf);
static gboolean gst_jack_ring_buffer_close_device(GstAudioRingBuffer * buf);
static gboolean gst_jack_ring_buffer_acquire(GstAudioRingBuffer * buf,GstAudioRingBufferSpec * spec);
static gboolean gst_jack_ring_buffer_release(GstAudioRingBuffer * buf);
static gboolean gst_jack_ring_buffer_start(GstAudioRingBuffer * buf);
static gboolean gst_jack_ring_buffer_pause(GstAudioRingBuffer * buf);
static gboolean gst_jack_ring_buffer_stop(GstAudioRingBuffer * buf);
static guint gst_jack_ring_buffer_delay(GstAudioRingBuffer * buf);
#endif

View file

@ -804,7 +804,7 @@ static gboolean
gst_pulse_audio_sink_sink_acceptcaps (GstPulseAudioSink * pbin, GstPad * pad,
GstCaps * caps)
{
GstRingBufferSpec spec = { 0 };
GstAudioRingBufferSpec spec = { 0 };
const GstStructure *st;
GstCaps *pad_caps = NULL;
gboolean ret = FALSE;
@ -819,7 +819,7 @@ gst_pulse_audio_sink_sink_acceptcaps (GstPulseAudioSink * pbin, GstPad * pad,
goto out;
spec.latency_time = GST_BASE_AUDIO_SINK (pbin->psink)->latency_time;
if (!gst_ring_buffer_parse_caps (&spec, caps))
if (!gst_audio_ring_buffer_parse_caps (&spec, caps))
goto out;
/* Make sure non-raw input is framed (one frame per buffer) and can be

View file

@ -131,7 +131,7 @@ static GMutex *pa_shared_resource_mutex = NULL;
* pulseaudio memory instead. */
struct _GstPulseRingBuffer
{
GstRingBuffer object;
GstAudioRingBuffer object;
gchar *context_name;
gchar *stream_name;
@ -159,28 +159,29 @@ struct _GstPulseRingBuffer
};
struct _GstPulseRingBufferClass
{
GstRingBufferClass parent_class;
GstAudioRingBufferClass parent_class;
};
static GType gst_pulseringbuffer_get_type (void);
static void gst_pulseringbuffer_finalize (GObject * object);
static GstRingBufferClass *ring_parent_class = NULL;
static GstAudioRingBufferClass *ring_parent_class = NULL;
static gboolean gst_pulseringbuffer_open_device (GstRingBuffer * buf);
static gboolean gst_pulseringbuffer_close_device (GstRingBuffer * buf);
static gboolean gst_pulseringbuffer_acquire (GstRingBuffer * buf,
GstRingBufferSpec * spec);
static gboolean gst_pulseringbuffer_release (GstRingBuffer * buf);
static gboolean gst_pulseringbuffer_start (GstRingBuffer * buf);
static gboolean gst_pulseringbuffer_pause (GstRingBuffer * buf);
static gboolean gst_pulseringbuffer_stop (GstRingBuffer * buf);
static void gst_pulseringbuffer_clear (GstRingBuffer * buf);
static guint gst_pulseringbuffer_commit (GstRingBuffer * buf,
static gboolean gst_pulseringbuffer_open_device (GstAudioRingBuffer * buf);
static gboolean gst_pulseringbuffer_close_device (GstAudioRingBuffer * buf);
static gboolean gst_pulseringbuffer_acquire (GstAudioRingBuffer * buf,
GstAudioRingBufferSpec * spec);
static gboolean gst_pulseringbuffer_release (GstAudioRingBuffer * buf);
static gboolean gst_pulseringbuffer_start (GstAudioRingBuffer * buf);
static gboolean gst_pulseringbuffer_pause (GstAudioRingBuffer * buf);
static gboolean gst_pulseringbuffer_stop (GstAudioRingBuffer * buf);
static void gst_pulseringbuffer_clear (GstAudioRingBuffer * buf);
static guint gst_pulseringbuffer_commit (GstAudioRingBuffer * buf,
guint64 * sample, guchar * data, gint in_samples, gint out_samples,
gint * accum);
G_DEFINE_TYPE (GstPulseRingBuffer, gst_pulseringbuffer, GST_TYPE_RING_BUFFER);
G_DEFINE_TYPE (GstPulseRingBuffer, gst_pulseringbuffer,
GST_TYPE_AUDIO_RING_BUFFER);
static void
gst_pulsesink_init_contexts (void)
@ -195,10 +196,10 @@ static void
gst_pulseringbuffer_class_init (GstPulseRingBufferClass * klass)
{
GObjectClass *gobject_class;
GstRingBufferClass *gstringbuffer_class;
GstAudioRingBufferClass *gstringbuffer_class;
gobject_class = (GObjectClass *) klass;
gstringbuffer_class = (GstRingBufferClass *) klass;
gstringbuffer_class = (GstAudioRingBufferClass *) klass;
ring_parent_class = g_type_class_peek_parent (klass);
@ -457,7 +458,7 @@ gst_pulsering_context_subscribe_cb (pa_context * c,
/* will be called when the device should be opened. In this case we will connect
* to the server. We should not try to open any streams in this state. */
static gboolean
gst_pulseringbuffer_open_device (GstRingBuffer * buf)
gst_pulseringbuffer_open_device (GstAudioRingBuffer * buf)
{
GstPulseSink *psink;
GstPulseRingBuffer *pbuf;
@ -572,7 +573,7 @@ connect_failed:
/* close the device */
static gboolean
gst_pulseringbuffer_close_device (GstRingBuffer * buf)
gst_pulseringbuffer_close_device (GstAudioRingBuffer * buf)
{
GstPulseSink *psink;
GstPulseRingBuffer *pbuf;
@ -621,10 +622,10 @@ static void
gst_pulsering_stream_request_cb (pa_stream * s, size_t length, void *userdata)
{
GstPulseSink *psink;
GstRingBuffer *rbuf;
GstAudioRingBuffer *rbuf;
GstPulseRingBuffer *pbuf;
rbuf = GST_RING_BUFFER_CAST (userdata);
rbuf = GST_AUDIO_RING_BUFFER_CAST (userdata);
pbuf = GST_PULSERING_BUFFER_CAST (userdata);
psink = GST_PULSESINK_CAST (GST_OBJECT_PARENT (pbuf));
@ -794,7 +795,8 @@ gst_pulsering_wait_for_stream_ready (GstPulseSink * psink, pa_stream * stream)
/* This method should create a new stream of the given @spec. No playback should
* start yet so we start in the corked state. */
static gboolean
gst_pulseringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
gst_pulseringbuffer_acquire (GstAudioRingBuffer * buf,
GstAudioRingBufferSpec * spec)
{
GstPulseSink *psink;
GstPulseRingBuffer *pbuf;
@ -1020,7 +1022,7 @@ connect_failed:
/* free the stream that we acquired before */
static gboolean
gst_pulseringbuffer_release (GstRingBuffer * buf)
gst_pulseringbuffer_release (GstAudioRingBuffer * buf)
{
GstPulseRingBuffer *pbuf;
@ -1107,7 +1109,7 @@ cork_failed:
}
static void
gst_pulseringbuffer_clear (GstRingBuffer * buf)
gst_pulseringbuffer_clear (GstAudioRingBuffer * buf)
{
GstPulseSink *psink;
GstPulseRingBuffer *pbuf;
@ -1151,7 +1153,7 @@ mainloop_enter_defer_cb (pa_mainloop_api * api, void *userdata)
/* start/resume playback ASAP, we don't uncork here but in the commit method */
static gboolean
gst_pulseringbuffer_start (GstRingBuffer * buf)
gst_pulseringbuffer_start (GstAudioRingBuffer * buf)
{
GstPulseSink *psink;
GstPulseRingBuffer *pbuf;
@ -1181,7 +1183,7 @@ gst_pulseringbuffer_start (GstRingBuffer * buf)
/* pause/stop playback ASAP */
static gboolean
gst_pulseringbuffer_pause (GstRingBuffer * buf)
gst_pulseringbuffer_pause (GstAudioRingBuffer * buf)
{
GstPulseSink *psink;
GstPulseRingBuffer *pbuf;
@ -1229,7 +1231,7 @@ mainloop_leave_defer_cb (pa_mainloop_api * api, void *userdata)
/* stop playback, we flush everything. */
static gboolean
gst_pulseringbuffer_stop (GstRingBuffer * buf)
gst_pulseringbuffer_stop (GstAudioRingBuffer * buf)
{
GstPulseSink *psink;
GstPulseRingBuffer *pbuf;
@ -1366,7 +1368,7 @@ G_STMT_START { \
/* our custom commit function because we write into the buffer of pulseaudio
* instead of keeping our own buffer */
static guint
gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample,
gst_pulseringbuffer_commit (GstAudioRingBuffer * buf, guint64 * sample,
guchar * data, gint in_samples, gint out_samples, gint * accum)
{
GstPulseSink *psink;
@ -1390,13 +1392,13 @@ gst_pulseringbuffer_commit (GstRingBuffer * buf, guint64 * sample,
/* make sure the ringbuffer is started */
if (G_UNLIKELY (g_atomic_int_get (&buf->state) !=
GST_RING_BUFFER_STATE_STARTED)) {
GST_AUDIO_RING_BUFFER_STATE_STARTED)) {
/* see if we are allowed to start it */
if (G_UNLIKELY (g_atomic_int_get (&buf->may_start) == FALSE))
goto no_start;
GST_DEBUG_OBJECT (buf, "start!");
if (!gst_ring_buffer_start (buf))
if (!gst_audio_ring_buffer_start (buf))
goto start_failed;
}
@ -1701,7 +1703,7 @@ gst_pulsering_flush (GstPulseRingBuffer * pbuf)
#ifndef GST_DISABLE_GST_DEBUG
gint bpf;
bpf = (GST_RING_BUFFER_CAST (pbuf))->spec.info.bpf;
bpf = (GST_AUDIO_RING_BUFFER_CAST (pbuf))->spec.info.bpf;
GST_LOG_OBJECT (psink,
"flushing %u samples at offset %" G_GINT64_FORMAT,
(guint) pbuf->m_towrite / bpf, pbuf->m_offset);
@ -1756,10 +1758,10 @@ G_DEFINE_TYPE_WITH_CODE (GstPulseSink, gst_pulsesink, GST_TYPE_BASE_AUDIO_SINK,
G_IMPLEMENT_INTERFACE (GST_TYPE_STREAM_VOLUME, NULL)
);
static GstRingBuffer *
static GstAudioRingBuffer *
gst_pulsesink_create_ringbuffer (GstBaseAudioSink * sink)
{
GstRingBuffer *buffer;
GstAudioRingBuffer *buffer;
GST_DEBUG_OBJECT (sink, "creating ringbuffer");
buffer = g_object_new (GST_TYPE_PULSERING_BUFFER, NULL);
@ -2015,7 +2017,7 @@ gst_pulsesink_query_acceptcaps (GstPulseSink * psink, GstCaps * caps)
GstStructure *st;
gboolean ret = FALSE;
GstRingBufferSpec spec = { 0 };
GstAudioRingBufferSpec spec = { 0 };
pa_stream *stream = NULL;
pa_operation *o = NULL;
pa_channel_map channel_map;
@ -2041,7 +2043,7 @@ gst_pulsesink_query_acceptcaps (GstPulseSink * psink, GstCaps * caps)
pa_threaded_mainloop_lock (mainloop);
spec.latency_time = GST_BASE_AUDIO_SINK (psink)->latency_time;
if (!gst_ring_buffer_parse_caps (&spec, caps))
if (!gst_audio_ring_buffer_parse_caps (&spec, caps))
goto out;
if (!gst_pulse_fill_format_info (&spec, &format, &channels))

View file

@ -83,7 +83,7 @@ static gboolean gst_pulsesrc_open (GstAudioSrc * asrc);
static gboolean gst_pulsesrc_close (GstAudioSrc * asrc);
static gboolean gst_pulsesrc_prepare (GstAudioSrc * asrc,
GstRingBufferSpec * spec);
GstAudioRingBufferSpec * spec);
static gboolean gst_pulsesrc_unprepare (GstAudioSrc * asrc);
@ -810,12 +810,12 @@ gst_pulsesrc_create_stream (GstPulseSrc * pulsesrc, GstCaps * caps)
pa_channel_map channel_map;
GstStructure *s;
gboolean need_channel_layout = FALSE;
GstRingBufferSpec spec;
GstAudioRingBufferSpec spec;
const gchar *name;
memset (&spec, 0, sizeof (GstRingBufferSpec));
memset (&spec, 0, sizeof (GstAudioRingBufferSpec));
spec.latency_time = GST_SECOND;
if (!gst_ring_buffer_parse_caps (&spec, caps))
if (!gst_audio_ring_buffer_parse_caps (&spec, caps))
goto invalid_caps;
/* Keep the refcount of the caps at 1 to make them writable */
@ -980,7 +980,7 @@ no_nego_needed:
}
static gboolean
gst_pulsesrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
gst_pulsesrc_prepare (GstAudioSrc * asrc, GstAudioRingBufferSpec * spec)
{
pa_buffer_attr wanted;
const pa_buffer_attr *actual;

View file

@ -134,7 +134,7 @@ gstaudioformat_to_pasampleformat (GstAudioFormat format,
}
gboolean
gst_pulse_fill_sample_spec (GstRingBufferSpec * spec, pa_sample_spec * ss)
gst_pulse_fill_sample_spec (GstAudioRingBufferSpec * spec, pa_sample_spec * ss)
{
if (spec->type == GST_BUFTYPE_RAW) {
if (!gstaudioformat_to_pasampleformat (GST_AUDIO_INFO_FORMAT (&spec->info),
@ -158,7 +158,7 @@ gst_pulse_fill_sample_spec (GstRingBufferSpec * spec, pa_sample_spec * ss)
#ifdef HAVE_PULSE_1_0
gboolean
gst_pulse_fill_format_info (GstRingBufferSpec * spec, pa_format_info ** f,
gst_pulse_fill_format_info (GstAudioRingBufferSpec * spec, pa_format_info ** f,
guint * channels)
{
pa_format_info *format;
@ -234,7 +234,7 @@ gst_pulse_client_name (void)
pa_channel_map *
gst_pulse_gst_to_channel_map (pa_channel_map * map,
const GstRingBufferSpec * spec)
const GstAudioRingBufferSpec * spec)
{
int i;
GstAudioChannelPosition *pos;
@ -268,9 +268,9 @@ gst_pulse_gst_to_channel_map (pa_channel_map * map,
return map;
}
GstRingBufferSpec *
GstAudioRingBufferSpec *
gst_pulse_channel_map_to_gst (const pa_channel_map * map,
GstRingBufferSpec * spec)
GstAudioRingBufferSpec * spec)
{
int i;
GstAudioChannelPosition *pos;

View file

@ -31,20 +31,20 @@
#include <gst/audio/gstringbuffer.h>
#include <gst/audio/gstaudiosink.h>
gboolean gst_pulse_fill_sample_spec (GstRingBufferSpec * spec,
gboolean gst_pulse_fill_sample_spec (GstAudioRingBufferSpec * spec,
pa_sample_spec * ss);
#ifdef HAVE_PULSE_1_0
gboolean gst_pulse_fill_format_info (GstRingBufferSpec * spec,
gboolean gst_pulse_fill_format_info (GstAudioRingBufferSpec * spec,
pa_format_info ** f, guint * channels);
#endif
gchar *gst_pulse_client_name (void);
pa_channel_map *gst_pulse_gst_to_channel_map (pa_channel_map * map,
const GstRingBufferSpec * spec);
const GstAudioRingBufferSpec * spec);
GstRingBufferSpec *gst_pulse_channel_map_to_gst (const pa_channel_map * map,
GstRingBufferSpec * spec);
GstAudioRingBufferSpec *gst_pulse_channel_map_to_gst (const pa_channel_map * map,
GstAudioRingBufferSpec * spec);
void gst_pulse_cvolume_from_linear (pa_cvolume *v, unsigned channels, gdouble volume);