mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +00:00
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".
This commit is contained in:
parent
256aa83574
commit
9e572ebf00
8 changed files with 80 additions and 45 deletions
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,26 @@
|
||||||
|
2008-08-13 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||||
|
|
||||||
|
* 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".
|
||||||
|
|
||||||
2008-08-13 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
2008-08-13 Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||||
|
|
||||||
Patch by: Laszlo Pandy <laszlok2 at gmail dot com>
|
Patch by: Laszlo Pandy <laszlok2 at gmail dot com>
|
||||||
|
|
|
@ -271,8 +271,8 @@ gst_pulsemixer_change_state (GstElement * element, GstStateChange transition)
|
||||||
|
|
||||||
if (!this->mixer)
|
if (!this->mixer)
|
||||||
this->mixer =
|
this->mixer =
|
||||||
gst_pulsemixer_ctrl_new (this->server, this->device,
|
gst_pulsemixer_ctrl_new (G_OBJECT (this), this->server,
|
||||||
GST_PULSEMIXER_UNKNOWN);
|
this->device, GST_PULSEMIXER_UNKNOWN);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ gst_pulsemixer_ctrl_subscribe_cb (pa_context * context,
|
||||||
gst_pulsemixer_ctrl_source_info_cb, c);
|
gst_pulsemixer_ctrl_source_info_cb, c);
|
||||||
|
|
||||||
if (!o) {
|
if (!o) {
|
||||||
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)));
|
pa_strerror (pa_context_errno (c->context)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ gst_pulsemixer_ctrl_success_cb (pa_context * context, int success,
|
||||||
|
|
||||||
#define CHECK_DEAD_GOTO(c, label) do { \
|
#define CHECK_DEAD_GOTO(c, label) do { \
|
||||||
if (!(c)->context || pa_context_get_state((c)->context) != PA_CONTEXT_READY) { \
|
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; \
|
goto label; \
|
||||||
} \
|
} \
|
||||||
} while(0);
|
} while(0);
|
||||||
|
@ -224,7 +224,7 @@ gst_pulsemixer_ctrl_open (GstPulseMixerCtrl * c)
|
||||||
|
|
||||||
if (!(c->context =
|
if (!(c->context =
|
||||||
pa_context_new (pa_threaded_mainloop_get_api (c->mainloop), name))) {
|
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;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ gst_pulsemixer_ctrl_open (GstPulseMixerCtrl * c)
|
||||||
gst_pulsemixer_ctrl_subscribe_cb, c);
|
gst_pulsemixer_ctrl_subscribe_cb, c);
|
||||||
|
|
||||||
if (pa_context_connect (c->context, c->server, 0, NULL) < 0) {
|
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)));
|
pa_strerror (pa_context_errno (c->context)));
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ gst_pulsemixer_ctrl_open (GstPulseMixerCtrl * c)
|
||||||
pa_threaded_mainloop_wait (c->mainloop);
|
pa_threaded_mainloop_wait (c->mainloop);
|
||||||
|
|
||||||
if (pa_context_get_state (c->context) != PA_CONTEXT_READY) {
|
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)));
|
pa_strerror (pa_context_errno (c->context)));
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
@ -254,7 +254,7 @@ gst_pulsemixer_ctrl_open (GstPulseMixerCtrl * c)
|
||||||
pa_context_subscribe (c->context,
|
pa_context_subscribe (c->context,
|
||||||
PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SOURCE,
|
PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SOURCE,
|
||||||
gst_pulsemixer_ctrl_success_cb, c))) {
|
gst_pulsemixer_ctrl_success_cb, c))) {
|
||||||
GST_WARNING ("Failed to subscribe to events: %s",
|
GST_WARNING_OBJECT (c->object, "Failed to subscribe to events: %s",
|
||||||
pa_strerror (pa_context_errno (c->context)));
|
pa_strerror (pa_context_errno (c->context)));
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ gst_pulsemixer_ctrl_open (GstPulseMixerCtrl * c)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!c->operation_success) {
|
if (!c->operation_success) {
|
||||||
GST_WARNING ("Failed to subscribe to events: %s",
|
GST_WARNING_OBJECT (c->object, "Failed to subscribe to events: %s",
|
||||||
pa_strerror (pa_context_errno (c->context)));
|
pa_strerror (pa_context_errno (c->context)));
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ gst_pulsemixer_ctrl_open (GstPulseMixerCtrl * c)
|
||||||
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))) {
|
||||||
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)));
|
pa_strerror (pa_context_errno (c->context)));
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
@ -293,7 +293,7 @@ gst_pulsemixer_ctrl_open (GstPulseMixerCtrl * c)
|
||||||
|
|
||||||
if (!c->operation_success && (c->type == GST_PULSEMIXER_SINK
|
if (!c->operation_success && (c->type == GST_PULSEMIXER_SINK
|
||||||
|| pa_context_errno (c->context) != PA_ERR_NOENTITY)) {
|
|| pa_context_errno (c->context) != PA_ERR_NOENTITY)) {
|
||||||
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)));
|
pa_strerror (pa_context_errno (c->context)));
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ gst_pulsemixer_ctrl_open (GstPulseMixerCtrl * c)
|
||||||
if (!(o =
|
if (!(o =
|
||||||
pa_context_get_source_info_by_name (c->context, c->device,
|
pa_context_get_source_info_by_name (c->context, c->device,
|
||||||
gst_pulsemixer_ctrl_source_info_cb, c))) {
|
gst_pulsemixer_ctrl_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)));
|
pa_strerror (pa_context_errno (c->context)));
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,7 @@ gst_pulsemixer_ctrl_open (GstPulseMixerCtrl * c)
|
||||||
o = NULL;
|
o = NULL;
|
||||||
|
|
||||||
if (!c->operation_success) {
|
if (!c->operation_success) {
|
||||||
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)));
|
pa_strerror (pa_context_errno (c->context)));
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
@ -380,12 +380,13 @@ gst_pulsemixer_ctrl_close (GstPulseMixerCtrl * c)
|
||||||
}
|
}
|
||||||
|
|
||||||
GstPulseMixerCtrl *
|
GstPulseMixerCtrl *
|
||||||
gst_pulsemixer_ctrl_new (const gchar * server, const gchar * device,
|
gst_pulsemixer_ctrl_new (GObject * object, const gchar * server,
|
||||||
GstPulseMixerType type)
|
const gchar * device, GstPulseMixerType type)
|
||||||
{
|
{
|
||||||
GstPulseMixerCtrl *c = NULL;
|
GstPulseMixerCtrl *c = NULL;
|
||||||
|
|
||||||
c = g_new (GstPulseMixerCtrl, 1);
|
c = g_new (GstPulseMixerCtrl, 1);
|
||||||
|
c->object = g_object_ref (object);
|
||||||
c->tracklist = NULL;
|
c->tracklist = NULL;
|
||||||
c->server = g_strdup (server);
|
c->server = g_strdup (server);
|
||||||
c->device = g_strdup (device);
|
c->device = g_strdup (device);
|
||||||
|
@ -424,6 +425,7 @@ gst_pulsemixer_ctrl_free (GstPulseMixerCtrl * c)
|
||||||
g_free (c->device);
|
g_free (c->device);
|
||||||
g_free (c->name);
|
g_free (c->name);
|
||||||
g_free (c->description);
|
g_free (c->description);
|
||||||
|
g_object_unref (c->object);
|
||||||
g_free (c);
|
g_free (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -452,7 +454,7 @@ gst_pulsemixer_ctrl_timeout_event (pa_mainloop_api * a, pa_time_event * e,
|
||||||
&c->volume, NULL, NULL);
|
&c->volume, NULL, NULL);
|
||||||
|
|
||||||
if (!o)
|
if (!o)
|
||||||
GST_WARNING ("Failed to set device volume: %s",
|
GST_WARNING_OBJECT (c->object, "Failed to set device volume: %s",
|
||||||
pa_strerror (pa_context_errno (c->context)));
|
pa_strerror (pa_context_errno (c->context)));
|
||||||
else
|
else
|
||||||
pa_operation_unref (o);
|
pa_operation_unref (o);
|
||||||
|
@ -469,7 +471,7 @@ gst_pulsemixer_ctrl_timeout_event (pa_mainloop_api * a, pa_time_event * e,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
if (!o)
|
if (!o)
|
||||||
GST_WARNING ("Failed to set device mute: %s",
|
GST_WARNING_OBJECT (c->object, "Failed to set device mute: %s",
|
||||||
pa_strerror (pa_context_errno (c->context)));
|
pa_strerror (pa_context_errno (c->context)));
|
||||||
else
|
else
|
||||||
pa_operation_unref (o);
|
pa_operation_unref (o);
|
||||||
|
|
|
@ -42,6 +42,8 @@ typedef enum
|
||||||
|
|
||||||
struct _GstPulseMixerCtrl
|
struct _GstPulseMixerCtrl
|
||||||
{
|
{
|
||||||
|
GObject *object;
|
||||||
|
|
||||||
GList *tracklist;
|
GList *tracklist;
|
||||||
|
|
||||||
gchar *server, *device;
|
gchar *server, *device;
|
||||||
|
@ -67,7 +69,7 @@ struct _GstPulseMixerCtrl
|
||||||
gboolean update_volume, update_mute;
|
gboolean update_volume, update_mute;
|
||||||
};
|
};
|
||||||
|
|
||||||
GstPulseMixerCtrl *gst_pulsemixer_ctrl_new (const gchar * server,
|
GstPulseMixerCtrl *gst_pulsemixer_ctrl_new (GObject *object, const gchar * server,
|
||||||
const gchar * device, GstPulseMixerType type);
|
const gchar * device, GstPulseMixerType type);
|
||||||
void gst_pulsemixer_ctrl_free (GstPulseMixerCtrl * mixer);
|
void gst_pulsemixer_ctrl_free (GstPulseMixerCtrl * mixer);
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ gst_pulseprobe_open (GstPulseProbe * c)
|
||||||
|
|
||||||
if (!(c->context =
|
if (!(c->context =
|
||||||
pa_context_new (pa_threaded_mainloop_get_api (c->mainloop), name))) {
|
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;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ gst_pulseprobe_open (GstPulseProbe * c)
|
||||||
c);
|
c);
|
||||||
|
|
||||||
if (pa_context_connect (c->context, c->server, 0, NULL) < 0) {
|
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)));
|
pa_strerror (pa_context_errno (c->context)));
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ gst_pulseprobe_open (GstPulseProbe * c)
|
||||||
pa_threaded_mainloop_wait (c->mainloop);
|
pa_threaded_mainloop_wait (c->mainloop);
|
||||||
|
|
||||||
if (pa_context_get_state (c->context) != PA_CONTEXT_READY) {
|
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)));
|
pa_strerror (pa_context_errno (c->context)));
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ unlock_and_fail:
|
||||||
|
|
||||||
#define CHECK_DEAD_GOTO(c, label) do { \
|
#define CHECK_DEAD_GOTO(c, label) do { \
|
||||||
if (!(c)->context || pa_context_get_state((c)->context) != PA_CONTEXT_READY) { \
|
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; \
|
goto label; \
|
||||||
} \
|
} \
|
||||||
} while(0);
|
} while(0);
|
||||||
|
@ -173,7 +173,7 @@ gst_pulseprobe_enumerate (GstPulseProbe * c)
|
||||||
if (!(o =
|
if (!(o =
|
||||||
pa_context_get_sink_info_list (c->context,
|
pa_context_get_sink_info_list (c->context,
|
||||||
gst_pulseprobe_sink_info_cb, c))) {
|
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)));
|
pa_strerror (pa_context_errno (c->context)));
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ gst_pulseprobe_enumerate (GstPulseProbe * c)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!c->operation_success) {
|
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)));
|
pa_strerror (pa_context_errno (c->context)));
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ gst_pulseprobe_enumerate (GstPulseProbe * c)
|
||||||
if (!(o =
|
if (!(o =
|
||||||
pa_context_get_source_info_list (c->context,
|
pa_context_get_source_info_list (c->context,
|
||||||
gst_pulseprobe_source_info_cb, c))) {
|
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)));
|
pa_strerror (pa_context_errno (c->context)));
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ gst_pulseprobe_enumerate (GstPulseProbe * c)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!c->operation_success) {
|
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)));
|
pa_strerror (pa_context_errno (c->context)));
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
@ -258,12 +258,13 @@ gst_pulseprobe_close (GstPulseProbe * c)
|
||||||
}
|
}
|
||||||
|
|
||||||
GstPulseProbe *
|
GstPulseProbe *
|
||||||
gst_pulseprobe_new (GObjectClass * klass, guint prop_id, const gchar * server,
|
gst_pulseprobe_new (GObject * object, GObjectClass * klass, guint prop_id,
|
||||||
gboolean sinks, gboolean sources)
|
const gchar * server, gboolean sinks, gboolean sources)
|
||||||
{
|
{
|
||||||
GstPulseProbe *c = NULL;
|
GstPulseProbe *c = NULL;
|
||||||
|
|
||||||
c = g_new (GstPulseProbe, 1);
|
c = g_new (GstPulseProbe, 1);
|
||||||
|
c->object = g_object_ref (object);
|
||||||
c->server = g_strdup (server);
|
c->server = g_strdup (server);
|
||||||
c->enumerate_sinks = sinks;
|
c->enumerate_sinks = sinks;
|
||||||
c->enumerate_sources = sources;
|
c->enumerate_sources = sources;
|
||||||
|
@ -293,6 +294,8 @@ gst_pulseprobe_free (GstPulseProbe * c)
|
||||||
g_list_foreach (c->devices, (GFunc) g_free, NULL);
|
g_list_foreach (c->devices, (GFunc) g_free, NULL);
|
||||||
g_list_free (c->devices);
|
g_list_free (c->devices);
|
||||||
|
|
||||||
|
g_object_unref (c->object);
|
||||||
|
|
||||||
g_free (c);
|
g_free (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +313,7 @@ gst_pulseprobe_needs_probe (GstPulseProbe * c, guint prop_id,
|
||||||
if (prop_id == c->prop_id)
|
if (prop_id == c->prop_id)
|
||||||
return !c->devices_valid;
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,7 +323,7 @@ gst_pulseprobe_probe_property (GstPulseProbe * c, guint prop_id,
|
||||||
{
|
{
|
||||||
|
|
||||||
if (prop_id != c->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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +342,7 @@ gst_pulseprobe_get_values (GstPulseProbe * c, guint prop_id,
|
||||||
GList *item;
|
GList *item;
|
||||||
|
|
||||||
if (prop_id != c->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 NULL;
|
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));
|
array = g_value_array_new (g_list_length (c->devices));
|
||||||
g_value_init (&value, G_TYPE_STRING);
|
g_value_init (&value, G_TYPE_STRING);
|
||||||
for (item = c->devices; item != NULL; item = item->next) {
|
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_set_string (&value, (const gchar *) item->data);
|
||||||
g_value_array_append (array, &value);
|
g_value_array_append (array, &value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ typedef struct _GstPulseProbe GstPulseProbe;
|
||||||
|
|
||||||
struct _GstPulseProbe
|
struct _GstPulseProbe
|
||||||
{
|
{
|
||||||
|
GObject *object;
|
||||||
gchar *server;
|
gchar *server;
|
||||||
GList *devices;
|
GList *devices;
|
||||||
int devices_valid;
|
int devices_valid;
|
||||||
|
@ -48,8 +49,8 @@ struct _GstPulseProbe
|
||||||
int operation_success;
|
int operation_success;
|
||||||
};
|
};
|
||||||
|
|
||||||
GstPulseProbe *gst_pulseprobe_new (GObjectClass * klass, guint prop_id,
|
GstPulseProbe *gst_pulseprobe_new (GObject *object, GObjectClass * klass,
|
||||||
const gchar * server, gboolean sinks, gboolean sources);
|
guint prop_id, const gchar * server, gboolean sinks, gboolean sources);
|
||||||
void gst_pulseprobe_free (GstPulseProbe * probe);
|
void gst_pulseprobe_free (GstPulseProbe * probe);
|
||||||
|
|
||||||
const GList *gst_pulseprobe_get_properties (GstPulseProbe * probe);
|
const GList *gst_pulseprobe_get_properties (GstPulseProbe * probe);
|
||||||
|
|
|
@ -249,7 +249,7 @@ gst_pulsesink_init (GTypeInstance * instance, gpointer g_class)
|
||||||
e = pa_threaded_mainloop_start (pulsesink->mainloop);
|
e = pa_threaded_mainloop_start (pulsesink->mainloop);
|
||||||
g_assert (e == 0);
|
g_assert (e == 0);
|
||||||
|
|
||||||
pulsesink->probe = gst_pulseprobe_new (G_OBJECT_GET_CLASS (pulsesink), PROP_DEVICE, pulsesink->device, TRUE, FALSE); /* TRUE for sinks, FALSE for sources */
|
pulsesink->probe = gst_pulseprobe_new (G_OBJECT (pulsesink), G_OBJECT_GET_CLASS (pulsesink), PROP_DEVICE, pulsesink->device, TRUE, FALSE); /* TRUE for sinks, FALSE for sources */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -489,14 +489,16 @@ gst_pulsesink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec)
|
||||||
if (!pulsesink->context
|
if (!pulsesink->context
|
||||||
|| pa_context_get_state (pulsesink->context) != PA_CONTEXT_READY) {
|
|| pa_context_get_state (pulsesink->context) != PA_CONTEXT_READY) {
|
||||||
GST_ELEMENT_ERROR (pulsesink, RESOURCE, FAILED, ("Bad context state: %s",
|
GST_ELEMENT_ERROR (pulsesink, RESOURCE, FAILED, ("Bad context state: %s",
|
||||||
pulsesink->context ? pa_strerror (pa_context_errno (pulsesink->
|
pulsesink->
|
||||||
context)) : NULL), (NULL));
|
context ? pa_strerror (pa_context_errno (pulsesink->context)) :
|
||||||
|
NULL), (NULL));
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(pulsesink->stream = pa_stream_new (pulsesink->context,
|
if (!(pulsesink->stream = pa_stream_new (pulsesink->context,
|
||||||
pulsesink->stream_name ? pulsesink->
|
pulsesink->
|
||||||
stream_name : "Playback Stream", &pulsesink->sample_spec,
|
stream_name ? pulsesink->stream_name : "Playback Stream",
|
||||||
|
&pulsesink->sample_spec,
|
||||||
gst_pulse_gst_to_channel_map (&channel_map, spec)))) {
|
gst_pulse_gst_to_channel_map (&channel_map, spec)))) {
|
||||||
GST_ELEMENT_ERROR (pulsesink, RESOURCE, FAILED,
|
GST_ELEMENT_ERROR (pulsesink, RESOURCE, FAILED,
|
||||||
("Failed to create stream: %s",
|
("Failed to create stream: %s",
|
||||||
|
|
|
@ -259,7 +259,7 @@ gst_pulsesrc_init (GTypeInstance * instance, gpointer g_class)
|
||||||
|
|
||||||
pulsesrc->mixer = NULL;
|
pulsesrc->mixer = NULL;
|
||||||
|
|
||||||
pulsesrc->probe = gst_pulseprobe_new (G_OBJECT_GET_CLASS (pulsesrc), PROP_DEVICE, pulsesrc->device, FALSE, TRUE); /* FALSE for sinks, TRUE for sources */
|
pulsesrc->probe = gst_pulseprobe_new (G_OBJECT (pulsesrc), G_OBJECT_GET_CLASS (pulsesrc), PROP_DEVICE, pulsesrc->device, FALSE, TRUE); /* FALSE for sinks, TRUE for sources */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -493,8 +493,9 @@ gst_pulsesrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
|
||||||
if (!pulsesrc->context
|
if (!pulsesrc->context
|
||||||
|| pa_context_get_state (pulsesrc->context) != PA_CONTEXT_READY) {
|
|| pa_context_get_state (pulsesrc->context) != PA_CONTEXT_READY) {
|
||||||
GST_ELEMENT_ERROR (pulsesrc, RESOURCE, FAILED, ("Bad context state: %s",
|
GST_ELEMENT_ERROR (pulsesrc, RESOURCE, FAILED, ("Bad context state: %s",
|
||||||
pulsesrc->context ? pa_strerror (pa_context_errno (pulsesrc->
|
pulsesrc->
|
||||||
context)) : NULL), (NULL));
|
context ? pa_strerror (pa_context_errno (pulsesrc->context)) :
|
||||||
|
NULL), (NULL));
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -666,7 +667,7 @@ gst_pulsesrc_delay (GstAudioSrc * asrc)
|
||||||
goto unlock_and_fail;
|
goto unlock_and_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_WARNING ("Not data while querying latency");
|
GST_WARNING_OBJECT (pulsesrc, "Not data while querying latency");
|
||||||
t = 0;
|
t = 0;
|
||||||
} else if (negative)
|
} else if (negative)
|
||||||
t = 0;
|
t = 0;
|
||||||
|
@ -691,8 +692,8 @@ gst_pulsesrc_change_state (GstElement * element, GstStateChange transition)
|
||||||
|
|
||||||
if (!this->mixer)
|
if (!this->mixer)
|
||||||
this->mixer =
|
this->mixer =
|
||||||
gst_pulsemixer_ctrl_new (this->server, this->device,
|
gst_pulsemixer_ctrl_new (G_OBJECT (this), this->server,
|
||||||
GST_PULSEMIXER_SOURCE);
|
this->device, GST_PULSEMIXER_SOURCE);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue