【发布时间】:2021-10-17 00:07:06
【问题描述】:
我是Gstreamer的新手,在编译Gstreamer的教程1时遇到问题。我正在使用带有 Visual c++ express 2010 的 Windows 7 64 位和 Gstreamer SDK 2012.11 32 位 (downloaded from here)。 这是代码:
#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;
}
第一个错误:
error C2664: 'gst_bus_timed_pop_filtered' : cannot convert parameter 3 from 'int' to 'GstMessageType'
所以我刚刚从代码中删除了 GST_MESSAGE_ERROR。所以现在是:
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
我真的不明白为什么它适用于 ubuntu 而不适用于 Windows。我真的不知道如何解决这个问题。 你能帮我吗?
问候,
【问题讨论】:
标签: visual-c++ gstreamer