track-element: Remove duration_changed virtual method.

We use notifies for the properties.
	+ Use notifies in audio-transition and video-transition
This commit is contained in:
Mathieu Duponchelle 2013-07-01 23:33:01 +02:00 committed by Thibault Saunier
parent f1a3d65ef6
commit 2cb71e730a
3 changed files with 26 additions and 5 deletions

View file

@ -64,6 +64,13 @@ static void ges_audio_transition_get_property (GObject * object, guint
static void ges_audio_transition_set_property (GObject * object, guint static void ges_audio_transition_set_property (GObject * object, guint
property_id, const GValue * value, GParamSpec * pspec); property_id, const GValue * value, GParamSpec * pspec);
static void
duration_changed_cb (GESTrackElement * self, GParamSpec * arg G_GNUC_UNUSED)
{
ges_audio_transition_duration_changed (self,
ges_timeline_element_get_duration (GES_TIMELINE_ELEMENT (self)));
}
static void static void
ges_audio_transition_class_init (GESAudioTransitionClass * klass) ges_audio_transition_class_init (GESAudioTransitionClass * klass)
{ {
@ -80,8 +87,6 @@ ges_audio_transition_class_init (GESAudioTransitionClass * klass)
object_class->dispose = ges_audio_transition_dispose; object_class->dispose = ges_audio_transition_dispose;
object_class->finalize = ges_audio_transition_finalize; object_class->finalize = ges_audio_transition_finalize;
toclass->duration_changed = ges_audio_transition_duration_changed;
toclass->create_element = ges_audio_transition_create_element; toclass->create_element = ges_audio_transition_create_element;
} }
@ -113,6 +118,9 @@ ges_audio_transition_dispose (GObject * object)
self->priv->b_control_source = NULL; self->priv->b_control_source = NULL;
} }
g_signal_handlers_disconnect_by_func (GES_TRACK_ELEMENT (self),
duration_changed_cb, NULL);
G_OBJECT_CLASS (ges_audio_transition_parent_class)->dispose (object); G_OBJECT_CLASS (ges_audio_transition_parent_class)->dispose (object);
} }
@ -225,6 +233,9 @@ ges_audio_transition_create_element (GESTrackElement * track_element)
ges_timeline_element_get_duration (GES_TIMELINE_ELEMENT (track_element)); ges_timeline_element_get_duration (GES_TIMELINE_ELEMENT (track_element));
ges_audio_transition_duration_changed (track_element, duration); ges_audio_transition_duration_changed (track_element, duration);
g_signal_connect (track_element, "notify::duration",
G_CALLBACK (duration_changed_cb), NULL);
gst_object_add_control_binding (GST_OBJECT (atarget), gst_object_add_control_binding (GST_OBJECT (atarget),
gst_direct_control_binding_new (GST_OBJECT (atarget), propname, gst_direct_control_binding_new (GST_OBJECT (atarget), propname,
acontrol_source)); acontrol_source));

View file

@ -74,7 +74,6 @@ struct _GESTrackElement {
* @gnlobject_factorytype: name of the GNonLin GStElementFactory type to use. * @gnlobject_factorytype: name of the GNonLin GStElementFactory type to use.
* @create_gnl_object: method to create the GNonLin container object. * @create_gnl_object: method to create the GNonLin container object.
* @create_element: method to return the GstElement to put in the gnlobject. * @create_element: method to return the GstElement to put in the gnlobject.
* @duration_changed: duration property glnobject has changed
* @active_changed: active property of gnlobject has changed * @active_changed: active property of gnlobject has changed
* @get_props_hastable: method to list children properties that user could like * @get_props_hastable: method to list children properties that user could like
* to configure. Since: 0.10.2 * to configure. Since: 0.10.2
@ -97,7 +96,6 @@ struct _GESTrackElementClass {
GstElement* (*create_gnl_object) (GESTrackElement * object); GstElement* (*create_gnl_object) (GESTrackElement * object);
GstElement* (*create_element) (GESTrackElement * object); GstElement* (*create_element) (GESTrackElement * object);
void (*duration_changed) (GESTrackElement *object, guint64 duration);
void (*active_changed) (GESTrackElement *object, gboolean active); void (*active_changed) (GESTrackElement *object, gboolean active);
/*< private >*/ /*< private >*/

View file

@ -103,6 +103,13 @@ static void ges_video_transition_get_property (GObject * object, guint
static void ges_video_transition_set_property (GObject * object, guint static void ges_video_transition_set_property (GObject * object, guint
property_id, const GValue * value, GParamSpec * pspec); property_id, const GValue * value, GParamSpec * pspec);
static void
duration_changed_cb (GESTrackElement * self, GParamSpec * arg G_GNUC_UNUSED)
{
ges_video_transition_duration_changed (self,
ges_timeline_element_get_duration (GES_TIMELINE_ELEMENT (self)));
}
static void static void
ges_video_transition_class_init (GESVideoTransitionClass * klass) ges_video_transition_class_init (GESVideoTransitionClass * klass)
{ {
@ -156,7 +163,6 @@ ges_video_transition_class_init (GESVideoTransitionClass * klass)
properties[PROP_INVERT]); properties[PROP_INVERT]);
toclass = GES_TRACK_ELEMENT_CLASS (klass); toclass = GES_TRACK_ELEMENT_CLASS (klass);
toclass->duration_changed = ges_video_transition_duration_changed;
toclass->create_element = ges_video_transition_create_element; toclass->create_element = ges_video_transition_create_element;
} }
@ -213,6 +219,9 @@ ges_video_transition_dispose (GObject * object)
priv->mixer = NULL; priv->mixer = NULL;
} }
g_signal_handlers_disconnect_by_func (GES_TRACK_ELEMENT (self),
duration_changed_cb, NULL);
G_OBJECT_CLASS (ges_video_transition_parent_class)->dispose (object); G_OBJECT_CLASS (ges_video_transition_parent_class)->dispose (object);
} }
@ -423,6 +432,9 @@ ges_video_transition_create_element (GESTrackElement * object)
priv->topbin = topbin; priv->topbin = topbin;
priv->type = priv->pending_type; priv->type = priv->pending_type;
g_signal_connect (object, "notify::duration",
G_CALLBACK (duration_changed_cb), NULL);
return topbin; return topbin;
} }