insertbin: make it available in the registry

so it could also be used from the gst-parse-launch

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5514>
This commit is contained in:
Alexander Slobodeniuk 2023-10-20 00:55:00 +02:00
parent d2c9200828
commit 709913b1d2
7 changed files with 252 additions and 2 deletions

View file

@ -52,7 +52,31 @@ Each operation (addition or removal) can take a callback, this callback
is guaranteed to be called. Unlike GIO, there is no guarantee about where
this callback will be called from, it could be called before the action
returns or it could be called later from another thread. The signature of
this callback GstInsertBinCallback().</doc>
this callback GstInsertBinCallback().
Apart from the library API, since 1.24 insertbin can also be found in the
registry:
``` C
GstElement *pipeline, *insertbin, *videoflip;
gst_init (NULL, NULL);
pipeline =
gst_parse_launch ("videotestsrc ! insertbin name=i ! autovideosink",
NULL);
...
insertbin = gst_bin_get_by_name (GST_BIN (pipeline), "i");
videoflip = gst_element_factory_make ("videoflip", NULL);
...
g_object_set (videoflip, "method", 1, NULL);
g_signal_emit_by_name (insertbin, "append", videoflip, NULL, NULL);
...
```</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/insertbin/gstinsertbin.h"/>
<implements name="Gst.ChildProxy"/>
<constructor name="new" c:identifier="gst_insert_bin_new" version="1.2">

View file

@ -33552,6 +33552,152 @@
"tracers": {},
"url": "Unknown package origin"
},
"insertbin": {
"description": "insertbin",
"elements": {
"insertbin": {
"author": "Olivier Crete <olivier.crete@collabora.com>",
"description": "Auto-links filter style elements insertally",
"hierarchy": [
"GstInsertBin",
"GstBin",
"GstElement",
"GstObject",
"GInitiallyUnowned",
"GObject"
],
"interfaces": [
"GstChildProxy"
],
"klass": "Generic/Bin/Filter",
"pad-templates": {
"sink": {
"caps": "ANY",
"direction": "sink",
"presence": "always"
},
"src": {
"caps": "ANY",
"direction": "src",
"presence": "always"
}
},
"rank": "none",
"signals": {
"append": {
"action": true,
"args": [
{
"name": "arg0",
"type": "GstElement"
},
{
"name": "arg1",
"type": "gpointer"
},
{
"name": "arg2",
"type": "gpointer"
}
],
"return-type": "void",
"when": "last"
},
"insert-after": {
"action": true,
"args": [
{
"name": "arg0",
"type": "GstElement"
},
{
"name": "arg1",
"type": "GstElement"
},
{
"name": "arg2",
"type": "gpointer"
},
{
"name": "arg3",
"type": "gpointer"
}
],
"return-type": "void",
"when": "last"
},
"insert-before": {
"action": true,
"args": [
{
"name": "arg0",
"type": "GstElement"
},
{
"name": "arg1",
"type": "GstElement"
},
{
"name": "arg2",
"type": "gpointer"
},
{
"name": "arg3",
"type": "gpointer"
}
],
"return-type": "void",
"when": "last"
},
"prepend": {
"action": true,
"args": [
{
"name": "arg0",
"type": "GstElement"
},
{
"name": "arg1",
"type": "gpointer"
},
{
"name": "arg2",
"type": "gpointer"
}
],
"return-type": "void",
"when": "last"
},
"remove": {
"action": true,
"args": [
{
"name": "arg0",
"type": "GstElement"
},
{
"name": "arg1",
"type": "gpointer"
},
{
"name": "arg2",
"type": "gpointer"
}
],
"return-type": "void",
"when": "last"
}
}
}
},
"filename": "gstinsertbin",
"license": "LGPL",
"other-types": {},
"package": "GStreamer Bad Plug-ins",
"source": "gst-plugins-bad",
"tracers": {},
"url": "Unknown package origin"
},
"inter": {
"description": "plugin for inter-pipeline communication",
"elements": {

View file

@ -37,6 +37,30 @@
* returns or it could be called later from another thread. The signature of
* this callback GstInsertBinCallback().
*
* Apart from the library API, since 1.24 insertbin can also be found in the
* registry:
*
* ``` C
* GstElement *pipeline, *insertbin, *videoflip;
*
* gst_init (NULL, NULL);
* pipeline =
* gst_parse_launch ("videotestsrc ! insertbin name=i ! autovideosink",
* NULL);
*
* ...
*
* insertbin = gst_bin_get_by_name (GST_BIN (pipeline), "i");
* videoflip = gst_element_factory_make ("videoflip", NULL);
*
* ...
*
* g_object_set (videoflip, "method", 1, NULL);
* g_signal_emit_by_name (insertbin, "append", videoflip, NULL, NULL);
*
* ...
* ```
*
* Since: 1.2
*/

View file

@ -0,0 +1,13 @@
insertbin_sources = [
'plugin.c'
]
gstinsertbin = library('gstinsertbin',
insertbin_sources,
c_args : gst_plugins_bad_args + [ '-DGST_USE_UNSTABLE_API' ],
include_directories : [configinc],
dependencies : [gst_dep, gstinsertbin_dep],
install : true,
install_dir : plugins_install_dir,
)
plugins += [gstinsertbin]

View file

@ -0,0 +1,42 @@
/* GStreamer
*
* Copyright (C) 2023 Alexander Slobodeniuk <aslobodeniuk@fluendo.com>
*
* insertbin: a GstBin to insertally link filter-like elements.
*
* 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/insertbin/gstinsertbin.h>
GST_ELEMENT_REGISTER_DECLARE (insertbin);
GST_ELEMENT_REGISTER_DEFINE (insertbin, "insertbin", GST_RANK_NONE,
GST_TYPE_INSERT_BIN);
static gboolean
plugin_init (GstPlugin * plugin)
{
return GST_ELEMENT_REGISTER (insertbin, plugin);
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
insertbin,
"insertbin",
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)

View file

@ -5,7 +5,7 @@ foreach plugin : ['accurip', 'adpcmdec', 'adpcmenc', 'aiff', 'asfmux',
'debugutils', 'dvbsubenc',
'dvbsuboverlay', 'dvdspu', 'faceoverlay', 'festival',
'fieldanalysis', 'freeverb', 'frei0r', 'gaudieffects', 'gdp',
'geometrictransform', 'id3tag', 'inter', 'interlace',
'geometrictransform', 'id3tag', 'insertbin', 'inter', 'interlace',
'ivfparse', 'ivtc', 'jp2kdecimator', 'jpegformat', 'librfb',
'midi', 'mpegdemux', 'mpegpsmux', 'mpegtsdemux', 'mpegtsmux',
'mxf', 'netsim', 'onvif', 'pcapparse', 'pnm', 'proxy',

View file

@ -32,6 +32,7 @@ option('gaudieffects', type : 'feature', value : 'auto')
option('gdp', type : 'feature', value : 'auto')
option('geometrictransform', type : 'feature', value : 'auto')
option('id3tag', type : 'feature', value : 'auto')
option('insertbin', type : 'feature', value : 'auto')
option('inter', type : 'feature', value : 'auto')
option('interlace', type : 'feature', value : 'auto')
option('ivfparse', type : 'feature', value : 'auto')