Move NLE to a dedicated GstPlugin
authorThibault Saunier <tsaunier@gnome.org>
Wed, 19 Aug 2015 09:24:11 +0000 (11:24 +0200)
committerThibault Saunier <tsaunier@gnome.org>
Thu, 20 Aug 2015 11:49:20 +0000 (13:49 +0200)
Summary: Allowing external user to directly use it

Reviewers: Mathieu_Du

Differential Revision: https://phabricator.freedesktop.org/D231

27 files changed:
.arcconfig
Makefile.am
configure.ac
ges/Makefile.am
ges/ges-internal.h
ges/ges-track.c
ges/ges-utils.c
ges/ges.c
plugins/Makefile.am [new file with mode: 0644]
plugins/nle/.gitignore [moved from ges/nle/.gitignore with 100% similarity]
plugins/nle/Makefile.am [new file with mode: 0644]
plugins/nle/gnlmarshal.list [moved from ges/nle/gnlmarshal.list with 100% similarity]
plugins/nle/gstnle.c [new file with mode: 0644]
plugins/nle/nle.h [moved from ges/nle/nle.h with 100% similarity]
plugins/nle/nlecomposition.c [moved from ges/nle/nlecomposition.c with 100% similarity]
plugins/nle/nlecomposition.h [moved from ges/nle/nlecomposition.h with 100% similarity]
plugins/nle/nleghostpad.c [moved from ges/nle/nleghostpad.c with 100% similarity]
plugins/nle/nleghostpad.h [moved from ges/nle/nleghostpad.h with 100% similarity]
plugins/nle/nleobject.c [moved from ges/nle/nleobject.c with 100% similarity]
plugins/nle/nleobject.h [moved from ges/nle/nleobject.h with 100% similarity]
plugins/nle/nleoperation.c [moved from ges/nle/nleoperation.c with 100% similarity]
plugins/nle/nleoperation.h [moved from ges/nle/nleoperation.h with 100% similarity]
plugins/nle/nlesource.c [moved from ges/nle/nlesource.c with 100% similarity]
plugins/nle/nlesource.h [moved from ges/nle/nlesource.h with 100% similarity]
plugins/nle/nletypes.h [moved from ges/nle/nletypes.h with 100% similarity]
plugins/nle/nleurisource.c [moved from ges/nle/nleurisource.c with 100% similarity]
plugins/nle/nleurisource.h [moved from ges/nle/nleurisource.h with 100% similarity]

index fc70fd3..728aa7a 100644 (file)
@@ -1,3 +1,3 @@
 {
-    "phabricator.uri" : "http://phabricator.freedesktop.org/"
+    "phabricator.uri" : "https:\/\/phabricator.freedesktop.org\/api\/"
 }
index 127de2d..c9c83a3 100644 (file)
@@ -1,6 +1,6 @@
 DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc
 
-SUBDIRS = ges tests tools common m4 pkgconfig docs bindings
+SUBDIRS = ges tests tools common m4 pkgconfig docs bindings plugins
 
 DIST_SUBDIRS = $(SUBDIRS)
 
index 3a20a23..65ed31a 100644 (file)
@@ -235,6 +235,12 @@ AG_GST_CHECK_GST_CONTROLLER($GST_API_VERSION, [$GST_REQ], yes)
 AG_GST_CHECK_GST_PLUGINS_BASE($GST_API_VERSION, [$GSTPB_REQ], yes)
 AM_CONDITIONAL(HAVE_GST_CHECK, test "x$HAVE_GST_CHECK" = "xyes")
 
+AG_GST_ARG_WITH_PLUGINS
+AG_GST_CHECK_PLUGIN(plugins)
+
+dnl set location of plugin directory
+AG_GST_SET_PLUGINDIR
+
 GSTPB_PLUGINS_DIR=`$PKG_CONFIG gstreamer-plugins-base-$GST_API_VERSION --variable pluginsdir`
 AC_SUBST(GSTPB_PLUGINS_DIR)
 AC_MSG_NOTICE(Using GStreamer Base Plugins in $GSTPB_PLUGINS_DIR)
@@ -420,6 +426,8 @@ docs/libs/Makefile
 pkgconfig/Makefile
 pkgconfig/gst-editing-services.pc
 pkgconfig/gst-editing-services-uninstalled.pc
+plugins/Makefile
+plugins/nle/Makefile
 bindings/Makefile
 bindings/python/Makefile
 bindings/python/gi/Makefile
