• gstreamer插件开发-Specifying the pads


    Specifying the pads

    如前所述,pad是数据进出元素的端口,这使得它们在元素创建过程中成为非常重要的项。在样板代码中,我们已经看到了静态pad模板如何将pad模板注册到元素类中。在这里,我们将看到如何创建实际的元素,使用_event()函数来配置特定的格式,以及如何注册函数来让数据流过元素。

    在element _init()函数中,您从pad模板创建pad,该pad模板已经在_class_init()函数中的元素类中注册。创建pad之后,必须设置一个_chain()函数指针,它将接收和处理sinkpad上的输入数据。你也可以选择设置_event()函数指针和_query()函数指针。另外,pad也可以在循环模式下运行,这意味着它们可以自己提取数据。稍后将详细介绍此主题。之后,您必须将pad注册到元素中。事情是这样发生的:

    static void gst_my_filter_init (GstMyFilter *filter)
    {
      /* pad through which data comes in to the element */
      filter->sinkpad = gst_pad_new_from_static_template (
        &sink_template, "sink");
      /* pads are configured here with gst_pad_set_*_function () */
    
    
    
      gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
    
      /* pad through which data goes out of the element */
      filter->srcpad = gst_pad_new_from_static_template (
        &src_template, "src");
      /* pads are configured here with gst_pad_set_*_function () */
    
    
    
      gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
    
      /* properties initial value */
      filter->silent = FALSE;
    }
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
  • 相关阅读:
    安卓手机抓包配置
    数据结构题目收录(五)
    HTTP基本概念介绍
    Linux进程基础(一)
    iOS中UIColor,CGColor,CIColor详解
    ES6 入门教程 16 Reflect 16.2 静态方法 & 16.3 实例:使用 Proxy 实现观察者模式
    flink读取mongodb数据源
    YGG GAP 第一季 NFT 背后的设计理念
    Java 和低延迟
    数据库原理及应用实验报告-实验4-SQL的视图
  • 原文地址:https://blog.csdn.net/qq_41290252/article/details/134049363