This is my second time to read GStreamer Application Development Manual
Record something important
- Element:
Element is an object that can send and/or receive data, also is the most important class of objects in GStreamer
Type | Details | Number of pads |
---|---|---|
Source elements | do not accept data, only generate data | a source pad |
Filters and filter-like elements | operate the data | at least one input and one output pads |
Sink elements | accept data and do not produce anything | a sink pad |
- Create an element(two methods)
- gst_element_factory_make
- gst_element_factory_find + gst_element_factory_create
- gst_init has to be called frist
- When you don’t need the element anymore, you need to unref it using gst_object_unref ()
The following example isthe simplest way to create an element using gst_element_factory_make
#include <gst/gst.h> int main (int argc, char *argv[]) { GstElement *element; /* init GStreamer */ gst_init (&argc, &argv); /* create element */ element = gst_element_factory_make ("fakesrc", "source"); if (!element) { g_print ("Failed to create element of type ’fakesrc’\n"); return -1; } gst_object_unref (GST_OBJECT (element)); return 0; }
- gst_element_factory_make
- Pad:
Pad is element’s input or output
A pad can have any of three availabilities:always, sometimes and on request
- Bin & Pipeline:
A bin is a container elements
A pipeline is a special subtype of a bin that allows scheduling of the containing elements
- Bus:
A bus is a simple system that takes care of forwarding messages from the pipeline threads to an application in its own thread context
Every pipeline contains a bus by default
- Use a bus(two methods)
- Run a main loop and attach some kind of watch to the bus using gst_bus_add_watch () or gst_bus_add_signal_watch ()
- Get the messages on the bus using gst_bus_peek () and/or gst_bus_poll ()
Message types:
- Run a main loop and attach some kind of watch to the bus using gst_bus_add_watch () or gst_bus_add_signal_watch ()
Name | Details |
---|---|
Error, warning and information notifications | those are used by elements if a message should be shown to the user about the state of the pipeline |
End-of-stream notification | emitted when the stream has ended |
Tags | emitted when metadata was found in the stream |
State-changes | emitted after a successful state change |
Buffering | emitted during caching of network-streams |
Element messages | these are special messages that are unique to certain elements and usually represent additional features |
Application-specific messages | any information on those can be extracted by getting the message |structure (see above) and reading its fields |
- Buffers & Events:
The data flowing through a pipeline consists of a combination of buffers and events
- Buffers contain the actual media data
- Events contain control information, such as seeking information and end-of-stream notifiers
- Buffers contain the actual media data
- A buffer consists:
Number | Name | Description |
---|---|---|
1 | Poniter | A pointer to a piece of memory |
2 | Size | The size of the memory |
3 | Timestamp | A timestamp for the buffer |
4 | refcount | A refcount that indicates how many elements are using this buffer, This refcount will be used to destroy the buffer when no element has a reference to it |
5 | Flags | Buffer flags |
Get more information here
没有评论:
发表评论