index 0c30083..8f45924 100644 (file)
@@ -15,12 +15,6 @@ nodist_libges_@GST_API_VERSION@_la_SOURCES = lex.priv_ges_parse_yy.c parse_lex.h
 
 libges_@GST_API_VERSION@_la_SOURCES =          \
        $(built_source_make)                    \
-       nle/nleobject.c         \
-       nle/nlecomposition.c    \
-       nle/nleghostpad.c               \
-       nle/nleoperation.c              \
-       nle/nlesource.c         \
-       nle/nleurisource.c  \
        ges.c                                   \
        ges-enums.c                             \
        ges-meta-container.c        \
@@ -151,15 +145,6 @@ libges_@GST_API_VERSION@include_HEADERS =  \
        ges-version.h
 
 noinst_HEADERS = \
-       nle/nle.h                       \
-       nle/nleobject.h         \
-       nle/nlecomposition.h    \
-       nle/nletypes.h          \
-       nle/nleghostpad.h               \
-       nle/nleoperation.h              \
-       nle/nlesource.h         \
-       nle/nletypes.h          \
-       nle/nleurisource.h \
        ges-internal.h \
        ges-auto-transition.h \
        ges-structured-interface.h \
index 53a775d..cf3852c 100644 (file)
@@ -382,5 +382,6 @@ G_GNUC_INTERNAL GESMultiFileURI * ges_multi_file_uri_new (const gchar * uri);
 
 G_GNUC_INTERNAL gboolean nle_composition_add_object (GstElement *comp, GstElement *object);
 G_GNUC_INTERNAL gboolean nle_composition_remove_object (GstElement *comp, GstElement *object);
+G_GNUC_INTERNAL gboolean nle_object_commit (GstElement * nlesource, gboolean recurse);
 
 #endif /* __GES_INTERNAL_H__ */
index e573f85..8d66342 100644 (file)
@@ -33,7 +33,6 @@
 #include "ges-meta-container.h"
 #include "ges-video-track.h"
 #include "ges-audio-track.h"
-#include "nle/nleobject.h"
 
 G_DEFINE_TYPE_WITH_CODE (GESTrack, ges_track, GST_TYPE_BIN,
     G_IMPLEMENT_INTERFACE (GES_TYPE_META_CONTAINER, NULL));
@@ -453,7 +452,7 @@ ges_track_dispose (GObject * object)
       (GFunc) dispose_trackelements_foreach, track);
   g_sequence_free (priv->trackelements_by_start);
   g_list_free_full (priv->gaps, (GDestroyNotify) free_gap);
-  nle_object_commit (NLE_OBJECT (track->priv->composition), TRUE);
+  nle_object_commit (track->priv->composition, TRUE);
 
   if (priv->mixing_operation)
     gst_object_unref (priv->mixing_operation);
@@ -1096,7 +1095,7 @@ ges_track_commit (GESTrack * track)
 
   track_resort_and_fill_gaps (track);
 
-  return nle_object_commit (NLE_OBJECT (track->priv->composition), TRUE);
+  return nle_object_commit (track->priv->composition, TRUE);
 }
 
 
index 21eb5dc..4be6be4 100644 (file)
@@ -173,3 +173,13 @@ nle_composition_remove_object (GstElement * comp, GstElement * object)
 {
   return gst_bin_remove (GST_BIN (comp), object);
 }
+
+gboolean
+nle_object_commit (GstElement * nlesource, gboolean recurse)
+{
+  gboolean ret;
+
+  g_signal_emit_by_name (nlesource, "commit", recurse, &ret);
+
+  return ret;
+}
index f169729..5cc39f4 100644 (file)
--- a/ges/ges.c
+++ b/ges/ges.c
@@ -34,7 +34,6 @@
 #include <ges/ges.h>
 #include "ges/gstframepositionner.h"
 #include "ges-internal.h"
-#include "ges/nle/nle.h"
 
 #define GES_GNONLIN_VERSION_NEEDED_MAJOR 1
 #define GES_GNONLIN_VERSION_NEEDED_MINOR 2
@@ -44,20 +43,6 @@ GST_DEBUG_CATEGORY (_ges_debug);
 
 static gboolean ges_initialized = FALSE;
 
