• 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
  • 相关阅读:
    SpringBoot使用guava的布隆过滤器
    理解MySQL的会话变量、局部变量和全局变量
    【无标题】
    数学建模--优化类模型
    git submodule 子模块的基本使用
    操作系统笔记(王道考研) 第三章:内存管理
    【经济调度】基于蝙蝠算法实现电力系统经济调度附Matlab代码
    Java中带图片的数据导出到excel
    0068 IO流
    Python的迭代对象和迭代器
  • 原文地址:https://blog.csdn.net/qq_41290252/article/details/134049363