Abstract
Ogg Vorbis is a
completely open, patent-free, professional audio encoding and streaming
technology
Copy-on-write (COW), sometimes referred to as implicit sharing
or shadowing,is a resource-management technique used in computer programming to
efficiently implement a "duplicate" or "copy" operation
on modifiable resources. If a resource is duplicated but not modified, it
is not necessary to create a new resource; the resource can be shared between
the copy and the original.
Modifications must still create a copy, hence the technique: the copy operation
is deferred to the first write. By sharing resources in this way, it is
possible to significantly reduce the resource consumption of
unmodified copies, while adding a small overhead to resource-modifying
operations.
A GstElement object is created from a factory.Element factories are the basic types retrieved from the GStreamer registry, they describe all plugins and elements that GStreamer can create.
Pads are element's input and output, where you can connect other elements. Pads have specific data handling capabilities,Data types are negotiated between pads using a process called caps negotiation
A bin is
a container for a collection of elements
A pipeline is a top-level
bin. It provides a bus for the application and manages the synchronization for
its children
buffers are objects for
passing streaming data between elements in the pipeline.
events are objects sent
between elements or from the application to elements, such as EOS, Seek
messages are
objects posted by elements on the pipeline's message bus
queries allow
applications to request information such as duration or current playback
position from the pipeline
Probing is best envisioned as a pad listener. Technically, a probe is nothing more than a callback that can be attached to a pad;The probe notifies you of any activity that happens on the pad, like buffers,events and queries. You can add the probe to a pad.Blocking probes are used to temporarily block pads because they are unlinked or because you are going to unlink them. If the dataflow is not blocked, the pipeline would go into an error state if data is pushed on an unlinked pad.
gst_init has to be called from the main application. This call will perform the necessary initialization of the library
tags: the first type is stream tags, which describe the content of a stream in a non-technical way. Examples include the author of a song, the title of that very same song or the album it is a part of.
The other type of metadata is stream-info, which is a somewhat technical
description of the properties of a stream. This can include video size, audio
samplerate, codecs used and so on(read though Caps).
Tag reading is done through a bus in GStreamer,listen for GST_MESSAGE_TAG
messages and handle them as you wish
adding an element to a bin will disconnect any already existing links. Also, you cannot directly link elements that are not in the same bin or pipeline;When you set a bin or pipeline to a certain target state,
it will usually
propagate the state change to all elements within the bin or pipeline
automatically;add an element to will take ownership of that element.
If you destroy the bin,
the element will be dereferenced with it.
A bus is a simple system that takes care of forwarding messages from the streaming threads to an application in its own thread context
streaming threads, that is GstTask, which A GstPad will typically create to
push or pull data to/from the peer pads
A typical stream starts with a stream start event that marks the start of the stream, followed by a segment event that marks the buffer timestamp range. After that buffers are sent one after the other. After the last buffer an EOS marks the end of the stream.
+-----+-------+ +-++-+ +-+ +---+
|START|SEGMENT| |B||B| ... |B| |EOS|
+-----+-------+ +-++-+ +-+ +---+
pipeline: gstreamer will create at least one thread FOR Bus to pass message to appication
Caps are called simple caps when they contain only one structure, and fixed caps when they contain only one structure and have no variable field types
Synchronization is to make sure that a buffer with a certain running-time is played when the clock reaches the same running-time.
GStreamer uses a GstClock object, buffer timestamps and a SEGMENT event to
synchronize streams in a pipeline
Latency compensation
Before the pipeline goes to the PLAYING state, it will, in addition to
selecting a clock and calculating a base-time, calculate the latency in the
pipeline.
It does this by doing a LATENCY query on all the sinks in the pipeline. The
pipeline then selects the maximum latency in the pipeline and configures this
with a LATENCY event.
All sink elements will delay playback by the value in the LATENCY event. Since
all sinks delay with the same amount of time, they will be relative in sync
buffering is used to accumulate enough data in a pipeline so that playback can occur smoothly and without interruptions
In the buffering state, the application should keep the pipeline in the PAUSED
state
"Appsrc” (an imaginary source) and “appsink” (an imaginary sink) can be used to inject data into or grab the output from a pipeline
Playbin is the recommended solution for everything related to simple playback of media that should just work
decodebin is a more flexible autoplugger ,which is is the actual autoplugger
backend of playbin
uridecodebin element is very similar to decodebin, only that it automatically
plugs a source plugin based on the protocol of the URI given.
The playsink element is a powerful sink element. It has request pads for raw
decoded audio, video and text and it will configure itself to play the media
streams
GST_STATE_PAUSED is the state in which an element is ready to accept and handle data. For most elements this state is the same as PLAYING. The only exception to this rule are sink elements. Sink elements only accept one single buffer of data and then block. At this point the pipeline is 'prerolled' and ready to render data immediately
Pad works in push-mode/pull-mode:
Gstreamer lib organizaiton:
usefule tips for coding with gstreamer:
gst-launch -v src ! decodebin ! sink
// this is very useful when try to find out the elements your need!
gst-inspect plugin/element
Elements will write output to GStreamer debugging system to log what they're doing
GStreamer-based applications accept the commandline option --gst-debug=LIST