diff options
author | Yoann Lopes <yoann.lopes@digia.com> | 2013-08-16 17:51:53 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-22 13:16:49 +0200 |
commit | a2f078f1088827ec2bc066aaee7ca3199c6cb4eb (patch) | |
tree | a83d8cdf2f16d2950442373360dd169eb62e750f /src/plugins/wmf/evrd3dpresentengine.cpp | |
parent | ca769ba264f868ea2f41f2656f7126218b428ad4 (diff) |
WMF and GStreamer: fixed incorrect frame startTime and endTime.
The QVideoFrame documentation explicitly says that the time is in
microseconds, however the GStreamer backend was setting the time in
milliseconds and the WMF backend in 100-nanosecond units.
With WMF, the time was missing from the QVideoFrame when presenting it to
the video surface.
Task-number: QTBUG-31731
Change-Id: I0638d2abf8eed25b3a531db67c19a18703e5b630
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
Diffstat (limited to 'src/plugins/wmf/evrd3dpresentengine.cpp')
-rw-r--r-- | src/plugins/wmf/evrd3dpresentengine.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/plugins/wmf/evrd3dpresentengine.cpp b/src/plugins/wmf/evrd3dpresentengine.cpp index c67b5d448..01a5c3341 100644 --- a/src/plugins/wmf/evrd3dpresentengine.cpp +++ b/src/plugins/wmf/evrd3dpresentengine.cpp @@ -288,9 +288,21 @@ void D3DPresentEngine::presentSample(void *opaque, qint64) } if (surface && updateTexture(surface)) { - m_surface->present(QVideoFrame(new TextureVideoBuffer(m_glTexture), - m_surfaceFormat.frameSize(), - m_surfaceFormat.pixelFormat())); + QVideoFrame frame = QVideoFrame(new TextureVideoBuffer(m_glTexture), + m_surfaceFormat.frameSize(), + m_surfaceFormat.pixelFormat()); + + // WMF uses 100-nanosecond units, Qt uses microseconds + LONGLONG startTime = -1; + if (SUCCEEDED(sample->GetSampleTime(&startTime))) { + frame.setStartTime(startTime * 0.1); + + LONGLONG duration = -1; + if (SUCCEEDED(sample->GetSampleDuration(&duration))) + frame.setEndTime((startTime + duration) * 0.1); + } + + m_surface->present(frame); } done: |