check in GESTrackImageSource
authorBrandon Lewis <brandon@collabora.co.uk>
Fri, 6 Aug 2010 10:58:08 +0000 (12:58 +0200)
committerEdward Hervey <edward.hervey@collabora.co.uk>
Fri, 13 Aug 2010 09:50:30 +0000 (11:50 +0200)
docs/libs/ges-sections.txt
ges/Makefile.am
ges/ges-track-image-source.c [new file with mode: 0644]
ges/ges-track-image-source.h [new file with mode: 0644]
ges/ges-types.h
ges/ges.h

index a354d67..c0bc68b 100644 (file)
@@ -132,6 +132,22 @@ ges_track_filesource_get_type
 </SECTION>
 
 <SECTION>
+<FILE>ges-track-image-source</FILE>
+<TITLE>GESTrackImageSource</TITLE>
+GESTrackImageSource
+GESTrackImageSourceClass
+<SUBSECTION Standard>
+GES_IS_TRACK_IMAGE_SOURCE
+GES_IS_TRACK_IMAGE_SOURCE_CLASS
+GES_TRACK_IMAGE_SOURCE
+GES_TRACK_IMAGE_SOURCE_CLASS
+GES_TRACK_IMAGE_SOURCE_GET_CLASS
+GES_TYPE_TRACK_IMAGE_SOURCE
+ges_track_image_source_get_type
+ges_track_image_source_new
+</SECTION>
+
+<SECTION>
 <FILE>ges-track-transition</FILE>
 <TITLE>GESTrackTransition</TITLE>
 GESTrackTransition
index a4eb491..b117f3a 100644 (file)
@@ -29,6 +29,7 @@ libges_@GST_MAJORMINOR@_la_SOURCES =          \
        ges-track-source.c                      \
        ges-track-operation.c                   \
        ges-track-filesource.c                  \
+       ges-track-image-source.c                \
        ges-track-transition.c                  \
        ges-track-audio-transition.c            \
        ges-track-video-transition.c            \
@@ -64,6 +65,7 @@ libges_@GST_MAJORMINOR@include_HEADERS =      \
        ges-track-source.h                      \
        ges-track-operation.h                   \
        ges-track-filesource.h                  \
+       ges-track-image-source.h                \
        ges-track-transition.h                  \
        ges-track-audio-transition.h            \
        ges-track-video-transition.h            \
