背景
最近工作用到了GStreamer,本着从入门到放弃的态度,打算记录一下学习的过程,废话不多说,先来个HelloWorld。
GStreamer简介
GStreamer is an extremely powerful and versatile framework for creating streaming media applications. Many of the virtues of the GStreamer framework come from its modularity: GStreamer can seamlessly incorporate new plugin modules. But because modularity and power often come at a cost of greater complexity, writing new applications is not always easy.
GStreamer是一个用于创建流媒体应用的强大通用框架。GStreamer框架的许多优点来自于她的模块化:GStreamer可以无缝地集成新的插件模块。但是模块化和功能强大伴随着非常大的复杂性,因此写新的应用不是那么容易的。
配置环境
- Windows 11
- Microsoft Visual Studio Community 2022 (64 位)
使用步骤
- 下载安装runtime和development files,安装选项保持默认就行
- 下载官方HelloWorld代码工程,源码保存在GitLab上,只需要下载tuorials目录即可,地址:examples/tutorials · discontinued-for-monorepo · GStreamer / gst-docs · GitLab
examples/tutorials · discontinued-for-monorepo · GStreamer / gst-docs · GitLab
- 配置环境变量,需要新增一个环境变量“GSTREAMER_1_0_ROOT_X86_64”,并在Path环境变量里加上“%GSTREAMER_1_0_ROOT_MSVC_X86_64%\bin”
- 打开visual studio,选择打开项目/解决方案,选中代码工程中的“tutorials.sln”,打开之后选择“生成--生成解决方案”,有部分项目生成失败没有影响,检查“x64\Debug”中能生成对应的exe文件即可
- 双击生成的“basic-tutorial-1.exe”,会弹出一个窗口播放一段网络视频,至此一个GStreamer HelloWorld应用已经完成。
注意事项
- 官方提供的sample是基于vs2010,通过高版本打开时需要更新sdk
- 环境变量需要在打开vs前配置,否则可能需要重启vs,我之前就是一直编译不过,重启vs就OK了