gstreamer 插件编写【一】基础知识

一、Buffer and Event,

    当我们需要push数据到硬件sink插件时,可以使用以下方法直接操作硬件memory。来自:http://gstreamer.freedesktop.org/data/doc/gstreamer/head/pwg/html/section-basics-data.html

Many 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.html

Table 16.1. Table of Audio Types

Media TypeDescriptionPropertyProperty TypeProperty ValuesProperty Description
All audio types.            
audio/*All audio types            rateintegergreater than 0              The sample rate of the data, in samples (per channel) per second.            
channelsintegergreater than 0              The number of channels of audio data.            
All raw audio types.            
audio/x-raw              Unstructured and uncompressed raw audio data.            formatstring              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.html

The 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 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-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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值