From edc5c27ffbcc527d6bc8121463228eaa015e9cdd Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 19 Aug 2015 11:24:11 +0200 Subject: [PATCH] Move NLE to a dedicated GstPlugin Summary: Allowing external user to directly use it Reviewers: Mathieu_Du Differential Revision: https://phabricator.freedesktop.org/D231 --- .arcconfig | 2 +- Makefile.am | 2 +- configure.ac | 8 ++++ ges/Makefile.am | 15 ------ ges/ges-internal.h | 1 + ges/ges-track.c | 5 +- ges/ges-utils.c | 10 ++++ ges/ges.c | 24 ---------- plugins/Makefile.am | 1 + {ges => plugins}/nle/.gitignore | 0 plugins/nle/Makefile.am | 30 ++++++++++++ {ges => plugins}/nle/gnlmarshal.list | 0 plugins/nle/gstnle.c | 66 +++++++++++++++++++++++++++ {ges => plugins}/nle/nle.h | 0 {ges => plugins}/nle/nlecomposition.c | 0 {ges => plugins}/nle/nlecomposition.h | 0 {ges => plugins}/nle/nleghostpad.c | 0 {ges => plugins}/nle/nleghostpad.h | 0 {ges => plugins}/nle/nleobject.c | 0 {ges => plugins}/nle/nleobject.h | 0 {ges => plugins}/nle/nleoperation.c | 0 {ges => plugins}/nle/nleoperation.h | 0 {ges => plugins}/nle/nlesource.c | 0 {ges => plugins}/nle/nlesource.h | 0 {ges => plugins}/nle/nletypes.h | 0 {ges => plugins}/nle/nleurisource.c | 0 {ges => plugins}/nle/nleurisource.h | 0 27 files changed, 120 insertions(+), 44 deletions(-) create mode 100644 plugins/Makefile.am rename {ges => plugins}/nle/.gitignore (100%) create mode 100644 plugins/nle/Makefile.am rename {ges => plugins}/nle/gnlmarshal.list (100%) create mode 100644 plugins/nle/gstnle.c rename {ges => plugins}/nle/nle.h (100%) rename {ges => plugins}/nle/nlecomposition.c (100%) rename {ges => plugins}/nle/nlecomposition.h (100%) rename {ges => plugins}/nle/nleghostpad.c (100%) rename {ges => plugins}/nle/nleghostpad.h (100%) rename {ges => plugins}/nle/nleobject.c (100%) rename {ges => plugins}/nle/nleobject.h (100%) rename {ges => plugins}/nle/nleoperation.c (100%) rename {ges => plugins}/nle/nleoperation.h (100%) rename {ges => plugins}/nle/nlesource.c (100%) rename {ges => plugins}/nle/nlesource.h (100%) rename {ges => plugins}/nle/nletypes.h (100%) rename {ges => plugins}/nle/nleurisource.c (100%) rename {ges => plugins}/nle/nleurisource.h (100%) diff --git a/.arcconfig b/.arcconfig index fc70fd3df8..728aa7a425 100644 --- a/.arcconfig +++ b/.arcconfig @@ -1,3 +1,3 @@ { - "phabricator.uri" : "http://phabricator.freedesktop.org/" + "phabricator.uri" : "https:\/\/phabricator.freedesktop.org\/api\/" } diff --git a/Makefile.am b/Makefile.am index 127de2d417..c9c83a3850 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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) diff --git a/configure.ac b/configure.ac index 3a20a23150..65ed31a02d 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/ges/Makefile.am b/ges/Makefile.am index 0c3008326c..8f459242f4 100644 --- a/ges/Makefile.am +++ b/ges/Makefile.am @@ -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 \ diff --git a/ges/ges-internal.h b/ges/ges-internal.h index 53a775da2e..cf3852c312 100644 --- a/ges/ges-internal.h +++ b/ges/ges-internal.h @@ -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__ */ diff --git a/ges/ges-track.c b/ges/ges-track.c index e573f85ad9..8d6634225e 100644 --- a/ges/ges-track.c +++ b/ges/ges-track.c @@ -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); } diff --git a/ges/ges-utils.c b/ges/ges-utils.c index 21eb5dc951..4be6be4fd3 100644 --- a/ges/ges-utils.c +++ b/ges/ges-utils.c @@ -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; +} diff --git a/ges/ges.c b/ges/ges.c index f16972955b..5cc39f43f3 100644 --- a/ges/ges.c +++ b/ges/ges.c @@ -34,7 +34,6 @@ #include #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 index 0000000000..7f0a0065bc --- /dev/null +++ b/plugins/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = nle diff --git a/ges/nle/.gitignore b/plugins/nle/.gitignore 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 index 0000000000..2e8fa57de1 --- /dev/null +++ b/plugins/nle/Makefile.am @@ -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/ges/nle/gnlmarshal.list b/plugins/nle/gnlmarshal.list similarity index 100% rename from ges/nle/gnlmarshal.list rename to plugins/nle/gnlmarshal.list diff --git a/plugins/nle/gstnle.c b/plugins/nle/gstnle.c new file mode 100644 index 0000000000..df32330ae3 --- /dev/null +++ b/plugins/nle/gstnle.c @@ -0,0 +1,66 @@ +/* Non Linear Engine plugin + * + * Copyright (C) 2015 Thibault Saunier + * + * 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 +#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) diff --git a/ges/nle/nle.h b/plugins/nle/nle.h similarity index 100% rename from ges/nle/nle.h rename to plugins/nle/nle.h diff --git a/ges/nle/nlecomposition.c b/plugins/nle/nlecomposition.c similarity index 100% rename from ges/nle/nlecomposition.c rename to plugins/nle/nlecomposition.c diff --git a/ges/nle/nlecomposition.h b/plugins/nle/nlecomposition.h similarity index 100% rename from ges/nle/nlecomposition.h rename to plugins/nle/nlecomposition.h diff --git a/ges/nle/nleghostpad.c b/plugins/nle/nleghostpad.c similarity index 100% rename from ges/nle/nleghostpad.c rename to plugins/nle/nleghostpad.c diff --git a/ges/nle/nleghostpad.h b/plugins/nle/nleghostpad.h similarity index 100% rename from ges/nle/nleghostpad.h rename to plugins/nle/nleghostpad.h diff --git a/ges/nle/nleobject.c b/plugins/nle/nleobject.c similarity index 100% rename from ges/nle/nleobject.c rename to plugins/nle/nleobject.c diff --git a/ges/nle/nleobject.h b/plugins/nle/nleobject.h similarity index 100% rename from ges/nle/nleobject.h rename to plugins/nle/nleobject.h diff --git a/ges/nle/nleoperation.c b/plugins/nle/nleoperation.c similarity index 100% rename from ges/nle/nleoperation.c rename to plugins/nle/nleoperation.c diff --git a/ges/nle/nleoperation.h b/plugins/nle/nleoperation.h similarity index 100% rename from ges/nle/nleoperation.h rename to plugins/nle/nleoperation.h diff --git a/ges/nle/nlesource.c b/plugins/nle/nlesource.c similarity index 100% rename from ges/nle/nlesource.c rename to plugins/nle/nlesource.c diff --git a/ges/nle/nlesource.h b/plugins/nle/nlesource.h similarity index 100% rename from ges/nle/nlesource.h rename to plugins/nle/nlesource.h diff --git a/ges/nle/nletypes.h b/plugins/nle/nletypes.h similarity index 100% rename from ges/nle/nletypes.h rename to plugins/nle/nletypes.h diff --git a/ges/nle/nleurisource.c b/plugins/nle/nleurisource.c similarity index 100% rename from ges/nle/nleurisource.c rename to plugins/nle/nleurisource.c diff --git a/ges/nle/nleurisource.h b/plugins/nle/nleurisource.h similarity index 100% rename from ges/nle/nleurisource.h rename to plugins/nle/nleurisource.h -- 2.34.1