在Qt中显示视频画面,可以把每一帧的数据存为QImage然后显示出来,也可以使用OpenGL或DirectX来进行绘制,直接操作显卡显示,之前我在做视频解码播放时,都是用QImage的方式,本篇将介绍如何使用D3D来渲染显示视频帧,显示效果:
DirectX属于微软的技术,在windows窗口渲染时会更合适,当然使用QWidget也是可以的,QWidget可以转为HWND, QWidget有如下成员函数:
WId QWidget::winId() const
Qt Assist的解释
Returns the window system identifier of the widget.
Portable in principle, but if you use it you are probably about to do something non-portable. Be careful.
If a widget is non-native (alien) and winId() is invoked on it, that widget will be provided a native handle.
This value may change at run-time. An event with type