gstreamer
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
gstreamer的更多相关文章
- GStreamer 记录
GStreamer 是一个新的多媒体框架,大大简化了多媒体工具的开发流程,比如,这里有一个 IBM 的文档,介绍了一个 MP3 播放器. http://www.ibm.com/developerwor ...
- Linux No volume control GStreamer plugins and/or devices found
案例环境:Oracle Linux Server release 5.7 进入Oracle Linux系统后,在右上角点击声音图标时,则会弹出如下报错窗口: The volume control di ...
- [quote ]ffmpeg, gstreamer, Raspberry Pi, Windows Desktop streaming
[quote ]ffmpeg, gstreamer, Raspberry Pi, Windows Desktop streaming http://blog.pi3g.com/2013/08/ffmp ...
- ubuntu系统下安装gstreamer的ffmpeg支持
当您在安装gstreamer到您的ubuntu系统中时,为了更好地进行流媒体开发,需要安装ffmpeg支持,但一般情况下,直接使用 sudo apt-get install gstreamer0.10 ...
- Gstreamer基本概念介绍(开发前必读)
1. 元件(Elements) 元件(element)是GStreamer中最重要的概念.你可以通过创建一系列的元件(Elements),并把它们连接起来,从而让数据流在这个被连接的各个元件(Elem ...
- vlc/ffmepg/mplayer/gstreamer/openmax/mpc/ffdshow/directshow
一些应该学习的开源框架与库用途和差别 一.播放器层次 这个层次上,是直接可以用的软件,已经做完了一切工作,如果我们需要用他们,是不需要写一行代码的,编译通过就可以拿来使用了,对于国内这些山寨公司来说, ...
- Gstreamer 数据流线程(GstTask / GstTaskPool)分析
作者:fengcc 原创文章 转载请注明出处 GStreamer 是一个基于流水线的多媒体框架,基于 GObject,以 C 语言写成. 凭借 GStreamer,程序员可以很容易地创建各种多媒体功能 ...
- gstreamer让playbin能够播放rtp over udp流数据
最近一段时间在研究传屏低延迟传输相关的一些东西.本来想使用gstreamer来验证下rtp over udp传送h264 nal数据相关 的,结果发现竟然不能用playbin来播放rtp的数据!诚然, ...
- Gstreamer 中的playback插件
1. PLAYBACK插件基本介绍 在早期的版本中同时存在playbin和playbin2,但是在最新的版本中,playbin2已经稳定,取代了playbin, playbin不再进行维护.下面是官网 ...
- GStreamer Plugin: Embedded video playback halted; module decodebin20 reported: Your GStreamer installation is missing a plug-in.
标题是在Linux下使用系统yum install 的opencv库来获取视频帧的时候抛出来的错误消息.opencv调用了Gstream的API来处理了视频.错误抛出的代码如下图: http://ub ...
随机推荐
- HDU 1011(星河战队 树形DP)
题意是说在一个洞穴中有许多房间,每个房间中有一些虫子和大脑,这些房间之间用隧道相连形成一棵树,士兵们杀虫子的能力有限,也可以直接杀死虫子而不消耗士兵战斗力,但这样就无法得到房间中的大脑,士兵们不能走回 ...
- Openresty 学习笔记(四)lualocks包管理器安装使用
Luarocks是一个Lua包管理器,基于Lua语言开发,提供一个命令行的方式来管理Lua包依赖.安装第三方Lua包等,社区比较流行的包管理器之一,另还有一个LuaDist,Luarocks的包数量比 ...
- Docker 从入门到放弃(二)容器使用
Docker 容器使用 一.Docker 客户端 docker 客户端非常简单 ,我们可以直接输入 docker 命令来查看到 Docker 客户端的所有命令选项. root@iZ235mi4a64Z ...
- apt-get使用命令
apt-get的卸载命令:remove/purge/autoremove/clean/autoclean apt-get purge / apt-get –purge remove 删除已安装包(不保 ...
- Java SE之I/O流:知识框架
- luogu P3235 [HNOI2014]江南乐
传送门 这题又是我什么时候做的(挠头) 首先是个和SG函数有关的博弈论,SG=0则先手必败.显然一堆石子就是一个游戏,而若干堆石子的SG值就是每堆SG的异或和,所以算出每堆石子SG就能知道答案 然后怎 ...
- ES学习
官方参考手册 https://www.elastic.co/guide/en/elasticsearch/reference/5.6/index.html https://www.elastic.co ...
- Delete 和 Put 请求失效, Spring 框架
Delete 和 Put 请求失效, Spring 框架 原因:使用tomcat 启动Spring项目的时候,请求失效.因为tomcat 不支持 Delete 和 Put 在 Web.xml 中增加下 ...
- jQuery(二)button事件改变标签值
button事件改变标签值 例子一: <html> <head> <script type="text/javascript" src="/ ...
- PHP载入GIF图像造成服务器宕机(CVE-2018-5711)的漏洞复现
参考链接: http://www.freebuf.com/vuls/161262.html 今日看新漏洞发现一个UC编辑部的标题,CVE-2018-5711:一张GIF图片就能让服务器宕机的PHP漏洞 ...