Visual c++ Gstreamer与visual C++;express 2010-教程1
我是Gstreamer的新手,在编译Gstreamer教程1时遇到了问题。我使用Windows 7 64位,用Visual C++快件2010,和gStuler-SDK 2012.11 32位()。 代码如下:Visual c++ Gstreamer与visual C++;express 2010-教程1,visual-c++,gstreamer,Visual C++,Gstreamer,我是Gstreamer的新手,在编译Gstreamer教程1时遇到了问题。我使用Windows 7 64位,用Visual C++快件2010,和gStuler-SDK 2012.11 32位()。 代码如下: #include "stdafx.h" #include <gst/gst.h> int main(int argc, char *argv[]) { GstElement *pipeline; GstBus *bus; GstMessage *msg;
#include "stdafx.h"
#include <gst/gst.h>
int main(int argc, char *argv[]) {
GstElement *pipeline;
GstBus *bus;
GstMessage *msg;
/* Initialize GStreamer */
gst_init (&argc, &argv);
/* Build the pipeline */
pipeline = gst_parse_launch ("playbin2 uri=file://E:/test_1.MOV", NULL);
/* Start playing */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
/* Wait until error or EOS */
bus = gst_element_get_bus (pipeline);
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, GST_MESSAGE_ERROR | GST_MESSAGE_EOS);
/* Free resources */
if (msg != NULL)
gst_message_unref (msg);
gst_object_unref (bus);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
return 0;
}
所以我刚从代码中删除了GST_消息_错误。所以现在的路线是:
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, GST_MESSAGE_EOS);
我在Ubuntu上也有同样的问题。但在那之后,在Ubuntu中,我可以播放视频
第二个错误:
但是在Windows中,编译是很好的,但是当我尝试运行它时,我有以下错误:
GStreamer-CRITICAL **: gst_element_set_state: assertion 'GST_IS_ELEMENT <element>' failed
GStreamer-CRITICAL **: gst_element_get_bus: assertion 'GST_IS_ELEMENT <element>' failed
GStreamer-CRITICAL **: gst_bus_timed_pop_filtered: assertion 'GST_IS_BUS <bus>' failed
GStreamer-CRITICAL **: gst_object_unref: assertion 'object=!NULL' failed
GStreamer-CRITICAL **: gst_element_set_state: assertion 'GST_IS_ELEMENT <element>' failed
GStreamer-CRITICAL **: gst_object_unref: assertion 'object=!NULL' failed
GStreamer-CRITICAL**:gst\u-element\u-set\u状态:断言“gst\u是\u-element”失败
GStreamer CRITICAL**:gst\u元素\u获取\u总线:断言“gst\u是\u元素”失败
GStreamer CRITICAL**:gst\u总线\u定时\u pop\u已筛选:断言“gst\u IS\u总线”失败
GStreamer CRITICAL**:gst\u object\u unref:assertion'object=!“NULL”失败
GStreamer CRITICAL**:gst\U元素\U集合\U状态:断言“gst\U是\U元素”失败
GStreamer CRITICAL**:gst\u object\u unref:assertion'object=!“NULL”失败
我真的不明白为什么它和ubuntu一起工作,而不是和Windows一起工作。我真的不知道如何解决这个问题。
你能帮我吗
关于第一个错误 <>可能是代码被编译为C++,这在EnUM强制转换中有点严格。尝试替换:
GST_消息|错误| GST_消息(EOS
with(GstMessageType)(GST_消息|错误| GST_消息(EOS)
第二个错误
线路很可能:
pipeline = gst_parse_launch ("playbin2 uri=file://E:/test_1.MOV", NULL);
返回NULL,其余的错误都是此错误的结果。为什么它可以返回NULL?原因有很多。也许你还没有安装带有“playbin2”的插件?试试这个:
- 将指向
结构的指针作为第二个参数传递给GError
(它有一个gst\u parse\u launch
字段,可以给您一些提示)消息
- 运行程序时,将gst debug level=4或更高级别作为命令行参数传递。您将在控制台输出中看到许多信息,失败的原因将在那里的某个地方
“playbin2”从gstreamer 1.0重命名为“playbin”。第二个错误: 我想为Ubuntu 16.04 LTS用户解释一下 要尝试这些示例,您应该从这些存储库的源代码中编译并安装:
gstreamer
gst-plugins-base
gst-plugins-good
原因是用于示例的版本与我安装的apt版本不匹配(playbin
缺失)
在从源代码编译之前,您还需要依赖关系来构建vorbis
、vpx
和souphttpsrc
插件(它们是所提到的存储库的一部分)。您可以通过运行以下命令来安装它们:
apt安装libvorbis dev libsoup2.4-dev libvpx dev
要检查上述插件是否包含在存储库构建中,请参见/configure
输出。如果没有,可能您的系统上仍然缺少一些依赖项。输出将告诉您缺少什么
之后,您应该成功编译并运行该示例(您应该看到一个视频回放)
使用GStreamer解决初始安装问题的一般流程是(如公认答案中所述)使用--gst debug level=4
,找出缺少的插件并安装它们。这里应该使用静态转换()而不是C样式转换。
gstreamer
gst-plugins-base
gst-plugins-good