When I play files with a video frame rate of 25, the duration is displayed correctly. But if I play files with a video frame rate of 29.9, the duration will be incorrect (less than expected).
I have the following values ββfor the position (when the values ββare repeated at the end, playback still goes on):
0 255 1209 2210 3208 4209 5210 6209 7210 8205 9207 10208 11211 12207 13209 14210 15207 16210 17209 18206 19209 20209 21207 22209 23209 24059 24059 24059 24059 24059 24059 24059 24059
How can I get the correct duration information?
Here is the code:
player = new QMediaPlayer(this); connect(player, SIGNAL(durationChanged(qint64)), SLOT(durationChanged(qint64))); connect(player, SIGNAL(positionChanged(qint64)), SLOT(positionChanged(qint64))); void durationChanged(qint64 duration) { this->duration = duration/1000; ui->slider->setMaximum(duration / 1000); } void positionChanged(qint64 progress) { qDebug() << progress; ui->slider->setValue(progress / 1000); }
source share