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 ...
随机推荐
- Android面试基础(一)IOC(DI)框架(ViewUtils)讲解_反射和自定义注解类
1. Android中的IOC(DI)框架 1.1 ViewUtils简介(xUtils中的四大部分之一) IOC: Inverse of Controller 控制反转. DI: Dependenc ...
- Golang入门教程(十六)Goridge -高性能的 PHP-to-Golang RPC编解码器库
什么是 RPC 框架? RPC(Remote Procedure Call)—远程过程调用,它是一种通过网络从远程计算机程序上请求服务,而不需要了解底层网络技术的协议.RPC协议假定某些传输协议的存在 ...
- Eclipse使用Maven搭建Java Web项目,并直接部署Tomcat
1.环境: win10 Java 1.8 Maven 3.3.9 Eclipse IDE for Java EE Developers 2.准备: eclipse环境什么的不赘述,Maven环境还是要 ...
- j2ee应用开发调试工具
j2ee应用程序不能独立运行,需要运行在一个servlet/jsp容器中,常用的servlet/jsp容器如:tomcat,jetty等.在开发调试j2ee程序时,也需要部署在一个指定的容器中.如果每 ...
- inetd的工作流程
- tensorflow--logistic regression
import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist=input_data. ...
- JDK1.8HashMap源码解读
package java.util; import sun.misc.SharedSecrets; import java.io.IOException; import java.io.Invalid ...
- day 9 - 2 函数练习
1.写函数,检查获取传入列表或元组对象的所有奇数位索引对应的元素,并将其作为新列表返回给调用者. def func(lis): print(lis[1::2]) #取偶数 return lis[::2 ...
- 使用IDEA新建Web工程启动报404的错误
新换了一个项目组被人吐槽配置文件都能写错,所以打算从头开始一步步搭建一个项目,包含ssm基础框架.mongodb工具类.redis工具类.jsf配置.log配置等 今天先来搭建一个web工程.工程搭建 ...
- ubuntu16.04配置anaconda环境
0 - 下载安装包 推荐到清华镜像下载.我选择的是Anaconda3-5.1.0-Linux-x86_64.sh. 1 - 安装Anaconda 然后切换到安装包目录,执行下面命令,期间一直按回车或者 ...