mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
jack: port jack elements
This commit is contained in:
parent
9a96783abb
commit
5ed18ad7b9
2 changed files with 38 additions and 47 deletions
|
@ -437,8 +437,8 @@ gst_jack_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
|
||||||
buffer_size, spec->segsize, spec->segtotal);
|
buffer_size, spec->segsize, spec->segtotal);
|
||||||
|
|
||||||
/* allocate the ringbuffer memory now */
|
/* allocate the ringbuffer memory now */
|
||||||
buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize);
|
buf->size = spec->segtotal * spec->segsize;
|
||||||
memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
|
buf->memory = g_malloc0 (buf->size);
|
||||||
|
|
||||||
if ((res = gst_jack_audio_client_set_active (sink->client, TRUE)))
|
if ((res = gst_jack_audio_client_set_active (sink->client, TRUE)))
|
||||||
goto could_not_activate;
|
goto could_not_activate;
|
||||||
|
@ -540,8 +540,8 @@ gst_jack_ring_buffer_release (GstRingBuffer * buf)
|
||||||
abuf->sample_rate = -1;
|
abuf->sample_rate = -1;
|
||||||
|
|
||||||
/* free the buffer */
|
/* free the buffer */
|
||||||
gst_buffer_unref (buf->data);
|
g_free (buf->memory);
|
||||||
buf->data = NULL;
|
buf->memory = NULL;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -655,11 +655,8 @@ enum
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
#define _do_init(bla) \
|
#define gst_jack_audio_sink_parent_class parent_class
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_jack_audio_sink_debug, "jacksink", 0, "jacksink element");
|
G_DEFINE_TYPE (GstJackAudioSink, gst_jack_audio_sink, GST_TYPE_BASE_AUDIO_SINK);
|
||||||
|
|
||||||
GST_BOILERPLATE_FULL (GstJackAudioSink, gst_jack_audio_sink, GstBaseAudioSink,
|
|
||||||
GST_TYPE_BASE_AUDIO_SINK, _do_init);
|
|
||||||
|
|
||||||
static void gst_jack_audio_sink_dispose (GObject * object);
|
static void gst_jack_audio_sink_dispose (GObject * object);
|
||||||
static void gst_jack_audio_sink_set_property (GObject * object, guint prop_id,
|
static void gst_jack_audio_sink_set_property (GObject * object, guint prop_id,
|
||||||
|
@ -671,27 +668,19 @@ static GstCaps *gst_jack_audio_sink_getcaps (GstBaseSink * bsink);
|
||||||
static GstRingBuffer *gst_jack_audio_sink_create_ringbuffer (GstBaseAudioSink *
|
static GstRingBuffer *gst_jack_audio_sink_create_ringbuffer (GstBaseAudioSink *
|
||||||
sink);
|
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
|
static void
|
||||||
gst_jack_audio_sink_class_init (GstJackAudioSinkClass * klass)
|
gst_jack_audio_sink_class_init (GstJackAudioSinkClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
|
GstElementClass *gstelement_class;
|
||||||
GstBaseSinkClass *gstbasesink_class;
|
GstBaseSinkClass *gstbasesink_class;
|
||||||
GstBaseAudioSinkClass *gstbaseaudiosink_class;
|
GstBaseAudioSinkClass *gstbaseaudiosink_class;
|
||||||
|
|
||||||
|
GST_DEBUG_CATEGORY_INIT (gst_jack_audio_sink_debug, "jacksink", 0,
|
||||||
|
"jacksink element");
|
||||||
|
|
||||||
gobject_class = (GObjectClass *) klass;
|
gobject_class = (GObjectClass *) klass;
|
||||||
|
gstelement_class = (GstElementClass *) klass;
|
||||||
gstbasesink_class = (GstBaseSinkClass *) klass;
|
gstbasesink_class = (GstBaseSinkClass *) klass;
|
||||||
gstbaseaudiosink_class = (GstBaseAudioSinkClass *) klass;
|
gstbaseaudiosink_class = (GstBaseAudioSinkClass *) klass;
|
||||||
|
|
||||||
|
@ -716,6 +705,13 @@ gst_jack_audio_sink_class_init (GstJackAudioSinkClass * klass)
|
||||||
GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
|
GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
|
||||||
G_PARAM_STATIC_STRINGS));
|
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);
|
gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_jack_audio_sink_getcaps);
|
||||||
|
|
||||||
gstbaseaudiosink_class->create_ringbuffer =
|
gstbaseaudiosink_class->create_ringbuffer =
|
||||||
|
@ -729,8 +725,7 @@ gst_jack_audio_sink_class_init (GstJackAudioSinkClass * klass)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_jack_audio_sink_init (GstJackAudioSink * sink,
|
gst_jack_audio_sink_init (GstJackAudioSink * sink)
|
||||||
GstJackAudioSinkClass * g_class)
|
|
||||||
{
|
{
|
||||||
sink->connect = DEFAULT_PROP_CONNECT;
|
sink->connect = DEFAULT_PROP_CONNECT;
|
||||||
sink->server = g_strdup (DEFAULT_PROP_SERVER);
|
sink->server = g_strdup (DEFAULT_PROP_SERVER);
|
||||||
|
|
|
@ -448,8 +448,8 @@ gst_jack_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
|
||||||
buffer_size, spec->segsize, spec->segtotal);
|
buffer_size, spec->segsize, spec->segtotal);
|
||||||
|
|
||||||
/* allocate the ringbuffer memory now */
|
/* allocate the ringbuffer memory now */
|
||||||
buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize);
|
buf->size = spec->segtotal * spec->segsize;
|
||||||
memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
|
buf->memory = g_malloc0 (buf->size);
|
||||||
|
|
||||||
if ((res = gst_jack_audio_client_set_active (src->client, TRUE)))
|
if ((res = gst_jack_audio_client_set_active (src->client, TRUE)))
|
||||||
goto could_not_activate;
|
goto could_not_activate;
|
||||||
|
@ -553,8 +553,8 @@ gst_jack_ring_buffer_release (GstRingBuffer * buf)
|
||||||
abuf->sample_rate = -1;
|
abuf->sample_rate = -1;
|
||||||
|
|
||||||
/* free the buffer */
|
/* free the buffer */
|
||||||
gst_buffer_unref (buf->data);
|
g_free (buf->memory);
|
||||||
buf->data = NULL;
|
buf->memory = NULL;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -674,11 +674,8 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||||
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]")
|
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, MAX ]")
|
||||||
);
|
);
|
||||||
|
|
||||||
#define _do_init(bla) \
|
#define gst_jack_audio_src_parent_class parent_class
|
||||||
GST_DEBUG_CATEGORY_INIT(gst_jack_audio_src_debug, "jacksrc", 0, "jacksrc element");
|
G_DEFINE_TYPE (GstJackAudioSrc, gst_jack_audio_src, GST_TYPE_BASE_AUDIO_SRC);
|
||||||
|
|
||||||
GST_BOILERPLATE_FULL (GstJackAudioSrc, gst_jack_audio_src, GstBaseAudioSrc,
|
|
||||||
GST_TYPE_BASE_AUDIO_SRC, _do_init);
|
|
||||||
|
|
||||||
static void gst_jack_audio_src_dispose (GObject * object);
|
static void gst_jack_audio_src_dispose (GObject * object);
|
||||||
static void gst_jack_audio_src_set_property (GObject * object, guint prop_id,
|
static void gst_jack_audio_src_set_property (GObject * object, guint prop_id,
|
||||||
|
@ -692,28 +689,20 @@ static GstRingBuffer *gst_jack_audio_src_create_ringbuffer (GstBaseAudioSrc *
|
||||||
|
|
||||||
/* GObject vmethod implementations */
|
/* 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 */
|
/* initialize the jack_audio_src's class */
|
||||||
static void
|
static void
|
||||||
gst_jack_audio_src_class_init (GstJackAudioSrcClass * klass)
|
gst_jack_audio_src_class_init (GstJackAudioSrcClass * klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
|
GstElementClass *gstelement_class;
|
||||||
GstBaseSrcClass *gstbasesrc_class;
|
GstBaseSrcClass *gstbasesrc_class;
|
||||||
GstBaseAudioSrcClass *gstbaseaudiosrc_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;
|
gstbasesrc_class = (GstBaseSrcClass *) klass;
|
||||||
gstbaseaudiosrc_class = (GstBaseAudioSrcClass *) klass;
|
gstbaseaudiosrc_class = (GstBaseAudioSrcClass *) klass;
|
||||||
|
|
||||||
|
@ -738,6 +727,13 @@ gst_jack_audio_src_class_init (GstJackAudioSrcClass * klass)
|
||||||
GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
|
GST_PARAM_MUTABLE_READY | G_PARAM_READWRITE |
|
||||||
G_PARAM_STATIC_STRINGS));
|
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);
|
gstbasesrc_class->get_caps = GST_DEBUG_FUNCPTR (gst_jack_audio_src_getcaps);
|
||||||
gstbaseaudiosrc_class->create_ringbuffer =
|
gstbaseaudiosrc_class->create_ringbuffer =
|
||||||
GST_DEBUG_FUNCPTR (gst_jack_audio_src_create_ringbuffer);
|
GST_DEBUG_FUNCPTR (gst_jack_audio_src_create_ringbuffer);
|
||||||
|
@ -755,7 +751,7 @@ gst_jack_audio_src_class_init (GstJackAudioSrcClass * klass)
|
||||||
* initialize instance structure
|
* initialize instance structure
|
||||||
*/
|
*/
|
||||||
static void
|
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);
|
//gst_base_src_set_live(GST_BASE_SRC (src), TRUE);
|
||||||
src->connect = DEFAULT_PROP_CONNECT;
|
src->connect = DEFAULT_PROP_CONNECT;
|
||||||
|
|
Loading…
Reference in a new issue