GstInterpipe
Introduction
Overview
GstInterpipe is a Gstreamer plug-in that allows communication between two independent pipelines. The plug-in consists of two elements:
- interpipesink
- interpipesrc
Generally speaking, the idea is that given a source pipeline:
v4l2src ! interpipesink name=video_src
Various sink pipelines may listen to it by:
interpipesrc listen-to=video_src ! xvimagesink interpipesrc listen-to-video_src num-buffers=1 ! jpegenc ! filesink location=snapshot.jpeg
The state of each pipeline is independent, each one can manage events by their own and can be attached or detached at any moment.
The concept behind the Interpipes Project is to simplify the construction of GStreamer applications, which often has the complexity of requiring dynamic pipelines. It transforms the construction process from low level pad probe manipulation to the higher level setting an element's parameter value. Application developers don't get mired down in stalled pipelines because one branch of a complex pipeline changed state.
For example, take a look in a complex pipeline like the one in the figure 1:
The complex pipeline of figure 1 can be constructed into smaller, independent pipelines using interpipe elements as it is illustrated in the figure 2:
This way the stream flow in a complex pipeline is reduced to simply set the correct listeners in the interpipe elements taking away the complexity of re-configuring pads or some other complex and error-prone logic.
Project Characteristics
The GstInterpipe project exposes the following characteristics:
- Inspired by intervideosrc/intervideosink
- Uses appsrc and appsink as a base
- Generic data handling
- Multiple dynamic interpipesink - interpipesrc connections
- Replace tee and selector elements allowing dynamic pipeline flow control with GStreamer Daemon
Features
The principal features the plug-in exposes are the following. These ones are explained with further detail later.
- Buffer transfer
- Interpipesink will transfer automagically the buffers it receives to all the interpipesrcs that are currently listening to it.
- Dynamic switching
- Interpipesrcs can switch the interpipesink they are listening to at any time just by setting the property to the new value. No need to worry about the pipeline's state, dangerous events like EOS, pad probes, valves, selectors, pad links, etc...
- Caps negotiation
- Even though interpipes break a big pipeline into smaller ones, the caps negotiation process takes into account all of them. This means that it is guaranteed that the negotiated caps will be supported by the source and all its listeners (or fail due to missing valid intersection).
- Event forwarding
- Similar to buffers, events may be forwarded from the interpipesinks to the interpipesrcs, and viceversa. The project takes into account downstream and upstream events, as well as in-bounds and out-of-bands events.
- Timestamp synchronization
- The base times of independent pipelines will likely be different. Given that a buffer will be transferred from one pipe to another, this may represent a problem in situations where synchronization is a must. GstInterpipe takes care of this situation by compensating the buffer's timestamps according to the pipeline's base time, ensuring appropriate synchronization.
Limitations
The current release exposes the following limitations and known bugs:
- Specialized clocks
- At the time being, pipelines negotiate their clock independently. If a pipeline uses a special clock (i.e.: GstAudioSinkClock), the associated pipes (being independent) may negotiate different clocks, typically GstSystemClock. This could be a big problem if, for example, synchronization between streams is required. It is currently responsibility of the application to set the special clock in all the involved pipes by calling gst_pipeline_set_clock.
Getting the Software
GstInterpipe is an open source project and can be downloaded from GitHub. The project is hosted at:
TODO
As with every open source project, there's an open invitation to provide feedback to the maintainers as bug reports, feature requests and even source code collaborations. The following table summarizes the recommended methods to collaborate with RidgeRun:
Collaboration | Method |
---|---|
Bug report | GitHub's issue tracker |
Feature request | GitHub's issue tracker |
Patch Submission | Pull request |
Installation Guide
Dependencies
The following packages are needed in order to build and use gst-interpipe:
- gstreamer-1.0
- gstreamer-plugins-base-1.0
- gstreamer-video-1.0
- gstreamer-app-1.0
- gstreamer-check-1.0
The are likely already installed in your OS distribution. In case you want to double check and install the missing packages, run the following commands according to your OS:
Debian Based
This includes Ubuntu, Kubuntu, Debian, etc...
sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
Mac OSX
Using Mac Ports:
TODO
Building the project
Installing the plugin
User Guide
Features
Buffer Forwarding
Dynamic Switching
Caps Negotiation
Event Forwarding
Timestamp Synchronization
Properties
GstInterPipeSink
GstInterPipeSrc
==