add track object virtual methods for property change notifications

This commit is contained in:
Brandon Lewis 2010-07-08 12:35:41 +02:00 committed by Edward Hervey
parent b13bf26795
commit fee9f7fb67
2 changed files with 41 additions and 0 deletions

View file

@ -316,6 +316,10 @@ gnlobject_start_cb (GstElement * gnlobject, GParamSpec * arg G_GNUC_UNUSED,
GESTrackObject * obj)
{
guint64 start;
GESTrackObjectClass *klass;
klass = GES_TRACK_OBJECT_GET_CLASS (obj);
g_object_get (gnlobject, "start", &start, NULL);
GST_DEBUG ("gnlobject start : %" GST_TIME_FORMAT " current : %"
@ -323,6 +327,8 @@ gnlobject_start_cb (GstElement * gnlobject, GParamSpec * arg G_GNUC_UNUSED,
if (start != obj->start) {
obj->start = start;
if (klass->start_changed)
klass->start_changed (obj, start);
/* FIXME : emit changed */
}
}
@ -333,6 +339,10 @@ gnlobject_media_start_cb (GstElement * gnlobject,
GParamSpec * arg G_GNUC_UNUSED, GESTrackObject * obj)
{
guint64 start;
GESTrackObjectClass *klass;
klass = GES_TRACK_OBJECT_GET_CLASS (obj);
g_object_get (gnlobject, "media-start", &start, NULL);
GST_DEBUG ("gnlobject in-point : %" GST_TIME_FORMAT " current : %"
@ -340,6 +350,8 @@ gnlobject_media_start_cb (GstElement * gnlobject,
if (start != obj->inpoint) {
obj->inpoint = start;
if (klass->media_start_changed)
klass->media_start_changed (obj, start);
/* FIXME : emit changed */
}
}
@ -349,12 +361,18 @@ gnlobject_priority_cb (GstElement * gnlobject, GParamSpec * arg G_GNUC_UNUSED,
GESTrackObject * obj)
{
guint32 priority;
GESTrackObjectClass *klass;
klass = GES_TRACK_OBJECT_GET_CLASS (obj);
g_object_get (gnlobject, "priority", &priority, NULL);
GST_DEBUG ("gnlobject priority : %d current : %d", priority, obj->priority);
if (priority != obj->priority) {
obj->priority = priority;
if (klass->priority_changed)
klass->priority_changed (obj, priority);
/* FIXME : emit changed */
}
}
@ -364,6 +382,10 @@ gnlobject_duration_cb (GstElement * gnlobject, GParamSpec * arg G_GNUC_UNUSED,
GESTrackObject * obj)
{
guint64 duration;
GESTrackObjectClass *klass;
klass = GES_TRACK_OBJECT_GET_CLASS (obj);
g_object_get (gnlobject, "duration", &duration, NULL);
GST_DEBUG ("gnlobject duration : %" GST_TIME_FORMAT " current : %"
@ -371,6 +393,8 @@ gnlobject_duration_cb (GstElement * gnlobject, GParamSpec * arg G_GNUC_UNUSED,
if (duration != obj->duration) {
obj->duration = duration;
if (klass->duration_changed)
klass->duration_changed (obj, duration);
/* FIXME : emit changed */
}
}
@ -380,12 +404,18 @@ gnlobject_active_cb (GstElement * gnlobject, GParamSpec * arg G_GNUC_UNUSED,
GESTrackObject * obj)
{
gboolean active;
GESTrackObjectClass *klass;
klass = GES_TRACK_OBJECT_GET_CLASS (obj);
g_object_get (gnlobject, "active", &active, NULL);
GST_DEBUG ("gnlobject active : %d current : %d", active, obj->active);
if (active != obj->active) {
obj->active = active;
if (klass->active_changed)
klass->active_changed (obj, active);
/* FIXME : emit changed */
}
}

View file

@ -122,6 +122,11 @@ struct _GESTrackObject {
* GESTrackObjectClass:
* @parent_class: parent class
* @create_gnl_object: method to create the GNonLin container object.
* @start_changed: start property of gnlobject has changed
* @media_start_changed: media-start property of gnlobject has changed
* @duration_changed: duration property glnobject has changed
* @priority_changed: duration property glnobject has changed
* @active_changed: active property of gnlobject has changed
*
* Subclasses can override the @create_gnl_object method to override what type
* of GNonLin object will be created.
@ -136,6 +141,12 @@ struct _GESTrackObjectClass {
/*< public >*/
/* virtual methods for subclasses */
gboolean (*create_gnl_object) (GESTrackObject * object);
void (*start_changed) (GESTrackObject *object, guint64 start);
void (*media_start_changed) (GESTrackObject *object, guint64 media_start);
void (*priority_changed) (GESTrackObject *object, guint priority);
void (*duration_changed) (GESTrackObject *object, guint64 duration);
void (*active_changed) (GESTrackObject *object, gboolean active);
};
GType ges_track_object_get_type (void);