don't mix tabs and spaces

Original commit message from CVS:
don't mix tabs and spaces
This commit is contained in:
Thomas Vander Stichele 2004-03-15 19:32:27 +00:00 committed by Tim-Philipp Müller
parent 44f714a5fd
commit f88ab240e5
2 changed files with 155 additions and 151 deletions

View file

@ -106,8 +106,9 @@ gst_jack_get_type (void)
0, 0,
NULL, NULL,
}; };
jack_type = 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; return jack_type;
} }
@ -129,8 +130,9 @@ gst_jack_sink_get_type (void)
0, 0,
(GInstanceInitFunc) gst_jack_init, (GInstanceInitFunc) gst_jack_init,
}; };
jack_type = 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; return jack_type;
} }
@ -152,8 +154,9 @@ gst_jack_src_get_type (void)
0, 0,
(GInstanceInitFunc) gst_jack_init, (GInstanceInitFunc) gst_jack_init,
}; };
jack_type = 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; return jack_type;
} }
@ -240,7 +243,7 @@ gst_jack_set_property (GObject * object, guint prop_id, const GValue * value,
switch (prop_id) { switch (prop_id) {
case ARG_PORT_NAME_PREFIX: case ARG_PORT_NAME_PREFIX:
if (this->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)); this->port_name_prefix = g_strdup (g_value_get_string (value));
break; break;
default: default:
@ -318,8 +321,8 @@ gst_jack_request_new_pad (GstElement * element, GstPadTemplate * templ,
l = *pad_list; l = *pad_list;
while (l) { while (l) {
if (strcmp (GST_JACK_PAD (l)->name, name) == 0) { if (strcmp (GST_JACK_PAD (l)->name, name) == 0) {
g_warning ("requested port name %s already in use.", name); g_warning ("requested port name %s already in use.", name);
return NULL; return NULL;
} }
l = l->next; l = l->next;
} }
@ -338,7 +341,7 @@ gst_jack_request_new_pad (GstElement * element, GstPadTemplate * templ,
count = count =
GPOINTER_TO_INT (g_hash_table_lookup (port_name_counts, 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), g_hash_table_insert (port_name_counts, g_strdup (this->port_name_prefix),
GINT_TO_POINTER (count + 1)); 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))); JACK_DEBUG ("%s: READY", GST_OBJECT_NAME (GST_OBJECT (this)));
if (!this->bin) { if (!this->bin) {
if (!(this->bin = (GstJackBin *) gst_element_get_managing_bin (element)) if (!(this->bin = (GstJackBin *) gst_element_get_managing_bin (element))
|| !GST_IS_JACK_BIN (this->bin)) { || !GST_IS_JACK_BIN (this->bin)) {
this->bin = NULL; this->bin = NULL;
g_warning ("jack element %s needs to be contained in a jack bin.", g_warning ("jack element %s needs to be contained in a jack bin.",
GST_OBJECT_NAME (element)); GST_OBJECT_NAME (element));
return GST_STATE_FAILURE; return GST_STATE_FAILURE;
} }
/* fixme: verify that all names are unique */ /* fixme: verify that all names are unique */
l = this->pads; l = this->pads;
pads = pads =
(this->direction == (this->direction ==
GST_PAD_SRC) ? &this->bin->src_pads : &this->bin->sink_pads; GST_PAD_SRC) ? &this->bin->src_pads : &this->bin->sink_pads;
while (l) { while (l) {
pad = GST_JACK_PAD (l); pad = GST_JACK_PAD (l);
JACK_DEBUG ("%s: appending pad %s:%s to list", GST_OBJECT_NAME (this), JACK_DEBUG ("%s: appending pad %s:%s to list", GST_OBJECT_NAME (this),
pad->name, pad->peer_name); pad->name, pad->peer_name);
*pads = g_list_append (*pads, pad); *pads = g_list_append (*pads, pad);
l = g_list_next (l); l = g_list_next (l);
} }
} }
break; break;
@ -404,18 +407,18 @@ gst_jack_change_state (GstElement * element)
JACK_DEBUG ("%s: PAUSED", GST_OBJECT_NAME (GST_OBJECT (this))); JACK_DEBUG ("%s: PAUSED", GST_OBJECT_NAME (GST_OBJECT (this)));
if (GST_STATE (element) == GST_STATE_READY) { if (GST_STATE (element) == GST_STATE_READY) {
/* we're in READY->PAUSED */ /* we're in READY->PAUSED */
l = this->pads; l = this->pads;
while (l) { while (l) {
pad = GST_JACK_PAD (l); pad = GST_JACK_PAD (l);
caps = gst_caps_copy (gst_pad_get_negotiated_caps (pad->pad)); caps = gst_caps_copy (gst_pad_get_negotiated_caps (pad->pad));
gst_caps_set_simple (caps, gst_caps_set_simple (caps,
"rate", G_TYPE_INT, (int) this->bin->rate, "rate", G_TYPE_INT, (int) this->bin->rate,
"buffer-frames", G_TYPE_INT, (gint) this->bin->nframes, NULL); "buffer-frames", G_TYPE_INT, (gint) this->bin->nframes, NULL);
if (gst_pad_try_set_caps (pad->pad, caps) <= 0) if (gst_pad_try_set_caps (pad->pad, caps) <= 0)
return GST_STATE_FAILURE; return GST_STATE_FAILURE;
l = g_list_next (l); l = g_list_next (l);
} }
} }
break; break;
case GST_STATE_PLAYING: 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, "rate", &rate);
gst_structure_get_int (structure, "buffer-frames", &buffer_frames); gst_structure_get_int (structure, "buffer-frames", &buffer_frames);
if (this->bin && (rate != this->bin->rate || 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_REFUSED;
return GST_PAD_LINK_OK; return GST_PAD_LINK_OK;
@ -471,17 +474,17 @@ gst_jack_loop (GstElement * element)
buffer = GST_BUFFER (gst_pad_pull (pad->pad)); buffer = GST_BUFFER (gst_pad_pull (pad->pad));
if (GST_IS_EVENT (buffer)) { if (GST_IS_EVENT (buffer)) {
GstEvent *event = GST_EVENT (buffer); GstEvent *event = GST_EVENT (buffer);
switch (GST_EVENT_TYPE (buffer)) { switch (GST_EVENT_TYPE (buffer)) {
case GST_EVENT_EOS: case GST_EVENT_EOS:
gst_element_set_eos (element); gst_element_set_eos (element);
gst_event_unref (event); gst_event_unref (event);
return; return;
default: default:
gst_pad_event_default (pad->pad, event); gst_pad_event_default (pad->pad, event);
return; return;
} }
} }
/* if the other plugins only give out buffer-frames or less (as /* if the other plugins only give out buffer-frames or less (as
@ -490,8 +493,8 @@ gst_jack_loop (GstElement * element)
next */ next */
memcpy (pad->data, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer)); memcpy (pad->data, GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer));
if (len != GST_BUFFER_SIZE (buffer)) if (len != GST_BUFFER_SIZE (buffer))
memset (pad->data + GST_BUFFER_SIZE (buffer), 0, memset (pad->data + GST_BUFFER_SIZE (buffer), 0,
len - GST_BUFFER_SIZE (buffer)); len - GST_BUFFER_SIZE (buffer));
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
} else { } else {
@ -509,15 +512,15 @@ static gboolean
plugin_init (GstPlugin * plugin) plugin_init (GstPlugin * plugin)
{ {
if (!gst_element_register (plugin, "jackbin", GST_RANK_NONE, if (!gst_element_register (plugin, "jackbin", GST_RANK_NONE,
GST_TYPE_JACK_BIN)) GST_TYPE_JACK_BIN))
return FALSE; return FALSE;
if (!gst_element_register (plugin, "jacksrc", GST_RANK_NONE, if (!gst_element_register (plugin, "jacksrc", GST_RANK_NONE,
GST_TYPE_JACK_SRC)) GST_TYPE_JACK_SRC))
return FALSE; return FALSE;
if (!gst_element_register (plugin, "jacksink", GST_RANK_NONE, if (!gst_element_register (plugin, "jacksink", GST_RANK_NONE,
GST_TYPE_JACK_SINK)) GST_TYPE_JACK_SINK))
return FALSE; return FALSE;
return TRUE; return TRUE;

View file

@ -64,8 +64,9 @@ gst_jack_bin_get_type (void)
0, 0,
(GInstanceInitFunc) gst_jack_bin_init, (GInstanceInitFunc) gst_jack_bin_init,
}; };
jack_bin_type = 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; return jack_bin_type;
} }
@ -111,17 +112,17 @@ gst_jack_bin_change_state (GstElement * element)
case GST_STATE_NULL: case GST_STATE_NULL:
JACK_DEBUG ("jackbin: NULL state"); JACK_DEBUG ("jackbin: NULL state");
if (this->client) { if (this->client) {
JACK_DEBUG ("jackbin: closing client"); JACK_DEBUG ("jackbin: closing client");
jack_client_close (this->client); jack_client_close (this->client);
this->client = NULL; this->client = NULL;
} }
if (_jackbin) if (_jackbin)
signal (SIGHUP, SIG_DFL); signal (SIGHUP, SIG_DFL);
_jackbin = NULL; _jackbin = NULL;
if (GST_ELEMENT_CLASS (parent_class)->change_state) 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; break;
case GST_STATE_READY: case GST_STATE_READY:
@ -131,116 +132,116 @@ gst_jack_bin_change_state (GstElement * element)
signal (SIGHUP, sighup_handler); signal (SIGHUP, sighup_handler);
if (!this->client) { if (!this->client) {
if (!(this->client = jack_client_new ("gst-jack"))) { if (!(this->client = jack_client_new ("gst-jack"))) {
g_warning ("jack server not running?"); g_warning ("jack server not running?");
return GST_STATE_FAILURE; return GST_STATE_FAILURE;
} }
gst_scheduler_setup (GST_ELEMENT_SCHED (this)); gst_scheduler_setup (GST_ELEMENT_SCHED (this));
jack_set_process_callback (this->client, process, this); jack_set_process_callback (this->client, process, this);
jack_set_sample_rate_callback (this->client, sample_rate, this); jack_set_sample_rate_callback (this->client, sample_rate, this);
jack_set_buffer_size_callback (this->client, buffer_size, this); jack_set_buffer_size_callback (this->client, buffer_size, this);
this->nframes = jack_get_buffer_size (this->client); this->nframes = jack_get_buffer_size (this->client);
jack_on_shutdown (this->client, shutdown, this); jack_on_shutdown (this->client, shutdown, this);
} }
if (GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_OPEN)) { if (GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_OPEN)) {
l = this->src_pads; l = this->src_pads;
while (l) { while (l) {
JACK_DEBUG ("jackbin: unregistering pad %s:%s", JACK_DEBUG ("jackbin: unregistering pad %s:%s",
GST_JACK_PAD (l)->name, GST_JACK_PAD (l)->peer_name); GST_JACK_PAD (l)->name, GST_JACK_PAD (l)->peer_name);
jack_port_unregister (this->client, GST_JACK_PAD (l)->port); jack_port_unregister (this->client, GST_JACK_PAD (l)->port);
l = g_list_next (l); l = g_list_next (l);
} }
l = this->sink_pads; l = this->sink_pads;
while (l) { while (l) {
JACK_DEBUG ("jackbin: unregistering pad %s:%s", JACK_DEBUG ("jackbin: unregistering pad %s:%s",
GST_JACK_PAD (l)->name, GST_JACK_PAD (l)->peer_name); GST_JACK_PAD (l)->name, GST_JACK_PAD (l)->peer_name);
jack_port_unregister (this->client, GST_JACK_PAD (l)->port); jack_port_unregister (this->client, GST_JACK_PAD (l)->port);
l = g_list_next (l); l = g_list_next (l);
} }
GST_FLAG_UNSET (GST_OBJECT (this), GST_JACK_OPEN); GST_FLAG_UNSET (GST_OBJECT (this), GST_JACK_OPEN);
if (GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) { if (GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) {
JACK_DEBUG ("jackbin: deactivating client"); JACK_DEBUG ("jackbin: deactivating client");
jack_deactivate (this->client); jack_deactivate (this->client);
GST_FLAG_UNSET (GST_OBJECT (this), GST_JACK_ACTIVE); GST_FLAG_UNSET (GST_OBJECT (this), GST_JACK_ACTIVE);
} }
} }
if (GST_ELEMENT_CLASS (parent_class)->change_state) 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; break;
case GST_STATE_PAUSED: case GST_STATE_PAUSED:
JACK_DEBUG ("jackbin: PAUSED"); JACK_DEBUG ("jackbin: PAUSED");
if (!GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_OPEN)) { if (!GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_OPEN)) {
l = this->src_pads; l = this->src_pads;
while (l) { while (l) {
pad = GST_JACK_PAD (l); pad = GST_JACK_PAD (l);
JACK_DEBUG ("jackbin: registering input port %s (peer %s)", pad->name, JACK_DEBUG ("jackbin: registering input port %s (peer %s)", pad->name,
pad->peer_name); pad->peer_name);
pad->port = pad->port =
jack_port_register (this->client, pad->name, jack_port_register (this->client, pad->name,
JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput | JackPortIsTerminal, 0); JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput | JackPortIsTerminal, 0);
l = g_list_next (l); l = g_list_next (l);
} }
l = this->sink_pads; l = this->sink_pads;
while (l) { while (l) {
pad = GST_JACK_PAD (l); pad = GST_JACK_PAD (l);
JACK_DEBUG ("jackbin: registering output port %s (peer %s)", JACK_DEBUG ("jackbin: registering output port %s (peer %s)",
pad->name, pad->peer_name); pad->name, pad->peer_name);
pad->port = pad->port =
jack_port_register (this->client, pad->name, jack_port_register (this->client, pad->name,
JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput | JackPortIsTerminal, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput | JackPortIsTerminal,
0); 0);
l = g_list_next (l); l = g_list_next (l);
} }
/* must activate before connecting */ /* must activate before connecting */
if (!GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) { if (!GST_FLAG_IS_SET (GST_OBJECT (this), GST_JACK_ACTIVE)) {
JACK_DEBUG ("jackbin: activating client"); JACK_DEBUG ("jackbin: activating client");
jack_activate (this->client); jack_activate (this->client);
GST_FLAG_SET (GST_OBJECT (this), GST_JACK_ACTIVE); GST_FLAG_SET (GST_OBJECT (this), GST_JACK_ACTIVE);
} }
l = this->src_pads; l = this->src_pads;
while (l) { while (l) {
pad = GST_JACK_PAD (l); pad = GST_JACK_PAD (l);
JACK_DEBUG ("connecting jack port %s to gst jack port %s", JACK_DEBUG ("connecting jack port %s to gst jack port %s",
pad->peer_name, jack_port_name (pad->port)); pad->peer_name, jack_port_name (pad->port));
if (jack_connect (this->client, pad->peer_name, if (jack_connect (this->client, pad->peer_name,
jack_port_name (pad->port))) { jack_port_name (pad->port))) {
g_warning ("jackbin: could not connect %s and %s", pad->peer_name, g_warning ("jackbin: could not connect %s and %s", pad->peer_name,
jack_port_name (pad->port)); jack_port_name (pad->port));
return GST_STATE_FAILURE; return GST_STATE_FAILURE;
} }
l = g_list_next (l); l = g_list_next (l);
} }
l = this->sink_pads; l = this->sink_pads;
while (l) { while (l) {
pad = GST_JACK_PAD (l); pad = GST_JACK_PAD (l);
JACK_DEBUG ("connecting gst jack port %s to jack port %s", JACK_DEBUG ("connecting gst jack port %s to jack port %s",
jack_port_name (pad->port), pad->peer_name); jack_port_name (pad->port), pad->peer_name);
if (jack_connect (this->client, jack_port_name (pad->port), if (jack_connect (this->client, jack_port_name (pad->port),
pad->peer_name)) { pad->peer_name)) {
g_warning ("jackbin: could not connect %s and %s", pad->peer_name, g_warning ("jackbin: could not connect %s and %s", pad->peer_name,
jack_port_name (pad->port)); jack_port_name (pad->port));
return GST_STATE_FAILURE; return GST_STATE_FAILURE;
} }
l = g_list_next (l); l = g_list_next (l);
} }
JACK_DEBUG ("jackbin: setting OPEN flag"); JACK_DEBUG ("jackbin: setting OPEN flag");
GST_FLAG_SET (GST_OBJECT (this), GST_JACK_OPEN); GST_FLAG_SET (GST_OBJECT (this), GST_JACK_OPEN);
if (GST_ELEMENT_CLASS (parent_class)->change_state) 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);
} else { } else {
if (GST_ELEMENT_CLASS (parent_class)->change_state) 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; break;
@ -248,7 +249,7 @@ gst_jack_bin_change_state (GstElement * element)
JACK_DEBUG ("jackbin: PLAYING"); JACK_DEBUG ("jackbin: PLAYING");
if (GST_ELEMENT_CLASS (parent_class)->change_state) 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; break;
} }