diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-12 11:43:51 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-12 15:19:04 +0200 |
commit | 0c9bc813c6dabbed8d57843ad1e7ea21fe1008f1 (patch) | |
tree | 452299ba747e2340d4956c09542e534d83d72bce /src/plugins/directshow/camera | |
parent | d25ed5222aec9e642ac534aea463a91c1952f229 (diff) |
DirectShow: Introduce nullptr
Apply Fixits by Qt Creator.
Change-Id: Idbd52ceaac6ee02f23d05f5a9b1ab6d58298b6a5
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Diffstat (limited to 'src/plugins/directshow/camera')
8 files changed, 50 insertions, 50 deletions
diff --git a/src/plugins/directshow/camera/dscameracontrol.h b/src/plugins/directshow/camera/dscameracontrol.h index 2ad737008..2087623d1 100644 --- a/src/plugins/directshow/camera/dscameracontrol.h +++ b/src/plugins/directshow/camera/dscameracontrol.h @@ -52,7 +52,7 @@ class DSCameraControl : public QCameraControl { Q_OBJECT public: - DSCameraControl(QObject *parent = 0); + DSCameraControl(QObject *parent = nullptr); ~DSCameraControl() override; QCamera::State state() const override { return m_state; } diff --git a/src/plugins/directshow/camera/dscameraservice.cpp b/src/plugins/directshow/camera/dscameraservice.cpp index bb1691c20..ff488cf09 100644 --- a/src/plugins/directshow/camera/dscameraservice.cpp +++ b/src/plugins/directshow/camera/dscameraservice.cpp @@ -138,14 +138,14 @@ QMediaControl* DSCameraService::requestControl(const char *name) if (qstrcmp(name, QImageEncoderControl_iid) == 0) return m_imageEncoderControl; - return 0; + return nullptr; } void DSCameraService::releaseControl(QMediaControl *control) { if (control == m_videoRenderer) { delete m_videoRenderer; - m_videoRenderer = 0; + m_videoRenderer = nullptr; return; } diff --git a/src/plugins/directshow/camera/dscameraservice.h b/src/plugins/directshow/camera/dscameraservice.h index 239a9b55e..6ea85b725 100644 --- a/src/plugins/directshow/camera/dscameraservice.h +++ b/src/plugins/directshow/camera/dscameraservice.h @@ -64,7 +64,7 @@ class DSCameraService : public QMediaService Q_OBJECT public: - DSCameraService(QObject *parent = 0); + DSCameraService(QObject *parent = nullptr); ~DSCameraService() override; QMediaControl* requestControl(const char *name) override; diff --git a/src/plugins/directshow/camera/dscamerasession.cpp b/src/plugins/directshow/camera/dscamerasession.cpp index c3fa8d226..4bf448c31 100644 --- a/src/plugins/directshow/camera/dscamerasession.cpp +++ b/src/plugins/directshow/camera/dscamerasession.cpp @@ -314,10 +314,10 @@ void DSCameraSession::setImageProcessingParameter( return; } - IAMVideoProcAmp *pVideoProcAmp = NULL; + IAMVideoProcAmp *pVideoProcAmp = nullptr; HRESULT hr = m_graphBuilder->FindInterface( - NULL, - NULL, + nullptr, + nullptr, m_sourceFilter, IID_IAMVideoProcAmp, reinterpret_cast<void**>(&pVideoProcAmp) @@ -447,7 +447,7 @@ bool DSCameraSession::startPreview() QString errorString; HRESULT hr = S_OK; - IMediaControl* pControl = 0; + IMediaControl* pControl = nullptr; if (!configurePreviewFormat()) { errorString = tr("Failed to configure preview format"); @@ -499,7 +499,7 @@ bool DSCameraSession::stopPreview() m_previewSampleGrabber->stop(); QString errorString; - IMediaControl* pControl = 0; + IMediaControl* pControl = nullptr; HRESULT hr = m_filterGraph->QueryInterface(IID_IMediaControl, reinterpret_cast<void**>(&pControl)); if (FAILED(hr)) { @@ -685,12 +685,12 @@ bool DSCameraSession::createFilterGraph() QString errorString; HRESULT hr; - IMoniker* pMoniker = NULL; - ICreateDevEnum* pDevEnum = NULL; - IEnumMoniker* pEnum = NULL; + IMoniker* pMoniker = nullptr; + ICreateDevEnum* pDevEnum = nullptr; + IEnumMoniker* pEnum = nullptr; // Create the filter graph - hr = CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INPROC, + hr = CoCreateInstance(CLSID_FilterGraph,nullptr,CLSCTX_INPROC, IID_IGraphBuilder, reinterpret_cast<void**>(&m_filterGraph)); if (FAILED(hr)) { errorString = tr("Failed to create filter graph"); @@ -698,7 +698,7 @@ bool DSCameraSession::createFilterGraph() } // Create the capture graph builder - hr = CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL, CLSCTX_INPROC, + hr = CoCreateInstance(CLSID_CaptureGraphBuilder2, nullptr, CLSCTX_INPROC, IID_ICaptureGraphBuilder2, reinterpret_cast<void**>(&m_graphBuilder)); if (FAILED(hr)) { @@ -714,7 +714,7 @@ bool DSCameraSession::createFilterGraph() } // Find the Capture device - hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, + hr = CoCreateInstance(CLSID_SystemDeviceEnum, nullptr, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, reinterpret_cast<void**>(&pDevEnum)); if (SUCCEEDED(hr)) { @@ -723,13 +723,13 @@ bool DSCameraSession::createFilterGraph() pDevEnum->Release(); if (S_OK == hr) { pEnum->Reset(); - IMalloc *mallocInterface = 0; + IMalloc *mallocInterface = nullptr; CoGetMalloc(1, (LPMALLOC*)&mallocInterface); //go through and find all video capture devices - while (pEnum->Next(1, &pMoniker, NULL) == S_OK) { + while (pEnum->Next(1, &pMoniker, nullptr) == S_OK) { - BSTR strName = 0; - hr = pMoniker->GetDisplayName(NULL, NULL, &strName); + BSTR strName = nullptr; + hr = pMoniker->GetDisplayName(nullptr, nullptr, &strName); if (SUCCEEDED(hr)) { QString output = QString::fromWCharArray(strName); mallocInterface->Free(strName); @@ -745,14 +745,14 @@ bool DSCameraSession::createFilterGraph() pMoniker->Release(); } mallocInterface->Release(); - if (NULL == m_sourceFilter) + if (nullptr == m_sourceFilter) { if (m_sourceDeviceName.contains(QLatin1String("default"))) { pEnum->Reset(); // still have to loop to discard bind to storage failure case - while (pEnum->Next(1, &pMoniker, NULL) == S_OK) { - IPropertyBag *pPropBag = 0; + while (pEnum->Next(1, &pMoniker, nullptr) == S_OK) { + IPropertyBag *pPropBag = nullptr; hr = pMoniker->BindToStorage(nullptr, nullptr, IID_IPropertyBag, reinterpret_cast<void**>(&pPropBag)); @@ -763,7 +763,7 @@ bool DSCameraSession::createFilterGraph() // No need to get the description, just grab it - hr = pMoniker->BindToObject(0, 0, IID_IBaseFilter, + hr = pMoniker->BindToObject(nullptr, nullptr, IID_IBaseFilter, reinterpret_cast<void**>(&m_sourceFilter)); pPropBag->Release(); pMoniker->Release(); @@ -792,7 +792,7 @@ bool DSCameraSession::createFilterGraph() // Null renderer. Input connected to the sample grabber's output. Simply // discard the samples it receives. - hr = CoCreateInstance(cLSID_NullRenderer, NULL, CLSCTX_INPROC, + hr = CoCreateInstance(cLSID_NullRenderer, nullptr, CLSCTX_INPROC, IID_IBaseFilter, (void**)&m_nullRendererFilter); if (FAILED(hr)) { errorString = tr("Failed to create null renderer"); @@ -877,7 +877,7 @@ bool DSCameraSession::configurePreviewFormat() m_stride = DirectShowMediaType::bytesPerLine(m_previewSurfaceFormat); HRESULT hr; - IAMStreamConfig* pConfig = 0; + IAMStreamConfig* pConfig = nullptr; hr = m_graphBuilder->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, m_sourceFilter, IID_IAMStreamConfig, reinterpret_cast<void**>(&pConfig)); @@ -910,10 +910,10 @@ void DSCameraSession::updateImageProcessingParametersInfos() return; } - IAMVideoProcAmp *pVideoProcAmp = NULL; + IAMVideoProcAmp *pVideoProcAmp = nullptr; const HRESULT hr = m_graphBuilder->FindInterface( - NULL, - NULL, + nullptr, + nullptr, m_sourceFilter, IID_IAMVideoProcAmp, reinterpret_cast<void**>(&pVideoProcAmp) @@ -1020,10 +1020,10 @@ void DSCameraSession::disconnectGraph() { // To avoid increasing the memory usage every time the graph is re-connected it's // important that all filters are released; also the ones added by the "Intelligent Connect". - IEnumFilters *enumFilters = NULL; + IEnumFilters *enumFilters = nullptr; if (SUCCEEDED(m_filterGraph->EnumFilters(&enumFilters))) { - IBaseFilter *filter = NULL; - while (enumFilters->Next(1, &filter, NULL) == S_OK) { + IBaseFilter *filter = nullptr; + while (enumFilters->Next(1, &filter, nullptr) == S_OK) { m_filterGraph->RemoveFilter(filter); enumFilters->Reset(); filter->Release(); @@ -1040,24 +1040,24 @@ static bool qt_frameRateRangeGreaterThan(const QCamera::FrameRateRange &r1, cons void DSCameraSession::updateSourceCapabilities() { HRESULT hr; - AM_MEDIA_TYPE *pmt = NULL; - VIDEOINFOHEADER *pvi = NULL; + AM_MEDIA_TYPE *pmt = nullptr; + VIDEOINFOHEADER *pvi = nullptr; VIDEO_STREAM_CONFIG_CAPS scc; - IAMStreamConfig* pConfig = 0; + IAMStreamConfig* pConfig = nullptr; m_supportedViewfinderSettings.clear(); m_needsHorizontalMirroring = false; m_supportedFormats.clear(); m_imageProcessingParametersInfos.clear(); - IAMVideoControl *pVideoControl = 0; + IAMVideoControl *pVideoControl = nullptr; hr = m_graphBuilder->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, m_sourceFilter, IID_IAMVideoControl, reinterpret_cast<void**>(&pVideoControl)); if (FAILED(hr)) { qWarning() << "Failed to get the video control"; } else { - IPin *pPin = 0; + IPin *pPin = nullptr; if (!DirectShowUtils::getPin(m_sourceFilter, PINDIR_OUTPUT, &pPin, &hr)) { qWarning() << "Failed to get the pin for the video control"; } else { @@ -1109,12 +1109,12 @@ void DSCameraSession::updateSourceCapabilities() QList<QCamera::FrameRateRange> frameRateRanges; if (pVideoControl) { - IPin *pPin = 0; + IPin *pPin = nullptr; if (!DirectShowUtils::getPin(m_sourceFilter, PINDIR_OUTPUT, &pPin, &hr)) { qWarning() << "Failed to get the pin for the video control"; } else { long listSize = 0; - LONGLONG *frameRates = 0; + LONGLONG *frameRates = nullptr; SIZE size = { resolution.width(), resolution.height() }; if (SUCCEEDED(pVideoControl->GetFrameRateList(pPin, iIndex, size, &listSize, &frameRates))) { diff --git a/src/plugins/directshow/camera/dscamerasession.h b/src/plugins/directshow/camera/dscamerasession.h index a19345777..5e7d026c2 100644 --- a/src/plugins/directshow/camera/dscamerasession.h +++ b/src/plugins/directshow/camera/dscamerasession.h @@ -84,7 +84,7 @@ class DSCameraSession : public QObject { Q_OBJECT public: - DSCameraSession(QObject *parent = 0); + DSCameraSession(QObject *parent = nullptr); ~DSCameraSession() override; QCamera::Status status() const { return m_status; } diff --git a/src/plugins/directshow/camera/dsvideodevicecontrol.cpp b/src/plugins/directshow/camera/dsvideodevicecontrol.cpp index 2c1fab764..0f08154f1 100644 --- a/src/plugins/directshow/camera/dsvideodevicecontrol.cpp +++ b/src/plugins/directshow/camera/dsvideodevicecontrol.cpp @@ -129,10 +129,10 @@ void DSVideoDeviceControl::updateDevices() deviceList->clear(); - ICreateDevEnum* pDevEnum = NULL; - IEnumMoniker* pEnum = NULL; + ICreateDevEnum* pDevEnum = nullptr; + IEnumMoniker* pEnum = nullptr; // Create the System device enumerator - HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, + HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, nullptr, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, reinterpret_cast<void**>(&pDevEnum)); if (SUCCEEDED(hr)) { @@ -142,12 +142,12 @@ void DSVideoDeviceControl::updateDevices() if (S_OK == hr) { pEnum->Reset(); // go through and find all video capture devices - IMoniker* pMoniker = NULL; - IMalloc *mallocInterface = 0; + IMoniker* pMoniker = nullptr; + IMalloc *mallocInterface = nullptr; CoGetMalloc(1, (LPMALLOC*)&mallocInterface); - while (pEnum->Next(1, &pMoniker, NULL) == S_OK) { - BSTR strName = 0; - hr = pMoniker->GetDisplayName(NULL, NULL, &strName); + while (pEnum->Next(1, &pMoniker, nullptr) == S_OK) { + BSTR strName = nullptr; + hr = pMoniker->GetDisplayName(nullptr, nullptr, &strName); if (SUCCEEDED(hr)) { QString output(QString::fromWCharArray(strName)); mallocInterface->Free(strName); @@ -162,7 +162,7 @@ void DSVideoDeviceControl::updateDevices() // Find the description VARIANT varName; varName.vt = VT_BSTR; - hr = pPropBag->Read(L"FriendlyName", &varName, 0); + hr = pPropBag->Read(L"FriendlyName", &varName, nullptr); if (SUCCEEDED(hr)) { output = QString::fromWCharArray(varName.bstrVal); } diff --git a/src/plugins/directshow/camera/dsvideodevicecontrol.h b/src/plugins/directshow/camera/dsvideodevicecontrol.h index 26655f431..24a5b61a1 100644 --- a/src/plugins/directshow/camera/dsvideodevicecontrol.h +++ b/src/plugins/directshow/camera/dsvideodevicecontrol.h @@ -54,7 +54,7 @@ class DSVideoDeviceControl : public QVideoDeviceSelectorControl { Q_OBJECT public: - DSVideoDeviceControl(QObject *parent = 0); + DSVideoDeviceControl(QObject *parent = nullptr); int deviceCount() const override; QString deviceName(int index) const override; diff --git a/src/plugins/directshow/camera/dsvideorenderer.h b/src/plugins/directshow/camera/dsvideorenderer.h index 96cf74483..a6a1f8103 100644 --- a/src/plugins/directshow/camera/dsvideorenderer.h +++ b/src/plugins/directshow/camera/dsvideorenderer.h @@ -50,7 +50,7 @@ class DSVideoRendererControl : public QVideoRendererControl { Q_OBJECT public: - DSVideoRendererControl(DSCameraSession* session, QObject *parent = 0); + DSVideoRendererControl(DSCameraSession* session, QObject *parent = nullptr); ~DSVideoRendererControl() override; QAbstractVideoSurface *surface() const override; |