summaryrefslogtreecommitdiffstats
path: root/ext/jack
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2004-03-15 19:32:27 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2004-03-15 19:32:27 +0000
commit4fd57bbe3fef59592a8664dcc9fa2ab32ae99c69 (patch)
tree8f41b30e571aa6ed88b53f5471d5e38461136e60 /ext/jack
parent9f4226fe55f09cf5809376b467aa3f46dbf7b5c2 (diff)
downloadgst-plugins-bad-4fd57bbe3fef59592a8664dcc9fa2ab32ae99c69.tar.gz
gst-plugins-bad-4fd57bbe3fef59592a8664dcc9fa2ab32ae99c69.tar.bz2
gst-plugins-bad-4fd57bbe3fef59592a8664dcc9fa2ab32ae99c69.zip
don't mix tabs and spaces
Original commit message from CVS: don't mix tabs and spaces
Diffstat (limited to 'ext/jack')
-rw-r--r--ext/jack/gstjack.c115
-rw-r--r--ext/jack/gstjackbin.c209
2 files changed, 164 insertions, 160 deletions
diff --git a/ext/jack/gstjack.c b/ext/jack/gstjack.c
index 41f078bc..643896a8 100644
--- a/ext/jack/gstjack.c
+++ b/ext/jack/gstjack.c
@@ -106,8 +106,9 @@ gst_jack_get_type (void)
0,
NULL,
};
+
jack_type =
- g_type_register_static (GST_TYPE_ELEMENT, "GstJack", &jack_info, 0);
+ g_type_register_static (GST_TYPE_ELEMENT, "GstJack", &jack_info, 0);
}
return jack_type;
}
@@ -129,8 +130,9 @@ gst_jack_sink_get_type (void)
0,
(GInstanceInitFunc) gst_jack_init,
};
+
jack_type =
- g_type_register_static (GST_TYPE_JACK, "GstJackSink", &jack_info, 0);
+ g_type_register_static (GST_TYPE_JACK, "GstJackSink", &jack_info, 0);
}
return jack_type;
}
@@ -152,8 +154,9 @@ gst_jack_src_get_type (void)
0,
(GInstanceInitFunc) gst_jack_init,
};
+
jack_type =
- g_type_register_static (GST_TYPE_JACK, "GstJackSrc", &jack_info, 0);
+ g_type_register_static (GST_TYPE_JACK, "GstJackSrc", &jack_info, 0);
}
return jack_type;
}
@@ -240,7 +243,7 @@ gst_jack_set_property (GObject * object, guint prop_id, const GValue * value,
switch (prop_id) {
case ARG_PORT_NAME_PREFIX:
if (this->port_name_prefix)
- g_free (this->port_name_prefix);
+ g_free (this->port_name_prefix);
this->port_name_prefix = g_strdup (g_value_get_string (value));
break;
default:
@@ -318,8 +321,8 @@ gst_jack_request_new_pad (GstElement * element, GstPadTemplate * templ,
l = *pad_list;
while (l) {
if (strcmp (GST_JACK_PAD (l)->name, name) == 0) {
- g_warning ("requested port name %s already in use.", name);
- return NULL;
+ g_warning ("requested port name %s already in use.", name);
+ return NULL;
}
l = l->next;
}
@@ -338,7 +341,7 @@ gst_jack_request_new_pad (GstElement * element, GstPadTemplate * templ,
count =
GPOINTER_TO_INT (g_hash_table_lookup (port_name_counts,
- this->port_name_prefix));
+ this->port_name_prefix));
g_hash_table_insert (port_name_counts, g_strdup (this->port_name_prefix),
GINT_TO_POINTER (count + 1));
@@ -377,26 +380,26 @@ gst_jack_change_state (GstElement * element)
JACK_DEBUG ("%s: READY", GST_OBJECT_NAME (GST_OBJECT (this)));
if (!this->bin) {
- if (!(this->bin = (GstJackBin *) gst_element_get_managing_bin (element))
- || !GST_IS_JACK_BIN (this->bin)) {
- this->bin = NULL;
- g_warning ("jack element %s needs to be contained in a jack bin.",
- GST_OBJECT_NAME (element));
- return GST_STATE_FAILURE;
- }
-
- /* fixme: verify that all names are unique */
- l = this->pads;
- pads =
- (this->direction ==
- GST_PAD_SRC) ? &this->bin->src_pads : &this->bin->sink_pads;
- while (l) {
- pad = GST_JACK_PAD (l);
- JACK_DEBUG ("%s: appending pad %s:%s to list", GST_OBJECT_NAME (this),
- pad->name, pad->peer_name);
- *pads = g_list_append (*pads, pad);
- l = g_list_next (l);
- }
+ if (!(this->bin = (GstJackBin *) gst_element_get_managing_bin (element))
+ || !GST_IS_JACK_BIN (this->bin)) {
+ this->bin = NULL;
+ g_warning ("jack element %s needs to be contained in a jack bin.",
+ GST_OBJECT_NAME (element));
+ return GST_STATE_FAILURE;
+ }
+
+ /* fixme: verify that all names are unique */
+ l = this->pads;
+ pads =
+ (this->direction ==
+ GST_PAD_SRC) ? &this->bin->src_pads : &this->bin->sink_pads;
+ while (l) {
+ pad = GST_JACK_PAD (l);
+ JACK_DEBUG ("%s: appending pad %s:%s to list", GST_OBJECT_NAME (this),
+ pad->name, pad->peer_name);
+ *pads = g_list_append (*pads, pad);
+ l = g_list_next (l);
+ }
}
break;
@@ -404,18 +407,18 @@ gst_jack_change_state (GstElement * element)
JACK_DEBUG ("%s: PAUSED", GST_OBJECT_NAME (GST_OBJECT (this)));
if (GST_STATE (element) == GST_STATE_READY) {
- /* we're in READY->PAUSED */
- l = this->pads;
- while (l) {
- pad = GST_JACK_PAD (l);
- caps = gst_caps_copy (gst_pad_get_negotiated_caps (pad->pad));
- gst_caps_set_simple (caps,
- "rate", G_TYPE_INT, (int) this->bin->rate,
- "buffer-frames", G_TYPE_INT, (gint) this->bin->nframes, NULL);
- if (gst_pad_try_set_caps (pad->pad, caps) <= 0)
- return GST_STATE_FAILURE;
- l = g_list_next (l);
- }
+ /* we're in READY->PAUSED */
+ l = this->pads;
+ while (l) {
+ pad = GST_JACK_PAD (l);
+ caps = gst_caps_copy (gst_pad_get_negotiated_caps (pad->pad));
+ gst_caps_set_simple (caps,
+ "rate", G_TYPE_INT, (int) this->bin->rate,
+ "buffer-frames", G_TYPE_INT, (gint) this->bin->nframes, NULL);
+ if (gst_pad_try_set_caps (pad->pad, caps) <= 0)
+ return GST_STATE_FAILURE;
+ l = g_list_next (l);
+ }
}
break;
case GST_STATE_PLAYING:
@@ -444,7 +447,7 @@ gst_jack_link (GstPad * pad, const GstCaps * caps)
gst_structure_get_int (structure, "rate", &rate);
gst_structure_get_int (structure, "buffer-frames", &buffer_frames);
if (this->bin && (rate != this->bin->rate ||
- buffer_frames != this->bin->nframes))
+ buffer_frames != this->bin->nframes))
return GST_PAD_LINK_REFUSED;
return GST_PAD_LINK_OK;
@@ -471,17 +474,17 @@ gst_jack_loop (GstElement * element)
buffer = GST_BUFFER (gst_pad_pull (pad->pad));
if (GST_IS_EVENT (buffer)) {
- GstEvent *event = GST_EVENT (buffer);
-
- switch (GST_EVENT_TYPE (buffer)) {
- case GST_EVENT_EOS:
- gst_element_set_eos (element);
- gst_event_unref (event);
- return;
- default:
- gst_pad_event_default (pad->pad, event);
- return;
- }
+ GstEvent *event = GST_EVENT (buffer);
+
+ switch (GST_EVENT_TYPE (buffer)) {
+ case GST_EVENT_EOS:
+ gst_element_set_eos (element);
+ gst_event_unref (event);
+ return;
+ default:
+ gst_pad_event_default (pad->pad, event);
+ return;
+ }
}
/* if the other plugins only give out buffer-frames or less (as
@@ -490,8 +493,8 @@ gst_jack_loop (GstElement * element)
next */
memcpy (pad->data, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer));
if (len != GST_BUFFER_SIZE (buffer))
- memset (pad->data + GST_BUFFER_SIZE (buffer), 0,
- len - GST_BUFFER_SIZE (buffer));
+ memset (pad->data + GST_BUFFER_SIZE (buffer), 0,
+ len - GST_BUFFER_SIZE (buffer));
gst_buffer_unref (buffer);
} else {
@@ -509,15 +512,15 @@ static gboolean
plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "jackbin", GST_RANK_NONE,
- GST_TYPE_JACK_BIN))
+ GST_TYPE_JACK_BIN))
return FALSE;
if (!gst_element_register (plugin, "jacksrc", GST_RANK_NONE,
- GST_TYPE_JACK_SRC))
+ GST_TYPE_JACK_SRC))
return FALSE;
if (!gst_element_register (plugin, "jacksink", GST_RANK_NONE,
- GST_TYPE_JACK_SINK))
+ GST_TYPE_JACK_SINK))
return FALSE;
return TRUE;
diff --git a/ext/jack/gstjackbin.c b/ext/jack/gstjackbin.c
index 9be6e915..c2c49570 100644
--- a/ext/jack/gstjackbin.c
+++ b/ext/jack/gstjackbin.c
@@ -64,8 +64,9 @@ gst_jack_bin_get_type (void)
0,
(GInstanceInitFunc) gst_jack_bin_init,
};
+
jack_bin_type =
- g_type_register_static (GST_TYPE_BIN, "GstJackBin", &jack_bin_info, 0);
+ g_type_register_static (GST_TYPE_BIN, "GstJackBin", &jack_bin_info, 0);
}
return jack_bin_type;
}
@@ -111,17 +112,17 @@ gst_jack_bin_change_state (GstElement * element)
case GST_STATE_NULL:
JACK_DEBUG ("jackbin: NULL state");
if (this->client) {
- JACK_DEBUG ("jackbin: closing client");
- jack_client_close (this->client);
- this->client = NULL;
+ JACK_DEBUG ("jackbin: closing client");
+ jack_client_close (this->client);
+ this->client = NULL;
}
if (_jackbin)
- signal (SIGHUP, SIG_DFL);
+ signal (SIGHUP, SIG_DFL);
_jackbin = NULL;
if (GST_ELEMENT_CLASS (parent_class)->change_state)
- return GST_ELEMENT_CLASS (parent_class)->change_state (element);
+ return GST_ELEMENT_CLASS (parent_class)->change_state (element);
break;
case GST_STATE_READY:
@@ -131,116 +132,116 @@ gst_jack_bin_change_state (GstElement * element)
signal (SIGHUP, sighup_handler);
if (!this->client) {
- if (!(this->client = jack_client_new ("gst-jack"))) {
- g_warning ("jack server not running?");
- return GST_STATE_FAILURE;
- }
-
- gst_scheduler_setup (GST_ELEMENT_SCHED (this));
-
- jack_set_process_callback (this->client, process, this);
- jack_set_sample_rate_callback (this->client, sample_rate, this);
- jack_set_buffer_size_callback (this->client, buffer_size, this);
- this->nframes = jack_get_buffer_size (this->client);
- jack_on_shutdown (this->client, shutdown, this);
+ if (!(this->client = jack_client_new ("gst-jack"))) {
+ g_warning ("jack server not running?");
+ return GST_STATE_FAILURE;
+ }
+
+ gst_scheduler_setup (GST_ELEMENT_SCHED (this));
+
+ jack_set_process_callback (this->client, process, this);
+ jack_set_sample_rate_callback (this->client, sample_rate, this);
+ jack_set_buffer_size_callback (this->client, buffer_size, this);
+ this->nframes = jack_get_buffer_size (this->client);
+ jack_on_shutdown (this->client, shutdown, this);
}
if (GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_OPEN)) {
- l = this->src_pads;
- while (l) {
- JACK_DEBUG ("jackbin: unregistering pad %s:%s",
- GST_JACK_PAD (l)->name, GST_JACK_PAD (l)->peer_name);
- jack_port_unregister (this->client, GST_JACK_PAD (l)->port);
- l = g_list_next (l);
- }
- l = this->sink_pads;
- while (l) {
- JACK_DEBUG ("jackbin: unregistering pad %s:%s",
- GST_JACK_PAD (l)->name, GST_JACK_PAD (l)->peer_name);
- jack_port_unregister (this->client, GST_JACK_PAD (l)->port);
- l = g_list_next (l);
- }
- GST_FLAG_UNSET (GST_OBJECT (this), GST_JACK_OPEN);
-
- if (GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) {
- JACK_DEBUG ("jackbin: deactivating client");
- jack_deactivate (this->client);
- GST_FLAG_UNSET (GST_OBJECT (this), GST_JACK_ACTIVE);
- }
+ l = this->src_pads;
+ while (l) {
+ JACK_DEBUG ("jackbin: unregistering pad %s:%s",
+ GST_JACK_PAD (l)->name, GST_JACK_PAD (l)->peer_name);
+ jack_port_unregister (this->client, GST_JACK_PAD (l)->port);
+ l = g_list_next (l);
+ }
+ l = this->sink_pads;
+ while (l) {
+ JACK_DEBUG ("jackbin: unregistering pad %s:%s",
+ GST_JACK_PAD (l)->name, GST_JACK_PAD (l)->peer_name);
+ jack_port_unregister (this->client, GST_JACK_PAD (l)->port);
+ l = g_list_next (l);
+ }
+ GST_FLAG_UNSET (GST_OBJECT (this), GST_JACK_OPEN);
+
+ if (GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) {
+ JACK_DEBUG ("jackbin: deactivating client");
+ jack_deactivate (this->client);
+ GST_FLAG_UNSET (GST_OBJECT (this), GST_JACK_ACTIVE);
+ }
}
if (GST_ELEMENT_CLASS (parent_class)->change_state)
- return GST_ELEMENT_CLASS (parent_class)->change_state (element);
+ return GST_ELEMENT_CLASS (parent_class)->change_state (element);
break;
case GST_STATE_PAUSED:
JACK_DEBUG ("jackbin: PAUSED");
if (!GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_OPEN)) {
- l = this->src_pads;
- while (l) {
- pad = GST_JACK_PAD (l);
- JACK_DEBUG ("jackbin: registering input port %s (peer %s)", pad->name,
- pad->peer_name);
- pad->port =
- jack_port_register (this->client, pad->name,
- JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput | JackPortIsTerminal, 0);
- l = g_list_next (l);
- }
- l = this->sink_pads;
- while (l) {
- pad = GST_JACK_PAD (l);
- JACK_DEBUG ("jackbin: registering output port %s (peer %s)",
- pad->name, pad->peer_name);
- pad->port =
- jack_port_register (this->client, pad->name,
- JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput | JackPortIsTerminal,
- 0);
- l = g_list_next (l);
- }
-
- /* must activate before connecting */
- if (!GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) {
- JACK_DEBUG ("jackbin: activating client");
- jack_activate (this->client);
- GST_FLAG_SET (GST_OBJECT (this), GST_JACK_ACTIVE);
- }
-
- l = this->src_pads;
- while (l) {
- pad = GST_JACK_PAD (l);
- JACK_DEBUG ("connecting jack port %s to gst jack port %s",
- pad->peer_name, jack_port_name (pad->port));
- if (jack_connect (this->client, pad->peer_name,
- jack_port_name (pad->port))) {
- g_warning ("jackbin: could not connect %s and %s", pad->peer_name,
- jack_port_name (pad->port));
- return GST_STATE_FAILURE;
- }
- l = g_list_next (l);
- }
- l = this->sink_pads;
- while (l) {
- pad = GST_JACK_PAD (l);
- JACK_DEBUG ("connecting gst jack port %s to jack port %s",
- jack_port_name (pad->port), pad->peer_name);
- if (jack_connect (this->client, jack_port_name (pad->port),
- pad->peer_name)) {
- g_warning ("jackbin: could not connect %s and %s", pad->peer_name,
- jack_port_name (pad->port));
- return GST_STATE_FAILURE;
- }
- l = g_list_next (l);
- }
-
- JACK_DEBUG ("jackbin: setting OPEN flag");
- GST_FLAG_SET (GST_OBJECT (this), GST_JACK_OPEN);
-
- if (GST_ELEMENT_CLASS (parent_class)->change_state)
- return GST_ELEMENT_CLASS (parent_class)->change_state (element);
+ l = this->src_pads;
+ while (l) {
+ pad = GST_JACK_PAD (l);
+ JACK_DEBUG ("jackbin: registering input port %s (peer %s)", pad->name,
+ pad->peer_name);
+ pad->port =
+ jack_port_register (this->client, pad->name,
+ JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput | JackPortIsTerminal, 0);
+ l = g_list_next (l);
+ }
+ l = this->sink_pads;
+ while (l) {
+ pad = GST_JACK_PAD (l);
+ JACK_DEBUG ("jackbin: registering output port %s (peer %s)",
+ pad->name, pad->peer_name);
+ pad->port =
+ jack_port_register (this->client, pad->name,
+ JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput | JackPortIsTerminal,
+ 0);
+ l = g_list_next (l);
+ }
+
+ /* must activate before connecting */
+ if (!GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) {
+ JACK_DEBUG ("jackbin: activating client");
+ jack_activate (this->client);
+ GST_FLAG_SET (GST_OBJECT (this), GST_JACK_ACTIVE);
+ }
+
+ l = this->src_pads;
+ while (l) {
+ pad = GST_JACK_PAD (l);
+ JACK_DEBUG ("connecting jack port %s to gst jack port %s",
+ pad->peer_name, jack_port_name (pad->port));
+ if (jack_connect (this->client, pad->peer_name,
+ jack_port_name (pad->port))) {
+ g_warning ("jackbin: could not connect %s and %s", pad->peer_name,
+ jack_port_name (pad->port));
+ return GST_STATE_FAILURE;
+ }
+ l = g_list_next (l);
+ }
+ l = this->sink_pads;
+ while (l) {
+ pad = GST_JACK_PAD (l);
+ JACK_DEBUG ("connecting gst jack port %s to jack port %s",
+ jack_port_name (pad->port), pad->peer_name);
+ if (jack_connect (this->client, jack_port_name (pad->port),
+ pad->peer_name)) {
+ g_warning ("jackbin: could not connect %s and %s", pad->peer_name,
+ jack_port_name (pad->port));
+ return GST_STATE_FAILURE;
+ }
+ l = g_list_next (l);
+ }
+
+ JACK_DEBUG ("jackbin: setting OPEN flag");
+ GST_FLAG_SET (GST_OBJECT (this), GST_JACK_OPEN);
+
+ if (GST_ELEMENT_CLASS (parent_class)->change_state)
+ return GST_ELEMENT_CLASS (parent_class)->change_state (element);
} else {
- if (GST_ELEMENT_CLASS (parent_class)->change_state)
- return GST_ELEMENT_CLASS (parent_class)->change_state (element);
+ if (GST_ELEMENT_CLASS (parent_class)->change_state)
+ return GST_ELEMENT_CLASS (parent_class)->change_state (element);
}
break;
@@ -248,7 +249,7 @@ gst_jack_bin_change_state (GstElement * element)
JACK_DEBUG ("jackbin: PLAYING");
if (GST_ELEMENT_CLASS (parent_class)->change_state)
- return GST_ELEMENT_CLASS (parent_class)->change_state (element);
+ return GST_ELEMENT_CLASS (parent_class)->change_state (element);
break;
}