Gstreamer基本管道正在运行但未在Windows 7虚拟机上显示

时间:2015-03-02 10:20:12

标签: c++ windows gstreamer

我目前正在使用Windows 7(x86_64)上的Gstreamer作为VM(Virtualbox),我想运行一个基本的管道:

gst-launch-1.0 -v videotestsrc pattern=snow ! autovideosync

当我运行此管道时,我得到:

Setting pipeline to PAUSED...
Pipeline is PREROLLING

然后发生错误:

Pipeline doesn't want to preroll

我通过在管道末尾添加async-handling = true解决了这个错误,但没有任何内容仍在显示......

我尝试运行编写C ++代码的相同管道。这是一个简单的主要你可以运行。当我运行此代码时,我没有收到任何错误,但没有显示任何内容。

#include <gst/gst.h>
#include <glib.h>
#include <stdio.h>

int main(int argc, char* argv[]) {
GMainLoop *loop;
GstElement *pipeline, *source, *sink;

g_print("Starting...");
/* Initialisation */
gst_init(&argc, &argv);

g_print("Loop is created...");
loop = g_main_loop_new(NULL, FALSE);

/* Create gstreamer elements */
pipeline = gst_pipeline_new("gst-app-sink");
source = gst_element_factory_make("videotestsrc", "src");
sink = gst_element_factory_make("autovideosink", "sink");

if (!pipeline || !source || !sink) {
    g_printerr("One element could not be created. Exiting.\n");
    return -1;
}

/* Set up the pipeline */

/* we add all elements into the pipeline */
/* source | sink */
gst_bin_add_many(GST_BIN(pipeline), source, sink, NULL);

/* we link the elements together */
/* src -> sink */
gst_element_link(source, sink);

/* Set the pipeline to "playing" state*/
gst_element_set_state(pipeline, GST_STATE_PLAYING);

/* Iterate */
g_print("Running...\n");
g_main_loop_run(loop);

/* Out of the main loop, clean up nicely */
g_print("Returned, stopping playback\n");
gst_element_set_state(pipeline, GST_STATE_NULL);

g_print("Deleting pipeline\n");
gst_object_unref(GST_OBJECT(pipeline));
g_main_loop_unref(loop);

return 0;

}

我真的不知道它可能来自哪里。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

默认情况下,VM无法启用显示这类流所需的2D和3D视频加速。只需右键单击您的VM - &gt;设置 - &gt;显示并选中“启用3D加速”和“启用2D视频加速”。