diff options
Diffstat (limited to 'src/plugins/common/evr')
-rw-r--r-- | src/plugins/common/evr/evrcustompresenter.cpp | 30 | ||||
-rw-r--r-- | src/plugins/common/evr/evrcustompresenter.h | 2 |
2 files changed, 17 insertions, 15 deletions
diff --git a/src/plugins/common/evr/evrcustompresenter.cpp b/src/plugins/common/evr/evrcustompresenter.cpp index 2bc761c45..b2dd0426c 100644 --- a/src/plugins/common/evr/evrcustompresenter.cpp +++ b/src/plugins/common/evr/evrcustompresenter.cpp @@ -50,6 +50,9 @@ #include <qcoreapplication.h> #include <qmath.h> #include <QtCore/qdebug.h> + +#include <mutex> + #include <float.h> #include <evcode.h> @@ -542,7 +545,6 @@ EVRCustomPresenter::EVRCustomPresenter(QAbstractVideoSurface *surface) , m_sampleFreeCB(this, &EVRCustomPresenter::onSampleFree) , m_refCount(1) , m_renderState(RenderShutdown) - , m_mutex(QMutex::Recursive) , m_scheduler(this) , m_tokenCounter(0) , m_sampleNotify(false) @@ -659,7 +661,7 @@ HRESULT EVRCustomPresenter::InitServicePointers(IMFTopologyServiceLookup *lookup HRESULT hr = S_OK; DWORD objectCount = 0; - QMutexLocker locker(&m_mutex); + const std::lock_guard<QRecursiveMutex> locker(m_mutex); // Do not allow initializing when playing or paused. if (isActive()) @@ -739,7 +741,7 @@ HRESULT EVRCustomPresenter::ProcessMessage(MFVP_MESSAGE_TYPE message, ULONG_PTR { HRESULT hr = S_OK; - QMutexLocker locker(&m_mutex); + const std::lock_guard<QRecursiveMutex> locker(m_mutex); hr = checkShutdown(); if (FAILED(hr)) @@ -806,7 +808,7 @@ HRESULT EVRCustomPresenter::GetCurrentMediaType(IMFVideoMediaType **mediaType) *mediaType = NULL; - QMutexLocker locker(&m_mutex); + const std::lock_guard<QRecursiveMutex> locker(m_mutex); hr = checkShutdown(); if (FAILED(hr)) @@ -820,7 +822,7 @@ HRESULT EVRCustomPresenter::GetCurrentMediaType(IMFVideoMediaType **mediaType) HRESULT EVRCustomPresenter::OnClockStart(MFTIME, LONGLONG clockStartOffset) { - QMutexLocker locker(&m_mutex); + const std::lock_guard<QRecursiveMutex> locker(m_mutex); // We cannot start after shutdown. HRESULT hr = checkShutdown(); @@ -855,7 +857,7 @@ HRESULT EVRCustomPresenter::OnClockStart(MFTIME, LONGLONG clockStartOffset) HRESULT EVRCustomPresenter::OnClockRestart(MFTIME) { - QMutexLocker locker(&m_mutex); + const std::lock_guard<QRecursiveMutex> locker(m_mutex); HRESULT hr = checkShutdown(); if (FAILED(hr)) @@ -879,7 +881,7 @@ HRESULT EVRCustomPresenter::OnClockRestart(MFTIME) HRESULT EVRCustomPresenter::OnClockStop(MFTIME) { - QMutexLocker locker(&m_mutex); + const std::lock_guard<QRecursiveMutex> locker(m_mutex); HRESULT hr = checkShutdown(); if (FAILED(hr)) @@ -899,7 +901,7 @@ HRESULT EVRCustomPresenter::OnClockStop(MFTIME) HRESULT EVRCustomPresenter::OnClockPause(MFTIME) { - QMutexLocker locker(&m_mutex); + const std::lock_guard<QRecursiveMutex> locker(m_mutex); // We cannot pause the clock after shutdown. HRESULT hr = checkShutdown(); @@ -916,7 +918,7 @@ HRESULT EVRCustomPresenter::OnClockSetRate(MFTIME, float rate) // The presenter reports its maximum rate through the IMFRateSupport interface. // Here, we assume that the EVR honors the maximum rate. - QMutexLocker locker(&m_mutex); + const std::lock_guard<QRecursiveMutex> locker(m_mutex); HRESULT hr = checkShutdown(); if (FAILED(hr)) @@ -944,7 +946,7 @@ HRESULT EVRCustomPresenter::GetSlowestRate(MFRATE_DIRECTION, BOOL, float *rate) if (!rate) return E_POINTER; - QMutexLocker locker(&m_mutex); + const std::lock_guard<QRecursiveMutex> locker(m_mutex); HRESULT hr = checkShutdown(); @@ -961,7 +963,7 @@ HRESULT EVRCustomPresenter::GetFastestRate(MFRATE_DIRECTION direction, BOOL thin if (!rate) return E_POINTER; - QMutexLocker locker(&m_mutex); + const std::lock_guard<QRecursiveMutex> locker(m_mutex); float maxRate = 0.0f; @@ -983,7 +985,7 @@ HRESULT EVRCustomPresenter::GetFastestRate(MFRATE_DIRECTION direction, BOOL thin HRESULT EVRCustomPresenter::IsRateSupported(BOOL thin, float rate, float *nearestSupportedRate) { - QMutexLocker locker(&m_mutex); + const std::lock_guard<QRecursiveMutex> locker(m_mutex); float maxRate = 0.0f; float nearestRate = rate; // If we support rate, that is the nearest. @@ -1017,7 +1019,7 @@ HRESULT EVRCustomPresenter::IsRateSupported(BOOL thin, float rate, float *neares void EVRCustomPresenter::supportedFormatsChanged() { - QMutexLocker locker(&m_mutex); + const std::lock_guard<QRecursiveMutex> locker(m_mutex); m_canRenderToSurface = false; m_presentEngine->setHint(D3DPresentEngine::RenderToTexture, false); @@ -1030,7 +1032,7 @@ void EVRCustomPresenter::supportedFormatsChanged() m_canRenderToSurface = true; } else { formats = m_surface->supportedPixelFormats(QAbstractVideoBuffer::NoHandle); - Q_FOREACH (QVideoFrame::PixelFormat format, formats) { + for (QVideoFrame::PixelFormat format : qAsConst(formats)) { if (SUCCEEDED(m_presentEngine->checkFormat(qt_evr_D3DFormatFromPixelFormat(format)))) { m_canRenderToSurface = true; break; diff --git a/src/plugins/common/evr/evrcustompresenter.h b/src/plugins/common/evr/evrcustompresenter.h index 9e1ee88d6..c1c21580e 100644 --- a/src/plugins/common/evr/evrcustompresenter.h +++ b/src/plugins/common/evr/evrcustompresenter.h @@ -342,7 +342,7 @@ private: RenderState m_renderState; FrameStep m_frameStep; - QMutex m_mutex; + QRecursiveMutex m_mutex; // Samples and scheduling Scheduler m_scheduler; // Manages scheduling of samples. |