我正在尝试使用QML将gsrtreamer视频集成到QT应用程序中。我已经从示例qmlplayer2开始,该示例使用远程视频:
player->setUri(QLatin1Literal("http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_surround-fix.avi"));
我已经修改了这个示例,使用管道来获取一个udpsrc:
m_pipeline = QGst::Pipeline::create();
QGst::ElementPtr udp = QGst::ElementFactory::make(QLatin1Literal("udpsrc"));
udp->setProperty("address", "192.168.1.1");
udp->setProperty("port", 3333);
QGst::ElementPtr decodage = QGst::ElementFactory::make("jpegdec");
QGst::ElementPtr videosink = QGst::ElementFactory::make("autovideosink");
这相当于:
gst-launch-1.0 udpsrc address=192.168.1.1 port=3333 ! jpegdec ! autovideosink
这个方法有效,我可以流式传输视频并控制播放/暂停/停止按钮。
而我的QML指定VideoItem在主窗口中:
Rectangle {
id: window
width: 600
height: 300
Column {
width: 600
height: 544
y : 10;
VideoItem {
id: video
y : 10;
width: window.width
height: 260
surface: videoSurface1 //bound on the context from main()
}
// Other buttons
我发现的所有主题都太旧了(自今年Qt 5.5起,gstreamer已经是本地支持的),或者没有答案。
我的工作中是否有错误?
是否有其他实现我想要的功能的方法?
谢谢。