GESTrackObject: Make base_priority/priority-offset a private field

This commit is contained in:
Edward Hervey 2010-12-14 17:38:55 +01:00
parent bfaa119ef7
commit 5f6dadab77
3 changed files with 24 additions and 36 deletions

View file

@ -55,7 +55,6 @@ struct _GESTimelineObjectPrivate
/*< private > */
/* A list of TrackObject controlled by this TimelineObject */
GList *trackobjects;
};
enum
@ -581,7 +580,7 @@ track_object_priority_offset_changed_cb (GESTrackObject * child,
guint new, old;
/* all track objects have height 1 */
new = GES_TRACK_OBJECT_PRIORITY_OFFSET (child) + 1;
new = ges_track_object_get_priority_offset (child) + 1;
old = GES_TIMELINE_OBJECT_HEIGHT (obj);
GST_LOG ("object %p, new=%d, old=%d", obj, new, old);

View file

@ -52,8 +52,9 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GESTrackObject, ges_track_object,
struct _GESTrackObjectPrivate
{
/* Dummy variable */
void *nothing;
/* cache the base priority and offset */
guint32 base_priority;
guint32 priority_offset;
};
enum
@ -104,10 +105,10 @@ ges_track_object_get_property (GObject * object, guint property_id,
g_value_set_uint64 (value, tobj->duration);
break;
case PROP_PRIORITY:
g_value_set_uint (value, tobj->base_priority);
g_value_set_uint (value, tobj->priv->base_priority);
break;
case PROP_PRIORITY_OFFSET:
g_value_set_uint (value, tobj->priority_offset);
g_value_set_uint (value, tobj->priv->priority_offset);
break;
case PROP_ACTIVE:
g_value_set_boolean (value, tobj->active);
@ -321,12 +322,12 @@ ges_track_object_set_priority_internal (GESTrackObject * object,
guint32 priority)
{
guint32 save;
save = object->base_priority;
save = object->priv->base_priority;
GST_DEBUG ("object:%p, priority:%d", object, priority);
object->base_priority = priority;
object->priv->base_priority = priority;
if (!ges_track_object_update_priority (object)) {
object->base_priority = save;
object->priv->base_priority = save;
return FALSE;
}
return TRUE;
@ -337,12 +338,12 @@ ges_track_object_set_priority_offset_internal (GESTrackObject * object,
guint32 priority_offset)
{
guint32 save;
save = object->priority_offset;
save = object->priv->priority_offset;
GST_DEBUG ("object:%p, offset:%d", object, priority_offset);
object->priority_offset = priority_offset;
object->priv->priority_offset = priority_offset;
if (!ges_track_object_update_priority (object)) {
object->base_priority = save;
object->priv->base_priority = save;
return FALSE;
}
return TRUE;
@ -352,8 +353,9 @@ static gboolean
ges_track_object_update_priority (GESTrackObject * object)
{
guint32 priority, offset, gnl;
priority = object->base_priority;
offset = object->priority_offset;
priority = object->priv->base_priority;
offset = object->priv->priority_offset;
gnl = priority + offset;
GST_DEBUG ("object:%p, base:%d, offset:%d: gnl:%d", object, priority, offset,
gnl);
@ -668,3 +670,9 @@ ges_track_object_set_timeline_object (GESTrackObject * object,
object->timelineobj = tlobj;
}
guint32
ges_track_object_get_priority_offset (GESTrackObject * object)
{
return object->priv->priority_offset;
}

View file

@ -70,23 +70,6 @@ G_BEGIN_DECLS
*/
#define GES_TRACK_OBJECT_DURATION(obj) (((GESTrackObject*)obj)->duration)
/**
* GES_TRACK_OBJECT_PRIORITY:
* @obj: a #GESTrackObject
*
* The base priority of the object.
*/
#define GES_TRACK_OBJECT_PRIORITY(obj) (((GESTrackObject*)obj)->base_priority)
/**
* GES_TRACK_OBJECT_PRIORITY_OFFSET:
* @obj: a #GESTrackObject
*
* The priority of the object relative to its parent timeline object.
*/
#define GES_TRACK_OBJECT_PRIORITY_OFFSET(obj)\
(((GESTrackObject*)obj)->priority_offset)
typedef struct _GESTrackObjectPrivate GESTrackObjectPrivate;
/**
@ -120,10 +103,6 @@ struct _GESTrackObject {
guint32 gnl_priority;
gboolean active;
/* cache the base priority and offset */
guint32 base_priority;
guint32 priority_offset;
/*< private >*/
/* These fields are only used before the gnlobject is available */
guint64 pending_start;
@ -175,7 +154,7 @@ struct _GESTrackObjectClass {
void (*active_changed) (GESTrackObject *object, gboolean active);
/*< private >*/
/* signals */
/* signals (currently unused) */
void (*changed) (GESTrackObject * object);
/* Padding for API extension */
@ -195,6 +174,8 @@ gboolean ges_track_object_set_priority_internal (GESTrackObject * object, guint3
gboolean ges_track_object_set_priority_offset_internal(GESTrackObject *
object, guint32 priority_offset);
guint32 ges_track_object_get_priority_offset (GESTrackObject *object);
gboolean ges_track_object_set_active (GESTrackObject * object, gboolean active);
G_END_DECLS