这应该很简单,但我无法弄清楚。如何获取加载到 QVideoWidget/QMediaPlayer 中的文件的视频尺寸。所以,我的代码如下:
QMediaPlayer m_MediaPLayer(0, QMediaPlayer::VideoSurface);
m_VideoWidget = new QVideoWidget;
m_MediaPLayer.setVideoOutput(m_VideoWidget);
m_MediaPLayer.setMedia(QUrl::fromLocalFile("file.avi"));
m_MediaPLayer.play();
// I am here checking for media status changed event
connect(&m_MediaPLayer, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
this, SLOT(mediaStatusChanged(QMediaPlayer::MediaStatus)));
void MyClass::mediaStatusChanged(QMediaPlayer::MediaStatus status)
{
// Here I get notification for media status change but no idea how to
// get the video size. I could not figure out a way.
}