summaryrefslogtreecommitdiff
path: root/ext/jack
diff options
context:
space:
mode:
Diffstat (limited to 'ext/jack')
-rw-r--r--ext/jack/gstjackaudiosink.c48
-rw-r--r--ext/jack/gstjackaudiosrc.c47
2 files changed, 44 insertions, 51 deletions
diff --git a/ext/jack/gstjackaudiosink.c b/ext/jack/gstjackaudiosink.c
index 0aa578b75..7f4ecf73b 100644
--- a/ext/jack/gstjackaudiosink.c
+++ b/ext/jack/gstjackaudiosink.c
@@ -438,8 +438,8 @@ gst_jack_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
buffer_size, spec->segsize, spec->segtotal);
/* allocate the ringbuffer memory now */
- buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize);
- memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
+ buf->size = spec->segtotal * spec->segsize;
+ buf->memory = g_malloc0 (buf->size);
if ((res = gst_jack_audio_client_set_active (sink->client, TRUE)))
goto could_not_activate;
@@ -541,8 +541,8 @@ gst_jack_ring_buffer_release (GstRingBuffer * buf)
abuf->sample_rate = -1;
/* free the buffer */
- gst_buffer_unref (buf->data);
- buf->data = NULL;
+ g_free (buf->memory);
+ buf->memory = NULL;
return TRUE;
}
@@ -656,11 +656,8 @@ enum
PROP_LAST
};
-#define _do_init(bla) \
- GST_DEBUG_CATEGORY_INIT (gst_jack_audio_sink_debug, "jacksink", 0, "jacksink element");
-
-GST_BOILERPLATE_FULL (GstJackAudioSink, gst_jack_audio_sink, GstBaseAudioSink,
- GST_TYPE_BASE_AUDIO_SINK, _do_init);
+#define gst_jack_audio_sink_parent_class parent_class
+G_DEFINE_TYPE (GstJackAudioSink, gst_jack_audio_sink, GST_TYPE_BASE_AUDIO_SINK);
static void gst_jack_audio_sink_dispose (GObject * object);
static void gst_jack_audio_sink_set_property (GObject * object, guint prop_id,
@@ -668,31 +665,24 @@ static void gst_jack_audio_sink_set_property (GObject * object, guint prop_id,
static void gst_jack_audio_sink_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static GstCaps *gst_jack_audio_sink_getcaps (GstBaseSink * bsink);
+static GstCaps *gst_jack_audio_sink_getcaps (GstBaseSink * bsink,
+ GstCaps * filter);
static GstRingBuffer *gst_jack_audio_sink_create_ringbuffer (GstBaseAudioSink *
sink);
static void
-gst_jack_audio_sink_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details_simple (element_class, "Audio Sink (Jack)",
- "Sink/Audio", "Output audio to a JACK server",
- "Wim Taymans <wim.taymans@gmail.com>");
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&jackaudiosink_sink_factory));
-}
-
-static void
gst_jack_audio_sink_class_init (GstJackAudioSinkClass * klass)
{
GObjectClass *gobject_class;
+ GstElementClass *gstelement_class;
GstBaseSinkClass *gstbasesink_class;
GstBaseAudioSinkClass *gstbaseaudiosink_class;
+ GST_DEBUG_CATEGORY_INIT (gst_jack_audio_sink_debug, "jacksink", 0,
+ "jacksink element");
+
gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
gstbasesink_class = (GstBaseSinkClass *) klass;
gstbaseaudiosink_class = (GstBaseAudioSinkClass *) klass;
@@ -717,6 +707,13 @@ gst_jack_audio_sink_class_init (GstJackAudioSinkClass * klass)
GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
+ gst_element_class_set_details_simple (gstelement_class, "Audio Sink (Jack)",
+ "Sink/Audio", "Output audio to a JACK server",
+ "Wim Taymans <wim.taymans@gmail.com>");
+
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&jackaudiosink_sink_factory));
+
gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_jack_audio_sink_getcaps);
gstbaseaudiosink_class->create_ringbuffer =
@@ -730,8 +727,7 @@ gst_jack_audio_sink_class_init (GstJackAudioSinkClass * klass)
}
static void
-gst_jack_audio_sink_init (GstJackAudioSink * sink,
- GstJackAudioSinkClass * g_class)
+gst_jack_audio_sink_init (GstJackAudioSink * sink)
{
sink->connect = DEFAULT_PROP_CONNECT;
sink->server = g_strdup (DEFAULT_PROP_SERVER);
@@ -803,7 +799,7 @@ gst_jack_audio_sink_get_property (GObject * object, guint prop_id,
}
static GstCaps *
-gst_jack_audio_sink_getcaps (GstBaseSink * bsink)
+gst_jack_audio_sink_getcaps (GstBaseSink * bsink, GstCaps * filter)
{
GstJackAudioSink *sink = GST_JACK_AUDIO_SINK (bsink);
const char **ports;
diff --git a/ext/jack/gstjackaudiosrc.c b/ext/jack/gstjackaudiosrc.c
index 3aa6e9383..5f18f4339 100644
--- a/ext/jack/gstjackaudiosrc.c
+++ b/ext/jack/gstjackaudiosrc.c
@@ -448,8 +448,8 @@ gst_jack_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
buffer_size, spec->segsize, spec->segtotal);
/* allocate the ringbuffer memory now */
- buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize);
- memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
+ buf->size = spec->segtotal * spec->segsize;
+ buf->memory = g_malloc0 (buf->size);
if ((res = gst_jack_audio_client_set_active (src->client, TRUE)))
goto could_not_activate;
@@ -553,8 +553,8 @@ gst_jack_ring_buffer_release (GstRingBuffer * buf)
abuf->sample_rate = -1;
/* free the buffer */
- gst_buffer_unref (buf->data);
- buf->data = NULL;
+ g_free (buf->memory);
+ buf->memory = NULL;
return TRUE;
}
@@ -674,11 +674,8 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]")
);
-#define _do_init(bla) \
- GST_DEBUG_CATEGORY_INIT(gst_jack_audio_src_debug, "jacksrc", 0, "jacksrc element");
-
-GST_BOILERPLATE_FULL (GstJackAudioSrc, gst_jack_audio_src, GstBaseAudioSrc,
- GST_TYPE_BASE_AUDIO_SRC, _do_init);
+#define gst_jack_audio_src_parent_class parent_class
+G_DEFINE_TYPE (GstJackAudioSrc, gst_jack_audio_src, GST_TYPE_BASE_AUDIO_SRC);
static void gst_jack_audio_src_dispose (GObject * object);
static void gst_jack_audio_src_set_property (GObject * object, guint prop_id,
@@ -686,34 +683,27 @@ static void gst_jack_audio_src_set_property (GObject * object, guint prop_id,
static void gst_jack_audio_src_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static GstCaps *gst_jack_audio_src_getcaps (GstBaseSrc * bsrc);
+static GstCaps *gst_jack_audio_src_getcaps (GstBaseSrc * bsrc,
+ GstCaps * filter);
static GstRingBuffer *gst_jack_audio_src_create_ringbuffer (GstBaseAudioSrc *
src);
/* GObject vmethod implementations */
-static void
-gst_jack_audio_src_base_init (gpointer gclass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_factory));
- gst_element_class_set_details_simple (element_class, "Audio Source (Jack)",
- "Source/Audio", "Captures audio from a JACK server",
- "Tristan Matthews <tristan@sat.qc.ca>");
-}
-
/* initialize the jack_audio_src's class */
static void
gst_jack_audio_src_class_init (GstJackAudioSrcClass * klass)
{
GObjectClass *gobject_class;
+ GstElementClass *gstelement_class;
GstBaseSrcClass *gstbasesrc_class;
GstBaseAudioSrcClass *gstbaseaudiosrc_class;
- gobject_class = (GObjectClass *) klass;
+ GST_DEBUG_CATEGORY_INIT (gst_jack_audio_src_debug, "jacksrc", 0,
+ "jacksrc element");
+ gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
gstbasesrc_class = (GstBaseSrcClass *) klass;
gstbaseaudiosrc_class = (GstBaseAudioSrcClass *) klass;
@@ -738,6 +728,13 @@ gst_jack_audio_src_class_init (GstJackAudioSrcClass * klass)
GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&src_factory));
+
+ gst_element_class_set_details_simple (gstelement_class, "Audio Source (Jack)",
+ "Source/Audio", "Captures audio from a JACK server",
+ "Tristan Matthews <tristan@sat.qc.ca>");
+
gstbasesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_jack_audio_src_getcaps);
gstbaseaudiosrc_class->create_ringbuffer =
GST_DEBUG_FUNCPTR (gst_jack_audio_src_create_ringbuffer);
@@ -755,7 +752,7 @@ gst_jack_audio_src_class_init (GstJackAudioSrcClass * klass)
* initialize instance structure
*/
static void
-gst_jack_audio_src_init (GstJackAudioSrc * src, GstJackAudioSrcClass * gclass)
+gst_jack_audio_src_init (GstJackAudioSrc * src)
{
//gst_base_src_set_live(GST_BASE_SRC (src), TRUE);
src->connect = DEFAULT_PROP_CONNECT;
@@ -824,7 +821,7 @@ gst_jack_audio_src_get_property (GObject * object, guint prop_id,
}
static GstCaps *
-gst_jack_audio_src_getcaps (GstBaseSrc * bsrc)
+gst_jack_audio_src_getcaps (GstBaseSrc * bsrc, GstCaps * filter)
{
GstJackAudioSrc *src = GST_JACK_AUDIO_SRC (bsrc);
const char **ports;