1 /* GStreamer Editing Services
2 * Copyright (C) 2009 Edward Hervey <bilboed@bilboed.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #include "ges-track.h"
21 #include "ges-track-object.h"
26 * Corresponds to one output format (i.e. audio OR video)
28 * Contains the compatible TrackObject(s)
31 G_DEFINE_TYPE (GESTrack, ges_track, GST_TYPE_BIN);
33 #define GET_PRIVATE(o) \
34 (G_TYPE_INSTANCE_GET_PRIVATE ((o), GES_TYPE_TRACK, GESTrackPrivate));
36 typedef struct _GESTrackPrivate GESTrackPrivate;
38 struct _GESTrackPrivate
44 ges_track_get_property (GObject * object, guint property_id,
45 GValue * value, GParamSpec * pspec)
47 switch (property_id) {
49 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
54 ges_track_set_property (GObject * object, guint property_id,
55 const GValue * value, GParamSpec * pspec)
57 switch (property_id) {
59 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
64 ges_track_dispose (GObject * object)
66 G_OBJECT_CLASS (ges_track_parent_class)->dispose (object);
70 ges_track_finalize (GObject * object)
72 G_OBJECT_CLASS (ges_track_parent_class)->finalize (object);
76 ges_track_class_init (GESTrackClass * klass)
78 GObjectClass *object_class = G_OBJECT_CLASS (klass);
80 g_type_class_add_private (klass, sizeof (GESTrackPrivate));
82 object_class->get_property = ges_track_get_property;
83 object_class->set_property = ges_track_set_property;
84 object_class->dispose = ges_track_dispose;
85 object_class->finalize = ges_track_finalize;
89 ges_track_init (GESTrack * self)
96 return g_object_new (GES_TYPE_TRACK, NULL);
100 ges_track_set_timeline (GESTrack * track, GESTimeline * timeline)
102 GST_DEBUG ("track:%p, timeline:%p", track, timeline);
104 track->timeline = timeline;
108 ges_track_add_object (GESTrack * track, GESTrackObject * object)
110 GST_DEBUG ("track:%p, object:%p", track, object);
112 if (G_UNLIKELY (object->track != NULL)) {
113 GST_WARNING ("Object already belongs to another track");
117 if (G_UNLIKELY (object->gnlobject != NULL)) {
118 GST_ERROR ("TrackObject doesn't have a gnlobject !");
122 ges_track_object_set_track (object, track);
124 GST_DEBUG ("Adding object to ourself");
126 /* make sure the object has a valid gnlobject ! */
127 if (G_UNLIKELY (!gst_bin_add (GST_BIN (track->composition),
128 object->gnlobject))) {
129 GST_WARNING ("Couldn't add object to the GnlComposition");