[Cogl] [PATCH 5/9] gst: Don't rebuild the video sink for the plugin

Neil Roberts neil at linux.intel.com
Fri Mar 1 05:31:56 PST 2013


The plugin can just depend on libcogl-gst instead of relinking in the
code from it. If we don't do this then if an application directly
links against libcogl-gst then GStreamer will additionally pull in the
plugin library and it will have two copies of the symbols. This is
quite likely to get in a mess.
---
 cogl-gst/Makefile.am           | 12 ++++----
 cogl-gst/cogl-gst-plugin.c     | 62 ++++++++++++++++++++++++++++++++++++++++++
 cogl-gst/cogl-gst-video-sink.c | 24 ----------------
 3 files changed, 67 insertions(+), 31 deletions(-)
 create mode 100644 cogl-gst/cogl-gst-plugin.c

diff --git a/cogl-gst/Makefile.am b/cogl-gst/Makefile.am
index aae90da..1132d4a 100644
--- a/cogl-gst/Makefile.am
+++ b/cogl-gst/Makefile.am
@@ -46,12 +46,8 @@ AM_CPPFLAGS = \
 cogl_gstheadersdir = $(includedir)/cogl2/cogl-gst
 cogl_gstheaders_HEADERS = $(source_h)
 
-plugin_source_c = 				\
-  $(srcdir)/cogl-gst.h \
-  $(srcdir)/cogl-gst-shader.c \
-  $(srcdir)/cogl-gst-shader-private.h \
-	$(srcdir)/cogl-gst-video-sink.c	\
-	$(srcdir)/cogl-gst-video-sink.h	\
+plugin_source_c = \
+	$(srcdir)/cogl-gst-plugin.c \
 	$(NULL)
 
 libgstcogl_la_SOURCES =	\
@@ -61,7 +57,9 @@ libgstcogl_la_SOURCES =	\
 plugin_LTLIBRARIES = libgstcogl.la
 
 libgstcogl_la_CFLAGS = $(COGL_DEP_CFLAGS) $(COGL_GST_DEP_CFLAGS) $(COGL_EXTRA_CFLAGS) $(MAINTAINER_CFLAGS)
-libgstcogl_la_LIBADD = $(top_builddir)/cogl/libcogl2.la
+libgstcogl_la_LIBADD = \
+	$(top_builddir)/cogl/libcogl2.la \
+	$(top_builddir)/cogl-gst/libcogl-gst.la
 libgstcogl_la_LIBADD += $(COGL_DEP_LIBS) $(COGL_GST_DEP_LIBS) $(COGL_EXTRA_LDFLAGS)
 libgstcogl_la_LDFLAGS =	\
 	-avoid-version -no-undefined		\
diff --git a/cogl-gst/cogl-gst-plugin.c b/cogl-gst/cogl-gst-plugin.c
new file mode 100644
index 0000000..9588146
--- /dev/null
+++ b/cogl-gst/cogl-gst-plugin.c
@@ -0,0 +1,62 @@
+/*
+ * Cogl-GStreamer.
+ *
+ * GStreamer integration library for Cogl.
+ *
+ * cogl-gst-video-sink.c - Gstreamer Video Sink that renders to a
+ *                         Cogl Pipeline.
+ *
+ * Authored by Jonathan Matthew  <jonathan at kaolin.wh9.net>,
+ *             Chris Lord        <chris at openedhand.com>
+ *             Damien Lespiau    <damien.lespiau at intel.com>
+ *             Matthew Allum     <mallum at openedhand.com>
+ *             Plamena Manolova  <plamena.n.manolova at intel.com>
+ *
+ * Copyright (C) 2007, 2008 OpenedHand
+ * Copyright (C) 2009, 2010, 2013 Intel Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser 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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+
+#include "cogl-gst-video-sink.h"
+
+#define PACKAGE "CoglGst"
+#define VERSION "0.0"
+
+static CoglBool
+_plugin_init (GstPlugin * coglgstvideosink)
+{
+  return gst_element_register (coglgstvideosink, "coglsink", GST_RANK_PRIMARY,
+      COGL_GST_TYPE_VIDEO_SINK);
+}
+
+GST_PLUGIN_DEFINE (
+    GST_VERSION_MAJOR,
+    GST_VERSION_MINOR,
+    cogl,
+    "Sends video data from GStreamer to a Cogl pipeline",
+    _plugin_init,
+    VERSION,
+    "LGPL",
+    "CoglGst",
+    "http://gstreamer.net/"
+)
diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c
index 774ded3..9c82ff7 100644
--- a/cogl-gst/cogl-gst-video-sink.c
+++ b/cogl-gst/cogl-gst-video-sink.c
@@ -47,8 +47,6 @@
 
 #define COGL_GST_TEXTURE_FLAGS \
        (COGL_TEXTURE_NO_SLICING | COGL_TEXTURE_NO_ATLAS)
-#define PACKAGE "CoglGst"
-#define VERSION "0.0"
 #define COGL_GST_DEFAULT_PRIORITY    (G_PRIORITY_HIGH_IDLE)
 #ifdef HAVE_HW_DECODER_SUPPORT
 #define GST_USE_UNSTABLE_API 1
@@ -1095,25 +1093,3 @@ cogl_gst_video_sink_new (CoglContext *ctx)
 
   return sink;
 }
-
-
-static CoglBool
-_plugin_init (GstPlugin * coglgstvideosink)
-{
-  return gst_element_register (coglgstvideosink, "coglsink", GST_RANK_PRIMARY,
-      COGL_GST_TYPE_VIDEO_SINK);
-}
-
-GST_PLUGIN_DEFINE (
-    GST_VERSION_MAJOR,
-    GST_VERSION_MINOR,
-    cogl,
-    "Sends video data from GStreamer to a Cogl pipeline",
-    _plugin_init,
-    VERSION,
-    "LGPL",
-    "CoglGst",
-    "http://gstreamer.net/"
-)
-
-
-- 
1.7.11.3.g3c3efa5



More information about the Cogl mailing list