第一篇:Gst在Win环境下安装和使用
Win环境下安装
下载地址
点击进入 [下载地址],选择合适的版本(https://gstreamer.freedesktop.org/data/pkg/windows/)
安装完成后,添加环境变量
移动配置文件
将glibconfig.h文件移动到下面两个目录当中
测试
在VS上运行示例代码
VS2022配置环境
运行下方代码
#include <iostream>
#include <gst/gst.h>
#include <glib.h>
int main(int argc, char* argv[]) {
GstElement* pipeline;
GstElement* source, * filter, * sink;
//init
gst_init(&argc, &argv);
//creat pipeline
pipeline = gst_pipeline_new("my-pipline");
//create elements
source = gst_element_factory_make("fakesrc", "source");
filter = gst_element_factory_make("identity", "filter");
sink = gst_element_factory_make("fakesink", "sink");
//将元组添加到管道中
gst_bin_add_many(GST_BIN(pipeline), source, filter, sink, NULL);
//连接
if (!gst_element_link_many(source, filter, sink, NULL)) {
g_warning("failed to link elements\n");
std::cout << "failed to link elements!\n";
}
else
{
std::cout << "Hello GStreamer!\n";
}
/*在链接不同的组件之前,你需要确保这些组件都被加在同一个箱柜中,
因为将一个组件加载到一个箱柜中会破坏该组件已存在的一些链接关系。
同时,你不能直接链接不在同一箱柜或管道中的组件。*/
return 0;
}