gstreamer/ges/ges-timeline-object.c

159 lines
4.1 KiB
C
Raw Normal View History

2009-08-04 15:13:11 +00:00
/* GStreamer Editing Services
* Copyright (C) 2009 Edward Hervey <bilboed@bilboed.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "ges-internal.h"
2009-08-04 15:13:11 +00:00
#include "ges-timeline-object.h"
#include "ges.h"
2009-08-04 15:13:11 +00:00
/**
* GESTimelineObject
*
* Responsible for creating the TrackObject(s) for given TimelineTrack(s)
*
* Keeps a reference to the TrackObject(s) it created and sets/updates their properties.
*/
G_DEFINE_TYPE (GESTimelineObject, ges_timeline_object, G_TYPE_OBJECT);
static void
ges_timeline_object_get_property (GObject * object, guint property_id,
2009-08-04 15:16:31 +00:00
GValue * value, GParamSpec * pspec)
2009-08-04 15:13:11 +00:00
{
switch (property_id) {
2009-08-04 15:16:31 +00:00
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
2009-08-04 15:13:11 +00:00
}
}
static void
2009-08-04 15:16:31 +00:00
ges_timeline_object_set_property (GObject * object, guint property_id,
const GValue * value, GParamSpec * pspec)
2009-08-04 15:13:11 +00:00
{
switch (property_id) {
2009-08-04 15:16:31 +00:00
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
2009-08-04 15:13:11 +00:00
}
}
static void
2009-08-04 15:16:31 +00:00
ges_timeline_object_dispose (GObject * object)
2009-08-04 15:13:11 +00:00
{
G_OBJECT_CLASS (ges_timeline_object_parent_class)->dispose (object);
}
static void
2009-08-04 15:16:31 +00:00
ges_timeline_object_finalize (GObject * object)
2009-08-04 15:13:11 +00:00
{
G_OBJECT_CLASS (ges_timeline_object_parent_class)->finalize (object);
}
static void
2009-08-04 15:16:31 +00:00
ges_timeline_object_class_init (GESTimelineObjectClass * klass)
2009-08-04 15:13:11 +00:00
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->get_property = ges_timeline_object_get_property;
object_class->set_property = ges_timeline_object_set_property;
object_class->dispose = ges_timeline_object_dispose;
object_class->finalize = ges_timeline_object_finalize;
}
static void
2009-08-04 15:16:31 +00:00
ges_timeline_object_init (GESTimelineObject * self)
2009-08-04 15:13:11 +00:00
{
}
2009-08-04 15:16:31 +00:00
GESTimelineObject *
2009-08-04 15:13:11 +00:00
ges_timeline_object_new (void)
{
return g_object_new (GES_TYPE_TIMELINE_OBJECT, NULL);
}
2009-08-06 09:23:01 +00:00
/**
* ges_timeline_object_create_track_object:
* @object: The origin #GESTimelineObject
* @track: The #GESTrack to create a #GESTrackObject for.
*
* Creates a #GESTrackObject for the provided @track.
*
* Returns: A #GESTrackObject. Returns NULL if the #GESTrackObject could not
* be created.
*/
GESTrackObject *
ges_timeline_object_create_track_object (GESTimelineObject * object,
GESTrack * track)
{
GESTimelineObjectClass *class;
GESTrackObject *res;
2009-08-06 09:23:01 +00:00
class = GES_TIMELINE_OBJECT_GET_CLASS (object);
2009-08-06 09:23:01 +00:00
if (G_UNLIKELY (class->create_track_object == NULL)) {
GST_ERROR ("No 'create_track_object' implementation available");
return NULL;
}
res = class->create_track_object (object, track);
if (res) {
GST_DEBUG
("Got a TrackObject : %p , setting the timeline object as its creator");
ges_track_object_set_timeline_object (res, object);
}
GST_DEBUG ("Returning res:%p", res);
return res;
}
void
ges_timeline_object_set_layer (GESTimelineObject * object,
GESTimelineLayer * layer)
{
GST_DEBUG ("object:%p, layer:%p", object, layer);
object->layer = layer;
}
gboolean
ges_timeline_object_fill_track_object (GESTimelineObject * object,
GESTrackObject * trackobj, GstElement * gnlobj)
{
GESTimelineObjectClass *class;
gboolean res;
GST_DEBUG ("object:%p, trackobject:%p, gnlobject:%p",
object, trackobj, gnlobj);
class = GES_TIMELINE_OBJECT_GET_CLASS (object);
if (G_UNLIKELY (class->fill_track_object == NULL)) {
GST_WARNING ("No 'fill_track_object' implementation available");
return FALSE;
}
res = class->fill_track_object (object, trackobj, gnlobj);
GST_DEBUG ("Returning res:%d", res);
2009-08-06 09:23:01 +00:00
return res;
2009-08-06 09:23:01 +00:00
}