嗨我在Windows 7 64bit上使用gstreamer-0.10时遇到了一些问题(使用32位gstreamer)。
请参阅下面的代码,了解教程1(针对VS2010进行了修改):
#include <gst/gst.h>
int main(int argc, char *argv[]) {
GstElement *pipeline;
GstBus *bus;
GstMessage *msg;
// Added GError to catch pipeline problems?
// http://stackoverflow.com/questions/14923306/gstreamer-with-visual-c-express-2010-tutorial-1
GError **errorMsg = NULL;
/* Initialize GStreamer */
gst_init (&argc, &argv);
/* Build the pipeline */
pipeline = gst_parse_launch ("playbin2 uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", errorMsg);
// pipeline = gst_parse_launch ("playbin uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", errorMsg);
// pipeline = gst_parse_launch ("playbin2 uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL);
// pipeline = gst_parse_launch ("playbin uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", NULL);
// pipeline = gst_parse_launch ("videotestsrc ! autovideosink", errorMsg);
/* Start playing */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
/* Wait until error or EOS */
bus = gst_element_get_bus (pipeline);
/* MSVC Compiler is more strict with enum type casting hence the (GstMessageType) cast on the second parameter */
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, (GstMessageType)(GST_MESSAGE_ERROR | GST_MESSAGE_EOS));
// 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;
}
上面的代码编译得很好但是我在运行时收到以下输出:
(basic-tutorial-1_debug.exe:8700): GStreamer-CRITICAL **: gst_element_set_state:
assertion `GST_IS_ELEMENT (element)' failed
(basic-tutorial-1_debug.exe:8700): GStreamer-CRITICAL **: gst_element_get_bus: a
ssertion `GST_IS_ELEMENT (element)' failed
(basic-tutorial-1_debug.exe:8700): GStreamer-CRITICAL **: gst_bus_timed_pop_filt
ered: assertion `GST_IS_BUS (bus)' failed
(basic-tutorial-1_debug.exe:8700): GStreamer-CRITICAL **: gst_object_unref: asse
rtion `object != NULL' failed
(basic-tutorial-1_debug.exe:8700): GStreamer-CRITICAL **: gst_element_set_state:
assertion `GST_IS_ELEMENT (element)' failed
(basic-tutorial-1_debug.exe:8700): GStreamer-CRITICAL **: gst_object_unref: asse
rtion `object != NULL' failed
我还使用了--gst-debug-level = 4(下面选择的输出):
it_check: initialized GStreamer successfully
0:00:00.358921084 8236 004D5000 INFO GST_PIPELINE gstparse.c:334:g
st_parse_launch_full: parsing pipeline description 'playbin2 uri=http://docs.gst
reamer.com/media/sintel_trailer-480p.webm'
0:00:00.368644038 8236 004D5000 DEBUG GST_PIPELINE parse.l:107:priv
_gst_parse_yylex: flex: IDENTIFIER: playbin2
0:00:00.375062362 8236 004D5000 INFO GST_ELEMENT_FACTORY gstelementfactor
y.c:467:gst_element_factory_make: no such element factory "playbin2"!
0:00:00.381743480 8236 004D5000 ERROR GST_PIPELINE ./grammar.y:661:
priv_gst_parse_yyparse: no element "playbin2"
0:00:00.387568465 8236 004D5000 ERROR GST_PIPELINE ./grammar.y:929:
priv_gst_parse_launch: Unrecoverable syntax error while parsing pipeline playbin
2 uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm
我还尝试将'playbin2'重命名为'playbin'以及一些更常规的管道(在命令行上工作)。
如果有任何帮助,我将不胜感激。