[clutter-gst] video-sink: Add a standalone GStreamer plugin



commit 76d911db3b3e9ac8734b52dc41f83c1e528286a8
Author: Josep Torra <n770galaxy gmail com>
Date:   Wed Sep 21 14:15:11 2011 +0200

    video-sink: Add a standalone GStreamer plugin
    
    * Build the videosink as an independent .so library that can be deployed
      in GStreamer plugin directory.
    * Deprecate clutter_gst_video_sink_new() in favor of the usual GStreamer
      way of instanciating elements

 clutter-gst/Makefile.am                 |   23 ++++++++++++-
 clutter-gst/clutter-gst-util.c          |   25 +++++++++++++
 clutter-gst/clutter-gst-util.h          |    3 ++
 clutter-gst/clutter-gst-video-sink.c    |   57 +++++++++---------------------
 clutter-gst/clutter-gst-video-sink.h    |    1 -
 clutter-gst/clutter-gst-video-texture.c |    2 +-
 clutter-gst/clutter-gst.h               |    2 +-
 configure.ac                            |   11 ++++++
 8 files changed, 80 insertions(+), 44 deletions(-)
---
diff --git a/clutter-gst/Makefile.am b/clutter-gst/Makefile.am
index 4d4e124..47ca24d 100644
--- a/clutter-gst/Makefile.am
+++ b/clutter-gst/Makefile.am
@@ -25,7 +25,7 @@ source_h = 					\
 	$(srcdir)/clutter-gst-types.h		\
 	$(srcdir)/clutter-gst-util.h		\
 	$(srcdir)/clutter-gst-version.h		\
-	$(srcdir)/clutter-gst-video-sink.h 	\
+	$(srcdir)/clutter-gst-video-sink.h	\
 	$(srcdir)/clutter-gst-video-texture.h 	\
 	$(srcdir)/clutter-gst-player.h		\
 	$(NULL)
@@ -92,6 +92,27 @@ cluttergstheadersdir = $(includedir)/clutter- CLUTTER_API_VERSION@/clutter-gst
 cluttergstheaders_HEADERS = $(source_h) $(glib_enum_h)
 
 #
+# GStreamer plugin
+#
+
+plugin_source_c = 				\
+	$(srcdir)/clutter-gst-video-sink.c	\
+	$(NULL)
+
+libgstclutter_la_SOURCES =	\
+	$(plugin_source_c)      \
+	$(NULL)
+
+plugin_LTLIBRARIES = libgstclutter.la
+
+libgstclutter_la_LIBADD  = $(PLUGIN_LIBS)
+libgstclutter_la_LDFLAGS =	\
+	$(GL_LDFLAGS)		\
+	-module -avoid-version	\
+	-no-undefined		\
+	$(NULL)
+
+#
 # Introspection data
 #
 
diff --git a/clutter-gst/clutter-gst-util.c b/clutter-gst/clutter-gst-util.c
index 3c7c325..f344ede 100644
--- a/clutter-gst/clutter-gst-util.c
+++ b/clutter-gst/clutter-gst-util.c
@@ -98,6 +98,7 @@
 #include <clutter/clutter.h>
 
 #include "clutter-gst-debug.h"
+#include "clutter-gst-video-sink.h"
 #include "clutter-gst-util.h"
 
 static gboolean clutter_gst_is_initialized = FALSE;
@@ -202,3 +203,27 @@ clutter_gst_init_with_args (int            *argc,
   return CLUTTER_INIT_SUCCESS;
 }
 
+/**
+ * clutter_gst_video_sink_new:
+ * @texture: a #ClutterTexture
+ *
+ * Creates a new GStreamer video sink which uses @texture as the target
+ * for sinking a video stream from GStreamer.
+ *
+ * <note>This function has to be called from Clutter's main thread. While
+ * GStreamer will spawn threads to do its work, we want all the GL calls to
+ * happen in the same thread. Clutter-gst knows which thread it is by
+ * assuming this constructor is called from the Clutter thread.</note>
+ *
+ * Return value: a #GstElement for the newly created video sink
+ *
+ * Deprecated: 1.6: Use gst_element_factory_make ("cluttersink", ...) and the
+ * "texture" GObject property instead.
+ */
+GstElement *
+clutter_gst_video_sink_new (ClutterTexture *texture)
+{
+  return g_object_new (CLUTTER_GST_TYPE_VIDEO_SINK,
+                       "texture", texture,
+                       NULL);
+}
diff --git a/clutter-gst/clutter-gst-util.h b/clutter-gst/clutter-gst-util.h
index ea738a2..e418b52 100644
--- a/clutter-gst/clutter-gst-util.h
+++ b/clutter-gst/clutter-gst-util.h
@@ -33,6 +33,7 @@
 #define __CLUTTER_GST_UTIL_H__
 
 #include <clutter/clutter.h>
+#include <gst/gst.h>
 
 G_BEGIN_DECLS
 
@@ -44,6 +45,8 @@ ClutterInitError clutter_gst_init_with_args (int            *argc,
                                              GOptionEntry   *entries,
                                              const char     *translation_domain,
                                              GError        **error);
+GstElement *     clutter_gst_video_sink_new (ClutterTexture *texture) G_GNUC_DEPRECATED;
+
 
 G_END_DECLS
 
diff --git a/clutter-gst/clutter-gst-video-sink.c b/clutter-gst/clutter-gst-video-sink.c
index 9c676c8..4efd5a9 100644
--- a/clutter-gst/clutter-gst-video-sink.c
+++ b/clutter-gst/clutter-gst-video-sink.c
@@ -1343,27 +1343,6 @@ clutter_gst_video_sink_class_init (ClutterGstVideoSinkClass *klass)
   g_object_class_install_property (gobject_class, PROP_UPDATE_PRIORITY, pspec);
 }
 
