这应该是一个简单的问题,但我无法解决。如何获取加载到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.
}
mediaStatusChanged
信号事件处理程序中获取了大小。这也可能是一个原因。 - Luca