From a9789cf46b19726e201069e9d4dfee48f0570691 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 5 Sep 2018 09:12:49 +0200 Subject: DirectShow: Fix clang-tidy warnings about class definitions - Use ' = default' for trivial constructors/destructors - replace virtual by override or add override where applicable - Replace trivial constructors by member initialization for simple structs - Add Q_DISABLE_COPY where applicable - Mark move assignment/move constructors as noexcept - Remove unused member variables Change-Id: I579fb69ebcd945b94de32b827d93e5a4dab4df97 Reviewed-by: Oliver Wolff --- src/plugins/common/evr/evrcustompresenter.cpp | 2 +- src/plugins/common/evr/evrcustompresenter.h | 65 ++++++++++++-------------- src/plugins/common/evr/evrd3dpresentengine.cpp | 12 ++--- src/plugins/common/evr/evrd3dpresentengine.h | 2 + src/plugins/common/evr/evrvideowindowcontrol.h | 38 +++++++-------- 5 files changed, 59 insertions(+), 60 deletions(-) (limited to 'src/plugins/common') diff --git a/src/plugins/common/evr/evrcustompresenter.cpp b/src/plugins/common/evr/evrcustompresenter.cpp index b07dbe719..d5d9df14f 100644 --- a/src/plugins/common/evr/evrcustompresenter.cpp +++ b/src/plugins/common/evr/evrcustompresenter.cpp @@ -98,7 +98,7 @@ public: m_sample->AddRef(); } - ~PresentSampleEvent() + ~PresentSampleEvent() override { if (m_sample) m_sample->Release(); diff --git a/src/plugins/common/evr/evrcustompresenter.h b/src/plugins/common/evr/evrcustompresenter.h index 199dee774..bd04bd952 100644 --- a/src/plugins/common/evr/evrcustompresenter.h +++ b/src/plugins/common/evr/evrcustompresenter.h @@ -58,6 +58,7 @@ class QAbstractVideoSurface; template class AsyncCallback : public IMFAsyncCallback { + Q_DISABLE_COPY(AsyncCallback) public: typedef HRESULT (T::*InvokeFn)(IMFAsyncResult *asyncResult); @@ -66,7 +67,7 @@ public: } // IUnknown - STDMETHODIMP QueryInterface(REFIID iid, void** ppv) + STDMETHODIMP QueryInterface(REFIID iid, void** ppv) override { if (!ppv) return E_POINTER; @@ -83,23 +84,23 @@ public: return S_OK; } - STDMETHODIMP_(ULONG) AddRef() { + STDMETHODIMP_(ULONG) AddRef() override { // Delegate to parent class. return m_parent->AddRef(); } - STDMETHODIMP_(ULONG) Release() { + STDMETHODIMP_(ULONG) Release() override { // Delegate to parent class. return m_parent->Release(); } // IMFAsyncCallback methods - STDMETHODIMP GetParameters(DWORD*, DWORD*) + STDMETHODIMP GetParameters(DWORD*, DWORD*) override { // Implementation of this method is optional. return E_NOTIMPL; } - STDMETHODIMP Invoke(IMFAsyncResult* asyncResult) + STDMETHODIMP Invoke(IMFAsyncResult* asyncResult) override { return (m_parent->*m_invokeFn)(asyncResult); } @@ -110,6 +111,7 @@ public: class Scheduler { + Q_DISABLE_COPY(Scheduler) public: enum ScheduleEvent { @@ -164,6 +166,7 @@ private: class SamplePool { + Q_DISABLE_COPY(SamplePool) public: SamplePool(); ~SamplePool(); @@ -188,6 +191,7 @@ class EVRCustomPresenter , public IMFGetService , public IMFTopologyServiceLookupClient { + Q_DISABLE_COPY(EVRCustomPresenter) public: // Defines the state of the presenter. enum RenderState @@ -216,40 +220,40 @@ public: }; EVRCustomPresenter(QAbstractVideoSurface *surface = 0); - ~EVRCustomPresenter(); + ~EVRCustomPresenter() override; bool isValid() const; // IUnknown methods - STDMETHODIMP QueryInterface(REFIID riid, void ** ppv); - STDMETHODIMP_(ULONG) AddRef(); - STDMETHODIMP_(ULONG) Release(); + STDMETHODIMP QueryInterface(REFIID riid, void ** ppv) override; + STDMETHODIMP_(ULONG) AddRef() override; + STDMETHODIMP_(ULONG) Release() override; // IMFGetService methods - STDMETHODIMP GetService(REFGUID guidService, REFIID riid, LPVOID *ppvObject); + STDMETHODIMP GetService(REFGUID guidService, REFIID riid, LPVOID *ppvObject) override; // IMFVideoPresenter methods - STDMETHODIMP ProcessMessage(MFVP_MESSAGE_TYPE message, ULONG_PTR param); - STDMETHODIMP GetCurrentMediaType(IMFVideoMediaType** mediaType); + STDMETHODIMP ProcessMessage(MFVP_MESSAGE_TYPE message, ULONG_PTR param) override; + STDMETHODIMP GetCurrentMediaType(IMFVideoMediaType** mediaType) override; // IMFClockStateSink methods - STDMETHODIMP OnClockStart(MFTIME systemTime, LONGLONG clockStartOffset); - STDMETHODIMP OnClockStop(MFTIME systemTime); - STDMETHODIMP OnClockPause(MFTIME systemTime); - STDMETHODIMP OnClockRestart(MFTIME systemTime); - STDMETHODIMP OnClockSetRate(MFTIME systemTime, float rate); + STDMETHODIMP OnClockStart(MFTIME systemTime, LONGLONG clockStartOffset) override; + STDMETHODIMP OnClockStop(MFTIME systemTime) override; + STDMETHODIMP OnClockPause(MFTIME systemTime) override; + STDMETHODIMP OnClockRestart(MFTIME systemTime) override; + STDMETHODIMP OnClockSetRate(MFTIME systemTime, float rate) override; // IMFRateSupport methods - STDMETHODIMP GetSlowestRate(MFRATE_DIRECTION direction, BOOL thin, float *rate); - STDMETHODIMP GetFastestRate(MFRATE_DIRECTION direction, BOOL thin, float *rate); - STDMETHODIMP IsRateSupported(BOOL thin, float rate, float *nearestSupportedRate); + STDMETHODIMP GetSlowestRate(MFRATE_DIRECTION direction, BOOL thin, float *rate) override; + STDMETHODIMP GetFastestRate(MFRATE_DIRECTION direction, BOOL thin, float *rate) override; + STDMETHODIMP IsRateSupported(BOOL thin, float rate, float *nearestSupportedRate) override; // IMFVideoDeviceID methods - STDMETHODIMP GetDeviceID(IID* deviceID); + STDMETHODIMP GetDeviceID(IID* deviceID) override; // IMFTopologyServiceLookupClient methods - STDMETHODIMP InitServicePointers(IMFTopologyServiceLookup *lookup); - STDMETHODIMP ReleaseServicePointers(); + STDMETHODIMP InitServicePointers(IMFTopologyServiceLookup *lookup) override; + STDMETHODIMP ReleaseServicePointers() override; void supportedFormatsChanged(); void setSurface(QAbstractVideoSurface *surface); @@ -258,7 +262,7 @@ public: void stopSurface(); void presentSample(IMFSample *sample); - bool event(QEvent *); + bool event(QEvent *) override; private: HRESULT checkShutdown() const @@ -324,17 +328,10 @@ private: // Holds information related to frame-stepping. struct FrameStep { - FrameStep() - : state(FrameStepNone) - , steps(0) - , sampleNoRef(0) - { - } - - FrameStepState state; + FrameStepState state = FrameStepNone; QList samples; - DWORD steps; - DWORD_PTR sampleNoRef; + DWORD steps = 0; + DWORD_PTR sampleNoRef = 0; }; long m_refCount; diff --git a/src/plugins/common/evr/evrd3dpresentengine.cpp b/src/plugins/common/evr/evrd3dpresentengine.cpp index 54403faba..12b907336 100644 --- a/src/plugins/common/evr/evrd3dpresentengine.cpp +++ b/src/plugins/common/evr/evrd3dpresentengine.cpp @@ -204,7 +204,7 @@ private: unsigned int m_glTexture; QOpenGLContext *m_glContext; - ~OpenGLResources() + ~OpenGLResources() override { QScopedPointer surface; if (m_glContext != QOpenGLContext::currentContext()) { @@ -254,7 +254,7 @@ public: } } - ~IMFSampleVideoBuffer() + ~IMFSampleVideoBuffer() override { if (m_surface) { if (m_mapMode != NotMapped) @@ -265,11 +265,11 @@ public: m_sample->Release(); } - QVariant handle() const; + QVariant handle() const override; - MapMode mapMode() const { return m_mapMode; } - uchar *map(MapMode, int*, int*); - void unmap(); + MapMode mapMode() const override { return m_mapMode; } + uchar *map(MapMode, int*, int*) override; + void unmap() override; private: mutable D3DPresentEngine *m_engine; diff --git a/src/plugins/common/evr/evrd3dpresentengine.h b/src/plugins/common/evr/evrd3dpresentengine.h index 18a7409fa..df2c9b506 100644 --- a/src/plugins/common/evr/evrd3dpresentengine.h +++ b/src/plugins/common/evr/evrd3dpresentengine.h @@ -72,6 +72,7 @@ class OpenGLResources; class EGLWrapper { + Q_DISABLE_COPY(EGLWrapper) public: EGLWrapper(); @@ -99,6 +100,7 @@ private: class D3DPresentEngine { + Q_DISABLE_COPY(D3DPresentEngine) public: enum Hint { diff --git a/src/plugins/common/evr/evrvideowindowcontrol.h b/src/plugins/common/evr/evrvideowindowcontrol.h index fcfe20958..ce3b7746f 100644 --- a/src/plugins/common/evr/evrvideowindowcontrol.h +++ b/src/plugins/common/evr/evrvideowindowcontrol.h @@ -51,37 +51,37 @@ class EvrVideoWindowControl : public QVideoWindowControl Q_OBJECT public: EvrVideoWindowControl(QObject *parent = 0); - ~EvrVideoWindowControl(); + ~EvrVideoWindowControl() override; bool setEvr(IUnknown *evr); - 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; void applyImageControls(); -- cgit v1.2.3