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

使用 gst-element-maker 创建一个完全透传的 videofilter 插件

系列文章目录

创建 gstreamer 插件的几种方式
使用 gst-template 创建自己的 gstreamer 插件
使用 gst-plugins-bad 里面的 gst-element-maker 工具创建gstreamer 插件
使用 gst-element-maker 创建一个完全透传的 videofilter 插件


文章目录

  • 系列文章目录
  • 前言
  • 一、使用gst-element-maker 创建一个videofilter 插件
    • 1. 使用 gst-element-maker 基于videofilter 基类模板创建一个 g2dfilter 插件
    • 2. 修改 g2dfilter 插件源码,支持透传功能
    • 3. 编译修改后添加透传功能的 g2dfilter 插件
    • 4. 本地电脑安装 g2dfilter 插件
  • 二、测试 g2dfilter 插件的透传功能
  • 总结
  • 参考资料


前言

本文主要介绍如何使用gst-plugins-bad 里面的 gst-element-maker 工具创建一个基于 videofilter base class 的透传功能videofilter gstreamer插件(上一篇文章 使用 gst-plugins-bad 里面的 gst-element-maker 工具创建gstreamer 插件 只是创建了一个最基础的videofilter 插件,但是它不支持透传功能,即进入该插件 sink pad 的数据不能从该插件的 src pad 发送出去)
软硬件环境:
ubuntu18.04
meson 0.55.0
gstreamer 1.14.5
ninja 1.8.2
python 3.6.9


一、使用gst-element-maker 创建一个videofilter 插件

1. 使用 gst-element-maker 基于videofilter 基类模板创建一个 g2dfilter 插件

如下图所示,使用 gst-element-maker g2dfilter videofilter 命令生成 g2dfilter 插件相关的代码

cd gst-plugins-bad/tools
./gst-element-maker g2dfilter videofilter

在这里插入图片描述

2. 修改 g2dfilter 插件源码,支持透传功能

如下图所示,在 gstg2dfilter.c 文件中的 **gst_g2dfilter_start() **函数中添加一句 gst_base_transform_set_passthrough(trans, TRUE) 函数调用,就实现了透传功能, 至于gst_base_transform_set_passthrough() 函数的相关说明,请参考 gstreamer官网 GstBaseTransform 基类的相关资料
在这里插入图片描述
修改后的完整的gstg2dfilter.c 代码(包括添加的一些打印信息)如下:

/* GStreamer* Copyright (C) 2023 FIXME <fixme@example.com>** This library is free software; you can redistribute it and/or* modify it under the terms of the GNU Library General Public* License as published by the Free Software Foundation; either* version 2 of the License, or (at your option) any later version.** This library is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU* Library General Public License for more details.** You should have received a copy of the GNU Library General Public* License along with this library; if not, write to the* Free Software Foundation, Inc., 51 Franklin Street, Suite 500,* Boston, MA 02110-1335, USA.*/
/*** SECTION:element-gstg2dfilter** The g2dfilter element does FIXME stuff.** <refsect2>* <title>Example launch line</title>* |[* gst-launch-1.0 -v fakesrc ! g2dfilter ! FIXME ! fakesink* ]|* FIXME Describe what the pipeline does.* </refsect2>*/#ifdef HAVE_CONFIG_H
#include "config.h"
#endif#include <stdint.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/video/gstvideofilter.h>
#include "gstg2dfilter.h"GST_DEBUG_CATEGORY_STATIC (gst_g2dfilter_debug_category);
#define GST_CAT_DEFAULT gst_g2dfilter_debug_category/* prototypes */static void gst_g2dfilter_set_property (GObject * object,guint property_id, const GValue * value, GParamSpec * pspec);
static void gst_g2dfilter_get_property (GObject * object,guint property_id, GValue * value, GParamSpec * pspec);
static void gst_g2dfilter_dispose (GObject * object);
static void gst_g2dfilter_finalize (GObject * object);static gboolean gst_g2dfilter_start (GstBaseTransform 
http://www.lryc.cn/news/179154.html

相关文章:

  • 华为ensp单臂路由及OSPF实验
  • Android LiveData 介绍
  • 好看的货架效果(含3D效果)
  • 【每日一题】1498. 满足条件的子序列数目
  • Go语言数据类型实例讲解 - Go语言从入门到实战
  • RocketMQ 事务消息发送
  • 后端-POST请求中只需要两个参数,后端不想创建对象时
  • UG\NX二次开发 通过点云生成曲面 UF_MODL_create_surf_from_cloud
  • Linux常用指令(二)
  • 【HUAWEI】单臂路由
  • 安全学习_开发相关_Java第三方组件Log4jFastJSON及相关安全问题简介
  • 零代码编程:用ChatGPT批量自动下载archive.org上的音频书
  • 力扣用队列实现栈
  • 一朵华为云,如何做好百模千态?
  • 华为云云耀云服务器L实例评测 | 实例使用教学之软件安装:华为云云耀云服务器环境下安装 Docker
  • 小程序编译器性能优化之路
  • FFmpeg 命令:从入门到精通 | ffmpeg 命令分类查询
  • Linux学习记录——삼십일 socket编程---TCP套接字
  • 【学习笔记】深度学习分布式系统
  • 【数据结构】树、二叉树的概念和二叉树的顺序结构及实现
  • rust学习-string
  • No167.精选前端面试题,享受每天的挑战和学习
  • 【python】pycharm导入anaconda环境
  • 【数据结构】逻辑结构与物理结构
  • HTML5高级部分
  • 浏览器输入 URL 并回车发生了什么
  • asp.net core mvc 文件上传,下载,预览
  • Axios有哪些常用的方法?
  • PL/SQL+cpolar公网访问内网Oracle数据库
  • stable diffusion和gpt4-free快速运行