mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-29 23:32:04 +02:00
api: Replace mute-changed signal with mute notify
Notify is enough, we do not need a separate signal for mute property. This also allows binding this property to some other GObject props.
This commit is contained in:
19
lib/gst/clapper/gstclapper.c
vendored
19
lib/gst/clapper/gstclapper.c
vendored
@@ -117,7 +117,6 @@ enum
|
||||
SIGNAL_WARNING,
|
||||
SIGNAL_VIDEO_DIMENSIONS_CHANGED,
|
||||
SIGNAL_MEDIA_INFO_UPDATED,
|
||||
SIGNAL_MUTE_CHANGED,
|
||||
SIGNAL_VIDEO_DECODER_CHANGED,
|
||||
SIGNAL_AUDIO_DECODER_CHANGED,
|
||||
SIGNAL_LAST
|
||||
@@ -160,6 +159,7 @@ struct _GstClapper
|
||||
|
||||
/* Prevent unnecessary signals emissions */
|
||||
gdouble last_volume;
|
||||
gboolean last_mute;
|
||||
|
||||
GstClapperState app_state;
|
||||
gint buffering;
|
||||
@@ -484,11 +484,6 @@ gst_clapper_class_init (GstClapperClass * klass)
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, 0, NULL,
|
||||
NULL, NULL, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
|
||||
|
||||
signals[SIGNAL_MUTE_CHANGED] =
|
||||
g_signal_new ("mute-changed", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, 0, NULL,
|
||||
NULL, NULL, G_TYPE_NONE, 0, G_TYPE_INVALID);
|
||||
|
||||
signals[SIGNAL_WARNING] =
|
||||
g_signal_new ("warning", G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, 0, NULL,
|
||||
@@ -2950,24 +2945,26 @@ volume_notify_cb (G_GNUC_UNUSED GObject * obj, G_GNUC_UNUSED GParamSpec * pspec,
|
||||
}
|
||||
|
||||
static void
|
||||
mute_changed_dispatch (gpointer user_data)
|
||||
mute_notify_dispatch (gpointer user_data)
|
||||
{
|
||||
GstClapper *clapper = user_data;
|
||||
|
||||
if (clapper->inhibit_sigs)
|
||||
return;
|
||||
|
||||
g_signal_emit (clapper, signals[SIGNAL_MUTE_CHANGED], 0);
|
||||
g_object_notify_by_pspec (G_OBJECT (clapper), param_specs[PROP_MUTE]);
|
||||
}
|
||||
|
||||
static void
|
||||
mute_notify_cb (G_GNUC_UNUSED GObject * obj, G_GNUC_UNUSED GParamSpec * pspec,
|
||||
GstClapper * self)
|
||||
{
|
||||
if (g_signal_handler_find (self, G_SIGNAL_MATCH_ID,
|
||||
signals[SIGNAL_MUTE_CHANGED], 0, NULL, NULL, NULL) != 0) {
|
||||
gboolean mute = gst_clapper_get_mute (self);
|
||||
|
||||
if (self->last_mute != mute) {
|
||||
self->last_mute = mute;
|
||||
gst_clapper_signal_dispatcher_dispatch (self->signal_dispatcher, self,
|
||||
mute_changed_dispatch, g_object_ref (self),
|
||||
mute_notify_dispatch, g_object_ref (self),
|
||||
(GDestroyNotify) g_object_unref);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user