GESTrackObject: Add 'active' property.

This property allows (de)activating a track object
This commit is contained in:
Edward Hervey 2009-09-30 16:40:59 +02:00
parent acef4cf4c1
commit f18bb72d04
2 changed files with 33 additions and 1 deletions

View file

@ -56,6 +56,7 @@ enum
PROP_INPOINT, PROP_INPOINT,
PROP_DURATION, PROP_DURATION,
PROP_PRIORITY, PROP_PRIORITY,
PROP_ACTIVE
}; };
static gboolean static gboolean
@ -80,6 +81,9 @@ ges_track_object_get_property (GObject * object, guint property_id,
case PROP_PRIORITY: case PROP_PRIORITY:
g_value_set_uint (value, tobj->priority); g_value_set_uint (value, tobj->priority);
break; break;
case PROP_ACTIVE:
g_value_set_boolean (value, tobj->active);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
} }
@ -104,6 +108,9 @@ ges_track_object_set_property (GObject * object, guint property_id,
case PROP_PRIORITY: case PROP_PRIORITY:
ges_track_object_set_priority_internal (tobj, g_value_get_uint (value)); ges_track_object_set_priority_internal (tobj, g_value_get_uint (value));
break; break;
case PROP_ACTIVE:
ges_track_object_set_active (tobj, g_value_get_boolean (value));
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
} }
@ -180,6 +187,16 @@ ges_track_object_class_init (GESTrackObjectClass * klass)
g_param_spec_uint ("priority", "Priority", g_param_spec_uint ("priority", "Priority",
"The priority of the object", 0, G_MAXUINT, 0, G_PARAM_READWRITE)); "The priority of the object", 0, G_MAXUINT, 0, G_PARAM_READWRITE));
/**
* GESTrackObject:active
*
* Whether the object should be taken into account in the #GEStrack output.
* If #FALSE, then its contents will not be used in the resulting track.
*/
g_object_class_install_property (object_class, PROP_ACTIVE,
g_param_spec_boolean ("active", "Active", "Use object in output",
TRUE, G_PARAM_READWRITE));
klass->create_gnl_object = ges_track_object_create_gnl_object_func; klass->create_gnl_object = ges_track_object_create_gnl_object_func;
} }
@ -256,6 +273,20 @@ ges_track_object_set_priority_internal (GESTrackObject * object,
return TRUE; return TRUE;
} }
gboolean
ges_track_object_set_active (GESTrackObject * object, gboolean active)
{
GST_DEBUG ("object:%p, active:%d", object, active);
g_return_val_if_fail (object->gnlobject, FALSE);
if (G_UNLIKELY (active == object->active))
return FALSE;
g_object_set (object->gnlobject, "active", active, NULL);
return TRUE;
}
/* default 'create_gnl_object' virtual method implementation */ /* default 'create_gnl_object' virtual method implementation */
static gboolean static gboolean
ges_track_object_create_gnl_object_func (GESTrackObject * object) ges_track_object_create_gnl_object_func (GESTrackObject * object)

View file

@ -72,6 +72,7 @@ struct _GESTrackObject {
guint64 inpoint; guint64 inpoint;
guint64 duration; guint64 duration;
guint32 priority; guint32 priority;
gboolean active;
GstElement *gnlobject; GstElement *gnlobject;
}; };
@ -105,7 +106,7 @@ gboolean ges_track_object_set_start_internal (GESTrackObject * object, guint64 s
gboolean ges_track_object_set_inpoint_internal (GESTrackObject * object, guint64 inpoint); gboolean ges_track_object_set_inpoint_internal (GESTrackObject * object, guint64 inpoint);
gboolean ges_track_object_set_duration_internal (GESTrackObject * object, guint64 duration); gboolean ges_track_object_set_duration_internal (GESTrackObject * object, guint64 duration);
gboolean ges_track_object_set_priority_internal (GESTrackObject * object, guint32 priority); gboolean ges_track_object_set_priority_internal (GESTrackObject * object, guint32 priority);
gboolean ges_track_object_set_active (GESTrackObject * object, gboolean active);
G_END_DECLS G_END_DECLS
#endif /* _GES_TRACK_OBJECT */ #endif /* _GES_TRACK_OBJECT */