mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 16:31:58 +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_WARNING,
|
||||||
SIGNAL_VIDEO_DIMENSIONS_CHANGED,
|
SIGNAL_VIDEO_DIMENSIONS_CHANGED,
|
||||||
SIGNAL_MEDIA_INFO_UPDATED,
|
SIGNAL_MEDIA_INFO_UPDATED,
|
||||||
SIGNAL_MUTE_CHANGED,
|
|
||||||
SIGNAL_VIDEO_DECODER_CHANGED,
|
SIGNAL_VIDEO_DECODER_CHANGED,
|
||||||
SIGNAL_AUDIO_DECODER_CHANGED,
|
SIGNAL_AUDIO_DECODER_CHANGED,
|
||||||
SIGNAL_LAST
|
SIGNAL_LAST
|
||||||
@@ -160,6 +159,7 @@ struct _GstClapper
|
|||||||
|
|
||||||
/* Prevent unnecessary signals emissions */
|
/* Prevent unnecessary signals emissions */
|
||||||
gdouble last_volume;
|
gdouble last_volume;
|
||||||
|
gboolean last_mute;
|
||||||
|
|
||||||
GstClapperState app_state;
|
GstClapperState app_state;
|
||||||
gint buffering;
|
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,
|
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);
|
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] =
|
signals[SIGNAL_WARNING] =
|
||||||
g_signal_new ("warning", G_TYPE_FROM_CLASS (klass),
|
g_signal_new ("warning", G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, 0, NULL,
|
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
|
static void
|
||||||
mute_changed_dispatch (gpointer user_data)
|
mute_notify_dispatch (gpointer user_data)
|
||||||
{
|
{
|
||||||
GstClapper *clapper = user_data;
|
GstClapper *clapper = user_data;
|
||||||
|
|
||||||
if (clapper->inhibit_sigs)
|
if (clapper->inhibit_sigs)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_signal_emit (clapper, signals[SIGNAL_MUTE_CHANGED], 0);
|
g_object_notify_by_pspec (G_OBJECT (clapper), param_specs[PROP_MUTE]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mute_notify_cb (G_GNUC_UNUSED GObject * obj, G_GNUC_UNUSED GParamSpec * pspec,
|
mute_notify_cb (G_GNUC_UNUSED GObject * obj, G_GNUC_UNUSED GParamSpec * pspec,
|
||||||
GstClapper * self)
|
GstClapper * self)
|
||||||
{
|
{
|
||||||
if (g_signal_handler_find (self, G_SIGNAL_MATCH_ID,
|
gboolean mute = gst_clapper_get_mute (self);
|
||||||
signals[SIGNAL_MUTE_CHANGED], 0, NULL, NULL, NULL) != 0) {
|
|
||||||
|
if (self->last_mute != mute) {
|
||||||
|
self->last_mute = mute;
|
||||||
gst_clapper_signal_dispatcher_dispatch (self->signal_dispatcher, self,
|
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);
|
(GDestroyNotify) g_object_unref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user