Commit d1023646 authored by Olivier Crête's avatar Olivier Crête 👻

insertbin: Add bin to dynamically insert elements in a running pipeline

This element automatically links in any element added using it's
action signals. These elements must have a single source pad and a single
sink pad.
parent 07a51b16
......@@ -38,6 +38,8 @@ gst-plugins-bad-*.tar.*
/m4
Makefile.in
Makefile
*.gir
*.typelib
tmp-orc.c
gst*orc.h
......
......@@ -9,6 +9,7 @@ GST_PLUGINS_BAD_BUILT_SOURCES := \
gst-libs/gst/baseparse/Android.mk \
gst-libs/gst/basecamerabinsrc/Android.mk \
gst-libs/gst/codecparsers/Android.mk \
gst-libs/gst/insertbin/Android.mk
gst-libs/gst/interfaces/Android.mk \
gst/h264parse/Android.mk \
gst/videoparsers/Android.mk \
......@@ -98,6 +99,7 @@ CONFIGURE_TARGETS += gst-plugins-bad-configure
-include $(GST_PLUGINS_BAD_TOP)/gst-libs/gst/baseparse/Android.mk
-include $(GST_PLUGINS_BAD_TOP)/gst-libs/gst/basecamerabinsrc/Android.mk
-include $(GST_PLUGINS_BAD_TOP)/gst-libs/gst/codecparsers/Android.mk
-include $(GST_PLUGINS_BAD_TOP)/gst-libs/gst/insertbin/Android.mk
-include $(GST_PLUGINS_BAD_TOP)/gst-libs/gst/interfaces/Android.mk
-include $(GST_PLUGINS_BAD_TOP)/gst/h264parse/Android.mk
-include $(GST_PLUGINS_BAD_TOP)/gst/audiobuffer/Android.mk
......
......@@ -123,6 +123,9 @@ AG_GST_CHECK_DOWHILE_MACROS
AC_PATH_PROG(VALGRIND_PATH, valgrind, no)
AM_CONDITIONAL(HAVE_VALGRIND, test ! "x$VALGRIND_PATH" = "xno")
dnl check for gobject-introspection
GOBJECT_INTROSPECTION_CHECK([1.31.1])
dnl check for documentation tools
GTK_DOC_CHECK([1.12])
AG_GST_PLUGIN_DOCS([1.12])
......@@ -2257,6 +2260,7 @@ gst/y4m/Makefile
gst-libs/Makefile
gst-libs/gst/Makefile
gst-libs/gst/basecamerabinsrc/Makefile
gst-libs/gst/insertbin/Makefile
gst-libs/gst/interfaces/Makefile
gst-libs/gst/signalprocessor/Makefile
gst-libs/gst/codecparsers/Makefile
......@@ -2371,6 +2375,8 @@ pkgconfig/gstreamer-plugins-bad.pc
pkgconfig/gstreamer-plugins-bad-uninstalled.pc
pkgconfig/gstreamer-codecparsers.pc
pkgconfig/gstreamer-codecparsers-uninstalled.pc
pkgconfig/gstreamer-insertbin.pc
pkgconfig/gstreamer-insertbin-uninstalled.pc
pkgconfig/gstreamer-basevideo.pc
pkgconfig/gstreamer-basevideo-uninstalled.pc
tools/Makefile
......
......@@ -56,6 +56,7 @@ GTKDOC_LIBS = \
$(top_builddir)/gst-libs/gst/interfaces/libgstphotography-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/signalprocessor/libgstsignalprocessor-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/video/libgstbasevideo-@GST_API_VERSION@.la \
$(top_builddir)/gst-libs/gst/insertbin/libgstinsertbin-@GST_API_VERSION@.la \
$(GST_BASE_LIBS)
GTKDOC_CC=$(LIBTOOL) --tag=CC --mode=compile $(CC)
......
......@@ -44,6 +44,11 @@
<xi:include href="xml/gstsurfacebuffer.xml" />
<xi:include href="xml/gstsurfaceconverter.xml" />
</chapter>
<chapter id="tools">
<title>Useful elements</title>
<xi:include href="xml/gstinsertbin.xml" />
</chapter>
</part>
<part id="gstreamer-libs-hierarchy">
......
......@@ -486,3 +486,27 @@ GstSurfaceConverterInterface
gst_surface_converter_get_type
gst_surface_converter_upload
</SECTION>
<SECTION>
<FILE>gstinsertbin</FILE>
<TITLE>GstInsertbin</TITLE>
GstInsertBin
GstInsertBinClass
GstInsertBinCallback
gst_insert_bin_new
gst_insert_bin_append
gst_insert_bin_prepend
gst_insert_bin_insert_after
gst_insert_bin_insert_before
gst_insert_bin_remove
<SUBSECTION Standard>
GST_INSERT_BIN
GST_INSERT_BIN_CLASS
GST_INSERT_BIN_GET_CLASS
GST_IS_INSERT_BIN
GST_IS_INSERT_BIN_CLASS
GST_TYPE_INSERT_BIN
gst_insert_bin_get_type
<SUBSECTION Private>
GstInsertBinPrivate
</SECTION>
......@@ -2,3 +2,6 @@
#include <gst/codecparsers/gsth264parser.h>
#include <gst/codecparsers/gstmpegvideoparser.h>
#include <gst/insertbin/gstinsertbin.h>
gst_insert_bin_get_type
\ No newline at end of file
SUBDIRS = interfaces signalprocessor video basecamerabinsrc codecparsers
SUBDIRS = interfaces signalprocessor video basecamerabinsrc codecparsers \
insertbin
noinst_HEADERS = gst-i18n-plugin.h gettext.h glib-compat-private.h
DIST_SUBDIRS = interfaces signalprocessor video basecamerabinsrc codecparsers
DIST_SUBDIRS = interfaces signalprocessor video basecamerabinsrc codecparsers \
insertbin
lib_LTLIBRARIES = libgstinsertbin-@GST_API_VERSION@.la
libgstinsertbin_@GST_API_VERSION@_la_SOURCES = gstinsertbin.c
libgstinsertbin_@GST_API_VERSION@includedir = \
$(includedir)/gstreamer-@GST_API_VERSION@/gst/insertbin
libgstinsertbin_@GST_API_VERSION@include_HEADERS = gstinsertbin.h
libgstinsertbin_@GST_API_VERSION@_la_CFLAGS = \
$(GST_PLUGINS_BAD_CFLAGS) \
$(GST_CFLAGS)
libgstinsertbin_@GST_API_VERSION@_la_LIBADD = \
$(GST_LIBS)
libgstinsertbin_@GST_API_VERSION@_la_LDFLAGS = \
$(GST_LIB_LDFLAGS) \
$(GST_ALL_LDFLAGS) \
$(GST_LT_LDFLAGS)
if HAVE_INTROSPECTION
BUILT_GIRSOURCES = GstInsertBin-@GST_API_VERSION@.gir
gir_headers=$(patsubst %,$(srcdir)/%, $(libgstinsertbin_@GST_API_VERSION@include_HEADERS))
gir_headers+=$(patsubst %,$(builddir)/%, $(built_headers))
gir_sources=$(patsubst %,$(srcdir)/%, $(libgstinsertbin_@GST_API_VERSION@_la_SOURCES))
gir_sources+=$(patsubst %,$(builddir)/%, $(built_sources))
GstInsertBin-@GST_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libgstinsertbin-@GST_API_VERSION@.la
$(AM_V_GEN)PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" \
GST_PLUGIN_SYSTEM_PATH_1_0="" GST_PLUGIN_PATH_1_0="" GST_REGISTRY_UPDATE=no \
$(INTROSPECTION_SCANNER) -v --namespace GstInsertBin \
--nsversion=@GST_API_VERSION@ \
--strip-prefix=Gst \
--warn-all \
--c-include "gst/insertbin/gstinsertbin.h" \
-I$(top_srcdir)/gst-libs \
-I$(top_builddir)/gst-libs \
--add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
--add-include-path=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
--library=libgstinsertbin-@GST_API_VERSION@.la \
--include=Gst-@GST_API_VERSION@ \
--include=GstBase-@GST_API_VERSION@ \
--libtool="$(top_builddir)/libtool" \
--pkg gstreamer-@GST_API_VERSION@ \
--pkg gstreamer-base-@GST_API_VERSION@ \
--pkg-export gstreamer-insertbin-@GST_API_VERSION@ \
--add-init-section="gst_init(NULL,NULL);" \
--output $@ \
$(gir_headers) \
$(gir_sources)
# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
# install anything - we need to install inside our prefix.
girdir = $(datadir)/gir-1.0
gir_DATA = $(BUILT_GIRSOURCES)
typelibsdir = $(libdir)/girepository-1.0/
typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
%.typelib: %.gir $(INTROSPECTION_COMPILER)
$(AM_V_GEN)PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" \
$(INTROSPECTION_COMPILER) \
--includedir=$(srcdir) \
--includedir=$(builddir) \
--includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-@GST_API_VERSION@` \
--includedir=`PKG_CONFIG_PATH="$(GST_PKG_CONFIG_PATH)" $(PKG_CONFIG) --variable=girdir gstreamer-base-@GST_API_VERSION@` \
$(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
CLEANFILES = $(BUILT_GIRSOURCES) $(typelibs_DATA)
endif
Android.mk: $(BUILT_SOURCES) Makefile.am
androgenizer -:PROJECT libgstinsertbin -:STATIC libgstinsertbin-@GST_API_VERSION@ \
-:TAGS eng debug \
-:REL_TOP $(top_srcdir) -:ABS_TOP $(abs_top_srcdir) \
-:SOURCES $(libgstinsertbin_@GST_API_VERSION@_la_SOURCES) \
$(built_sources) \
-:CFLAGS $(DEFS) $(libgstinsertbin_@GST_API_VERSION@_la_CFLAGS) \
-:LDFLAGS $(libgstinsertbin_@GST_API_VERSION@_la_LDFLAGS) \
$(libgstinsertbin@GST_API_VERSION@_la_LIBADD) \
-ldl \
-:HEADER_TARGET gstreamer-@GST_API_VERSION@/gst/insertbin \
-:HEADERS $(libgstinsertbininclude_HEADERS) \
$(built_headers) \
-:PASSTHROUGH LOCAL_ARM_MODE:=arm \
> $@
This diff is collapsed.
/*
* GStreamer
*
* Copyright 2013 Collabora Ltd
* @author: Olivier Crete <olivier.crete@collabora.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., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#ifndef __GST_INSERT_BIN_H__
#define __GST_INSERT_BIN_H__
#include <gst/gst.h>
G_BEGIN_DECLS
#define GST_TYPE_INSERT_BIN (gst_insert_bin_get_type())
#define GST_INSERT_BIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_INSERT_BIN,GstInsertBin))
#define GST_IS_INSERT_BIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_INSERT_BIN))
#define GST_INSERT_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass) ,GST_TYPE_INSERT_BIN,GstInsertBinClass))
#define GST_IS_INSERT_BIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass) ,GST_TYPE_INSERT_BIN))
#define GST_INSERT_BIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj) ,GST_TYPE_INSERT_BIN,GstInsertBinClass))
typedef struct _GstInsertBin GstInsertBin;
typedef struct _GstInsertBinClass GstInsertBinClass;
typedef struct _GstInsertBinPrivate GstInsertBinPrivate;
/**
* GstInsertBinCallback:
* @insertbin: A #GstInsertBin
* @element: The #GstElement on which the operation was performed
* @success: %TRUE if the operation was successful
* @user_data: The user data passed
*
* This is the prototype of callbacks to be called when the operation completes.
* It could be called at any time, including as a re-entrant call while the
* operation is requested.
*/
typedef void (*GstInsertBinCallback) (GstInsertBin *insertbin,
GstElement *element,
gboolean success,
gpointer user_data);
/**
* GstInsertBin:
*
* The object structure.
*/
struct _GstInsertBin
{
GstBin parent;
/*< private >*/
GstInsertBinPrivate *priv;
};
/**
* GstInsertBinClass:
*
* The object class structure.
*/
struct _GstInsertBinClass
{
GstBinClass parent_class;
};
GType gst_insert_bin_get_type (void);
GstElement *gst_insert_bin_new (const gchar * name);
void gst_insert_bin_prepend (GstInsertBin * self, GstElement * element,
GstInsertBinCallback callback, gpointer user_data);
void gst_insert_bin_append (GstInsertBin * self, GstElement * element,
GstInsertBinCallback callback, gpointer user_data);
void gst_insert_bin_insert_before (GstInsertBin * self,
GstElement * element, GstElement * sibling,
GstInsertBinCallback callback, gpointer user_data);
void gst_insert_bin_insert_after (GstInsertBin * self,
GstElement * element, GstElement * sibling,
GstInsertBinCallback callback, gpointer user_data);
void gst_insert_bin_remove (GstInsertBin * self, GstElement * element,
GstInsertBinCallback callback, gpointer user_data);
G_END_DECLS
#endif /* __GST_INSERT_BIN_H__ */
......@@ -201,6 +201,7 @@ make ERROR_CFLAGS='' ERROR_CXXFLAGS=''
%{_libdir}/libgstphotography-%{majorminor}.so.*
%{_libdir}/libgstsignalprocessor-%{majorminor}.so.*
%{_libdir}/libgstcodecparsers-%{majorminor}.so.*
%{_libdir}/libgstinsertbin-%{majorminor}.so.*
# Plugins without external dependencies
%{_libdir}/gstreamer-%{majorminor}/libgstadpcmdec.so
%{_libdir}/gstreamer-%{majorminor}/libgstadpcmenc.so
......@@ -353,10 +354,12 @@ make ERROR_CFLAGS='' ERROR_CXXFLAGS=''
%{_libdir}/libgstbasevideo-%{majorminor}.so
%{_libdir}/libgstphotography-%{majorminor}.so
%{_libdir}/libgstsignalprocessor-%{majorminor}.so
%{_libdir}/libgstinsertbin-%{majorminor}.so
%{_libdir}/libgstcodecparsers-%{majorminor}.so
%{_libdir}/libgstbasecamerabinsrc-%{majorminor}.so
%{_includedir}/gstreamer-%{majorminor}/gst/interfaces/photography*
%{_includedir}/gstreamer-%{majorminor}/gst/codecparsers
%{_includedir}/gstreamer-%{majorminor}/gst/insertbin
%{_includedir}/gstreamer-%{majorminor}/gst/signalprocessor
%{_includedir}/gstreamer-%{majorminor}/gst/video
%{_includedir}/gstreamer-%{majorminor}/gst/basecamerabinsrc/gstbasecamerasrc.h
......@@ -367,6 +370,7 @@ make ERROR_CFLAGS='' ERROR_CXXFLAGS=''
# pkg-config files
%{_libdir}/pkgconfig/gstreamer-plugins-bad-%{majorminor}.pc
%{_libdir}/pkgconfig/gstreamer-codecparsers-%{majorminor}.pc
%{_libdir}/pkgconfig/gstreamer-insertbin-%{majorminor}.pc
%{_libdir}/pkgconfig/gstreamer-basevideo-%{majorminor}.pc
%files devel-docs
......
......@@ -2,11 +2,13 @@
pcverfiles = \
gstreamer-plugins-bad-@GST_API_VERSION@.pc \
gstreamer-codecparsers-@GST_API_VERSION@.pc \
gstreamer-insertbin-@GST_API_VERSION@.pc \
gstreamer-basevideo-@GST_API_VERSION@.pc
pcverfiles_uninstalled = \
gstreamer-plugins-bad-@GST_API_VERSION@-uninstalled.pc \
gstreamer-codecparsers-@GST_API_VERSION@-uninstalled.pc \
gstreamer-insertbin-@GST_API_VERSION@-uninstalled.pc \
gstreamer-basevideo-@GST_API_VERSION@-uninstalled.pc
all-local: $(pcverfiles) $(pcverfiles_uninstalled)
......@@ -28,6 +30,7 @@ CLEANFILES = $(pcverfiles) $(pcverfiles_uninstalled)
pcinfiles = \
gstreamer-plugins-bad.pc.in gstreamer-plugins-bad-uninstalled.pc.in \
gstreamer-codecparsers.pc.in gstreamer-codecparsers-uninstalled.pc.in \
gstreamer-insertbin.pc.in gstreamer-insertbin-uninstalled.pc.in \
gstreamer-basevideo.pc.in gstreamer-basevideo-uninstalled.pc.in
DISTCLEANFILES = $(pcinfiles:.in=)
......
prefix=
exec_prefix=
libdir=${pcfiledir}/../gst-libs/gst/insertbin
includedir=${pcfiledir}/../gst-libs
Name: GStreamer Insert Bin, Uninstalled
Description: Bin to automatically and insertally link elements, uninstalled
Requires: gstreamer-@GST_API_VERSION@
Version: @VERSION@
Libs: -L${libdir} ${libdir}/libgstinsertbin-@GST_API_VERSION@.la
Cflags: -I${includedir}
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@/gstreamer-@GST_API_VERSION@
Name: GStreamer Insert Bin
Description: Bin to automatically and insertally link elements
Requires: gstreamer-@GST_API_VERSION@
Version: @VERSION@
Libs: -L${libdir} -lgstinsertbin-@GST_API_VERSION@
Cflags: -I${includedir}
......@@ -232,6 +232,7 @@ check_PROGRAMS = \
elements/viewfinderbin \
$(check_zbar) \
$(check_orc) \
libs/insertbin \
$(EXPERIMENTAL_CHECKS)
noinst_HEADERS = elements/mxfdemux.h
......@@ -365,6 +366,13 @@ elements_uvch264demux_CFLAGS = -DUVCH264DEMUX_DATADIR="$(srcdir)/elements/uvch26
pipelines_streamheader_CFLAGS = $(GIO_CFLAGS) $(AM_CFLAGS)
pipelines_streamheader_LDADD = $(GIO_LIBS) $(LDADD)
libs_insertbin_LDADD = \
$(GST_PLUGINS_BAD_LIBS) $(GST_BASE_LIBS) $(GST_LIBS) $(LDADD) \
$(top_builddir)/gst-libs/gst/insertbin/libgstinsertbin-@GST_API_VERSION@.la
libs_insertbin_CFLAGS = \
$(GST_PLUGINS_BAD_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(AM_CFLAGS)
EXTRA_DIST = gst-plugins-bad.supp $(uvch264_dist_data)
orc_bayer_CFLAGS = $(ORC_CFLAGS)
......
......@@ -2,3 +2,4 @@
h264parser
mpegvideoparser
vc1parser
insertbin
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment