gstreamer-示例1中的错误

Gstreamer - error in the example 1

本文关键字:错误 示例 gstreamer-      更新时间:2023-10-16

当我运行示例1:

#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 ("playbin uri=https://www.freedesktop.org/software/gstreamer-sdk/data/media/sintel_trailer-480p.webm", 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;
}

我有两个错误:
1)类型" int"的参数与类型" gstmessagetype"的参数不兼容

2)'gstmessage *gst_bus_timed_pop_filtered(gstbus *,gstbus *,gstclocktime,gstmessagetype)':无法转换参数3从'int'到'gstmessageType'

怎么了?

- Property Manager>右键单击项目>添加现有属性表>链接文件GStreamer-1.0 Props(Share vs 2010 libs libs gstreamer-1.0.props)

尝试用(GstMessageType)(GST_MESSAGE_ERROR | GST_MESSAGE_EOS)

替换GST_MESSAGE_ERROR | GST_MESSAGE_EOS

我已经解决了问题(解决方案1),我仍然不得不弄乱路径和链接,我不确定我做了什么,但是它可能与bin目录链接(由于某种原因,这是以前不起作用的)。要注意的另一件事是程序需要具有.c扩展名(不是.cpp)。