mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-18 15:51:11 +00:00
GESTrackObject: Subclass from GInitiallyUnowned
The floating reference will be owned by the Track
This commit is contained in:
parent
c90f399bfb
commit
752e6cfb75
3 changed files with 17 additions and 6 deletions
|
@ -34,7 +34,8 @@
|
||||||
#include "ges-track-object.h"
|
#include "ges-track-object.h"
|
||||||
#include "ges-timeline-object.h"
|
#include "ges-timeline-object.h"
|
||||||
|
|
||||||
G_DEFINE_ABSTRACT_TYPE (GESTrackObject, ges_track_object, G_TYPE_OBJECT);
|
G_DEFINE_ABSTRACT_TYPE (GESTrackObject, ges_track_object,
|
||||||
|
G_TYPE_INITIALLY_UNOWNED);
|
||||||
|
|
||||||
struct _GESTrackObjectPrivate
|
struct _GESTrackObjectPrivate
|
||||||
{
|
{
|
||||||
|
|
|
@ -78,7 +78,7 @@ typedef struct _GESTrackObjectPrivate GESTrackObjectPrivate;
|
||||||
* The GESTrackObject base class.
|
* The GESTrackObject base class.
|
||||||
*/
|
*/
|
||||||
struct _GESTrackObject {
|
struct _GESTrackObject {
|
||||||
GObject parent;
|
GInitiallyUnowned parent;
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
guint64 start;
|
guint64 start;
|
||||||
|
@ -111,7 +111,7 @@ struct _GESTrackObject {
|
||||||
*/
|
*/
|
||||||
struct _GESTrackObjectClass {
|
struct _GESTrackObjectClass {
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GObjectClass parent_class;
|
GInitiallyUnownedClass parent_class;
|
||||||
|
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
/* virtual methods for subclasses */
|
/* virtual methods for subclasses */
|
||||||
|
|
|
@ -292,9 +292,12 @@ ges_track_set_caps (GESTrack * track, const GstCaps * caps)
|
||||||
/**
|
/**
|
||||||
* ges_track_add_object:
|
* ges_track_add_object:
|
||||||
* @track: a #GESTrack
|
* @track: a #GESTrack
|
||||||
* @object: the #GESTrackObject to add
|
* @object: (transfer full): the #GESTrackObject to add
|
||||||
*
|
*
|
||||||
* Adds the given object to the track.
|
* Adds the given object to the track. Sets the object's controlling track,
|
||||||
|
* and thus takes ownership of the @object.
|
||||||
|
*
|
||||||
|
* An object can only be added to one track.
|
||||||
*
|
*
|
||||||
* Returns: #TRUE if the object was properly added. #FALSE if the track does not
|
* Returns: #TRUE if the object was properly added. #FALSE if the track does not
|
||||||
* want to accept the object.
|
* want to accept the object.
|
||||||
|
@ -333,6 +336,8 @@ ges_track_add_object (GESTrack * track, GESTrackObject * object)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_object_ref_sink (object);
|
||||||
|
|
||||||
track->priv->trackobjects = g_list_append (track->priv->trackobjects, object);
|
track->priv->trackobjects = g_list_append (track->priv->trackobjects, object);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -343,7 +348,10 @@ ges_track_add_object (GESTrack * track, GESTrackObject * object)
|
||||||
* @track: a #GESTrack
|
* @track: a #GESTrack
|
||||||
* @object: the #GESTrackObject to remove
|
* @object: the #GESTrackObject to remove
|
||||||
*
|
*
|
||||||
* Removes the object from the track.
|
* Removes the object from the track and unparents it.
|
||||||
|
* Unparenting it means the reference owned by @track on the @object will be
|
||||||
|
* removed. If you wish to use the @object after this function, make sure you
|
||||||
|
* call g_object_ref() before removing it from the @track.
|
||||||
*
|
*
|
||||||
* Returns: #TRUE if the object was removed, else #FALSE if the track
|
* Returns: #TRUE if the object was removed, else #FALSE if the track
|
||||||
* could not remove the object (like if it didn't belong to the track).
|
* could not remove the object (like if it didn't belong to the track).
|
||||||
|
@ -377,6 +385,8 @@ ges_track_remove_object (GESTrack * track, GESTrackObject * object)
|
||||||
ges_track_object_set_track (object, NULL);
|
ges_track_object_set_track (object, NULL);
|
||||||
priv->trackobjects = g_list_remove (priv->trackobjects, object);
|
priv->trackobjects = g_list_remove (priv->trackobjects, object);
|
||||||
|
|
||||||
|
g_object_unref (object);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue