pulse: small cleanups

Add some debug info
Fix the state changes
This commit is contained in:
Wim Taymans 2009-09-08 19:34:09 +02:00
parent fe2d8bdc64
commit ca7bec0d65
3 changed files with 21 additions and 5 deletions

View file

@ -252,6 +252,7 @@ static GstStateChangeReturn
gst_pulsemixer_change_state (GstElement * element, GstStateChange transition) gst_pulsemixer_change_state (GstElement * element, GstStateChange transition)
{ {
GstPulseMixer *this = GST_PULSEMIXER (element); GstPulseMixer *this = GST_PULSEMIXER (element);
GstStateChangeReturn res;
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:
@ -260,19 +261,22 @@ gst_pulsemixer_change_state (GstElement * element, GstStateChange transition)
gst_pulsemixer_ctrl_new (G_OBJECT (this), this->server, gst_pulsemixer_ctrl_new (G_OBJECT (this), this->server,
this->device, GST_PULSEMIXER_UNKNOWN); this->device, GST_PULSEMIXER_UNKNOWN);
break; break;
default:
;
}
res = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
switch (transition) {
case GST_STATE_CHANGE_READY_TO_NULL: case GST_STATE_CHANGE_READY_TO_NULL:
if (this->mixer) { if (this->mixer) {
gst_pulsemixer_ctrl_free (this->mixer); gst_pulsemixer_ctrl_free (this->mixer);
this->mixer = NULL; this->mixer = NULL;
} }
break; break;
default: default:
; ;
} }
if (GST_ELEMENT_CLASS (parent_class)->change_state) return res;
return GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
return GST_STATE_CHANGE_SUCCESS;
} }

View file

@ -213,6 +213,8 @@ gst_pulsemixer_ctrl_open (GstPulseMixerCtrl * c)
g_assert (c); g_assert (c);
GST_DEBUG_OBJECT (c->object, "ctrl open");
c->mainloop = pa_threaded_mainloop_new (); c->mainloop = pa_threaded_mainloop_new ();
g_assert (c->mainloop); g_assert (c->mainloop);
@ -275,6 +277,7 @@ gst_pulsemixer_ctrl_open (GstPulseMixerCtrl * c)
/* Get sink info */ /* Get sink info */
if (c->type == GST_PULSEMIXER_UNKNOWN || c->type == GST_PULSEMIXER_SINK) { if (c->type == GST_PULSEMIXER_UNKNOWN || c->type == GST_PULSEMIXER_SINK) {
GST_WARNING_OBJECT (c->object, "Get info for '%s'", c->device);
if (!(o = if (!(o =
pa_context_get_sink_info_by_name (c->context, c->device, pa_context_get_sink_info_by_name (c->context, c->device,
gst_pulsemixer_ctrl_sink_info_cb, c))) { gst_pulsemixer_ctrl_sink_info_cb, c))) {
@ -353,6 +356,8 @@ gst_pulsemixer_ctrl_close (GstPulseMixerCtrl * c)
{ {
g_assert (c); g_assert (c);
GST_DEBUG_OBJECT (c->object, "ctrl close");
if (c->mainloop) if (c->mainloop)
pa_threaded_mainloop_stop (c->mainloop); pa_threaded_mainloop_stop (c->mainloop);
@ -386,6 +391,7 @@ gst_pulsemixer_ctrl_new (GObject * object, const gchar * server,
{ {
GstPulseMixerCtrl *c = NULL; GstPulseMixerCtrl *c = NULL;
GST_DEBUG_OBJECT (object, "new mixer ctrl for %s", device);
c = g_new (GstPulseMixerCtrl, 1); c = g_new (GstPulseMixerCtrl, 1);
c->object = g_object_ref (object); c->object = g_object_ref (object);
c->tracklist = NULL; c->tracklist = NULL;

View file

@ -103,6 +103,8 @@ gst_pulseprobe_open (GstPulseProbe * c)
g_assert (c); g_assert (c);
GST_DEBUG_OBJECT (c->object, "probe open");
c->mainloop = pa_threaded_mainloop_new (); c->mainloop = pa_threaded_mainloop_new ();
g_assert (c->mainloop); g_assert (c->mainloop);
@ -184,6 +186,8 @@ gst_pulseprobe_enumerate (GstPulseProbe * c)
{ {
pa_operation *o = NULL; pa_operation *o = NULL;
GST_DEBUG_OBJECT (c->object, "probe enumerate");
pa_threaded_mainloop_lock (c->mainloop); pa_threaded_mainloop_lock (c->mainloop);
if (c->enumerate_sinks) { if (c->enumerate_sinks) {
@ -268,6 +272,8 @@ gst_pulseprobe_close (GstPulseProbe * c)
{ {
g_assert (c); g_assert (c);
GST_DEBUG_OBJECT (c->object, "probe close");
if (c->mainloop) if (c->mainloop)
pa_threaded_mainloop_stop (c->mainloop); pa_threaded_mainloop_stop (c->mainloop);