-struct _elements_entry
-{
-  const gchar *name;
-    GType (*type) (void);
-};
-
-static struct _elements_entry _elements[] = {
-  {"nlesource", nle_source_get_type},
-  {"nlecomposition", nle_composition_get_type},
-  {"nleoperation", nle_operation_get_type},
-  {"nleurisource", nle_urisource_get_type},
-  {NULL, 0}
-};
-
 /**
  * ges_init:
  *
@@ -69,8 +54,6 @@ static struct _elements_entry _elements[] = {
 gboolean
 ges_init (void)
 {
-  gint i = 0;
-
   /* initialize debugging category */
   GST_DEBUG_CATEGORY_INIT (_ges_debug, "ges", GST_DEBUG_FG_YELLOW,
       "GStreamer Editing Services");
@@ -108,13 +91,6 @@ ges_init (void)
       GST_TYPE_FRAME_POSITIONNER);
   gst_element_register (NULL, "gespipeline", 0, GES_TYPE_PIPELINE);
 
-  for (; _elements[i].name; i++)
-    if (!(gst_element_register (NULL,
-                _elements[i].name, GST_RANK_NONE, (_elements[i].type) ())))
-      return FALSE;
-
-  nle_init_ghostpad_category ();
-
   /* TODO: user-defined types? */
   ges_initialized = TRUE;
 
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
new file mode 100644 (file)
index 0000000..7f0a006
--- /dev/null
@@ -0,0 +1 @@
+SUBDIRS = nle
similarity index 100%
rename from ges/nle/.gitignore
rename to plugins/nle/.gitignore
diff --git a/plugins/nle/Makefile.am b/plugins/nle/Makefile.am
new file mode 100644 (file)
index 0000000..2e8fa57
--- /dev/null
@@ -0,0 +1,30 @@
+plugin_LTLIBRARIES = libgstnle.la
+
+libgstnle_la_SOURCES = gstnle.c \
+       nleobject.c             \
+       nlecomposition.c        \
+       nleghostpad.c           \
+       nleoperation.c          \
+       nlesource.c             \
+       nleurisource.c
+
+libgstnle_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) \
+       $(GST_BASE_CFLAGS) $(GST_CFLAGS) \
+       -I$(top_srcdir)
+
+libgstnle_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) \
+       $(GST_BASE_LIBS) $(GST_LIBS)
+
+libgstnle_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstnle_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
+
+noinst_HEADERS = \
+       nle.h                   \
+       nleobject.h             \
+       nlecomposition.h        \
+       nletypes.h              \
+       nleghostpad.h           \
+       nleoperation.h          \
+       nlesource.h             \
+       nletypes.h              \
+       nleurisource.h
diff --git a/plugins/nle/gstnle.c b/plugins/nle/gstnle.c
new file mode 100644 (file)
index 0000000..df32330
--- /dev/null
@@ -0,0 +1,66 @@
+/* Non Linear Engine plugin
+ *
+ * Copyright (C) 2015 Thibault Saunier <thibault.saunier@collabora.com>
+ *
+ * gstnle.c
+ *
+ * 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., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+#include "nle.h"
+
+struct _elements_entry
+{
+  const gchar *name;
+    GType (*type) (void);
+};
+
+static struct _elements_entry _elements[] = {
+  {"nlesource", nle_source_get_type},
+  {"nlecomposition", nle_composition_get_type},
+  {"nleoperation", nle_operation_get_type},
+  {"nleurisource", nle_urisource_get_type},
+  {NULL, 0}
+};
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+  gint i = 0;
+
+  for (; _elements[i].name; i++)
+    if (!(gst_element_register (plugin,
+                _elements[i].name, GST_RANK_NONE, (_elements[i].type) ())))
+      return FALSE;
+
+  nle_init_ghostpad_category ();
+
+  return TRUE;
+}
+
+/* plugin export resolution */
+GST_PLUGIN_DEFINE
+    (GST_VERSION_MAJOR,
+    GST_VERSION_MINOR,
+    nle,
+    "GStreamer Non Linear Engine",
+    plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
similarity index 100%
rename from ges/nle/nle.h
rename to plugins/nle/nle.h
similarity index 100%
rename from ges/nle/nleobject.c
rename to plugins/nle/nleobject.c
similarity index 100%
rename from ges/nle/nleobject.h
rename to plugins/nle/nleobject.h
similarity index 100%
rename from ges/nle/nlesource.c
rename to plugins/nle/nlesource.c
similarity index 100%
rename from ges/nle/nlesource.h
rename to plugins/nle/nlesource.h
similarity index 100%
rename from ges/nle/nletypes.h
rename to plugins/nle/nletypes.h