2009-08-07 14:45:16 +00:00
|
|
|
/* GStreamer Editing Services
|
2009-11-30 14:14:25 +00:00
|
|
|
* Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
|
|
|
|
* 2009 Nokia Corporation
|
2009-08-07 14:45:16 +00:00
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2009-09-10 16:40:51 +00:00
|
|
|
/**
|
|
|
|
* SECTION:ges-custom-timeline-source
|
|
|
|
* @short_description: Convenience #GESTimelineSource
|
|
|
|
*
|
|
|
|
* #GESCustomTimelineSource allows creating #GESTimelineSource(s) without the
|
|
|
|
* need to subclass.
|
|
|
|
*
|
|
|
|
* Its usage should be limited to testing and prototyping purposes.
|
|
|
|
*/
|
|
|
|
|
2009-08-07 14:45:16 +00:00
|
|
|
#include "ges-internal.h"
|
|
|
|
#include "ges-custom-timeline-source.h"
|
|
|
|
#include "ges-timeline-source.h"
|
2010-12-08 15:09:35 +00:00
|
|
|
#include "ges-track-source.h"
|
2009-08-07 14:45:16 +00:00
|
|
|
|
2010-11-26 17:43:36 +00:00
|
|
|
struct _GESCustomTimelineSourcePrivate
|
|
|
|
{
|
2010-12-15 12:27:39 +00:00
|
|
|
GESFillTrackObjectUserFunc filltrackobjectfunc;
|
2010-11-26 17:43:36 +00:00
|
|
|
gpointer user_data;
|
|
|
|
};
|
|
|
|
|
2010-12-15 12:27:39 +00:00
|
|
|
G_DEFINE_TYPE (GESCustomTimelineSource, ges_custom_timeline_source,
|
2009-11-25 10:55:50 +00:00
|
|
|
GES_TYPE_TIMELINE_SOURCE);
|
2009-08-07 14:45:16 +00:00
|
|
|
|
2009-11-25 10:55:50 +00:00
|
|
|
static gboolean
|
2010-12-15 12:27:39 +00:00
|
|
|
ges_custom_timeline_source_fill_track_object (GESTimelineObject * object,
|
2009-08-07 14:45:16 +00:00
|
|
|
GESTrackObject * trobject, GstElement * gnlobj);
|
|
|
|
|
2010-12-08 15:09:35 +00:00
|
|
|
static GESTrackObject *
|
2010-12-15 12:27:39 +00:00
|
|
|
ges_custom_timeline_source_create_track_object (GESTimelineObject * obj,
|
2010-12-08 15:09:35 +00:00
|
|
|
GESTrack * track)
|
|
|
|
{
|
|
|
|
return g_object_new (GES_TYPE_TRACK_SOURCE, NULL);
|
|
|
|
}
|
|
|
|
|
2009-08-07 14:45:16 +00:00
|
|
|
static void
|
2010-12-15 12:27:39 +00:00
|
|
|
ges_custom_timeline_source_class_init (GESCustomTimelineSourceClass * klass)
|
2009-08-07 14:45:16 +00:00
|
|
|
{
|
|
|
|
GESTimelineObjectClass *tlobj_class = GES_TIMELINE_OBJECT_CLASS (klass);
|
|
|
|
|
2010-11-26 17:43:36 +00:00
|
|
|
g_type_class_add_private (klass, sizeof (GESCustomTimelineSourcePrivate));
|
|
|
|
|
2010-12-15 12:27:39 +00:00
|
|
|
tlobj_class->fill_track_object = ges_custom_timeline_source_fill_track_object;
|
|
|
|
tlobj_class->create_track_object =
|
|
|
|
ges_custom_timeline_source_create_track_object;
|
2009-08-07 14:45:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-12-15 12:27:39 +00:00
|
|
|
ges_custom_timeline_source_init (GESCustomTimelineSource * self)
|
2009-08-07 14:45:16 +00:00
|
|
|
{
|
2010-11-26 17:43:36 +00:00
|
|
|
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
|
|
|
GES_TYPE_CUSTOM_TIMELINE_SOURCE, GESCustomTimelineSourcePrivate);
|
2009-08-07 14:45:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2010-12-15 12:27:39 +00:00
|
|
|
ges_custom_timeline_source_fill_track_object (GESTimelineObject * object,
|
2009-08-07 14:45:16 +00:00
|
|
|
GESTrackObject * trobject, GstElement * gnlobj)
|
|
|
|
{
|
|
|
|
gboolean res;
|
2010-11-26 17:43:36 +00:00
|
|
|
GESCustomTimelineSourcePrivate *priv;
|
2009-08-07 14:45:16 +00:00
|
|
|
|
2009-09-08 16:47:46 +00:00
|
|
|
GST_DEBUG ("Calling callback (timelineobj:%p, trackobj:%p, gnlobj:%p)",
|
2009-08-07 14:45:16 +00:00
|
|
|
object, trobject, gnlobj);
|
|
|
|
|
2010-11-26 17:43:36 +00:00
|
|
|
priv = GES_CUSTOM_TIMELINE_SOURCE (object)->priv;
|
|
|
|
res = priv->filltrackobjectfunc (object, trobject, gnlobj, priv->user_data);
|
2009-08-07 14:45:16 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("Returning res:%d", res);
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2009-09-16 10:37:45 +00:00
|
|
|
/**
|
|
|
|
* ges_custom_timeline_source_new:
|
2010-12-15 12:27:39 +00:00
|
|
|
* @func: The #GESFillTrackObjectUserFunc that will be used to fill the track objects.
|
2009-09-16 10:37:45 +00:00
|
|
|
* @user_data: a gpointer that will be used when @func is called.
|
|
|
|
*
|
|
|
|
* Creates a new #GESCustomTimelineSource.
|
|
|
|
*
|
|
|
|
* Returns: The new #GESCustomTimelineSource.
|
|
|
|
*/
|
2009-08-07 14:45:16 +00:00
|
|
|
GESCustomTimelineSource *
|
2010-12-15 12:27:39 +00:00
|
|
|
ges_custom_timeline_source_new (GESFillTrackObjectUserFunc func,
|
2009-08-07 18:31:11 +00:00
|
|
|
gpointer user_data)
|
2009-08-07 14:45:16 +00:00
|
|
|
{
|
|
|
|
GESCustomTimelineSource *src;
|
|
|
|
|
|
|
|
src = g_object_new (GES_TYPE_CUSTOM_TIMELINE_SOURCE, NULL);
|
2010-11-26 17:43:36 +00:00
|
|
|
src->priv->filltrackobjectfunc = func;
|
|
|
|
src->priv->user_data = user_data;
|
2009-08-07 14:45:16 +00:00
|
|
|
|
|
|
|
return src;
|
|
|
|
}
|