当前位置: 首页 > news >正文

成都高端网站建设公司哪家好下载官方正版百度

成都高端网站建设公司哪家好,下载官方正版百度,长春建网站一般多少钱,品牌商城网站建设The chain function 链函数是所有数据处理都在其中进行的函数。在简单过滤器的情况下(本节示例的情况),_chain()函数大多是线性函数——因此对于每个传入的缓冲区,也将输出一个缓冲区。下面是一个非常简单的chain函数的实现: sta…

The chain function

链函数是所有数据处理都在其中进行的函数。在简单过滤器的情况下(本节示例的情况),_chain()函数大多是线性函数——因此对于每个传入的缓冲区,也将输出一个缓冲区。下面是一个非常简单的chain函数的实现:


static GstFlowReturn gst_my_filter_chain (GstPad    *pad,GstObject *parent,GstBuffer *buf);[..]static void
gst_my_filter_init (GstMyFilter * filter)
{
[..]/* configure chain function on the pad before adding* the pad to the element */gst_pad_set_chain_function (filter->sinkpad,gst_my_filter_chain);
[..]
}static GstFlowReturn
gst_my_filter_chain (GstPad    *pad,GstObject *parent,GstBuffer *buf)
{GstMyFilter *filter = GST_MY_FILTER (parent);if (!filter->silent)g_print ("Have data of size %" G_GSIZE_FORMAT" bytes!\n",gst_buffer_get_size (buf));return gst_pad_push (filter->srcpad, buf);
}

显然,上面的代码没什么用。你通常会在那里处理数据,而不是打印出数据所在的位置。但请记住,缓冲区并不总是可写的。

在更高级的元素(进行事件处理的元素)中,你可能需要另外指定一个事件处理函数,在发送流事件时调用该函数(如caps、end-of-stream、newsegment、tags等)。

static void
gst_my_filter_init (GstMyFilter * filter)
{
[..]gst_pad_set_event_function (filter->sinkpad,gst_my_filter_sink_event);
[..]
}static gboolean
gst_my_filter_sink_event (GstPad    *pad,GstObject *parent,GstEvent  *event)
{GstMyFilter *filter = GST_MY_FILTER (parent);switch (GST_EVENT_TYPE (event)) {case GST_EVENT_CAPS:/* we should handle the format here */break;case GST_EVENT_EOS:/* end-of-stream, we should close down all stream leftovers here */gst_my_filter_stop_processing (filter);break;default:break;}return gst_pad_event_default (pad, parent, event);
}static GstFlowReturn
gst_my_filter_chain (GstPad    *pad,GstObject *parent,GstBuffer *buf)
{GstMyFilter *filter = GST_MY_FILTER (parent);GstBuffer *outbuf;outbuf = gst_my_filter_process_data (filter, buf);gst_buffer_unref (buf);if (!outbuf) {/* something went wrong - signal an error */GST_ELEMENT_ERROR (GST_ELEMENT (filter), STREAM, FAILED, (NULL), (NULL));return GST_FLOW_ERROR;}return gst_pad_push (filter->srcpad, outbuf);
}

在某些情况下,元素还可以控制输入数据速率。在这种情况下,你可能想写一个所谓的基于循环的元素。源元素(只有源source pads)也可以是基于get-based的元素。这些概念将在本指南的高级部分和专门讨论源source pads的部分中进行解释。

The event function

event函数会通知你datastream中发生的特殊事件(例如caps、end-of-stream、newsegment、tags等)。事件可以upstream和downstream传递,所以你可以通过sink pad和source pad接收它们。

下面是一个非常简单的事件函数,我们将其安装在元素的sink pads上。

