GStreamer Daemon - Receiving Messages from the Bus
← Flush start/Flush stop |
⌂ Home |
→ Enabling the Debug Subsystem |
This wiki describes the basics on how to interact with GStreamer bus properties. Specifically, how to receiving messages from the bus. You'll find that the family of commands used to interact with pipelines are prefixed with bus_<action>.
Contents
Read bus
In order to read a bus use the following command:
bus_read <name> Read the bus of the pipeline.
Read and filter bus
Sometimes is important to read and filter some messages from the bus, Gstd has the capability to read and filter (ie:error+warning+eos), In order read and filter use the following command:
bus_filter <name> <filter> Read and filter the bus of the pipeline.
Bus timeout
This command will block while waiting for messages set with the bus_filter command. You can specify a maximum time with the timeout parameter, the time argument is set on nanoseconds.
bus_timeout <name> <time in nanoseconds> bus timeout of the pipeline.
Examples Application
A very useful application using a bus filter is when is needed to known if there is an error or EOS. These examples show how to use the bus filter and bus read.
Error bus filter
This example only filter errors with an infinite timeout.
⇒ Gstd Commands:
1 # Create the pipeline that generate an error
2 pipeline_create p filesrc location=/tmp/test.avi ! identity error-after=2000 ! avidemux ! avdec_mpeg4 ! fpsdisplaysink
3
4 # Filter only a message error
5 bus_filter p error
6
7 # Play the pipeline
8 pipeline_play p
9
10 # Waiting until bus read a message error
11 bus_read p
Error bus filter and timeout
This example only filter errors with a 100s of timeout. If did get an error message it returns
⇒ Gstd Commands:
1 # Create the pipeline that generate an error
2 pipeline_create p filesrc location=/tmp/test.avi ! identity error-after=2000 ! avidemux ! avdec_mpeg4 ! fpsdisplaysink
3
4 # Filter only a message error
5 bus_filter p error
6
7 # wait 100s to read message error, if not, returns
8 bus_timeout p 100000000000
9
10 # Play the pipeline
11 pipeline_play p
12
13 # Waiting until bus read a message error
14 bus_read p
Error+EOS bus filter
This example filter errors and eos messages with an infinite timeout.
⇒ Gstd Commands:
1 # Create the pipeline that generate an eos
2 pipeline_create p filesrc location=/tmp/test.avi ! avidemux ! avdec_mpeg4 ! fpsdisplaysink
3
4 # Filter a message error and EOS message
5 bus_filter p error+eos
6
7 # Play the pipeline
8 pipeline_play p
9
10 # Waiting until bus read a message error or eos message
11 bus_read p
← Flush start/Flush stop |
⌂ Home |
→ Enabling the Debug Subsystem |
- GStreamer Daemon Basics
- Building GStreamer Daemon
- Quick Start Guide
- Interacting with Pipelines
- Modifying Element Properties
- Sending Events
- Receiving Messages from the Bus
- Receiving Signals
- Enabling the Debug Subsystem
- Low-level Implementation for Applications
- Response Format
- API Reference
- Simple Examples
- Advanced Examples
- Troubleshooting
- Releases
- Licensing
- FAQ
- Contact Us