-/**
- * clutter_gst_video_sink_new:
- * @texture: a #ClutterTexture
- *
- * Creates a new GStreamer video sink which uses @texture as the target
- * for sinking a video stream from GStreamer.
- *
- * <note>This function has to be called from Clutter's main thread. While
- * GStreamer will spawn threads to do its work, we want all the GL calls to
- * happen in the same thread. Clutter-gst knows which thread it is by
- * assuming this constructor is called from the Clutter thread.</note>
- * Return value: a #GstElement for the newly created video sink
- */
-GstElement *
-clutter_gst_video_sink_new (ClutterTexture *texture)
-{
-  return g_object_new (CLUTTER_GST_TYPE_VIDEO_SINK,
-                       "texture", texture,
-                       NULL);
-}
-
 static void
 clutter_gst_navigation_send_event (GstNavigation *navigation,
                                    GstStructure  *structure)
@@ -1424,25 +1403,23 @@ clutter_gst_navigation_interface_init (GstNavigationInterface *iface)
 static gboolean
 plugin_init (GstPlugin *plugin)
 {
-  gboolean ret = gst_element_register (plugin,
-                                             "cluttersink",
-                                       GST_RANK_PRIMARY,
-                                       CLUTTER_GST_TYPE_VIDEO_SINK);
-
   GST_DEBUG_CATEGORY_INIT (clutter_gst_video_sink_debug,
-                                 "cluttersink",
-                                 0,
-                                 "clutter video sink");
-
-  return ret;
+			   "cluttersink",
+			   0,
+			   "clutter video sink");
+
+  return gst_element_register (plugin,
+			       "cluttersink",
+			       GST_RANK_NONE,
+			       CLUTTER_GST_TYPE_VIDEO_SINK);;
 }
 
-GST_PLUGIN_DEFINE_STATIC (GST_VERSION_MAJOR,
-                          GST_VERSION_MINOR,
-                          "cluttersink",
-                          "Element to render to Clutter textures",
-                          plugin_init,
-                          VERSION,
-                          "LGPL", /* license */
-                          PACKAGE,
-                          "http://www.clutter-project.org";);
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+		   GST_VERSION_MINOR,
+		   "cluttersink",
+		   "Element to render to Clutter textures",
+		   plugin_init,
+		   VERSION,
+		   "LGPL", /* license */
+		   PACKAGE,
+		   "http://www.clutter-project.org";);
diff --git a/clutter-gst/clutter-gst-video-sink.h b/clutter-gst/clutter-gst-video-sink.h
index 1a4ba8e..e05fd4a 100644
--- a/clutter-gst/clutter-gst-video-sink.h
+++ b/clutter-gst/clutter-gst-video-sink.h
@@ -100,7 +100,6 @@ struct _ClutterGstVideoSinkClass
 };
 
 GType       clutter_gst_video_sink_get_type    (void) G_GNUC_CONST;
-GstElement *clutter_gst_video_sink_new         (ClutterTexture *texture);
 
 G_END_DECLS
 
diff --git a/clutter-gst/clutter-gst-video-texture.c b/clutter-gst/clutter-gst-video-texture.c
index 5de9e06..bb38cef 100644
--- a/clutter-gst/clutter-gst-video-texture.c
+++ b/clutter-gst/clutter-gst-video-texture.c
@@ -51,7 +51,7 @@
 #include "clutter-gst-marshal.h"
 #include "clutter-gst-player.h"
 #include "clutter-gst-private.h"
-#include "clutter-gst-video-sink.h"
+#include "clutter-gst-util.h"
 #include "clutter-gst-video-texture.h"
 
 struct _ClutterGstVideoTexturePrivate
diff --git a/clutter-gst/clutter-gst.h b/clutter-gst/clutter-gst.h
index 1832396..0723db1 100644
--- a/clutter-gst/clutter-gst.h
+++ b/clutter-gst/clutter-gst.h
@@ -32,9 +32,9 @@
 
 #include "clutter-gst-types.h"
 #include "clutter-gst-enum-types.h"
+#include "clutter-gst-video-sink.h"
 #include "clutter-gst-video-texture.h"
 #include "clutter-gst-util.h"
 #include "clutter-gst-version.h"
-#include "clutter-gst-video-sink.h"
 
 #endif /* __CLUTTER_GST_H__ */
diff --git a/configure.ac b/configure.ac
index 508cf16..cbd9864 100644
--- a/configure.ac
+++ b/configure.ac
@@ -146,6 +146,17 @@ GST_MAJORMINOR=0.10
 pkg_modules="gstreamer-$GST_MAJORMINOR >= $GSTREAMER_REQ_VERSION gstreamer-plugins-base-$GST_MAJORMINOR gstreamer-base-$GST_MAJORMINOR gstreamer-interfaces-$GST_MAJORMINOR gstreamer-video-$GST_MAJORMINOR gstreamer-audio-$GST_MAJORMINOR gstreamer-tag-$GST_MAJORMINOR"
 PKG_CHECK_MODULES(GST, [$pkg_modules])
 
+dnl libs used by the plugin
+PKG_CHECK_MODULES([PLUGIN],
+                  [clutter-1.0 >= $CLUTTER_REQ_VERSION
+                   gstreamer-$GST_MAJORMINOR >= $GSTREAMER_REQ_VERSION
+                   gstreamer-base-$GST_MAJORMINOR
+                   gstreamer-interfaces-$GST_MAJORMINOR])
+
+dnl define location of gstreamer plugin directory
+plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR"
+AC_SUBST(plugindir)
+
 dnl ========================================================================
 dnl GL inclusion and link. We depend on GL for the single glGetIntegerv()
 dnl call. The end goal is to get rid of it, but we can't just yet.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]