1.添加positioning
2.添加控件,修改名称,修改最大值提升精度
3.
在类xplay2中添加
void Xplay2::timerEvent(QTimerEvent* e)
{
long long total = dt.totalMs;
qDebug() << "total: " << total << endl;
if (total > 0)
{
//当前解码到的pts除以总pts,是个比例
double pos = (double)dt.pts / (double)total;
qDebug()<< "pos: " << pos << endl;
int v = ui.playPos->maximum() * pos;
ui.playPos->setValue(v);
}
}
在xplay的构造函数中添加定时器
Xplay2::Xplay2(QWidget *parent)
: QWidget(parent)
{
ui.setupUi(this);
dt.start();
startTimer(40);
}
让控件刷新与视频同步(fps=25)