summaryrefslogtreecommitdiff
path: root/src/plugins/directshow/player
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-09-06 16:18:05 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-09-06 16:18:05 +0200
commit858e9b66e53440317bb8d41d7c342f7d28f13788 (patch)
tree1e4d8c2835fcecb60540af96a9667aadce35c766 /src/plugins/directshow/player
parent72536fa39c71b32f963322a8aa0c1dee320102fc (diff)
parent871a097d0c6e8203f82b398e21dcfd8151bdae27 (diff)
downloadqtmultimedia-858e9b66e53440317bb8d41d7c342f7d28f13788.tar.gz
Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I87da2a6655784bcaf76dd73992c8b874853b1fc7
Diffstat (limited to 'src/plugins/directshow/player')
-rw-r--r--src/plugins/directshow/player/directshowaudioendpointcontrol.h12
-rw-r--r--src/plugins/directshow/player/directshowioreader.cpp218
-rw-r--r--src/plugins/directshow/player/directshowioreader.h27
-rw-r--r--src/plugins/directshow/player/directshowiosource.cpp218
-rw-r--r--src/plugins/directshow/player/directshowiosource.h64
-rw-r--r--src/plugins/directshow/player/directshowmetadatacontrol.cpp96
-rw-r--r--src/plugins/directshow/player/directshowmetadatacontrol.h10
-rw-r--r--src/plugins/directshow/player/directshowplayercontrol.h48
-rw-r--r--src/plugins/directshow/player/directshowplayerservice.cpp13
-rw-r--r--src/plugins/directshow/player/directshowplayerservice.h8
-rw-r--r--src/plugins/directshow/player/directshowvideorenderercontrol.h6
-rw-r--r--src/plugins/directshow/player/videosurfacefilter.cpp32
-rw-r--r--src/plugins/directshow/player/vmr9videowindowcontrol.h38
13 files changed, 362 insertions, 428 deletions
diff --git a/src/plugins/directshow/player/directshowaudioendpointcontrol.h b/src/plugins/directshow/player/directshowaudioendpointcontrol.h
index e0e6a1545..b6f8a6724 100644
--- a/src/plugins/directshow/player/directshowaudioendpointcontrol.h
+++ b/src/plugins/directshow/player/directshowaudioendpointcontrol.h
@@ -53,16 +53,16 @@ class DirectShowAudioEndpointControl : public QAudioOutputSelectorControl
Q_OBJECT
public:
DirectShowAudioEndpointControl(DirectShowPlayerService *service, QObject *parent = 0);
- ~DirectShowAudioEndpointControl();
+ ~DirectShowAudioEndpointControl() override;
- QList<QString> availableOutputs() const;
+ QList<QString> availableOutputs() const override;
- QString outputDescription(const QString &name) const;
+ QString outputDescription(const QString &name) const override;
- QString defaultOutput() const;
- QString activeOutput() const;
+ QString defaultOutput() const override;
+ QString activeOutput() const override;
- void setActiveOutput(const QString& name);
+ void setActiveOutput(const QString& name) override;
private:
void updateEndpoints();
diff --git a/src/plugins/directshow/player/directshowioreader.cpp b/src/plugins/directshow/player/directshowioreader.cpp
index 7f3303633..3482cee02 100644
--- a/src/plugins/directshow/player/directshowioreader.cpp
+++ b/src/plugins/directshow/player/directshowioreader.cpp
@@ -123,76 +123,65 @@ ULONG DirectShowIOReader::Release()
HRESULT DirectShowIOReader::RequestAllocator(
IMemAllocator *pPreferred, ALLOCATOR_PROPERTIES *pProps, IMemAllocator **ppActual)
{
- if (!ppActual || !pProps) {
+ if (!ppActual || !pProps)
return E_POINTER;
- } else {
- ALLOCATOR_PROPERTIES actualProperties;
- if (pProps->cbAlign == 0)
- pProps->cbAlign = 1;
+ ALLOCATOR_PROPERTIES actualProperties;
- if (pPreferred && pPreferred->SetProperties(pProps, &actualProperties) == S_OK) {
- pPreferred->AddRef();
+ if (pProps->cbAlign == 0)
+ pProps->cbAlign = 1;
- *ppActual = pPreferred;
+ if (pPreferred && pPreferred->SetProperties(pProps, &actualProperties) == S_OK) {
+ pPreferred->AddRef();
- m_source->setAllocator(*ppActual);
+ *ppActual = pPreferred;
+ m_source->setAllocator(*ppActual);
+ return S_OK;
+ }
+ *ppActual = com_new<IMemAllocator>(CLSID_MemoryAllocator);
+ if (*ppActual) {
+ if ((*ppActual)->SetProperties(pProps, &actualProperties) == S_OK) {
+ m_source->setAllocator(*ppActual);
return S_OK;
- } else {
- *ppActual = com_new<IMemAllocator>(CLSID_MemoryAllocator);
-
- if (*ppActual) {
- if ((*ppActual)->SetProperties(pProps, &actualProperties) != S_OK) {
- (*ppActual)->Release();
- } else {
- m_source->setAllocator(*ppActual);
-
- return S_OK;
- }
- }
}
- ppActual = 0;
-
- return E_FAIL;
+ (*ppActual)->Release();
}
+ ppActual = nullptr;
+ return E_FAIL;
}
HRESULT DirectShowIOReader::Request(IMediaSample *pSample, DWORD_PTR dwUser)
{
QMutexLocker locker(&m_mutex);
- if (!pSample) {
+ if (!pSample)
return E_POINTER;
- } else if (m_flushing) {
+ if (m_flushing)
return VFW_E_WRONG_STATE;
- } else {
- REFERENCE_TIME startTime = 0;
- REFERENCE_TIME endTime = 0;
- BYTE *buffer;
- if (pSample->GetTime(&startTime, &endTime) != S_OK
- || pSample->GetPointer(&buffer) != S_OK) {
- return VFW_E_SAMPLE_TIME_NOT_SET;
- } else {
- LONGLONG position = startTime / 10000000;
- LONG length = (endTime - startTime) / 10000000;
-
- DirectShowSampleRequest *request = new DirectShowSampleRequest(
- pSample, dwUser, position, length, buffer);
+ REFERENCE_TIME startTime = 0;
+ REFERENCE_TIME endTime = 0;
+ BYTE *buffer;
- if (m_pendingTail) {
- m_pendingTail->next = request;
- } else {
- m_pendingHead = request;
+ if (pSample->GetTime(&startTime, &endTime) != S_OK
+ || pSample->GetPointer(&buffer) != S_OK) {
+ return VFW_E_SAMPLE_TIME_NOT_SET;
+ }
+ LONGLONG position = startTime / 10000000;
+ LONG length = (endTime - startTime) / 10000000;
- m_loop->postEvent(this, new QEvent(QEvent::User));
- }
- m_pendingTail = request;
+ auto request = new DirectShowSampleRequest(pSample, dwUser, position, length, buffer);
- return S_OK;
- }
+ if (m_pendingTail) {
+ m_pendingTail->next = request;
+ } else {
+ m_pendingHead = request;
+ m_loop->postEvent(this, new QEvent(QEvent::User));
}
+ m_pendingTail = request;
+
+ return S_OK;
}
HRESULT DirectShowIOReader::WaitForNext(
@@ -220,7 +209,8 @@ HRESULT DirectShowIOReader::WaitForNext(
delete request;
return hr;
- } else if (m_flushing) {
+ }
+ if (m_flushing) {
*ppSample = 0;
*pdwUser = 0;
@@ -236,90 +226,80 @@ HRESULT DirectShowIOReader::WaitForNext(
HRESULT DirectShowIOReader::SyncReadAligned(IMediaSample *pSample)
{
- if (!pSample) {
+ if (!pSample)
return E_POINTER;
- } else {
- REFERENCE_TIME startTime = 0;
- REFERENCE_TIME endTime = 0;
- BYTE *buffer;
- if (pSample->GetTime(&startTime, &endTime) != S_OK
- || pSample->GetPointer(&buffer) != S_OK) {
- return VFW_E_SAMPLE_TIME_NOT_SET;
- } else {
- LONGLONG position = startTime / 10000000;
- LONG length = (endTime - startTime) / 10000000;
+ REFERENCE_TIME startTime = 0;
+ REFERENCE_TIME endTime = 0;
+ BYTE *buffer;
- QMutexLocker locker(&m_mutex);
+ if (pSample->GetTime(&startTime, &endTime) != S_OK
+ || pSample->GetPointer(&buffer) != S_OK) {
+ return VFW_E_SAMPLE_TIME_NOT_SET;
+ }
+ LONGLONG position = startTime / 10000000;
+ LONG length = (endTime - startTime) / 10000000;
- if (thread() == QThread::currentThread()) {
- qint64 bytesRead = 0;
+ QMutexLocker locker(&m_mutex);
- HRESULT hr = blockingRead(position, length, buffer, &bytesRead);
+ if (thread() == QThread::currentThread()) {
+ qint64 bytesRead = 0;
- if (SUCCEEDED(hr))
- pSample->SetActualDataLength(bytesRead);
+ HRESULT hr = blockingRead(position, length, buffer, &bytesRead);
+ if (SUCCEEDED(hr))
+ pSample->SetActualDataLength(bytesRead);
- return hr;
- } else {
- m_synchronousPosition = position;
- m_synchronousLength = length;
- m_synchronousBuffer = buffer;
+ return hr;
+ }
+ m_synchronousPosition = position;
+ m_synchronousLength = length;
+ m_synchronousBuffer = buffer;
- m_loop->postEvent(this, new QEvent(QEvent::User));
+ m_loop->postEvent(this, new QEvent(QEvent::User));
- m_wait.wait(&m_mutex);
+ m_wait.wait(&m_mutex);
- m_synchronousBuffer = 0;
+ m_synchronousBuffer = nullptr;
- if (SUCCEEDED(m_synchronousResult))
- pSample->SetActualDataLength(m_synchronousBytesRead);
+ if (SUCCEEDED(m_synchronousResult))
+ pSample->SetActualDataLength(m_synchronousBytesRead);
- return m_synchronousResult;
- }
- }
- }
+ return m_synchronousResult;
}
HRESULT DirectShowIOReader::SyncRead(LONGLONG llPosition, LONG lLength, BYTE *pBuffer)
{
- if (!pBuffer) {
+ if (!pBuffer)
return E_POINTER;
- } else {
- if (thread() == QThread::currentThread()) {
- qint64 bytesRead;
- return blockingRead(llPosition, lLength, pBuffer, &bytesRead);
- } else {
- QMutexLocker locker(&m_mutex);
+ if (thread() == QThread::currentThread()) {
+ qint64 bytesRead;
+ return blockingRead(llPosition, lLength, pBuffer, &bytesRead);
+ }
+ QMutexLocker locker(&m_mutex);
- m_synchronousPosition = llPosition;
- m_synchronousLength = lLength;
- m_synchronousBuffer = pBuffer;
+ m_synchronousPosition = llPosition;
+ m_synchronousLength = lLength;
+ m_synchronousBuffer = pBuffer;
- m_loop->postEvent(this, new QEvent(QEvent::User));
+ m_loop->postEvent(this, new QEvent(QEvent::User));
- m_wait.wait(&m_mutex);
+ m_wait.wait(&m_mutex);
- m_synchronousBuffer = 0;
+ m_synchronousBuffer = nullptr;
- return m_synchronousResult;
- }
- }
+ return m_synchronousResult;
}
HRESULT DirectShowIOReader::Length(LONGLONG *pTotal, LONGLONG *pAvailable)
{
- if (!pTotal || !pAvailable) {
+ if (!pTotal || !pAvailable)
return E_POINTER;
- } else {
- QMutexLocker locker(&m_mutex);
- *pTotal = m_totalLength;
- *pAvailable = m_availableLength;
-
- return S_OK;
- }
+ QMutexLocker locker(&m_mutex);
+ *pTotal = m_totalLength;
+ *pAvailable = m_availableLength;
+ return S_OK;
}
@@ -432,9 +412,8 @@ HRESULT DirectShowIOReader::blockingRead(
::memset(buffer + *bytesRead, 0, length - *bytesRead);
return S_FALSE;
- } else {
- return S_OK;
}
+ return S_OK;
}
bool DirectShowIOReader::nonBlockingRead(
@@ -447,30 +426,29 @@ bool DirectShowIOReader::nonBlockingRead(
*result = S_FALSE;
return true;
- } else if (m_device->bytesAvailable() + m_device->pos() >= maxSize) {
+ }
+ if (m_device->bytesAvailable() + m_device->pos() >= maxSize) {
if (m_device->pos() != position && !m_device->seek(position)) {
*bytesRead = 0;
*result = S_FALSE;
return true;
- } else {
- const qint64 maxBytes = qMin<qint64>(length, m_device->bytesAvailable());
-
- *bytesRead = m_device->read(reinterpret_cast<char *>(buffer), maxBytes);
+ }
+ const qint64 maxBytes = qMin<qint64>(length, m_device->bytesAvailable());
- if (*bytesRead != length) {
- ::memset(buffer + *bytesRead, 0, length - *bytesRead);
+ *bytesRead = m_device->read(reinterpret_cast<char *>(buffer), maxBytes);
- *result = S_FALSE;
- } else {
- *result = S_OK;
- }
+ if (*bytesRead != length) {
+ ::memset(buffer + *bytesRead, 0, length - *bytesRead);
- return true;
+ *result = S_FALSE;
+ } else {
+ *result = S_OK;
}
- } else {
- return false;
+
+ return true;
}
+ return false;
}
void DirectShowIOReader::flushRequests()
diff --git a/src/plugins/directshow/player/directshowioreader.h b/src/plugins/directshow/player/directshowioreader.h
index 2d62c0b95..550990648 100644
--- a/src/plugins/directshow/player/directshowioreader.h
+++ b/src/plugins/directshow/player/directshowioreader.h
@@ -58,33 +58,34 @@ class DirectShowIOReader : public QObject, public IAsyncReader
Q_OBJECT
public:
DirectShowIOReader(QIODevice *device, DirectShowIOSource *source, DirectShowEventLoop *loop);
- ~DirectShowIOReader();
+ ~DirectShowIOReader() override;
// IUnknown
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject);
- ULONG STDMETHODCALLTYPE AddRef();
- ULONG STDMETHODCALLTYPE Release();
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject) override;
+ ULONG STDMETHODCALLTYPE AddRef() override;
+ ULONG STDMETHODCALLTYPE Release() override;
// IAsyncReader
HRESULT STDMETHODCALLTYPE RequestAllocator(
- IMemAllocator *pPreferred, ALLOCATOR_PROPERTIES *pProps, IMemAllocator **ppActual);
+ IMemAllocator *pPreferred, ALLOCATOR_PROPERTIES *pProps,
+ IMemAllocator **ppActual) override;
- HRESULT STDMETHODCALLTYPE Request(IMediaSample *pSample, DWORD_PTR dwUser);
+ HRESULT STDMETHODCALLTYPE Request(IMediaSample *pSample, DWORD_PTR dwUser) override;
HRESULT STDMETHODCALLTYPE WaitForNext(
- DWORD dwTimeout, IMediaSample **ppSample, DWORD_PTR *pdwUser);
+ DWORD dwTimeout, IMediaSample **ppSample, DWORD_PTR *pdwUser) override;
- HRESULT STDMETHODCALLTYPE SyncReadAligned(IMediaSample *pSample);
+ HRESULT STDMETHODCALLTYPE SyncReadAligned(IMediaSample *pSample) override;
- HRESULT STDMETHODCALLTYPE SyncRead(LONGLONG llPosition, LONG lLength, BYTE *pBuffer);
+ HRESULT STDMETHODCALLTYPE SyncRead(LONGLONG llPosition, LONG lLength, BYTE *pBuffer) override;
- HRESULT STDMETHODCALLTYPE Length(LONGLONG *pTotal, LONGLONG *pAvailable);
+ HRESULT STDMETHODCALLTYPE Length(LONGLONG *pTotal, LONGLONG *pAvailable) override;
- HRESULT STDMETHODCALLTYPE BeginFlush();
- HRESULT STDMETHODCALLTYPE EndFlush();
+ HRESULT STDMETHODCALLTYPE BeginFlush() override;
+ HRESULT STDMETHODCALLTYPE EndFlush() override;
protected:
- void customEvent(QEvent *event);
+ void customEvent(QEvent *event) override;
private Q_SLOTS:
void readyRead();
diff --git a/src/plugins/directshow/player/directshowiosource.cpp b/src/plugins/directshow/player/directshowiosource.cpp
index b3aa3fab9..31e9a1300 100644
--- a/src/plugins/directshow/player/directshowiosource.cpp
+++ b/src/plugins/directshow/player/directshowiosource.cpp
@@ -99,8 +99,8 @@ DirectShowIOSource::DirectShowIOSource(DirectShowEventLoop *loop)
static const int count = sizeof(directshow_subtypes) / sizeof(GUID);
- for (int i = 0; i < count; ++i) {
- type.subtype = directshow_subtypes[i];
+ for (const auto &directshowSubtype : directshow_subtypes) {
+ type.subtype = directshowSubtype;
m_supportedMediaTypes.append(DirectShowMediaType(type));
}
}
@@ -140,12 +140,11 @@ HRESULT DirectShowIOSource::QueryInterface(REFIID riid, void **ppvObject)
static const GUID iid_IAmFilterMiscFlags = {
0x2dd74950, 0xa890, 0x11d1, {0xab, 0xe8, 0x00, 0xa0, 0xc9, 0x05, 0xf3, 0x75}};
- if (!ppvObject) {
+ if (!ppvObject)
return E_POINTER;
- } else if (riid == IID_IUnknown
- || riid == IID_IPersist
- || riid == IID_IMediaFilter
- || riid == IID_IBaseFilter) {
+
+ if (riid == IID_IUnknown || riid == IID_IPersist || riid == IID_IMediaFilter
+ || riid == IID_IBaseFilter) {
*ppvObject = static_cast<IBaseFilter *>(this);
} else if (riid == iid_IAmFilterMiscFlags) {
*ppvObject = static_cast<IAMFilterMiscFlags *>(this);
@@ -222,15 +221,12 @@ HRESULT DirectShowIOSource::GetState(DWORD dwMilliSecsTimeout, FILTER_STATE *pSt
{
Q_UNUSED(dwMilliSecsTimeout);
- if (!pState) {
+ if (!pState)
return E_POINTER;
- } else {
- QMutexLocker locker(&m_mutex);
-
- *pState = m_state;
- return S_OK;
- }
+ QMutexLocker locker(&m_mutex);
+ *pState = m_state;
+ return S_OK;
}
HRESULT DirectShowIOSource::SetSyncSource(IReferenceClock *pClock)
@@ -250,53 +246,41 @@ HRESULT DirectShowIOSource::SetSyncSource(IReferenceClock *pClock)
HRESULT DirectShowIOSource::GetSyncSource(IReferenceClock **ppClock)
{
- if (!ppClock) {
+ if (!ppClock)
return E_POINTER;
- } else {
- if (!m_clock) {
- *ppClock = 0;
-
- return S_FALSE;
- } else {
- m_clock->AddRef();
- *ppClock = m_clock;
-
- return S_OK;
- }
+ if (!m_clock) {
+ *ppClock = nullptr;
+ return S_FALSE;
}
+ m_clock->AddRef();
+ *ppClock = m_clock;
+ return S_OK;
}
// IBaseFilter
HRESULT DirectShowIOSource::EnumPins(IEnumPins **ppEnum)
{
- if (!ppEnum) {
+ if (!ppEnum)
return E_POINTER;
- } else {
- *ppEnum = new DirectShowPinEnum(QList<IPin *>() << this);
- return S_OK;
- }
+ *ppEnum = new DirectShowPinEnum(QList<IPin *>() << this);
+ return S_OK;
}
HRESULT DirectShowIOSource::FindPin(LPCWSTR Id, IPin **ppPin)
{
- if (!ppPin || !Id) {
+ if (!ppPin || !Id)
return E_POINTER;
- } else {
- QMutexLocker locker(&m_mutex);
- if (QString::fromWCharArray(Id) == m_pinId) {
- AddRef();
-
- *ppPin = this;
- return S_OK;
- } else {
- *ppPin = 0;
-
- return VFW_E_NOT_FOUND;
- }
+ QMutexLocker locker(&m_mutex);
+ if (m_pinId == QStringView(Id)) {
+ AddRef();
+ *ppPin = this;
+ return S_OK;
}
+ *ppPin = nullptr;
+ return VFW_E_NOT_FOUND;
}
HRESULT DirectShowIOSource::JoinFilterGraph(IFilterGraph *pGraph, LPCWSTR pName)
@@ -311,24 +295,22 @@ HRESULT DirectShowIOSource::JoinFilterGraph(IFilterGraph *pGraph, LPCWSTR pName)
HRESULT DirectShowIOSource::QueryFilterInfo(FILTER_INFO *pInfo)
{
- if (!pInfo) {
+ if (!pInfo)
return E_POINTER;
- } else {
- QString name = m_filterName;
- if (name.length() >= MAX_FILTER_NAME)
- name.truncate(MAX_FILTER_NAME - 1);
+ QString name = m_filterName;
+ if (name.length() >= MAX_FILTER_NAME)
+ name.truncate(MAX_FILTER_NAME - 1);
- int length = name.toWCharArray(pInfo->achName);
- pInfo->achName[length] = '\0';
+ int length = name.toWCharArray(pInfo->achName);
+ pInfo->achName[length] = '\0';
- if (m_graph)
- m_graph->AddRef();
+ if (m_graph)
+ m_graph->AddRef();
- pInfo->pGraph = m_graph;
+ pInfo->pGraph = m_graph;
- return S_OK;
- }
+ return S_OK;
}
HRESULT DirectShowIOSource::QueryVendorInfo(LPWSTR *pVendorInfo)
@@ -424,121 +406,96 @@ HRESULT DirectShowIOSource::Disconnect()
{
QMutexLocker locker(&m_mutex);
- if (!m_peerPin) {
+ if (!m_peerPin)
return S_FALSE;
- } else if (m_state != State_Stopped) {
+ if (m_state != State_Stopped)
return VFW_E_NOT_STOPPED;
- } else {
- HRESULT hr = m_peerPin->Disconnect();
- if (!SUCCEEDED(hr))
- return hr;
+ HRESULT hr = m_peerPin->Disconnect();
+ if (!SUCCEEDED(hr))
+ return hr;
- if (m_allocator) {
- m_allocator->Release();
- m_allocator = 0;
- }
+ if (m_allocator) {
+ m_allocator->Release();
+ m_allocator = nullptr;
+ }
- m_peerPin->Release();
- m_peerPin = 0;
+ m_peerPin->Release();
+ m_peerPin = nullptr;
- return S_OK;
- }
+ return S_OK;
}
HRESULT DirectShowIOSource::ConnectedTo(IPin **ppPin)
{
- if (!ppPin) {
+ if (!ppPin)
return E_POINTER;
- } else {
- QMutexLocker locker(&m_mutex);
- if (!m_peerPin) {
- *ppPin = 0;
-
- return VFW_E_NOT_CONNECTED;
- } else {
- m_peerPin->AddRef();
-
- *ppPin = m_peerPin;
-
- return S_OK;
- }
+ QMutexLocker locker(&m_mutex);
+ if (!m_peerPin) {
+ *ppPin = nullptr;
+ return VFW_E_NOT_CONNECTED;
}
+ m_peerPin->AddRef();
+ *ppPin = m_peerPin;
+ return S_OK;
}
HRESULT DirectShowIOSource::ConnectionMediaType(AM_MEDIA_TYPE *pmt)
{
- if (!pmt) {
+ if (!pmt)
return E_POINTER;
- } else {
- QMutexLocker locker(&m_mutex);
-
- if (!m_peerPin) {
- pmt = 0;
- return VFW_E_NOT_CONNECTED;
- } else {
- DirectShowMediaType::copy(pmt, &m_connectionMediaType);
-
- return S_OK;
- }
+ QMutexLocker locker(&m_mutex);
+ if (!m_peerPin) {
+ pmt = nullptr;
+ return VFW_E_NOT_CONNECTED;
}
+ DirectShowMediaType::copy(pmt, &m_connectionMediaType);
+ return S_OK;
}
HRESULT DirectShowIOSource::QueryPinInfo(PIN_INFO *pInfo)
{
- if (!pInfo) {
+ if (!pInfo)
return E_POINTER;
- } else {
- AddRef();
- pInfo->pFilter = this;
- pInfo->dir = PINDIR_OUTPUT;
+ AddRef();
- const int bytes = qMin(MAX_FILTER_NAME, (m_pinId.length() + 1) * 2);
+ pInfo->pFilter = this;
+ pInfo->dir = PINDIR_OUTPUT;
- ::memcpy(pInfo->achName, m_pinId.utf16(), bytes);
+ const int bytes = qMin(MAX_FILTER_NAME, (m_pinId.length() + 1) * 2);
- return S_OK;
- }
+ ::memcpy(pInfo->achName, m_pinId.utf16(), bytes);
+
+ return S_OK;
}
HRESULT DirectShowIOSource::QueryId(LPWSTR *Id)
{
- if (!Id) {
+ if (!Id)
return E_POINTER;
- } else {
- const int bytes = (m_pinId.length() + 1) * 2;
-
- *Id = static_cast<LPWSTR>(::CoTaskMemAlloc(bytes));
-
- ::memcpy(*Id, m_pinId.utf16(), bytes);
- return S_OK;
- }
+ const int bytes = (m_pinId.length() + 1) * 2;
+ *Id = static_cast<LPWSTR>(::CoTaskMemAlloc(bytes));
+ ::memcpy(*Id, m_pinId.utf16(), bytes);
+ return S_OK;
}
HRESULT DirectShowIOSource::QueryAccept(const AM_MEDIA_TYPE *pmt)
{
- if (!pmt) {
+ if (!pmt)
return E_POINTER;
- } else if (pmt->majortype == MEDIATYPE_Stream) {
- return S_OK;
- } else {
- return S_FALSE;
- }
+ return pmt->majortype == MEDIATYPE_Stream ? S_OK : S_FALSE;
}
HRESULT DirectShowIOSource::EnumMediaTypes(IEnumMediaTypes **ppEnum)
{
- if (!ppEnum) {
+ if (!ppEnum)
return E_POINTER;
- } else {
- *ppEnum = new DirectShowMediaTypeEnum(m_supportedMediaTypes);
-
- return S_OK;
- }
+ *ppEnum = new DirectShowMediaTypeEnum(m_supportedMediaTypes);
+ return S_OK;
}
HRESULT DirectShowIOSource::QueryInternalConnections(IPin **apPin, ULONG *nPin)
@@ -575,13 +532,10 @@ HRESULT DirectShowIOSource::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tSt
HRESULT DirectShowIOSource::QueryDirection(PIN_DIRECTION *pPinDir)
{
- if (!pPinDir) {
+ if (!pPinDir)
return E_POINTER;
- } else {
- *pPinDir = PINDIR_OUTPUT;
-
- return S_OK;
- }
+ *pPinDir = PINDIR_OUTPUT;
+ return S_OK;
}
QT_END_NAMESPACE
diff --git a/src/plugins/directshow/player/directshowiosource.h b/src/plugins/directshow/player/directshowiosource.h
index 43df6c34f..02639de7c 100644
--- a/src/plugins/directshow/player/directshowiosource.h
+++ b/src/plugins/directshow/player/directshowiosource.h
@@ -53,6 +53,7 @@ class DirectShowIOSource
, public IAMFilterMiscFlags
, public IPin
{
+ Q_DISABLE_COPY(DirectShowIOSource)
public:
DirectShowIOSource(DirectShowEventLoop *loop);
virtual ~DirectShowIOSource();
@@ -61,60 +62,61 @@ public:
void setAllocator(IMemAllocator *allocator);
// IUnknown
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject);
- ULONG STDMETHODCALLTYPE AddRef();
- ULONG STDMETHODCALLTYPE Release();
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject) override;
+ ULONG STDMETHODCALLTYPE AddRef() override;
+ ULONG STDMETHODCALLTYPE Release() override;
// IPersist
- HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
+ HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID) override;
// IMediaFilter
- HRESULT STDMETHODCALLTYPE Run(REFERENCE_TIME tStart);
- HRESULT STDMETHODCALLTYPE Pause();
- HRESULT STDMETHODCALLTYPE Stop();
+ HRESULT STDMETHODCALLTYPE Run(REFERENCE_TIME tStart) override;
+ HRESULT STDMETHODCALLTYPE Pause() override;
+ HRESULT STDMETHODCALLTYPE Stop() override;
- HRESULT STDMETHODCALLTYPE GetState(DWORD dwMilliSecsTimeout, FILTER_STATE *pState);
+ HRESULT STDMETHODCALLTYPE GetState(DWORD dwMilliSecsTimeout, FILTER_STATE *pState) override;
- HRESULT STDMETHODCALLTYPE SetSyncSource(IReferenceClock *pClock);
- HRESULT STDMETHODCALLTYPE GetSyncSource(IReferenceClock **ppClock);
+ HRESULT STDMETHODCALLTYPE SetSyncSource(IReferenceClock *pClock) override;
+ HRESULT STDMETHODCALLTYPE GetSyncSource(IReferenceClock **ppClock) override;
// IBaseFilter
- HRESULT STDMETHODCALLTYPE EnumPins(IEnumPins **ppEnum);
- HRESULT STDMETHODCALLTYPE FindPin(LPCWSTR Id, IPin **ppPin);
+ HRESULT STDMETHODCALLTYPE EnumPins(IEnumPins **ppEnum) override;
+ HRESULT STDMETHODCALLTYPE FindPin(LPCWSTR Id, IPin **ppPin) override;
- HRESULT STDMETHODCALLTYPE JoinFilterGraph(IFilterGraph *pGraph, LPCWSTR pName);
+ HRESULT STDMETHODCALLTYPE JoinFilterGraph(IFilterGraph *pGraph, LPCWSTR pName) override;
- HRESULT STDMETHODCALLTYPE QueryFilterInfo(FILTER_INFO *pInfo);
- HRESULT STDMETHODCALLTYPE QueryVendorInfo(LPWSTR *pVendorInfo);
+ HRESULT STDMETHODCALLTYPE QueryFilterInfo(FILTER_INFO *pInfo) override;
+ HRESULT STDMETHODCALLTYPE QueryVendorInfo(LPWSTR *pVendorInfo) override;
// IAMFilterMiscFlags
- ULONG STDMETHODCALLTYPE GetMiscFlags();
+ ULONG STDMETHODCALLTYPE GetMiscFlags() override;
// IPin
- HRESULT STDMETHODCALLTYPE Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt);
- HRESULT STDMETHODCALLTYPE ReceiveConnection(IPin *pConnector, const AM_MEDIA_TYPE *pmt);
- HRESULT STDMETHODCALLTYPE Disconnect();
- HRESULT STDMETHODCALLTYPE ConnectedTo(IPin **ppPin);
+ HRESULT STDMETHODCALLTYPE Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt) override;
+ HRESULT STDMETHODCALLTYPE ReceiveConnection(IPin *pConnector, const AM_MEDIA_TYPE *pmt) override;
+ HRESULT STDMETHODCALLTYPE Disconnect() override;
+ HRESULT STDMETHODCALLTYPE ConnectedTo(IPin **ppPin) override;
- HRESULT STDMETHODCALLTYPE ConnectionMediaType(AM_MEDIA_TYPE *pmt);
+ HRESULT STDMETHODCALLTYPE ConnectionMediaType(AM_MEDIA_TYPE *pmt) override;
- HRESULT STDMETHODCALLTYPE QueryPinInfo(PIN_INFO *pInfo);
- HRESULT STDMETHODCALLTYPE QueryId(LPWSTR *Id);
+ HRESULT STDMETHODCALLTYPE QueryPinInfo(PIN_INFO *pInfo) override;
+ HRESULT STDMETHODCALLTYPE QueryId(LPWSTR *Id) override;
- HRESULT STDMETHODCALLTYPE QueryAccept(const AM_MEDIA_TYPE *pmt);
+ HRESULT STDMETHODCALLTYPE QueryAccept(const AM_MEDIA_TYPE *pmt) override;
- HRESULT STDMETHODCALLTYPE EnumMediaTypes(IEnumMediaTypes **ppEnum);
+ HRESULT STDMETHODCALLTYPE EnumMediaTypes(IEnumMediaTypes **ppEnum) override;
- HRESULT STDMETHODCALLTYPE QueryInternalConnections(IPin **apPin, ULONG *nPin);
+ HRESULT STDMETHODCALLTYPE QueryInternalConnections(IPin **apPin, ULONG *nPin) override;
- HRESULT STDMETHODCALLTYPE EndOfStream();
+ HRESULT STDMETHODCALLTYPE EndOfStream() override;
- HRESULT STDMETHODCALLTYPE BeginFlush();
- HRESULT STDMETHODCALLTYPE EndFlush();
+ HRESULT STDMETHODCALLTYPE BeginFlush() override;
+ HRESULT STDMETHODCALLTYPE EndFlush() override;
- HRESULT STDMETHODCALLTYPE NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
+ HRESULT STDMETHODCALLTYPE NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop,
+ double dRate) override;
- HRESULT STDMETHODCALLTYPE QueryDirection(PIN_DIRECTION *pPinDir);
+ HRESULT STDMETHODCALLTYPE QueryDirection(PIN_DIRECTION *pPinDir) override;
private:
volatile LONG m_ref;
diff --git a/src/plugins/directshow/player/directshowmetadatacontrol.cpp b/src/plugins/directshow/player/directshowmetadatacontrol.cpp
index 84f990830..90d2b3e7d 100644
--- a/src/plugins/directshow/player/directshowmetadatacontrol.cpp
+++ b/src/plugins/directshow/player/directshowmetadatacontrol.cpp
@@ -113,101 +113,99 @@ static QString nameForGUIDString(const QString &guid)
// Audio formats
if (guid == "{00001610-0000-0010-8000-00AA00389B71}" || guid == "{000000FF-0000-0010-8000-00AA00389B71}")
return QStringLiteral("MPEG AAC Audio");
- else if (guid == "{00001600-0000-0010-8000-00AA00389B71}")
+ if (guid == "{00001600-0000-0010-8000-00AA00389B71}")
return QStringLiteral("MPEG ADTS AAC Audio");
- else if (guid == "{00000092-0000-0010-8000-00AA00389B71}")
+ if (guid == "{00000092-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Dolby AC-3 SPDIF");
- else if (guid == "{E06D802C-DB46-11CF-B4D1-00805F6CBBEA}" || guid == "{00002000-0000-0010-8000-00AA00389B71}")
+ if (guid == "{E06D802C-DB46-11CF-B4D1-00805F6CBBEA}" || guid == "{00002000-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Dolby AC-3");
- else if (guid == "{A7FB87AF-2D02-42FB-A4D4-05CD93843BDD}")
+ if (guid == "{A7FB87AF-2D02-42FB-A4D4-05CD93843BDD}")
return QStringLiteral("Dolby Digital Plus");
- else if (guid == "{00000009-0000-0010-8000-00AA00389B71}")
+ if (guid == "{00000009-0000-0010-8000-00AA00389B71}")
return QStringLiteral("DRM");
- else if (guid == "{00000008-0000-0010-8000-00AA00389B71}")
+ if (guid == "{00000008-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Digital Theater Systems Audio (DTS)");
- else if (guid == "{00000003-0000-0010-8000-00AA00389B71}")
+ if (guid == "{00000003-0000-0010-8000-00AA00389B71}")
return QStringLiteral("IEEE Float Audio");
- else if (guid == "{00000055-0000-0010-8000-00AA00389B71}")
+ if (guid == "{00000055-0000-0010-8000-00AA00389B71}")
return QStringLiteral("MPEG Audio Layer-3 (MP3)");
- else if (guid == "{00000050-0000-0010-8000-00AA00389B71}")
+ if (guid == "{00000050-0000-0010-8000-00AA00389B71}")
return QStringLiteral("MPEG-1 Audio");
- else if (guid == "{2E6D7033-767A-494D-B478-F29D25DC9037}")
+ if (guid == "{2E6D7033-767A-494D-B478-F29D25DC9037}")
return QStringLiteral("MPEG Audio Layer 1/2");
- else if (guid == "{0000000A-0000-0010-8000-00AA00389B71}")
+ if (guid == "{0000000A-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Windows Media Audio Voice");
- else if (guid == "{00000001-0000-0010-8000-00AA00389B71}")
+ if (guid == "{00000001-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Uncompressed PCM Audio");
- else if (guid == "{00000164-0000-0010-8000-00AA00389B71}")
+ if (guid == "{00000164-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Windows Media Audio 9 SPDIF");
- else if (guid == "{00000161-0000-0010-8000-00AA00389B71}")
+ if (guid == "{00000161-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Windows Media Audio 8 (WMA2)");
- else if (guid == "{00000162-0000-0010-8000-00AA00389B71}")
+ if (guid == "{00000162-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Windows Media Audio 9 (WMA3");
- else if (guid == "{00000163-0000-0010-8000-00AA00389B71}")
+ if (guid == "{00000163-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Windows Media Audio 9 Lossless");
- else if (guid == "{8D2FD10B-5841-4a6b-8905-588FEC1ADED9}")
+ if (guid == "{8D2FD10B-5841-4a6b-8905-588FEC1ADED9}")
return QStringLiteral("Vorbis");
- else if (guid == "{0000F1AC-0000-0010-8000-00AA00389B71}")
+ if (guid == "{0000F1AC-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Free Lossless Audio Codec (FLAC)");
- else if (guid == "{00006C61-0000-0010-8000-00AA00389B71}")
+ if (guid == "{00006C61-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Apple Lossless Audio Codec (ALAC)");
// Video formats
if (guid == "{35327664-0000-0010-8000-00AA00389B71}")
return QStringLiteral("DVCPRO 25 (DV25)");
- else if (guid == "{30357664-0000-0010-8000-00AA00389B71}")
+ if (guid == "{30357664-0000-0010-8000-00AA00389B71}")
return QStringLiteral("DVCPRO 50 (DV50)");
- else if (guid == "{20637664-0000-0010-8000-00AA00389B71}")
+ if (guid == "{20637664-0000-0010-8000-00AA00389B71}")
return QStringLiteral("DVC/DV Video");
- else if (guid == "{31687664-0000-0010-8000-00AA00389B71}")
+ if (guid == "{31687664-0000-0010-8000-00AA00389B71}")
return QStringLiteral("DVCPRO 100 (DVH1)");
- else if (guid == "{64687664-0000-0010-8000-00AA00389B71}")
+ if (guid == "{64687664-0000-0010-8000-00AA00389B71}")
return QStringLiteral("HD-DVCR (DVHD)");
- else if (guid == "{64737664-0000-0010-8000-00AA00389B71}")
+ if (guid == "{64737664-0000-0010-8000-00AA00389B71}")
return QStringLiteral("SDL-DVCR (DVSD)");
- else if (guid == "{6C737664-0000-0010-8000-00AA00389B71}")
+ if (guid == "{6C737664-0000-0010-8000-00AA00389B71}")
return QStringLiteral("SD-DVCR (DVSL)");
- else if (guid == "{33363248-0000-0010-8000-00AA00389B71}")
+ if (guid == "{33363248-0000-0010-8000-00AA00389B71}")
return QStringLiteral("H.263 Video");
- else if (guid == "{34363248-0000-0010-8000-00AA00389B71}")
+ if (guid == "{34363248-0000-0010-8000-00AA00389B71}")
return QStringLiteral("H.264 Video");
- else if (guid == "{35363248-0000-0010-8000-00AA00389B71}")
+ if (guid == "{35363248-0000-0010-8000-00AA00389B71}")
return QStringLiteral("H.265 Video");
- else if (guid == "{43564548-0000-0010-8000-00AA00389B71}")
+ if (guid == "{43564548-0000-0010-8000-00AA00389B71}")
return QStringLiteral("High Efficiency Video Coding (HEVC)");
- else if (guid == "{3253344D-0000-0010-8000-00AA00389B71}")
+ if (guid == "{3253344D-0000-0010-8000-00AA00389B71}")
return QStringLiteral("MPEG-4 part 2 Video (M4S2)");
- else if (guid == "{47504A4D-0000-0010-8000-00AA00389B71}")
+ if (guid == "{47504A4D-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Motion JPEG (MJPG)");
- else if (guid == "{3334504D-0000-0010-8000-00AA00389B71}")
+ if (guid == "{3334504D-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Microsoft MPEG 4 version 3 (MP43)");
- else if (guid == "{5334504D-0000-0010-8000-00AA00389B71}")
+ if (guid == "{5334504D-0000-0010-8000-00AA00389B71}")
return QStringLiteral("ISO MPEG 4 version 1 (MP4S)");
- else if (guid == "{5634504D-0000-0010-8000-00AA00389B71}")
+ if (guid == "{5634504D-0000-0010-8000-00AA00389B71}")
return QStringLiteral("MPEG-4 part 2 Video (MP4V)");
- else if (guid == "{E06D8026-DB46-11CF-B4D1-00805F6CBBEA}")
+ if (guid == "{E06D8026-DB46-11CF-B4D1-00805F6CBBEA}")
return QStringLiteral("MPEG-2 Video");
- else if (guid == "{3147504D-0000-0010-8000-00AA00389B71}")
+ if (guid == "{3147504D-0000-0010-8000-00AA00389B71}")
return QStringLiteral("MPEG-1 Video");
- else if (guid == "{3153534D-0000-0010-8000-00AA00389B71}")
+ if (guid == "{3153534D-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Windows Media Screen 1 (MSS1)");
- else if (guid == "{3253534D-0000-0010-8000-00AA00389B71}")
+ if (guid == "{3253534D-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Windows Media Video 9 Screen (MSS2)");
- else if (guid == "{31564D57-0000-0010-8000-00AA00389B71}")
+ if (guid == "{31564D57-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Windows Media Video 7 (WMV1)");
- else if (guid == "{32564D57-0000-0010-8000-00AA00389B71}")
+ if (guid == "{32564D57-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Windows Media Video 8 (WMV2)");
- else if (guid == "{33564D57-0000-0010-8000-00AA00389B71}")
+ if (guid == "{33564D57-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Windows Media Video 9 (WMV3)");
- else if (guid == "{31435657-0000-0010-8000-00AA00389B71}")
+ if (guid == "{31435657-0000-0010-8000-00AA00389B71}")
return QStringLiteral("Windows Media Video VC1 (WVC1)");
- else if (guid == "{30385056-0000-0010-8000-00AA00389B71}")
+ if (guid == "{30385056-0000-0010-8000-00AA00389B71}")
return QStringLiteral("VP8 Video");
- else if (guid == "{30395056-0000-0010-8000-00AA00389B71}")
+ if (guid == "{30395056-0000-0010-8000-00AA00389B71}")
return QStringLiteral("VP9 Video");
-
- else
- return QStringLiteral("Unknown codec");
+ return QStringLiteral("Unknown codec");
}
typedef HRESULT (WINAPI *q_SHCreateItemFromParsingName)(PCWSTR, IBindCtx *, const GUID&, void **);
@@ -451,9 +449,7 @@ DirectShowMetaDataControl::DirectShowMetaDataControl(QObject *parent)
{
}
-DirectShowMetaDataControl::~DirectShowMetaDataControl()
-{
-}
+DirectShowMetaDataControl::~DirectShowMetaDataControl() = default;
bool DirectShowMetaDataControl::isMetaDataAvailable() const
{
diff --git a/src/plugins/directshow/player/directshowmetadatacontrol.h b/src/plugins/directshow/player/directshowmetadatacontrol.h
index 3d2fa5e8e..ea20bf0c5 100644
--- a/src/plugins/directshow/player/directshowmetadatacontrol.h
+++ b/src/plugins/directshow/player/directshowmetadatacontrol.h
@@ -55,19 +55,19 @@ class DirectShowMetaDataControl : public QMetaDataReaderControl
Q_OBJECT
public:
DirectShowMetaDataControl(QObject *parent = 0);
- ~DirectShowMetaDataControl();
+ ~DirectShowMetaDataControl() override;
- bool isMetaDataAvailable() const;
+ bool isMetaDataAvailable() const override;
- QVariant metaData(const QString &key) const;
- QStringList availableMetaData() const;
+ QVariant metaData(const QString &key) const override;
+ QStringList availableMetaData() const override;
void reset();
void updateMetadata(IFilterGraph2 *graph, IBaseFilter *source,
const QString &fileSrc = QString());
protected:
- void customEvent(QEvent *event);
+ void customEvent(QEvent *event) override;
private:
void setMetadataAvailable(bool available);
diff --git a/src/plugins/directshow/player/directshowplayercontrol.h b/src/plugins/directshow/player/directshowplayercontrol.h
index fd2c21c38..dba9ab9a0 100644
--- a/src/plugins/directshow/player/directshowplayercontrol.h
+++ b/src/plugins/directshow/player/directshowplayercontrol.h
@@ -56,42 +56,42 @@ class DirectShowPlayerControl : public QMediaPlayerControl
Q_OBJECT
public:
DirectShowPlayerControl(DirectShowPlayerService *service, QObject *parent = 0);
- ~DirectShowPlayerControl();
+ ~DirectShowPlayerControl() override;
- QMediaPlayer::State state() const;
+ QMediaPlayer::State state() const override;
- QMediaPlayer::MediaStatus mediaStatus() const;
+ QMediaPlayer::MediaStatus mediaStatus() const override;
- qint64 duration() const;
+ qint64 duration() const override;
- qint64 position() const;
- void setPosition(qint64 position);
+ qint64 position() const override;
+ void setPosition(qint64 position) override;
- int volume() const;
- void setVolume(int volume);
+ int volume() const override;
+ void setVolume(int volume) override;
- bool isMuted() const;
- void setMuted(bool muted);
+ bool isMuted() const override;
+ void setMuted(bool muted) override;
- int bufferStatus() const;
+ int bufferStatus() const override;
- bool isAudioAvailable() const;
- bool isVideoAvailable() const;
+ bool isAudioAvailable() const override;
+ bool isVideoAvailable() const override;
- bool isSeekable() const;
+ bool isSeekable() const override;
- QMediaTimeRange availablePlaybackRanges() const;
+ QMediaTimeRange availablePlaybackRanges() const override;
- qreal playbackRate() const;
- void setPlaybackRate(qreal rate);
+ qreal playbackRate() const override;
+ void setPlaybackRate(qreal rate) override;
- QMediaContent media() const;
- const QIODevice *mediaStream() const;
- void setMedia(const QMediaContent &media, QIODevice *stream);
+ QMediaContent media() const override;
+ const QIODevice *mediaStream() const override;
+ void setMedia(const QMediaContent &media, QIODevice *stream) override;
- void play();
- void pause();
- void stop();
+ void play() override;
+ void pause() override;
+ void stop() override;
void updateState(QMediaPlayer::State state);
void updateStatus(QMediaPlayer::MediaStatus status);
@@ -102,7 +102,7 @@ public:
void updatePosition(qint64 position);
protected:
- void customEvent(QEvent *event);
+ void customEvent(QEvent *event) override;
private:
enum Properties
diff --git a/src/plugins/directshow/player/directshowplayerservice.cpp b/src/plugins/directshow/player/directshowplayerservice.cpp
index abbbd4b49..8768bd3da 100644
--- a/src/plugins/directshow/player/directshowplayerservice.cpp
+++ b/src/plugins/directshow/player/directshowplayerservice.cpp
@@ -115,7 +115,7 @@ public:
}
protected:
- void run() { m_service->run(); }
+ void run() override { m_service->run(); }
private:
DirectShowPlayerService *m_service;
@@ -1091,9 +1091,9 @@ qint64 DirectShowPlayerService::position() const
QMutexLocker locker(const_cast<QMutex *>(&m_mutex));
if (m_graphStatus == Loaded) {
- if (m_executingTask == Seek || m_executingTask == SetRate || (m_pendingTasks & Seek)) {
+ if (m_executingTask == Seek || m_executingTask == SetRate || (m_pendingTasks & Seek))
return m_position;
- } else if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
+ if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG position = 0;
seeking->GetCurrentPosition(&position);
@@ -1112,9 +1112,9 @@ QMediaTimeRange DirectShowPlayerService::availablePlaybackRanges() const
QMutexLocker locker(const_cast<QMutex *>(&m_mutex));
if (m_graphStatus == Loaded) {
- if (m_executingTask == Seek || m_executingTask == SetRate || (m_pendingTasks & Seek)) {
+ if (m_executingTask == Seek || m_executingTask == SetRate || (m_pendingTasks & Seek))
return m_playbackRange;
- } else if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
+ if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
LONGLONG minimum = 0;
LONGLONG maximum = 0;
@@ -1195,9 +1195,8 @@ int DirectShowPlayerService::bufferStatus() const
reader->Release();
return percentage;
- } else {
- return 0;
}
+ return 0;
#else
return 0;
#endif
diff --git a/src/plugins/directshow/player/directshowplayerservice.h b/src/plugins/directshow/player/directshowplayerservice.h
index de71a6fdf..d48b0575a 100644
--- a/src/plugins/directshow/player/directshowplayerservice.h
+++ b/src/plugins/directshow/player/directshowplayerservice.h
@@ -79,10 +79,10 @@ public:
};
DirectShowPlayerService(QObject *parent = 0);
- ~DirectShowPlayerService();
+ ~DirectShowPlayerService() override;
- QMediaControl* requestControl(const char *name);
- void releaseControl(QMediaControl *control);
+ QMediaControl *requestControl(const char *name) override;
+ void releaseControl(QMediaControl *control) override;
void load(const QMediaContent &media, QIODevice *stream);
void play();
@@ -101,7 +101,7 @@ public:
void setVideoOutput(IBaseFilter *filter);
protected:
- void customEvent(QEvent *event);
+ void customEvent(QEvent *event) override;
private Q_SLOTS:
void videoOutputChanged();
diff --git a/src/plugins/directshow/player/directshowvideorenderercontrol.h b/src/plugins/directshow/player/directshowvideorenderercontrol.h
index ce515a329..b2abeeaed 100644
--- a/src/plugins/directshow/player/directshowvideorenderercontrol.h
+++ b/src/plugins/directshow/player/directshowvideorenderercontrol.h
@@ -59,10 +59,10 @@ class DirectShowVideoRendererControl : public QVideoRendererControl
Q_OBJECT
public:
DirectShowVideoRendererControl(DirectShowEventLoop *loop, QObject *parent = 0);
- ~DirectShowVideoRendererControl();
+ ~DirectShowVideoRendererControl() override;
- QAbstractVideoSurface *surface() const;
- void setSurface(QAbstractVideoSurface *surface);
+ QAbstractVideoSurface *surface() const override;
+ void setSurface(QAbstractVideoSurface *surface) override;
IBaseFilter *filter();
diff --git a/src/plugins/directshow/player/videosurfacefilter.cpp b/src/plugins/directshow/player/videosurfacefilter.cpp
index c521a251b..826d26bdb 100644
--- a/src/plugins/directshow/player/videosurfacefilter.cpp
+++ b/src/plugins/directshow/player/videosurfacefilter.cpp
@@ -330,12 +330,11 @@ bool VideoSurfaceFilter::setMediaType(const AM_MEDIA_TYPE *type)
m_surfaceFormat = QVideoSurfaceFormat();
m_bytesPerLine = 0;
return true;
- } else {
- m_surfaceFormat = DirectShowMediaType::videoFormatFromType(type);
- m_bytesPerLine = DirectShowMediaType::bytesPerLine(m_surfaceFormat);
- qCDebug(qLcRenderFilter) << "setMediaType -->" << m_surfaceFormat;
- return m_surfaceFormat.isValid();
}
+ m_surfaceFormat = DirectShowMediaType::videoFormatFromType(type);
+ m_bytesPerLine = DirectShowMediaType::bytesPerLine(m_surfaceFormat);
+ qCDebug(qLcRenderFilter) << "setMediaType -->" << m_surfaceFormat;
+ return m_surfaceFormat.isValid();
}
HRESULT VideoSurfaceFilter::completeConnection(IPin *pin)
@@ -344,10 +343,7 @@ HRESULT VideoSurfaceFilter::completeConnection(IPin *pin)
qCDebug(qLcRenderFilter, "completeConnection");
- if (!startSurface())
- return VFW_E_TYPE_NOT_ACCEPTED;
- else
- return S_OK;
+ return startSurface() ? S_OK : VFW_E_TYPE_NOT_ACCEPTED;
}
HRESULT VideoSurfaceFilter::connectionEnded()
@@ -783,32 +779,40 @@ void VideoSurfaceFilter::renderPendingSample()
bool VideoSurfaceFilter::event(QEvent *e)
{
- if (e->type() == QEvent::Type(StartSurface)) {
+ switch (e->type()) {
+ case StartSurface: {
QMutexLocker locker(&m_mutex);
startSurface();
m_waitSurface.wakeAll();
return true;
- } else if (e->type() == QEvent::Type(StopSurface)) {
+ }
+ case StopSurface: {
QMutexLocker locker(&m_mutex);
stopSurface();
m_waitSurface.wakeAll();
return true;
- } else if (e->type() == QEvent::Type(RestartSurface)) {
+ }
+ case RestartSurface: {
QMutexLocker locker(&m_mutex);
restartSurface();
m_waitSurface.wakeAll();
return true;
- } else if (e->type() == QEvent::Type(FlushSurface)) {
+ }
+ case FlushSurface: {
QMutexLocker locker(&m_mutex);
flushSurface();
m_waitSurface.wakeAll();
return true;
- } else if (e->type() == QEvent::Type(RenderSample)) {
+ }
+ case RenderSample: {
QMutexLocker locker(&m_mutex);
renderPendingSample();
m_waitSurface.wakeAll();
return true;
}
+ default:
+ break;
+ }
return QObject::event(e);
}
diff --git a/src/plugins/directshow/player/vmr9videowindowcontrol.h b/src/plugins/directshow/player/vmr9videowindowcontrol.h
index ed3b53233..8ab9bd506 100644
--- a/src/plugins/directshow/player/vmr9videowindowcontrol.h
+++ b/src/plugins/directshow/player/vmr9videowindowcontrol.h
@@ -53,37 +53,37 @@ class Vmr9VideoWindowControl : public QVideoWindowControl
Q_OBJECT
public:
Vmr9VideoWindowControl(QObject *parent = 0);
- ~Vmr9VideoWindowControl();
+ ~Vmr9VideoWindowControl() override;
IBaseFilter *filter() const { return m_filter; }
- WId winId() const;
- void setWinId(WId id);
+ WId winId() const override;
+ void setWinId(WId id) override;
- QRect displayRect() const;
- void setDisplayRect(const QRect &rect);
+ QRect displayRect() const override;
+ void setDisplayRect(const QRect &rect) override;
- bool isFullScreen() const;
- void setFullScreen(bool fullScreen);
+ bool isFullScreen() const override;
+ void setFullScreen(bool fullScreen) override;
- void repaint();
+ void repaint() override;
- QSize nativeSize() const;
+ QSize nativeSize() const override;
- Qt::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(Qt::AspectRatioMode mode);
+ Qt::AspectRatioMode aspectRatioMode() const override;
+ void setAspectRatioMode(Qt::AspectRatioMode mode) override;
- int brightness() const;
- void setBrightness(int brightness);
+ int brightness() const override;
+ void setBrightness(int brightness) override;
- int contrast() const;
- void setContrast(int contrast);
+ int contrast() const override;
+ void setContrast(int contrast) override;
- int hue() const;
- void setHue(int hue);
+ int hue() const override;
+ void setHue(int hue) override;
- int saturation() const;
- void setSaturation(int saturation);
+ int saturation() const override;
+ void setSaturation(int saturation) override;
private:
void setProcAmpValues();