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

View file

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

View file

@ -75,8 +75,8 @@ struct _GESTrackTransitionClass {
/* <public> */ /* <public> */
GstElement* (*create_element) (GESTrackTransition *self); GstElement* (*create_element) (GESTrackTransition *self);
void (*duration_changed) (GESTrackTransition *self, GstElement
*gnlobj); void (*duration_changed) (GESTrackTransition *self);
}; };
GType ges_track_transition_get_type (void); 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); GstElement ** smpteref);
static void static void
ges_track_video_transition_duration_changed (GESTrackTransition * self, ges_track_video_transition_duration_changed (GESTrackTransition * self);
GstElement * gnlobj);
static GstElement *ges_track_video_transition_create_element (GESTrackTransition static GstElement *ges_track_video_transition_create_element (GESTrackTransition
* self); * self);
@ -280,26 +279,20 @@ link_element_to_mixer_with_smpte (GstBin * bin, GstElement * element,
} }
static void static void
ges_track_video_transition_duration_changed (GESTrackTransition * object, ges_track_video_transition_duration_changed (GESTrackTransition * object)
GstElement * gnlobj)
{ {
GValue start_value = { 0, }; GValue start_value = { 0, };
GValue end_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); GESTrackVideoTransition *self = GES_TRACK_VIDEO_TRANSITION (object);
GST_LOG ("updating controller"); GST_LOG ("updating controller");
if (!gnlobj) if (G_UNLIKELY (!gnlobj || !self->controller))
return; return;
if (!(self->controller)) GST_INFO ("duration: %" G_GUINT64_FORMAT, duration);
return;
GST_LOG ("getting properties");
g_object_get (G_OBJECT (gnlobj), "duration", (guint64 *) & duration, NULL);
GST_INFO ("duration: %d\n", duration);
g_value_init (&start_value, G_TYPE_DOUBLE); g_value_init (&start_value, G_TYPE_DOUBLE);
g_value_init (&end_value, G_TYPE_DOUBLE); g_value_init (&end_value, G_TYPE_DOUBLE);
g_value_set_double (&start_value, self->start_value); g_value_set_double (&start_value, self->start_value);