New CustomTimelineSource class.
authorEdward Hervey <edward.hervey@collabora.co.uk>
Fri, 7 Aug 2009 14:45:16 +0000 (16:45 +0200)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Fri, 7 Aug 2009 14:45:16 +0000 (16:45 +0200)
ges/Makefile.am
ges/ges-custom-timeline-source.c [new file with mode: 0644]
ges/ges-custom-timeline-source.h [new file with mode: 0644]
ges/ges-types.h
ges/ges.h

index c8b77db..0bf350c 100644 (file)
@@ -9,6 +9,7 @@ CLEANFILES = $(BUILT_SOURCES) $(built_header_make) $(built_source_make)
 
 libges_@GST_MAJORMINOR@_la_SOURCES =           \
        ges.c                                   \
+       ges-custom-timeline-source.c            \
        ges-simple-timeline-layer.c             \
        ges-timeline.c                          \
        ges-timeline-layer.c                    \
@@ -24,6 +25,7 @@ libges_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/ges
 libges_@GST_MAJORMINOR@include_HEADERS =       \
        ges-types.h                             \
        ges.h                                   \
+       ges-custom-timeline-source.h            \
        ges-internal.h                          \
        ges-simple-timeline-layer.h             \
        ges-timeline.h                          \
diff --git a/ges/ges-custom-timeline-source.c b/ges/ges-custom-timeline-source.c
new file mode 100644 (file)
index 0000000..cbc3448
--- /dev/null
@@ -0,0 +1,109 @@
+/* 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-custom-timeline-source.h"
+#include "ges-timeline-source.h"
+
+G_DEFINE_TYPE (GESCustomTimelineSource, ges_cust_timeline_src,
+    GES_TYPE_TIMELINE_SOURCE)
+
+     static gboolean
+         ges_cust_timeline_src_fill_track_object (GESTimelineObject * object,
+    GESTrackObject * trobject, GstElement * gnlobj);
+
+     static void
+         ges_cust_timeline_src_get_property (GObject * object,
+    guint property_id, GValue * value, GParamSpec * pspec)
+{
+  switch (property_id) {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+  }
+}
+
+static void
+ges_cust_timeline_src_set_property (GObject * object, guint property_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  switch (property_id) {
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+  }
+}
+
+static void
+ges_cust_timeline_src_dispose (GObject * object)
+{
+  G_OBJECT_CLASS (ges_cust_timeline_src_parent_class)->dispose (object);
+}
+
+static void
+ges_cust_timeline_src_finalize (GObject * object)
+{
+  G_OBJECT_CLASS (ges_cust_timeline_src_parent_class)->finalize (object);
+}
+
+static void
+ges_cust_timeline_src_class_init (GESCustomTimelineSourceClass * klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GESTimelineObjectClass *tlobj_class = GES_TIMELINE_OBJECT_CLASS (klass);
+
+  object_class->get_property = ges_cust_timeline_src_get_property;
+  object_class->set_property = ges_cust_timeline_src_set_property;
+  object_class->dispose = ges_cust_timeline_src_dispose;
+  object_class->finalize = ges_cust_timeline_src_finalize;
+
+  tlobj_class->fill_track_object = ges_cust_timeline_src_fill_track_object;
+}
+
+static void
+ges_cust_timeline_src_init (GESCustomTimelineSource * self)
+{
+}
+
+static gboolean
+ges_cust_timeline_src_fill_track_object (GESTimelineObject * object,
+    GESTrackObject * trobject, GstElement * gnlobj)
+{
+  gboolean res;
+
+  GST_DEBUG ("Calling callback (timelineobj:%p, trackobj:%, gnlobj:%p)",
+      object, trobject, gnlobj);
+
+  res =
+      GES_CUSTOM_TIMELINE_SOURCE (object)->filltrackobjectfunc (object,
+      trobject, gnlobj);
+
+  GST_DEBUG ("Returning res:%d", res);
+
+  return res;
+}
+
+GESCustomTimelineSource *
+ges_custom_timeline_source_new (FillTrackObjectFunc func)
+{
+  GESCustomTimelineSource *src;
+
+  src = g_object_new (GES_TYPE_CUSTOM_TIMELINE_SOURCE, NULL);
+  src->filltrackobjectfunc = func;
+
+  return src;
+}
diff --git a/ges/ges-custom-timeline-source.h b/ges/ges-custom-timeline-source.h
new file mode 100644 (file)
index 0000000..2499a64
--- /dev/null
@@ -0,0 +1,64 @@
+/* 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_CUST_TIMELINE_SRC
+#define _GES_CUST_TIMELINE_SRC
+
+#include <glib-object.h>
+#include <ges/ges-types.h>
+#include <ges/ges-timeline-source.h>
+
+G_BEGIN_DECLS
+
+#define GES_TYPE_CUSTOM_TIMELINE_SOURCE ges_cust_timeline_src_get_type()
+
+#define GES_CUSTOM_TIMELINE_SOURCE(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_CUSTOM_TIMELINE_SOURCE, GESCustomTimelineSource))
+
+#define GES_CUSTOM_TIMELINE_SOURCE_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_CUSTOM_TIMELINE_SOURCE, GESCustomTimelineSourceClass))
+
+#define GES_IS_CUSTOM_TIMELINE_SOURCE(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_CUSTOM_TIMELINE_SOURCE))
+
+#define GES_IS_CUSTOM_TIMELINE_SOURCE_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_CUSTOM_TIMELINE_SOURCE))
+
+#define GES_CUSTOM_TIMELINE_SOURCE_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_CUSTOM_TIMELINE_SOURCE, GESCustomTimelineSourceClass))
+
+struct _GESCustomTimelineSource {
+  GESTimelineSource parent;
+
+  FillTrackObjectFunc filltrackobjectfunc;
+};
+
+struct _GESCustomTimelineSourceClass {
+  GESTimelineSourceClass parent_class;
+};
+
+GType ges_cust_timeline_src_get_type (void);
+
+GESCustomTimelineSource*
+ges_custom_timeline_source_new (FillTrackObjectFunc);
+
+G_END_DECLS
+
+#endif /* _GES_CUST_TIMELINE_SRC */
+
index a87463d..7c4e60e 100644 (file)
@@ -20,6 +20,9 @@
 #ifndef __GES_TYPES_H__
 #define __GES_TYPES_H__
 
+typedef struct _GESCustomTimelineSource GESCustomTimelineSource;
+typedef struct _GESCustomTimelineSourceClass GESCustomTimelineSourceClass;
+
 typedef struct _GESSimpleTimelineLayer GESSimpleTimelineLayer;
 typedef struct _GESSimpleTimelineLayerClass GESSimpleTimelineLayerClass;
 
index b4369aa..995ae4f 100644 (file)
--- a/ges/ges.h
+++ b/ges/ges.h
@@ -36,6 +36,8 @@
 #include <ges/ges-track-object.h>
 #include <ges/ges-track-source.h>
 
+#include <ges/ges-custom-timeline-source.h>
+
 G_BEGIN_DECLS
 
 void ges_init (void);