我試圖編寫一個非常簡單的GStreamer應用程序。只要GStreamer有所作爲,它無關緊要。即使只顯示一些文本或簡單的JPEG也沒問題。GStreamer演示版在虛擬機中無法工作(尋求簡單示例)
下面是我可以通過谷歌搜索找到的最好的例子(我已經添加了一些錯誤檢查)。當我在Linux虛擬機運行在Windows下運行,我看到這個控制檯消息:80ee:
libEGL警告:爲FD 4個PCI ID牛肉,驅動程序(空)
libEGL警告:DRI2 :未能打開vboxvideo(搜索路徑 /usr/lib中/ I386-Linux的GNU/DRI:$ {ORIGIN}/DRI:/ usr/lib中/ DRI)
谷歌搜索表明這是一個錯誤在一臺虛擬機裏面的3D翻譯。我找不到解決辦法。
那麼,有人可以修復下面的代碼,以便它可以在VM中運行嗎?我認爲這將意味着避免3D渲染,因此可能會顯示圖像或文本?沒有必要播放視頻,這只是一個簡單的證明GStreamer使用其他內容(必須在虛擬機中運行)的概念。
下面的代碼...
void GstreamerPlayVideo()
{
GstElement *pipeline;
GstBus *bus;
GstMessage *msg;
int argc;
GError *error = NULL;
/* Initialize GStreamer */
if (gst_init_check(&argc, NULL, &error) == TRUE)
{
/* Build the pipeline */
// Change URL to test failure
pipeline = gst_parse_launch ("bin uri=http://docs.gstreamer.com/media/sintel_trailer-480p.webm", &error);
//// pipeline = gst_parse_launch ("bin uri=http://tecfa.unige.ch/guides/x3d/www.web3d.org/x3d/content/examples/HelloWorld.gif", &error);
if (pipeline != NULL)
{
/* Start playing */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
/* wait until it's up and running or failed */
if (gst_element_get_state (pipeline, NULL, NULL, -1) == GST_STATE_CHANGE_FAILURE)
{
g_error ("GST failed to go into PLAYING state");
exit(1);
}
/* Wait until error or EOS */
bus = gst_element_get_bus (pipeline);
if (bus != NULL)
{
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, GST_MESSAGE_ERROR | GST_MESSAGE_EOS);
/* Parse message */
if (msg != NULL)
{
gchar *debug_info;
switch (GST_MESSAGE_TYPE (msg))
{
case GST_MESSAGE_ERROR:
gst_message_parse_error (msg, &error, &debug_info);
g_printerr ("Error received from element %s: %s\n", GST_OBJECT_NAME (msg->src), error->message);
g_printerr ("Debugging information: %s\n", debug_info ? debug_info : "none");
g_clear_error (&error);
g_free (debug_info);
break;
case GST_MESSAGE_EOS:
g_print ("End-Of-Stream reached.\n");
break;
default:
/* We should not reach here because we only asked for ERRORs and EOS */
g_printerr ("Unexpected message received.\n");
break;
}
gst_message_unref (msg);
}
/* Free resources */
gst_object_unref (bus);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
}
else
{
g_print ("GST get bus error: %s\n", error->message);
exit(1);
}
}
else
{
g_print ("GST parse error: %s\n", error->message);
exit(1);
}
}
else
{
g_print ("GST init error: %s\n", error->message);
exit(1);
}
} // GstreamerPlayVideo()
可以嘗試用[一些管道(HTTP運行GST推出-1.0://wiki.oz9aec .NET /的index.php/Gstreamer_cheat_sheet)?至少gst-launch-1.0 --version只是爲了知道你在使用哪個gstreamer ..什麼是[OpenGL版本](http://askubuntu.com/questions/47062/what-is-terminal-command-that-can -show-OpenGL的版本)? – nayana
對不起,我是Gstreamer n00b。你可以擴展嗎?幫我編碼嗎? – Mawg
以及我的意思是隻是去你的殼和鍵入: gst-launch-1.0 videotestsrc! ximagesink – nayana