<xi:include href="xml/ges-track.xml"/>
<xi:include href="xml/ges-track-object.xml"/>
<xi:include href="xml/ges-track-source.xml"/>
+ <xi:include href="xml/ges-track-filesource.xml"/>
<xi:include href="xml/ges-timeline.xml"/>
<xi:include href="xml/ges-timeline-layer.xml"/>
<xi:include href="xml/ges-timeline-object.xml"/>
<xi:include href="xml/ges-timeline-source.xml"/>
+ <xi:include href="xml/ges-timeline-filesource.xml"/>
<xi:include href="xml/ges-timeline-transition.xml"/>
</chapter>
</SECTION>
<SECTION>
+<FILE>ges-track-filesource</FILE>
+<TITLE>GESTrackFileSource</TITLE>
+GESTrackFileSource
+GESTrackFileSourceClass
+ges_track_filesource_new
+<SUBSECTION Standard>
+GES_TRACK_FILESOURCE
+GES_TRACK_FILESOURCE_CLASS
+GES_TRACK_FILESOURCE_GET_CLASS
+GES_TYPE_TRACK_FILESOURCE
+GES_IS_TRACK_FILESOURCE
+GES_IS_TRACK_FILESOURCE_CLASS
+ges_track_filesource_get_type
+</SECTION>
+
+
+
+<SECTION>
<FILE>ges-timeline</FILE>
<TITLE>GESTimeline</TITLE>
GESTimeline
GES_TYPE_TIMELINE_SOURCE
</SECTION>
+<SECTION>
+<FILE>ges-timeline-filesource</FILE>
+<TITLE>GESTimelineFileSource</TITLE>
+GESTimelineFileSource
+GESTimelineFileSourceClass
+ges_timeline_filesource_new
+<SUBSECTION Standard>
+ges_tl_filesource_get_type
+GES_IS_TIMELINE_FILE_SOURCE
+GES_IS_TIMELINE_FILE_SOURCE_CLASS
+GES_TIMELINE_FILE_SOURCE
+GES_TIMELINE_FILE_SOURCE_CLASS
+GES_TIMELINE_FILE_SOURCE_GET_CLASS
+GES_TYPE_TIMELINE_FILE_SOURCE
+</SECTION>
+
<SECTION>
<FILE>ges-timeline-transition</FILE>
ges-timeline-object.c \
ges-timeline-pipeline.c \
ges-timeline-source.c \
+ ges-timeline-file-source.c \
ges-timeline-transition.c \
ges-track.c \
ges-track-object.c \
- ges-track-source.c
+ ges-track-source.c \
+ ges-track-filesource.c
libges_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/ges/
libges_@GST_MAJORMINOR@include_HEADERS = \
ges-timeline-object.h \
ges-timeline-pipeline.h \
ges-timeline-source.h \
+ ges-timeline-file-source.h \
ges-timeline-transition.h \
ges-track.h \
ges-track-object.h \
- ges-track-source.h
+ ges-track-source.h \
+ ges-track-filesource.h
libges_@GST_MAJORMINOR@_la_CFLAGS = -I$(top_srcdir) $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
--- /dev/null
+/* 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"
+#include "ges-timeline-file-source.h"
+#include "ges-timeline-source.h"
+#include "ges-track-filesource.h"
+
+G_DEFINE_TYPE (GESTimelineFileSource, ges_tl_filesource,
+ GES_TYPE_TIMELINE_SOURCE);
+
+enum
+{
+ PROP_0,
+ PROP_URI
+};
+
+static GESTrackObject
+ * ges_tl_filesource_create_track_object (GESTimelineObject * obj,
+ GESTrack * track);
+
+static void
+ges_tl_filesource_get_property (GObject * object, guint property_id,
+ GValue * value, GParamSpec * pspec)
+{
+ GESTimelineFileSource *tfs = GES_TIMELINE_FILE_SOURCE (object);
+
+ switch (property_id) {
+ case PROP_URI:
+ g_value_set_string (value, tfs->uri);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+ges_tl_filesource_set_property (GObject * object, guint property_id,
+ const GValue * value, GParamSpec * pspec)
+{
+ GESTimelineFileSource *tfs = GES_TIMELINE_FILE_SOURCE (object);
+
+ switch (property_id) {
+ case PROP_URI:
+ tfs->uri = g_value_dup_string (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+ges_tl_filesource_dispose (GObject * object)
+{
+ G_OBJECT_CLASS (ges_tl_filesource_parent_class)->dispose (object);
+}
+
+static void
+ges_tl_filesource_finalize (GObject * object)
+{
+ G_OBJECT_CLASS (ges_tl_filesource_parent_class)->finalize (object);
+}
+
+static void
+ges_tl_filesource_class_init (GESTimelineFileSourceClass * klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GESTimelineObjectClass *timobj_class = GES_TIMELINE_OBJECT_CLASS (klass);
+
+ object_class->get_property = ges_tl_filesource_get_property;
+ object_class->set_property = ges_tl_filesource_set_property;
+ object_class->dispose = ges_tl_filesource_dispose;
+ object_class->finalize = ges_tl_filesource_finalize;
+
+
+ /**
+ * GESTimelineFileSource:uri
+ *
+ * The location of the file/resource to use.
+ */
+ g_object_class_install_property (object_class, PROP_URI,
+ g_param_spec_string ("uri", "URI", "uri of the resource",
+ NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+ timobj_class->create_track_object = ges_tl_filesource_create_track_object;
+ timobj_class->need_fill_track = FALSE;
+}
+
+static void
+ges_tl_filesource_init (GESTimelineFileSource * self)
+{
+}
+
+static GESTrackObject *
+ges_tl_filesource_create_track_object (GESTimelineObject * obj,
+ GESTrack * track)
+{
+ GST_DEBUG ("Creating a GESTrackFileSource");
+
+ /* FIXME : Implement properly ! */
+ return (GESTrackObject *) ges_track_filesource_new (((GESTimelineFileSource *)
+ obj)->uri);
+}
+
+/**
+ * ges_timeline_filesource_new:
+ * @uri: the URI the source should control
+ *
+ * Creates a new #GESTimelineFileSource for the provided @uri.
+ *
+ * Returns: The newly created #GESTimelineFileSource, or NULL if there was an
+ * error.
+ */
+GESTimelineFileSource *
+ges_timeline_filesource_new (gchar * uri)
+{
+ /* FIXME : Check for validity/existence of URI */
+ return g_object_new (GES_TYPE_TIMELINE_FILE_SOURCE, "uri", uri, NULL);
+}
--- /dev/null
+/* 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.
+ */
+
+#ifndef _GES_TL_FILESOURCE
+#define _GES_TL_FILESOURCE
+
+#include <glib-object.h>
+#include <ges/ges-types.h>
+#include <ges/ges-timeline-source.h>
+
+G_BEGIN_DECLS
+
+#define GES_TYPE_TIMELINE_FILE_SOURCE ges_tl_filesource_get_type()
+
+#define GES_TIMELINE_FILE_SOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_TIMELINE_FILE_SOURCE, GESTimelineFileSource))
+
+#define GES_TIMELINE_FILE_SOURCE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_TIMELINE_FILE_SOURCE, GESTimelineFileSourceClass))
+
+#define GES_IS_TIMELINE_FILE_SOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_TIMELINE_FILE_SOURCE))
+
+#define GES_IS_TIMELINE_FILE_SOURCE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_TIMELINE_FILE_SOURCE))
+
+#define GES_TIMELINE_FILE_SOURCE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_TIMELINE_FILE_SOURCE, GESTimelineFileSourceClass))
+
+
+struct _GESTimelineFileSource {
+ GESTimelineSource parent;
+
+ /*< private >*/
+ gchar *uri;
+};
+
+struct _GESTimelineFileSourceClass {
+ GESTimelineSourceClass parent_class;
+};
+
+GType ges_tl_filesource_get_type (void);
+
+GESTimelineFileSource* ges_timeline_filesource_new (gchar *uri);
+
+G_END_DECLS
+
+#endif /* _GES_TL_FILESOURCE */
+
g_object_class_install_property (object_class, PROP_PRIORITY,
g_param_spec_uint ("priority", "Priority",
"The priority of the object", 0, G_MAXUINT, 0, G_PARAM_READWRITE));
+
+ klass->need_fill_track = TRUE;
}
static void
* @object: The origin #GESTimelineObject
* @track: The #GESTrack to create a #GESTrackObject for.
*
- * Creates a #GESTrackObject for the provided @track.
+ * Creates a #GESTrackObject for the provided @track. The timeline object
+ * keep a reference to the newly created trackobject, you therefore need to
+ * call @ges_timeline_object_release_track_object when you are done with it.
*
* Returns: A #GESTrackObject. Returns NULL if the #GESTrackObject could not
* be created.
ges_track_object_set_timeline_object (res, object);
GST_DEBUG ("Adding TrackObject to the list of controlled track objects");
- object->trackobjects = g_list_append (object->trackobjects, res);
+ object->trackobjects =
+ g_list_append (object->trackobjects, g_object_ref (res));
}
return res;
}
+/**
+ * ges_timeline_object_release_track_object:
+ * @object: a #GESTimelineObject
+ * @trobj: the #GESTrackObject to release
+ */
gboolean
ges_timeline_object_release_track_object (GESTimelineObject * object,
GESTrackObject * trobj)
ges_track_object_set_timeline_object (trobj, NULL);
+ g_object_unref (trobj);
+
return TRUE;
}
GESTrackObject * trackobj, GstElement * gnlobj)
{
GESTimelineObjectClass *class;
- gboolean res;
+ gboolean res = TRUE;
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;
- }
+ if (class->need_fill_track) {
+ 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);
+ res = class->fill_track_object (object, trackobj, gnlobj);
+ }
if (G_LIKELY (res)) {
GST_DEBUG ("Setting properties");
* @parent_class: object parent class
* @create_track_object: method to create a #GESTrackObject for a given #GESTrack.
* @fill_track_object: method to fill an associated #GESTrackObject.
+ * @need_fill_track: Set to TRUE if @fill_track_object needs to be called.
*
* Subclasses can override the @create_track_object and @fill_track_object methods.
*/
GESTrack * track);
/* FIXME : might need a release_track_object */
FillTrackObjectFunc fill_track_object;
+ gboolean need_fill_track;
};
GType ges_timeline_object_get_type (void);
--- /dev/null
+/* 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.
+ */
+
+/**
+ * SECTION:ges-track-source
+ * @short_description: Base Class for single-media sources
+ */
+
+#include "ges-internal.h"
+#include "ges-track-object.h"
+#include "ges-track-filesource.h"
+
+G_DEFINE_TYPE (GESTrackFileSource, ges_track_filesource, GES_TYPE_TRACK_SOURCE);
+
+enum
+{
+ PROP_0,
+ PROP_URI
+};
+
+static void
+ges_track_filesource_get_property (GObject * object, guint property_id,
+ GValue * value, GParamSpec * pspec)
+{
+ GESTrackFileSource *tfs = GES_TRACK_FILESOURCE (object);
+
+ switch (property_id) {
+ case PROP_URI:
+ g_value_set_string (value, tfs->uri);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+ges_track_filesource_set_property (GObject * object, guint property_id,
+ const GValue * value, GParamSpec * pspec)
+{
+ GESTrackFileSource *tfs = GES_TRACK_FILESOURCE (object);
+
+ switch (property_id) {
+ case PROP_URI:
+ tfs->uri = g_value_dup_string (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+ }
+}
+
+static void
+ges_track_filesource_dispose (GObject * object)
+{
+ G_OBJECT_CLASS (ges_track_filesource_parent_class)->dispose (object);
+}
+
+static void
+ges_track_filesource_finalize (GObject * object)
+{
+ G_OBJECT_CLASS (ges_track_filesource_parent_class)->finalize (object);
+}
+
+static gboolean
+ges_track_filesource_create_gnl_object (GESTrackObject * object)
+{
+ object->gnlobject = gst_element_factory_make ("gnlurisource", NULL);
+ g_object_set (object->gnlobject, "uri", ((GESTrackFileSource *) object)->uri,
+ NULL);
+
+ return TRUE;
+}
+
+static void
+ges_track_filesource_class_init (GESTrackFileSourceClass * klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GESTrackObjectClass *track_class = GES_TRACK_OBJECT_CLASS (klass);
+
+ object_class->get_property = ges_track_filesource_get_property;
+ object_class->set_property = ges_track_filesource_set_property;
+ object_class->dispose = ges_track_filesource_dispose;
+ object_class->finalize = ges_track_filesource_finalize;
+
+ /**
+ * GESTrackFileSource:uri
+ *
+ * The location of the file/resource to use.
+ */
+ g_object_class_install_property (object_class, PROP_URI,
+ g_param_spec_string ("uri", "URI", "uri of the resource",
+ NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ track_class->create_gnl_object = ges_track_filesource_create_gnl_object;
+}
+
+static void
+ges_track_filesource_init (GESTrackFileSource * self)
+{
+}
+
+GESTrackFileSource *
+ges_track_filesource_new (gchar * uri)
+{
+ return g_object_new (GES_TYPE_TRACK_FILESOURCE, "uri", uri, NULL);
+}
--- /dev/null
+/* 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.
+ */
+
+#ifndef _GES_TRACK_FILESOURCE
+#define _GES_TRACK_FILESOURCE
+
+#include <glib-object.h>
+#include <ges/ges-types.h>
+#include <ges/ges-track-source.h>
+
+G_BEGIN_DECLS
+
+#define GES_TYPE_TRACK_FILESOURCE ges_track_filesource_get_type()
+
+#define GES_TRACK_FILESOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_TRACK_FILESOURCE, GESTrackFileSource))
+
+#define GES_TRACK_FILESOURCE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_TRACK_FILESOURCE, GESTrackFileSourceClass))
+
+#define GES_IS_TRACK_FILESOURCE(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_TRACK_FILESOURCE))
+
+#define GES_IS_TRACK_FILESOURCE_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_TRACK_FILESOURCE))
+
+#define GES_TRACK_FILESOURCE_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_TRACK_FILESOURCE, GESTrackFileSourceClass))
+
+struct _GESTrackFileSource {
+ GESTrackObject parent;
+
+ /*< public >*/
+ gchar *uri;
+};
+
+struct _GESTrackFileSourceClass {
+ GESTrackObjectClass parent_class;
+};
+
+GType ges_track_filesource_get_type (void);
+
+GESTrackFileSource* ges_track_filesource_new (gchar *uri);
+
+G_END_DECLS
+
+#endif /* _GES_TRACK_FILESOURCE */
+
typedef struct _GESTimelineSource GESTimelineSource;
typedef struct _GESTimelineSourceClass GESTimelineSourceClass;
+typedef struct _GESTimelineFileSource GESTimelineFileSource;
+typedef struct _GESTimelineFileSourceClass GESTimelineFileSourceClass;
typedef struct _GESTimelineTransition GESTimelineTransition;
typedef struct _GESTimelineTransitionClass GESTimelineTransitionClass;
typedef struct _GESTrackSource GESTrackSource;
typedef struct _GESTrackSourceClass GESTrackSourceClass;
+typedef struct _GESTrackFileSource GESTrackFileSource;
+typedef struct _GESTrackFileSourceClass GESTrackFileSourceClass;
+
#endif /* __GES_TYPES_H__ */
#include <ges/ges-track-source.h>
#include <ges/ges-custom-timeline-source.h>
+#include <ges/ges-timeline-file-source.h>
+#include <ges/ges-track-filesource.h>
G_BEGIN_DECLS