modules/gst: Make modules/gst a real module

modules/gst is moved from the pinoscore library to a separate loadable
module.
For now pinos will always try to load "module-gst".
This commit is contained in:
Linus Svensson 2016-08-29 13:14:26 +02:00 committed by Wim Taymans
parent ba45aad1a2
commit 1c7fafd03e
4 changed files with 84 additions and 11 deletions

View file

@ -249,6 +249,17 @@ PKG_CHECK_MODULES(ALSA, alsa >= 0.9.1, dummy=yes,
AC_SUBST(ALSA_CFLAGS)
AC_SUBST(ALSA_LIBS)
###################################
# Modules #
###################################
#### module-gst (Gstreamer module) ####
AC_ARG_ENABLE([module-gst],
AS_HELP_STRING([--disable-module-gst],[Disable building of GStreamer module]))
AM_CONDITIONAL([BUILD_MODULE_GST], [test "x$enable_module_gst" != "xno"])
AS_IF([test "x$enable_module_gst" != "xno"], ENABLE_MODULE_GST=yes, ENABLE_MODULE_GST=no)
#### Build and Install man pages ####
AC_ARG_ENABLE([manpages],
@ -279,5 +290,8 @@ Configuration
Moduledir : ${moduledir}
Compiler : ${CC}
Modules
module-gst : ${ENABLE_MODULE_GST}
pinos configured. Type 'make' to build.
"

View file

@ -46,6 +46,9 @@ AM_LDFLAGS = $(NODELETE_LDFLAGS) -Wl,-rpath=/home/wim/gst/head/pinos/spa/build/l
FOREIGN_CFLAGS = -w
MODULE_LDFLAGS = $(AM_LDFLAGS) $(AM_LIBLDFLAGS) -module -avoid-version
MODULE_LIBADD = $(AM_LIBADD) libpinoscore-@PINOS_MAJORMINOR@.la
###################################
# Extra files #
###################################
@ -208,10 +211,6 @@ libpinoscore_@PINOS_MAJORMINOR@_la_SOURCES = \
server/node.c server/node.h \
server/port.c server/port.h \
server/node-factory.c server/node-factory.h \
modules/gst/gst-manager.c modules/gst/gst-manager.h \
modules/gst/gst-source.c modules/gst/gst-source.h \
modules/gst/gst-sink.c modules/gst/gst-sink.h \
modules/gst/gst-node-factory.c modules/gst/gst-node-factory.h \
modules/spa/spa-alsa-sink.c modules/spa/spa-alsa-sink.h \
modules/spa/spa-v4l2-source.c modules/spa/spa-v4l2-source.h \
dbus/org-pinos.c dbus/org-pinos.h
@ -221,6 +220,26 @@ libpinoscore_@PINOS_MAJORMINOR@_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version
libpinoscore_@PINOS_MAJORMINOR@_la_LIBADD = $(LIBLTDL) $(LTLIBICONV) \
libpinos-@PINOS_MAJORMINOR@.la $(AM_LIBADD)
###################################
# Modules #
###################################
module_LTLIBRARIES =
if BUILD_MODULE_GST
module_LTLIBRARIES += module-gst.la
module_gst_la_SOURCES = \
modules/gst/gst-manager.c \
modules/gst/gst-node-factory.c \
modules/gst/gst-sink.c \
modules/gst/gst-source.c \
modules/gst/module.c
module_gst_la_CFLAGS = $(AM_CFLAGS) $(GST_CFLAGS)
module_gst_la_LDFLAGS = $(MODULE_LDFLAGS)
module_gst_la_LIBADD = $(MODULE_LIBADD)
endif
###################################
# GStreamer Plugin #
###################################

View file

@ -19,13 +19,10 @@
#include <gio/gio.h>
#include <glib.h>
#include <gst/gst.h>
#include <client/pinos.h>
#include <server/daemon.h>
#include <server/module.h>
#include <modules/gst/gst-manager.h>
#include <modules/gst/gst-node-factory.h>
#include <spa/include/spa/memory.h>
gint
@ -34,7 +31,7 @@ main (gint argc, gchar *argv[])
PinosDaemon *daemon;
GMainLoop *loop;
PinosProperties *props;
PinosNodeFactory *factory;
GError *err = NULL;
pinos_init (&argc, &argv);
spa_memory_init ();
@ -44,8 +41,10 @@ main (gint argc, gchar *argv[])
props = pinos_properties_new ("test", "test", NULL);
daemon = pinos_daemon_new (props);
factory = pinos_gst_node_factory_new ("gst-node-factory");
pinos_daemon_add_node_factory (daemon, factory);
if (pinos_module_load (daemon, "module-gst", &err) == NULL) {
g_error ("could not load module-gst: %s", err->message);
g_clear_error (&err);
}
pinos_spa_alsa_sink_new (daemon, "alsa-sink", NULL);
pinos_spa_v4l2_source_new (daemon, "v4l2-source", NULL);
@ -55,7 +54,6 @@ main (gint argc, gchar *argv[])
pinos_properties_free (props);
g_main_loop_unref (loop);
g_object_unref (factory);
g_object_unref (daemon);
return 0;

View file

@ -0,0 +1,42 @@
/* Pinos
* Copyright (C) 2016 Axis Communications <dev-gstreamer@axis.com>
* @author Linus Svensson <linus.svensson@axis.com>
*
* 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.
*/
#include <server/daemon.h>
#include <server/module.h>
#include "gst-manager.h"
#include "gst-node-factory.h"
gboolean pinos__module_init (PinosModule *module);
G_MODULE_EXPORT gboolean
pinos__module_init (PinosModule * module)
{
PinosNodeFactory *factory;
pinos_gst_manager_new (module->daemon);
factory = pinos_gst_node_factory_new ("gst-node-factory");
pinos_daemon_add_node_factory (module->daemon, factory);
g_object_unref (factory);
return TRUE;
}