static gboolean gst_my_filter_sink_event (GstPad    *pad,GstObject *parent,GstEvent  *event);[..]static void
gst_my_filter_init (GstMyFilter * filter)
{
[..]/* configure event function on the pad before adding* the pad to the element */gst_pad_set_event_function (filter->sinkpad,gst_my_filter_sink_event);
[..]
}static gboolean
gst_my_filter_sink_event (GstPad    *pad,GstObject *parent,GstEvent  *event)
{gboolean ret;GstMyFilter *filter = GST_MY_FILTER (parent);switch (GST_EVENT_TYPE (event)) {case GST_EVENT_CAPS:/* we should handle the format here *//* push the event downstream */ret = gst_pad_push_event (filter->srcpad, event);break;case GST_EVENT_EOS:/* end-of-stream, we should close down all stream leftovers here */gst_my_filter_stop_processing (filter);ret = gst_pad_event_default (pad, parent, event);break;default:/* just call the default handler */ret = gst_pad_event_default (pad, parent, event);break;}return ret;
}

对于未知事件,最好调用默认的事件处理程序gst_pad_event_default()。根据事件类型,默认处理程序将转发事件或简单地取消引用它。默认情况下,CAPS事件是不转发的,因此我们需要在事件处理程序中执行此操作。

The query function

通过query函数,元素将收到查询,并必须响应查询。这些查询包括位置、持续时间等,还包括元素支持的格式和调度模式。查询可以在上游和下游传输,所以你可以在sink pad和source pad上接收它们。

下面是我们在元素的source pad上安装的一个非常简单的查询函数。

static gboolean gst_my_filter_src_query (GstPad    *pad,GstObject *parent,GstQuery  *query);[..]static void
gst_my_filter_init (GstMyFilter * filter)
{
[..]/* configure event function on the pad before adding* the pad to the element */gst_pad_set_query_function (filter->srcpad,gst_my_filter_src_query);
[..]
}static gboolean
gst_my_filter_src_query (GstPad    *pad,GstObject *parent,GstQuery  *query)
{gboolean ret;GstMyFilter *filter = GST_MY_FILTER (parent);switch (GST_QUERY_TYPE (query)) {case GST_QUERY_POSITION:/* we should report the current position */[...]break;case GST_QUERY_DURATION:/* we should report the duration here */[...]break;case GST_QUERY_CAPS:/* we should report the supported caps here */[...]break;default:/* just call the default handler */ret = gst_pad_query_default (pad, parent, query);break;}return ret;
}

对于未知的查询,最好调用默认的查询处理程序gst_pad_query_default()。根据查询类型,默认处理程序将转发查询或简单地取消引用它。

http://www.qdjiajiao.com/news/1860.html

相关文章:

  • 厦门网站优化服务腾讯中国联通
  • 成都免费网站制作seo推广百度百科
  • 温州网站建设策划方案软件工程培训机构哪家好
  • 高端品牌建站seo咨询服务
  • 网站权重优化方式成人教育培训机构排名
  • 什么网站做论坛签名优化教程网站推广排名
  • 个人怎么做微信公众号和微网站新手怎么引流推广推广引流
  • 做公众号的素材网站推广软件是什么工作
  • 郑州品牌网站建设百度热搜榜排名今日
  • 比较好的网站建设公司关键词竞价排名名词解释
  • 网站后台权限设计怎么在百度上做推广上首页
  • 网站推广工作如何做太原企业网站建设
  • 网站开发资金规模搜索推广代运营
  • 个人备案网站可以做淘宝客百度seo推广怎么收费
  • 手机做网站知乎艺人百度指数排行榜
  • 合肥高端网站建设公司长春网站建设设计
  • 百度推广 url主域名和注册网站不一致seo网站优化收藏
  • 手机网站开发实例不限次数观看视频的app
  • 松江手机网站建设百度搜索引擎工作原理
  • 建设视频网站费用天机seo
  • 专做定制网站建设下载百度网盘app最新版
  • 广告设计培训班学校有哪些2022百度seo优化工具
  • 天津建设网官方网站销售的三个核心点
  • 网站设计与程序方向怎么接游戏推广的业务
  • 开发公司岗位设置东莞seo网站推广建设
  • 旅游政务网站建设方案知乎seo排名的搜软件
  • 那些网站专门做棋牌推广的东莞整站优化推广公司找火速
  • 做网站用福建省人民政府门户网站
  • 天津营销网站建设如何让百度收录
  • 大施品牌策划公司网络优化培训