GstAppSrc简介
Description
The appsrc element can be used by applications to insert data into a GStreamer pipeline. Unlike most GStreamer elements, appsrc provides external API functions.appsrc can be used by linking with the libgstapp library to access the methods directly or by using the appsrc action signals.
应用程序可以通过appsrc元件向管道中插入数据。appsrc有别于其他GStreamer元件,它提供额外的API函数。通过链接libgstapp库来使用appsrc,直接调用其方法或者使用appsrc的响应信号。
Before operating appsrc, the caps property must be set to fixed caps describing the format of the data that will be pushed with appsrc. An exception to this is when pushing buffers with unknown caps, in which case no caps should be set. This is typically true of file-like sources that push raw byte buffers. If you don't want to explicitly set the caps, you can use gst_app_src_push_sample. This method gets the caps associated with the sample and sets them on the appsrc replacing any previously set caps (if different from sample's caps).
在操作appsrc前,caps属性必须被设定为一个固定的caps,以描述被推进appsrc数据的格式。当推送缓存搭到一个未知的caps即caps没有被设置,这时会发生一个异常。当使用类似文件一样的源时,推送其原始数据到appsrc将会典型地发生这种情况。如果你不想准确地设定caps,你可以使用gst_app_src_push_sample函数,该函数获取与采样数据关联的caps,且该caps取代appsrc上先前已设定的caps(如果你设定的caps不同于原来采样的caps)。
The main way of handing data to the appsrc element is by calling the gst_app_src_push_buffer() method or by emitting the push-buffer action signal. This will put the buffer onto a queue from which appsrc will read from in its streaming thread. It is important to note that data transport will not happen from the thread that performed the push-buffer call.
主要的操作数据到appsrc元件中的方式是调用gst_app_src_push_buffer方法,或者是发送push-buffer响应信号,该操作将缓存放进了一个队列,appsrc将在它的流线程中读取该队列中的数据。值得注意的是数据传输过程不是在执行push-buffer操作的线程。
The "max-bytes" property controls how much data can be queued in appsrc before appsrc considers the queue full. A filled internal queue will always signal the "enough-data" signal, which signals the application that it should stop pushing data into appsrc. The "block" property will cause appsrc to block the push-buffer method until free data becomes available again.When the internal queue is running out of data, the "need-data" signal is emitted, which signals the application that it should start pushing more data into appsrc.
max-bytes属性控制了在被appsrc认为队列满之前有多少数据可以被放进appsrc里的队列中。内部队列满时将发出“enough-data”信号,该信号通知应用程序应该停止向appsrc中推送数据了。block属性将是appsrc阻塞push-buffer方法直到可以推进去数据。当内部队列没有可用的数据,“need-data”信号将被发送,该信号将通知应用程序应该推送更多的数据到appsrc中。
In addition to the "need-data" and "enough-data" signals, appsrc can emit the "seek-data" signal when the "stream-mode" property is set to "seekable" or "random-access". The signal argument will contain the new desired position in the stream expressed in the unit set with the "format" property. After receiving the seek-data signal, the application should push-buffers from the new position.These signals allow the application to operate the appsrc in two different ways:
在“need-data”和“enough-data”之外,当stream-mode属性设置为seekable或者random-access时,appsrc能够发送“seek-data”信号。该信号的参数包含了新的希望在stream中设定的位置,且该参数以format属性为单位。在接收到seek-data信号后,应用程序应该从新的位置开始推送数据。这些信号(need-data,enought-data,和seek-data)允许应用程序以两种不同的方式操作appsrc。
The push mode, in which the application repeatedly calls the push-buffer/push-sample method with a new buffer/sample. Optionally, the queue size in the appsrc can be controlled with the enough-data and need-data signals by respectively stopping/starting the push-buffer/push-sample calls. This is a typical mode of operation for the stream-type "stream" and "seekable". Use this mode when implementing various network protocols or hardware devices.
推模式,应用程序重复的调用push-buffer/push-sample函数(来向appsrc中)推送一个新的buffer/sample。appsrc中队列里缓存的数量能够被控制,通过enough-data、need-data信号相应的停止或者开始调用push-buffer/push-sample。在stream-type属性为stream和seekable时,这是一种典型的模式。处理各种网络协议或者硬件设备(打交道)时使用这种模式。
The pull mode, in which the need-data signal triggers the next push-buffer call. This mode is typically used in the "random-access" stream-type. Use this mode for file access or other randomly accessable sources. In this mode, a buffer of exactly the amount of bytes given by the need-data signal should be pushed into appsrc.
拉模式,该模式下,need-data信号触发下一次push-buffer函数调用。该模式在random-access流类型下被典型使用。对于文件操作或者其他的可随机操作源使用这种模式,在这种模式下,由need-data信号确定字节数的缓存应该被推进appsrc中。
In all modes, the size property on appsrc should contain the total stream size in bytes. Setting this property is mandatory in the random-access mode. For the stream and seekable modes, setting this property is optional but recommended.
在所有模式下,appsrc的size属性都将以字节数表示包含的总的流数量。在random-access模式下务必要设置该属性,对于stream好seekable模式,该属性是可选但被推荐设置的。
When the application has finished pushing data into appsrc, it should call gst_app_src_end_of_stream() or emit the end-of-stream action signal. After this call, no more buffers can be pushed into appsrc until a flushing seek occurs or the state of the appsrc has gone through READY.
当应用程序完成推送数据到appsrc,其应该调用gst_app_src_end_of_stream函数,或者发送end-of-stream响应信号。在调用该函数后,不应该再由缓存被推送到appsrc,直到立即定位发生或者是appsrc切换到了REAY状态。
GstAppSrc简介的更多相关文章
- ASP.NET Core 1.1 简介
ASP.NET Core 1.1 于2016年11月16日发布.这个版本包括许多伟大的新功能以及许多错误修复和一般的增强.这个版本包含了多个新的中间件组件.针对Windows的WebListener服 ...
- MVVM模式和在WPF中的实现(一)MVVM模式简介
MVVM模式解析和在WPF中的实现(一) MVVM模式简介 系列目录: MVVM模式解析和在WPF中的实现(一)MVVM模式简介 MVVM模式解析和在WPF中的实现(二)数据绑定 MVVM模式解析和在 ...
- Cassandra简介
在前面的一篇文章<图形数据库Neo4J简介>中,我们介绍了一种非常流行的图形数据库Neo4J的使用方法.而在本文中,我们将对另外一种类型的NoSQL数据库——Cassandra进行简单地介 ...
- REST简介
一说到REST,我想大家的第一反应就是“啊,就是那种前后台通信方式.”但是在要求详细讲述它所提出的各个约束,以及如何开始搭建REST服务时,却很少有人能够清晰地说出它到底是什么,需要遵守什么样的准则. ...
- Microservice架构模式简介
在2014年,Sam Newman,Martin Fowler在ThoughtWorks的一位同事,出版了一本新书<Building Microservices>.该书描述了如何按照Mic ...
- const,static,extern 简介
const,static,extern 简介 一.const与宏的区别: const简介:之前常用的字符串常量,一般是抽成宏,但是苹果不推荐我们抽成宏,推荐我们使用const常量. 执行时刻:宏是预编 ...
- HTTPS简介
一.简单总结 1.HTTPS概念总结 HTTPS 就是对HTTP进行了TLS或SSL加密. 应用层的HTTP协议通过传输层的TCP协议来传输,HTTPS 在 HTTP和 TCP中间加了一层TLS/SS ...
- 【Machine Learning】机器学习及其基础概念简介
机器学习及其基础概念简介 作者:白宁超 2016年12月23日21:24:51 摘要:随着机器学习和深度学习的热潮,各种图书层出不穷.然而多数是基础理论知识介绍,缺乏实现的深入理解.本系列文章是作者结 ...
- Cesium简介以及离线部署运行
Cesium简介 cesium是国外一个基于JavaScript编写的使用WebGL的地图引擎,一款开源3DGIS的js库.cesium支持3D,2D,2.5D形式的地图展示,可以自行绘制图形,高亮区 ...
随机推荐
- gitlab gitlab runner
1.安装gitlab https://about.gitlab.com/installation/#ubuntu 2.安装runner https://docs.gitlab.com/runner/i ...
- EV根证书
Extended Validation SSL Certificates翻译为扩展验证型服务器证书(EV 服务器证书 或 EV SSL证书),申请该证书需要经过最彻底的身份验证,确保证书持有组织的真实 ...
- [置顶]
zabbix告警信息-lykchat信息发送系统
lykchat信息发送系统 lykchat信息发送系统是Python3开发的,通过模拟微信网页端,基于个人微信号,为系统管理人员提供信息发送工具. 实现的功能有用户登录管理.微信登陆管理和微信信息发送 ...
- EasyMvc入门教程-高级控件说明(20)表格控件
表单与表格是信息化系统里很常见的控件,EasyMvc提供了简单的数据绑定方式(基于Json),看下面的示例: 准备的接口地址代码如下:(该接口适用以下所有例子) public IActionResu ...
- windows 网络编程[转]
利用winsock编写网络应用程序服务端的步骤简述如下WSAStartup 初始化网络编程库 socket 创建套接字 bind 指定地址.端口,绑定套接字 listen 进入监听状态 accept ...
- glsl镜面水倒影的实现[转]
http://blog.sina.com.cn/s/blog_78ea87380101ejbf.html 使用两相机,一个master相机, 主要负责场景的渲染, 另一个rtt相机, 和master相 ...
- Ambient Occulution
SSAO HDAO normal pair 求一个谷 SAO 重建normal HBAO input depth,normal 这几个都是screen space的ao
- MFC MFC对话框滚动条的使用
对话框的(上下/左右)滚动事件,比如,把一个比较大的对话框放入tab控件的某一页时,就需要添加滚动条.在使用了java和qt等图形界面化的集成开发环境之后,再使用MFC,就会发现,想要让一个对话框 ...
- 同步I/O 和 异步I/O
所谓同步I/O是指在调用ReadFile.WriteFile等函数进行输入输出操作时,系统完毕了输入输出ReedFile.WriteFile才返回. 在操作系统进行I/O操作的过程上,用户态线程不能运 ...
- make -j 4 echo !$
make -j 4 #以cpu四核编译 !$上一次命令空格后的部分