gstreamer 插件编写【一】基础知识
2014-03-15 15:37
483 查看
一、Buffer and Event,
当我们需要push数据到硬件sink插件时,可以使用以下方法直接操作硬件memory。来自:http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-basics-data.htmlMany sink elements have accelerated methods for copying data to hardware, or have direct access to hardware. It is common for these elements to be able to create a GstBufferPool or GstAllocator for their upstream peers. One such example
is ximagesink. It creates buffers that contain XImages. Thus, when an upstream peer copies data into the buffer, it is copying directly into the XImage, enabling ximagesink to draw the image directly to the screen instead of having to copy data into an XImage
first.
二、Gstreamer 媒体类型定义:
完整的定义在:http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-types-definitions.htmlTable 16.1. Table of Audio Types
Media Type | Description | Property | Property Type | Property Values | Property Description |
---|---|---|---|---|---|
All audio types. | |||||
audio/* | All audio types | rate | integer | greater than 0 | The sample rate of the data, in samples (per channel) per second. |
channels | integer | greater than 0 | The number of channels of audio data. | ||
All raw audio types. | |||||
audio/x-raw | Unstructured and uncompressed raw audio data. | format | string | S8 U8 S16LE S16BE U16LE U16BE S24_32LE S24_32BE U24_32LE U24_32BE S32LE S32BE U32LE U32BE S24LE S24BE U24LE U24BE S20LE S20BE U20LE U20BE S18LE S18BE U18LE U18BE F32LE F32BE F64LE F64BE | The format of the sample data. |
三、The chain function(处理来自sink pad的数据)
参考:http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/chapter-building-chainfn.htmlThe chain function is the function in which all data processing takes place. In the case of a simple filter,
_chain ()functions are mostly linear functions - so for each incoming buffer。
四、The event function
The event function notifies you of special events that happen in the datastream (such as caps, end-of-stream, newsegment, tags, etc.). Events can travel both upstream and downstream, so you can receive them on sink pads as well as source pads.参考:http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/chapter-building-eventfn.html
五、The query function
Through the query function, your element will receive queries that it has to reply to. These are queries like position, duration but also about the supported formats and scheduling modes your element supports. Queries can travel both upstream anddownstream, so you can receive them on sink pads as well as source pads.
参考:http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/chapter-building-queryfn.html
六、Element 状态:
A state describes whether the element instance is initialized, whether it is ready to transfer data and whether it is currently handling data. There are four states defined inGStreamer:GST_STATE_NULL
GST_STATE_READY
GST_STATE_PAUSED
GST_STATE_PLAYING
参考:http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/chapter-statemanage-states.html
七、Adding Properties:
The primary and most important way of controlling how an element behaves, is through GObject properties. GObject properties are defined in the_class_init ()function. The element optionally implements a
_get_property ()and a
_set_property ()function. These functions will be notified if an application changes or requests the value of a property, and can then fill in the value or take action required for that property to
change value internally.
参考:http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/chapter-building-args.html
七、Building a Test Application:构建测试程序测试新建的plugin。
参考:http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/chapter-building-testapp.html相关文章推荐
- 锋利的jQuery-7--编写插件基础知识
- Java基础知识强化92:日期工具类的编写和测试案例
- Linux 脚本编写基础知识
- 9、插件开发指南(基础知识)
- 我的Firefox插件开发之旅(6)——FF插件的一些基础知识
- Python 插件(add-in)基础知识
- Eclipse插件开发之基础篇(1) 插件开发的基础知识
- Eclipse插件开发之基础篇(1) 插件开发的基础知识
- 基础知识(三)makefile文件编写初级篇
- Eclipse插件开发之基础篇(1) 插件开发的基础知识
- MEX 文件编写基础知识
- 我的Firefox插件开发之旅(6)——FF插件的一些基础知识
- jQuery弹簧插件编写基础之“又见弹窗”
- 010天(.net学习之路-C#基础知识)-编写资源管理器
- jQuery插件编写:基础篇(一)
- jQuery插件编写基础之“又见弹窗”
- Gstreamer 插件编写【二】高级特性
- 一、基础篇:unity简单集成百度地图(基础地图),做记录,抗遗忘。(利用Android studio为unity编写百度地图插件)
- Firefox插件开发(6)——FF插件的一些基础知识
- 软件测试基础知识二——编写测试用例的方法