mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
add create_track_objects
This commit is contained in:
parent
dca01a3c0e
commit
cd7cefffa6
3 changed files with 65 additions and 4 deletions
|
@ -35,6 +35,9 @@ gboolean
|
|||
ges_timeline_object_fill_track_object_func (GESTimelineObject * object,
|
||||
GESTrackObject * trackobj, GstElement * gnlobj);
|
||||
|
||||
gboolean
|
||||
ges_timeline_object_create_track_objects_func (GESTimelineObject
|
||||
* object, GESTrack * track);
|
||||
|
||||
G_DEFINE_TYPE (GESTimelineObject, ges_timeline_object, G_TYPE_OBJECT);
|
||||
|
||||
|
@ -116,6 +119,7 @@ ges_timeline_object_class_init (GESTimelineObjectClass * klass)
|
|||
object_class->set_property = ges_timeline_object_set_property;
|
||||
object_class->dispose = ges_timeline_object_dispose;
|
||||
object_class->finalize = ges_timeline_object_finalize;
|
||||
klass->create_track_objects = ges_timeline_object_create_track_objects_func;
|
||||
|
||||
/**
|
||||
* GESTimelineObject:start
|
||||
|
@ -214,6 +218,50 @@ ges_timeline_object_create_track_object (GESTimelineObject * object,
|
|||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* ges_timeline_object_create_track_objects:
|
||||
* @object: The origin #GESTimelineObject
|
||||
* @track: The #GESTrack to create each #GESTrackObject for.
|
||||
*
|
||||
* Creates all #GESTrackObjects supported by this object and adds them to the
|
||||
* provided track. The the track is responsible for calling
|
||||
* #ges_timeline_release_track_object on these objects when it is finished
|
||||
* with them.
|
||||
*
|
||||
* Returns: True if each track object was created successfully, or false if an
|
||||
* error occured.
|
||||
*/
|
||||
|
||||
gboolean
|
||||
ges_timeline_object_create_track_objects (GESTimelineObject * object,
|
||||
GESTrack * track)
|
||||
{
|
||||
GESTimelineObjectClass *klass;
|
||||
|
||||
klass = GES_TIMELINE_OBJECT_GET_CLASS (object);
|
||||
|
||||
if (!(klass->create_track_objects)) {
|
||||
GST_INFO ("no create_track_objects implentation");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return klass->create_track_objects (object, track);
|
||||
}
|
||||
|
||||
gboolean
|
||||
ges_timeline_object_create_track_objects_func (GESTimelineObject * object,
|
||||
GESTrack * track)
|
||||
{
|
||||
GESTrackObject *result;
|
||||
|
||||
result = ges_timeline_object_create_track_object (object, track);
|
||||
if (!result) {
|
||||
GST_WARNING ("couldn't create track object");
|
||||
return FALSE;
|
||||
}
|
||||
return ges_track_add_object (track, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* ges_timeline_object_release_track_object:
|
||||
* @object: a #GESTimelineObject
|
||||
|
|
|
@ -69,9 +69,8 @@ typedef gboolean (*FillTrackObjectFunc) (GESTimelineObject * object,
|
|||
*
|
||||
* Creates the 'primary track object for this @object.
|
||||
*
|
||||
* Implementors should override this function if they only need to create one
|
||||
* track object per track. If the implementor wishes to create multiple track
|
||||
* objects, they should override create_track_objects instead.
|
||||
* Implementors should override this function if they only interested in
|
||||
* creating a single custom track object per track.
|
||||
*
|
||||
* The implementer of this function shall return the proper #GESTrackObject
|
||||
* that should be controlled by @object for the given @track.
|
||||
|
@ -84,6 +83,18 @@ typedef gboolean (*FillTrackObjectFunc) (GESTimelineObject * object,
|
|||
typedef GESTrackObject* (*CreateTrackObjectFunc) (GESTimelineObject * object,
|
||||
GESTrack * track);
|
||||
|
||||
/**
|
||||
* CreateTrackObjectFunc:
|
||||
* @object: a #GESTimelineObject
|
||||
* @track: a #GESTimelineTrack
|
||||
*
|
||||
* Create all track objects this object handles for this type of track.
|
||||
*
|
||||
* Returns: %TRUE on success %FALSE on failure.
|
||||
*/
|
||||
typedef gboolean (*CreateTrackObjectsFunc) (GESTimelineObject * object,
|
||||
GESTrack *track);
|
||||
|
||||
/**
|
||||
* GES_TIMELINE_OBJECT_START:
|
||||
* @obj: a #GESTimelineObject
|
||||
|
|
|
@ -265,7 +265,9 @@ add_object_to_tracks (GESTimeline * timeline, GESTimelineObject * object)
|
|||
GESTrack *track = priv->track;
|
||||
|
||||
GST_LOG ("Trying with track %p", track);
|
||||
ges_timeline_object_create_track_objects (object, track);
|
||||
if (!ges_timeline_object_create_track_objects (object, track)) {
|
||||
GST_WARNING ("error creating track objects");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue