summaryrefslogtreecommitdiffstats
path: root/ext/pulse/pulseprobe.c
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-08-13 12:34:13 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-08-13 12:34:13 +0000
commit9e572ebf0065421567134e942d24ae26f0cee55d (patch)
tree67fee78fbaa9b24f6fc36b13446463abc9d4efcd /ext/pulse/pulseprobe.c
parent256aa83574bc0f7cc666f449860570bef5f26275 (diff)
ext/pulse/: Improve debugging a bit by including the parent object in pulsemixerctrl and pulseprobe objects and using...
Original commit message from CVS: * ext/pulse/pulsemixer.c: (gst_pulsemixer_change_state): * ext/pulse/pulsemixerctrl.c: (gst_pulsemixer_ctrl_subscribe_cb), (gst_pulsemixer_ctrl_open), (gst_pulsemixer_ctrl_new), (gst_pulsemixer_ctrl_free), (gst_pulsemixer_ctrl_timeout_event): * ext/pulse/pulsemixerctrl.h: * ext/pulse/pulseprobe.c: (gst_pulseprobe_open), (gst_pulseprobe_enumerate), (gst_pulseprobe_new), (gst_pulseprobe_free), (gst_pulseprobe_needs_probe), (gst_pulseprobe_probe_property), (gst_pulseprobe_get_values): * ext/pulse/pulseprobe.h: * ext/pulse/pulsesink.c: (gst_pulsesink_init): * ext/pulse/pulsesrc.c: (gst_pulsesrc_init), (gst_pulsesrc_delay), (gst_pulsesrc_change_state): Improve debugging a bit by including the parent object in pulsemixerctrl and pulseprobe objects and using GST_WARNING_OBJECT instead of GST_WARNING. Use the parent GObject subclass instead of a random struct as GObject parameter for G_OBJECT_WARN_INVALID_PROPERTY_ID. This fixes a crash when probing for another property than "device".
Diffstat (limited to 'ext/pulse/pulseprobe.c')
-rw-r--r--ext/pulse/pulseprobe.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/ext/pulse/pulseprobe.c b/ext/pulse/pulseprobe.c
index 97f3c7c7..5d2e0b7e 100644
--- a/ext/pulse/pulseprobe.c
+++ b/ext/pulse/pulseprobe.c
@@ -114,7 +114,7 @@ gst_pulseprobe_open (GstPulseProbe * c)
if (!(c->context =
pa_context_new (pa_threaded_mainloop_get_api (c->mainloop), name))) {
- GST_WARNING ("Failed to create context");
+ GST_WARNING_OBJECT (c->object, "Failed to create context");
goto unlock_and_fail;
}
@@ -122,7 +122,7 @@ gst_pulseprobe_open (GstPulseProbe * c)
c);
if (pa_context_connect (c->context, c->server, 0, NULL) < 0) {
- GST_WARNING ("Failed to connect context: %s",
+ GST_WARNING_OBJECT (c->object, "Failed to connect context: %s",
pa_strerror (pa_context_errno (c->context)));
goto unlock_and_fail;
}
@@ -131,7 +131,7 @@ gst_pulseprobe_open (GstPulseProbe * c)
pa_threaded_mainloop_wait (c->mainloop);
if (pa_context_get_state (c->context) != PA_CONTEXT_READY) {
- GST_WARNING ("Failed to connect context: %s",
+ GST_WARNING_OBJECT (c->object, "Failed to connect context: %s",
pa_strerror (pa_context_errno (c->context)));
goto unlock_and_fail;
}
@@ -155,7 +155,7 @@ unlock_and_fail:
#define CHECK_DEAD_GOTO(c, label) do { \
if (!(c)->context || pa_context_get_state((c)->context) != PA_CONTEXT_READY) { \
- GST_WARNING("Not connected: %s", (c)->context ? pa_strerror(pa_context_errno((c)->context)) : "NULL"); \
+ GST_WARNING_OBJECT((c)->object, "Not connected: %s", (c)->context ? pa_strerror(pa_context_errno((c)->context)) : "NULL"); \
goto label; \
} \
} while(0);
@@ -173,7 +173,7 @@ gst_pulseprobe_enumerate (GstPulseProbe * c)
if (!(o =
pa_context_get_sink_info_list (c->context,
gst_pulseprobe_sink_info_cb, c))) {
- GST_WARNING ("Failed to get sink info: %s",
+ GST_WARNING_OBJECT (c->object, "Failed to get sink info: %s",
pa_strerror (pa_context_errno (c->context)));
goto unlock_and_fail;
}
@@ -185,7 +185,7 @@ gst_pulseprobe_enumerate (GstPulseProbe * c)
}
if (!c->operation_success) {
- GST_WARNING ("Failed to get sink info: %s",
+ GST_WARNING_OBJECT (c->object, "Failed to get sink info: %s",
pa_strerror (pa_context_errno (c->context)));
goto unlock_and_fail;
}
@@ -200,7 +200,7 @@ gst_pulseprobe_enumerate (GstPulseProbe * c)
if (!(o =
pa_context_get_source_info_list (c->context,
gst_pulseprobe_source_info_cb, c))) {
- GST_WARNING ("Failed to get source info: %s",
+ GST_WARNING_OBJECT (c->object, "Failed to get source info: %s",
pa_strerror (pa_context_errno (c->context)));
goto unlock_and_fail;
}
@@ -212,7 +212,7 @@ gst_pulseprobe_enumerate (GstPulseProbe * c)
}
if (!c->operation_success) {
- GST_WARNING ("Failed to get sink info: %s",
+ GST_WARNING_OBJECT (c->object, "Failed to get sink info: %s",
pa_strerror (pa_context_errno (c->context)));
goto unlock_and_fail;
}
@@ -258,12 +258,13 @@ gst_pulseprobe_close (GstPulseProbe * c)
}
GstPulseProbe *
-gst_pulseprobe_new (GObjectClass * klass, guint prop_id, const gchar * server,
- gboolean sinks, gboolean sources)
+gst_pulseprobe_new (GObject * object, GObjectClass * klass, guint prop_id,
+ const gchar * server, gboolean sinks, gboolean sources)
{
GstPulseProbe *c = NULL;
c = g_new (GstPulseProbe, 1);
+ c->object = g_object_ref (object);
c->server = g_strdup (server);
c->enumerate_sinks = sinks;
c->enumerate_sources = sources;
@@ -293,6 +294,8 @@ gst_pulseprobe_free (GstPulseProbe * c)
g_list_foreach (c->devices, (GFunc) g_free, NULL);
g_list_free (c->devices);
+ g_object_unref (c->object);
+
g_free (c);
}
@@ -310,7 +313,7 @@ gst_pulseprobe_needs_probe (GstPulseProbe * c, guint prop_id,
if (prop_id == c->prop_id)
return !c->devices_valid;
- G_OBJECT_WARN_INVALID_PROPERTY_ID (c, prop_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (c->object, prop_id, pspec);
return FALSE;
}
@@ -320,7 +323,7 @@ gst_pulseprobe_probe_property (GstPulseProbe * c, guint prop_id,
{
if (prop_id != c->prop_id) {
- G_OBJECT_WARN_INVALID_PROPERTY_ID (c, prop_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (c->object, prop_id, pspec);
return;
}
@@ -339,7 +342,7 @@ gst_pulseprobe_get_values (GstPulseProbe * c, guint prop_id,
GList *item;
if (prop_id != c->prop_id) {
- G_OBJECT_WARN_INVALID_PROPERTY_ID (c, prop_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (c->object, prop_id, pspec);
return NULL;
}
@@ -349,7 +352,8 @@ gst_pulseprobe_get_values (GstPulseProbe * c, guint prop_id,
array = g_value_array_new (g_list_length (c->devices));
g_value_init (&value, G_TYPE_STRING);
for (item = c->devices; item != NULL; item = item->next) {
- GST_WARNING ("device found: %s", (const gchar *) item->data);
+ GST_WARNING_OBJECT (c->object, "device found: %s",
+ (const gchar *) item->data);
g_value_set_string (&value, (const gchar *) item->data);
g_value_array_append (array, &value);
}