Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Centricular Ltd.
|
|
|
|
* Author: Sebastian Dröge <sebastian@centricular.com>
|
|
|
|
* Author: Nirbheek Chauhan <nirbheek@centricular.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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:element-proxysink
|
|
|
|
* @title: proxysink
|
|
|
|
*
|
|
|
|
* Proxysink is a sink element that proxies events, queries, and buffers to
|
|
|
|
* another pipeline that contains a matching proxysrc element. The purpose is
|
|
|
|
* to allow two decoupled pipelines to function as though they are one without
|
|
|
|
* having to manually shuttle buffers, events, queries, etc between the two.
|
|
|
|
*
|
|
|
|
* This element also copies sticky events onto the matching proxysrc element.
|
|
|
|
*
|
|
|
|
* For example usage, see proxysrc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
#include "gstproxysink.h"
|
|
|
|
#include "gstproxysrc.h"
|
|
|
|
#include "gstproxy-priv.h"
|
|
|
|
|
|
|
|
#define GST_CAT_DEFAULT gst_proxy_sink_debug
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS_ANY);
|
|
|
|
|
|
|
|
/* We're not subclassing from basesink because we don't want any of the special
|
|
|
|
* handling it has for events/queries/etc. We just pass-through everything. */
|
|
|
|
|
|
|
|
/* Unlink proxysrc, we don't contain any elements so our parent is GstElement */
|
|
|
|
#define parent_class gst_proxy_sink_parent_class
|
|
|
|
G_DEFINE_TYPE (GstProxySink, gst_proxy_sink, GST_TYPE_ELEMENT);
|
2021-02-25 14:22:15 +00:00
|
|
|
GST_ELEMENT_REGISTER_DEFINE (proxysink, "proxysink", GST_RANK_NONE,
|
|
|
|
GST_TYPE_PROXY_SINK);
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
|
|
|
|
static gboolean gst_proxy_sink_sink_query (GstPad * pad, GstObject * parent,
|
|
|
|
GstQuery * query);
|
|
|
|
static GstFlowReturn gst_proxy_sink_sink_chain (GstPad * pad,
|
|
|
|
GstObject * parent, GstBuffer * buffer);
|
|
|
|
static GstFlowReturn gst_proxy_sink_sink_chain_list (GstPad * pad,
|
|
|
|
GstObject * parent, GstBufferList * list);
|
|
|
|
static gboolean gst_proxy_sink_sink_event (GstPad * pad, GstObject * parent,
|
|
|
|
GstEvent * event);
|
|
|
|
|
|
|
|
static GstStateChangeReturn gst_proxy_sink_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
|
|
|
|
2019-05-21 13:17:40 +00:00
|
|
|
static gboolean gst_proxy_sink_send_event (GstElement * element,
|
|
|
|
GstEvent * event);
|
|
|
|
static gboolean gst_proxy_sink_query (GstElement * element, GstQuery * query);
|
|
|
|
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
static void
|
|
|
|
gst_proxy_sink_class_init (GstProxySinkClass * klass)
|
|
|
|
{
|
|
|
|
GstElementClass *gstelement_class = (GstElementClass *) klass;
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_proxy_sink_debug, "proxysink", 0, "proxy sink");
|
|
|
|
|
|
|
|
gstelement_class->change_state = gst_proxy_sink_change_state;
|
2019-05-21 13:17:40 +00:00
|
|
|
gstelement_class->send_event = gst_proxy_sink_send_event;
|
|
|
|
gstelement_class->query = gst_proxy_sink_query;
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&sink_template));
|
|
|
|
|
|
|
|
gst_element_class_set_static_metadata (gstelement_class, "Proxy Sink",
|
|
|
|
"Sink", "Proxy source for internal process communication",
|
|
|
|
"Sebastian Dröge <sebastian@centricular.com>");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_proxy_sink_init (GstProxySink * self)
|
|
|
|
{
|
2018-02-12 19:30:01 +00:00
|
|
|
self->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
|
|
|
|
gst_pad_set_chain_function (self->sinkpad,
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_proxy_sink_sink_chain));
|
2018-02-12 19:30:01 +00:00
|
|
|
gst_pad_set_chain_list_function (self->sinkpad,
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_proxy_sink_sink_chain_list));
|
2018-02-12 19:30:01 +00:00
|
|
|
gst_pad_set_event_function (self->sinkpad,
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_proxy_sink_sink_event));
|
2018-02-12 19:30:01 +00:00
|
|
|
gst_pad_set_query_function (self->sinkpad,
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_proxy_sink_sink_query));
|
2018-02-12 19:30:01 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (self), self->sinkpad);
|
2019-05-21 13:03:21 +00:00
|
|
|
|
|
|
|
GST_OBJECT_FLAG_SET (self, GST_ELEMENT_FLAG_SINK);
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_proxy_sink_change_state (GstElement * element, GstStateChange transition)
|
|
|
|
{
|
|
|
|
GstElementClass *gstelement_class =
|
|
|
|
GST_ELEMENT_CLASS (gst_proxy_sink_parent_class);
|
|
|
|
GstProxySink *self = GST_PROXY_SINK (element);
|
|
|
|
GstStateChangeReturn ret;
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2018-02-12 19:30:01 +00:00
|
|
|
self->pending_sticky_events = FALSE;
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = gstelement_class->change_state (element, transition);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2019-05-21 13:17:40 +00:00
|
|
|
static gboolean
|
|
|
|
gst_proxy_sink_send_event (GstElement * element, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstProxySink *self = GST_PROXY_SINK (element);
|
|
|
|
|
|
|
|
if (GST_EVENT_IS_UPSTREAM (event)) {
|
|
|
|
return gst_pad_push_event (self->sinkpad, event);
|
|
|
|
} else {
|
|
|
|
gst_event_unref (event);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_proxy_sink_query (GstElement * element, GstQuery * query)
|
|
|
|
{
|
|
|
|
GstProxySink *self = GST_PROXY_SINK (element);
|
|
|
|
|
|
|
|
if (GST_QUERY_IS_UPSTREAM (query)) {
|
|
|
|
return gst_pad_peer_query (self->sinkpad, query);
|
|
|
|
} else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
static gboolean
|
|
|
|
gst_proxy_sink_sink_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
|
|
|
{
|
|
|
|
GstProxySink *self = GST_PROXY_SINK (parent);
|
|
|
|
GstProxySrc *src;
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (pad, "Handling query of type '%s'",
|
|
|
|
gst_query_type_get_name (GST_QUERY_TYPE (query)));
|
|
|
|
|
2018-02-12 19:30:01 +00:00
|
|
|
src = g_weak_ref_get (&self->proxysrc);
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
if (src) {
|
|
|
|
GstPad *srcpad;
|
|
|
|
srcpad = gst_proxy_src_get_internal_srcpad (src);
|
|
|
|
|
|
|
|
ret = gst_pad_peer_query (srcpad, query);
|
|
|
|
gst_object_unref (srcpad);
|
|
|
|
gst_object_unref (src);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
GstPad *otherpad;
|
|
|
|
GstFlowReturn ret;
|
|
|
|
} CopyStickyEventsData;
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
copy_sticky_events (G_GNUC_UNUSED GstPad * pad, GstEvent ** event,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
CopyStickyEventsData *data = user_data;
|
|
|
|
|
|
|
|
data->ret = gst_pad_store_sticky_event (data->otherpad, *event);
|
|
|
|
|
|
|
|
return data->ret == GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_proxy_sink_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstProxySink *self = GST_PROXY_SINK (parent);
|
|
|
|
GstProxySrc *src;
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
gboolean sticky = GST_EVENT_IS_STICKY (event);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (pad, "Got %s event", GST_EVENT_TYPE_NAME (event));
|
|
|
|
|
|
|
|
if (GST_EVENT_TYPE (event) == GST_EVENT_FLUSH_STOP)
|
2018-02-12 19:30:01 +00:00
|
|
|
self->pending_sticky_events = FALSE;
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
|
2018-02-12 19:30:01 +00:00
|
|
|
src = g_weak_ref_get (&self->proxysrc);
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
if (src) {
|
|
|
|
GstPad *srcpad;
|
|
|
|
srcpad = gst_proxy_src_get_internal_srcpad (src);
|
|
|
|
|
2018-02-12 19:30:01 +00:00
|
|
|
if (sticky && self->pending_sticky_events) {
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
CopyStickyEventsData data = { srcpad, GST_FLOW_OK };
|
|
|
|
|
|
|
|
gst_pad_sticky_events_foreach (pad, copy_sticky_events, &data);
|
2018-02-12 19:30:01 +00:00
|
|
|
self->pending_sticky_events = data.ret != GST_FLOW_OK;
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ret = gst_pad_push_event (srcpad, event);
|
|
|
|
gst_object_unref (srcpad);
|
|
|
|
gst_object_unref (src);
|
|
|
|
|
|
|
|
if (!ret && sticky) {
|
2018-02-12 19:30:01 +00:00
|
|
|
self->pending_sticky_events = TRUE;
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
ret = TRUE;
|
|
|
|
}
|
2020-08-12 10:57:10 +00:00
|
|
|
} else {
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
gst_event_unref (event);
|
2020-08-12 10:57:10 +00:00
|
|
|
ret = TRUE;
|
|
|
|
}
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_proxy_sink_sink_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
|
|
|
|
{
|
|
|
|
GstProxySink *self = GST_PROXY_SINK (parent);
|
|
|
|
GstProxySrc *src;
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (pad, "Chaining buffer %p", buffer);
|
|
|
|
|
2018-02-12 19:30:01 +00:00
|
|
|
src = g_weak_ref_get (&self->proxysrc);
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
if (src) {
|
|
|
|
GstPad *srcpad;
|
|
|
|
srcpad = gst_proxy_src_get_internal_srcpad (src);
|
|
|
|
|
2018-02-12 19:30:01 +00:00
|
|
|
if (self->pending_sticky_events) {
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
CopyStickyEventsData data = { srcpad, GST_FLOW_OK };
|
|
|
|
|
|
|
|
gst_pad_sticky_events_foreach (pad, copy_sticky_events, &data);
|
2018-02-12 19:30:01 +00:00
|
|
|
self->pending_sticky_events = data.ret != GST_FLOW_OK;
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ret = gst_pad_push (srcpad, buffer);
|
|
|
|
gst_object_unref (srcpad);
|
|
|
|
gst_object_unref (src);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (pad, "Chained buffer %p: %s", buffer,
|
|
|
|
gst_flow_get_name (ret));
|
|
|
|
} else {
|
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
GST_LOG_OBJECT (pad, "Dropped buffer %p: no otherpad", buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_proxy_sink_sink_chain_list (GstPad * pad, GstObject * parent,
|
|
|
|
GstBufferList * list)
|
|
|
|
{
|
|
|
|
GstProxySink *self = GST_PROXY_SINK (parent);
|
|
|
|
GstProxySrc *src;
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (pad, "Chaining buffer list %p", list);
|
|
|
|
|
2018-02-12 19:30:01 +00:00
|
|
|
src = g_weak_ref_get (&self->proxysrc);
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
if (src) {
|
|
|
|
GstPad *srcpad;
|
|
|
|
srcpad = gst_proxy_src_get_internal_srcpad (src);
|
|
|
|
|
2018-02-12 19:30:01 +00:00
|
|
|
if (self->pending_sticky_events) {
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
CopyStickyEventsData data = { srcpad, GST_FLOW_OK };
|
|
|
|
|
|
|
|
gst_pad_sticky_events_foreach (pad, copy_sticky_events, &data);
|
2018-02-12 19:30:01 +00:00
|
|
|
self->pending_sticky_events = data.ret != GST_FLOW_OK;
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ret = gst_pad_push_list (srcpad, list);
|
|
|
|
gst_object_unref (srcpad);
|
|
|
|
gst_object_unref (src);
|
|
|
|
GST_LOG_OBJECT (pad, "Chained buffer list %p: %s", list,
|
|
|
|
gst_flow_get_name (ret));
|
|
|
|
} else {
|
|
|
|
gst_buffer_list_unref (list);
|
|
|
|
GST_LOG_OBJECT (pad, "Dropped buffer list %p: no otherpad", list);
|
|
|
|
}
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Wrapper function for accessing private member
|
|
|
|
* This can also be retrieved with gst_element_get_static_pad, but that depends
|
|
|
|
* on the implementation of GstProxySink */
|
|
|
|
GstPad *
|
|
|
|
gst_proxy_sink_get_internal_sinkpad (GstProxySink * self)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (self, NULL);
|
2018-02-12 19:30:01 +00:00
|
|
|
return gst_object_ref (self->sinkpad);
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gst_proxy_sink_set_proxysrc (GstProxySink * self, GstProxySrc * src)
|
|
|
|
{
|
|
|
|
g_return_if_fail (self);
|
2018-02-12 19:30:01 +00:00
|
|
|
g_weak_ref_set (&self->proxysrc, src);
|
Add new 'proxy' element to stream data between pipelines
This keep-it-simple plugin is useful when you want to pipe arbitrary
data to a different pipeline within the same process. Some advantages
over appsink/appsrc, the inter elements, etc:
* Ease of use. Buffers, events, and caps are transmitted as-is without
copying or serialization.
* Enables zerocopy (especially DMABUF) transparently without any
special-casing.
* Enables usage with sinks or elements that are unreliable and may
throw errors and need re-initialization, such as a network sink, a
USB device sink (v4l2), etc.
* Transmits arbitrary data, not just audio/video/subs
* Can easily implement 1 producer pipeline -> N dynamic consumer
pipelines within a single process when combined with the `tee`
element.
All queries, events, buffers, and buffer lists are proxied. State
changes, clocks, and base times for the two pipelines are independent
since the upstream and downstreams continue to be different pipelines.
https://bugzilla.gnome.org/show_bug.cgi?id=788200
2016-02-03 18:38:57 +00:00
|
|
|
}
|