TrackTransition: Remove second argument from duration_changed vmethod

And get properties directly from parent classes instead
This commit is contained in:
Edward Hervey 2010-07-06 19:06:24 +02:00
parent f107a01ede
commit b30a85117c
4 changed files with 21 additions and 37 deletions

View file

@ -37,8 +37,7 @@ enum
static void
ges_track_audio_transition_duration_changed (GESTrackTransition * self,
GstElement * gnlobj);
ges_track_audio_transition_duration_changed (GESTrackTransition * self);
static GstElement *ges_track_audio_transition_create_element (GESTrackTransition
* self);
@ -228,12 +227,11 @@ ges_track_audio_transition_create_element (GESTrackTransition * object)
}
static void
ges_track_audio_transition_duration_changed (GESTrackTransition * object,
GstElement * gnlobj)
ges_track_audio_transition_duration_changed (GESTrackTransition * object)
{
GESTrackAudioTransition *self;
guint64 duration;
guint64 duration = GES_TRACK_OBJECT_DURATION (object);
GstElement *gnlobj = GES_TRACK_OBJECT (object)->gnlobject;
GValue zero = { 0, };
GValue one = { 0, };
@ -242,16 +240,11 @@ ges_track_audio_transition_duration_changed (GESTrackTransition * object,
GST_LOG ("updating controller: gnlobj (%p) acontroller(%p) bcontroller(%p)",
gnlobj, self->a_controller, self->b_controller);
if (!gnlobj)
if (G_UNLIKELY ((gnlobj == NULL) || !self->a_controller
|| !self->b_controller))
return;
if (!(self->a_controller) || !(self->b_controller))
return;
GST_LOG ("getting properties");
g_object_get (G_OBJECT (gnlobj), "duration", (guint64 *) & duration, NULL);
GST_INFO ("duration: %lud\n", duration);
GST_INFO ("duration: %" G_GUINT64_FORMAT, duration);
g_value_init (&zero, G_TYPE_DOUBLE);
g_value_init (&one, G_TYPE_DOUBLE);
g_value_set_double (&zero, 0.0);

View file

@ -39,20 +39,16 @@ gnlobject_duration_cb (GstElement * gnlobject, GParamSpec * arg
{
GESTrackTransitionClass *klass;
klass = GES_TRACK_TRANSITION_GET_CLASS (self);
GST_LOG ("got duration changed signal");
klass = GES_TRACK_TRANSITION_GET_CLASS (self);
klass->duration_changed (self, gnlobject);
if (klass->duration_changed)
klass->duration_changed (self);
}
static void
ges_track_transition_duration_changed (GESTrackTransition * self, GstElement
* gnlobject)
ges_track_transition_duration_changed (GESTrackTransition * self)
{
GESTrackType type;
type = ((GESTrackObject *) self)->track->type;
GST_WARNING ("transitions don't handle this track type!");
}
@ -114,7 +110,9 @@ ges_track_transition_create_gnl_object (GESTrackObject * object)
gst_bin_add (GST_BIN (object->gnlobject), element);
klass->duration_changed (self, object->gnlobject);
if (klass->duration_changed)
klass->duration_changed (self);
return TRUE;
}

View file

@ -75,8 +75,8 @@ struct _GESTrackTransitionClass {
/* <public> */
GstElement* (*create_element) (GESTrackTransition *self);
void (*duration_changed) (GESTrackTransition *self, GstElement
*gnlobj);
void (*duration_changed) (GESTrackTransition *self);
};
GType ges_track_transition_get_type (void);

View file

@ -44,8 +44,7 @@ static GObject *link_element_to_mixer_with_smpte (GstBin * bin,
GstElement ** smpteref);
static void
ges_track_video_transition_duration_changed (GESTrackTransition * self,
GstElement * gnlobj);
ges_track_video_transition_duration_changed (GESTrackTransition * self);
static GstElement *ges_track_video_transition_create_element (GESTrackTransition
* self);
@ -280,26 +279,20 @@ link_element_to_mixer_with_smpte (GstBin * bin, GstElement * element,
}
static void
ges_track_video_transition_duration_changed (GESTrackTransition * object,
GstElement * gnlobj)
ges_track_video_transition_duration_changed (GESTrackTransition * object)
{
GValue start_value = { 0, };
GValue end_value = { 0, };
guint64 duration;
guint64 duration = GES_TRACK_OBJECT_DURATION (object);
GstElement *gnlobj = GES_TRACK_OBJECT (object)->gnlobject;
GESTrackVideoTransition *self = GES_TRACK_VIDEO_TRANSITION (object);
GST_LOG ("updating controller");
if (!gnlobj)
if (G_UNLIKELY (!gnlobj || !self->controller))
return;
if (!(self->controller))
return;
GST_LOG ("getting properties");
g_object_get (G_OBJECT (gnlobj), "duration", (guint64 *) & duration, NULL);
GST_INFO ("duration: %d\n", duration);
GST_INFO ("duration: %" G_GUINT64_FORMAT, duration);
g_value_init (&start_value, G_TYPE_DOUBLE);
g_value_init (&end_value, G_TYPE_DOUBLE);
g_value_set_double (&start_value, self->start_value);