GStreamer API学习记录(五)

GStreamer API学习记录(五)

前言
GST API的学习由:GST官网(一、二)---->QT源码中的GST(三、四)---->blogs中的GST资料(五~)。
资料地址

零散函数知识点

可以通过gst_clock_get_time()函数获取。

Gstreamer 预滚(Preroll):bin的状态从ready到paused的中间状态。不丢帧的准备数据。

gst_element_query_position(pipeline, &m_format,&m_position):查询播放的进度。


启动Pipeline就是一个Gst的应用程序。

启动方法:
1、gst_parse_launch启动
本项目中用pipeline = gst_parse_launch (qPrintable(cmd), &error);的方法把所有元件事先写好在cmd,然后一起启动pipeline。
这种方法简洁,适合与元件没有变化的情况。


2、gst_bin_add_many的方式
适合差异话的封装,便于模块化的代码组织

   GstElement *pipeline = gst_pipeline_new (NULL);
    GstElement *src = gst_element_factory_make ("videotestsrc", NULL);
    GstElement *glupload = gst_element_factory_make ("glupload", NULL);
    /* the plugin must be loaded before loading the qml file to register the
     * GstGLVideoItem qml item */
    GstElement *sink = gst_element_factory_make ("qmlglsink", NULL);

    g_assert (src && glupload && sink);

    gst_bin_add_many (GST_BIN (pipeline), src, glupload, sink, NULL);
    gst_element_link_many (src, glupload, sink, NULL);

//通过gst_bin_add_many就组成完整的pipeline,后面直接设置pipeline的状态就行。

QT的gst插件就是用方法二封装的,便于pipeline的模块化组成和修改。

posted @   wuya178  阅读(551)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 一文读懂知识蒸馏
· 终于写完轮子一部分:tcp代理 了,记录一下
点击右上角即可分享
微信分享提示