diff --git a/ges/ges-track-image-source.c b/ges/ges-track-image-source.c
new file mode 100644 (file)
index 0000000..f5d559d
--- /dev/null
@@ -0,0 +1,132 @@
+/* GStreamer Editing Services
+ * Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
+ *               2009 Nokia Corporation
+ *
+ * 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-image-source
+ * @short_description: outputs the video stream from a media file as a still
+ * image.
+ * 
+ * Outputs the video stream from a given file as a still frame. The frame
+ * chosen will be determined by the in-point property on the track object. For
+ * image files, do not set the in-point property.
+ */
+
+#include "ges-internal.h"
+#include "ges-track-object.h"
+#include "ges-track-image-source.h"
+
+G_DEFINE_TYPE (GESTrackImageSource, ges_track_image_source,
+    GES_TYPE_TRACK_SOURCE);
+
+enum
+{
+  PROP_0,
+  PROP_URI
+};
+
+static void
+ges_track_image_source_get_property (GObject * object, guint property_id,
+    GValue * value, GParamSpec * pspec)
+{
+  GESTrackImageSource *tfs = GES_TRACK_IMAGE_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_track_image_source_set_property (GObject * object, guint property_id,
+    const GValue * value, GParamSpec * pspec)
+{
+  GESTrackImageSource *tfs = GES_TRACK_IMAGE_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_track_image_source_dispose (GObject * object)
+{
+  GESTrackImageSource *tfs = GES_TRACK_IMAGE_SOURCE (object);
+
+  if (tfs->uri)
+    g_free (tfs->uri);
+
+  G_OBJECT_CLASS (ges_track_image_source_parent_class)->dispose (object);
+}
+
+static void
+ges_track_image_source_finalize (GObject * object)
+{
+  G_OBJECT_CLASS (ges_track_image_source_parent_class)->finalize (object);
+}
+
+static gboolean
+ges_track_image_source_create_gnl_object (GESTrackObject * object)
+{
+  object->gnlobject = gst_element_factory_make ("gnlurisource", NULL);
+  g_object_set (object->gnlobject, "uri", ((GESTrackImageSource *) object)->uri,
+      NULL);
+
+  return TRUE;
+}
+
+static void
+ges_track_image_source_class_init (GESTrackImageSourceClass * klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GESTrackObjectClass *track_class = GES_TRACK_OBJECT_CLASS (klass);
+
+  object_class->get_property = ges_track_image_source_get_property;
+  object_class->set_property = ges_track_image_source_set_property;
+  object_class->dispose = ges_track_image_source_dispose;
+  object_class->finalize = ges_track_image_source_finalize;
+
+  /**
+   * GESTrackImageSource: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_image_source_create_gnl_object;
+}
+
+static void
+ges_track_image_source_init (GESTrackImageSource * self)
+{
+}
+
+GESTrackImageSource *
+ges_track_image_source_new (gchar * uri)
+{
+  return g_object_new (GES_TYPE_TRACK_IMAGE_SOURCE, "uri", uri, NULL);
+}
diff --git a/ges/ges-track-image-source.h b/ges/ges-track-image-source.h
new file mode 100644 (file)
index 0000000..1a29dd1
--- /dev/null
@@ -0,0 +1,76 @@
+/* GStreamer Editing Services
+ * Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
+ *               2009 Nokia Corporation
+ *
+ * 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_IMAGE_SOURCE
+#define _GES_TRACK_IMAGE_SOURCE
+
+#include <glib-object.h>
+#include <ges/ges-types.h>
+#include <ges/ges-track-source.h>
+
+G_BEGIN_DECLS
+
+#define GES_TYPE_TRACK_IMAGE_SOURCE ges_track_image_source_get_type()
+
+#define GES_TRACK_IMAGE_SOURCE(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GES_TYPE_TRACK_IMAGE_SOURCE, GESTrackImageSource))
+
+#define GES_TRACK_IMAGE_SOURCE_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), GES_TYPE_TRACK_IMAGE_SOURCE, GESTrackImageSourceClass))
+
+#define GES_IS_TRACK_IMAGE_SOURCE(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GES_TYPE_TRACK_IMAGE_SOURCE))
+
+#define GES_IS_TRACK_IMAGE_SOURCE_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), GES_TYPE_TRACK_IMAGE_SOURCE))
+
+#define GES_TRACK_IMAGE_SOURCE_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_TRACK_IMAGE_SOURCE, GESTrackImageSourceClass))
+/** 
+ * GESTrackImageSource:
+ * @uri: #gchar *, the URI of the media file to play
+ *
+ */
+struct _GESTrackImageSource {
+  GESTrackSource parent;
+
+  /*< public >*/
+  gchar *uri;
+};
+
+/**
+ * GESTrackImageSourceClass:
+ * @parent_class: parent class
+ */
+
+struct _GESTrackImageSourceClass {
+  GESTrackSourceClass parent_class;
+
+  /* <public> */
+};
+
+GType ges_track_image_source_get_type (void);
+
+GESTrackImageSource* ges_track_image_source_new (gchar *uri);
+
+G_END_DECLS
+
+#endif /* _GES_TRACK_IMAGE_SOURCE */
+
index 2b8b788..5210b61 100644 (file)
@@ -75,6 +75,9 @@ typedef struct _GESTrackOperationClass GESTrackOperationClass;
 typedef struct _GESTrackFileSource GESTrackFileSource;
 typedef struct _GESTrackFileSourceClass GESTrackFileSourceClass;
 
+typedef struct _GESTrackImageSource GESTrackImageSource;
+typedef struct _GESTrackImageSourceClass GESTrackImageSourceClass;
+
 typedef struct _GESTrackTransition GESTrackTransition;
 typedef struct _GESTrackTransitionClass GESTrackTransitionClass;
 
index 221a107..a5c5ec7 100644 (file)
--- a/ges/ges.h
+++ b/ges/ges.h
@@ -45,6 +45,7 @@
 #include <ges/ges-custom-timeline-source.h>
 #include <ges/ges-timeline-file-source.h>
 #include <ges/ges-track-filesource.h>
+#include <ges/ges-track-image-source.h>
 #include <ges/ges-track-video-test-source.h>
 #include <ges/ges-track-audio-test-source.h>
 #include <ges/ges-track-title-source.h>