From 8421bdc381c3c64b3733dda5aec9d422282989d4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 5 Sep 2018 09:28:39 +0200 Subject: DirectShow: Fix clang-tidy warnings about C-style casts Replace by reinterpret_cast<>. Change-Id: Iebcac7858d875e2d6f53db21489d86beb19ba947 Reviewed-by: Oliver Wolff --- src/plugins/common/evr/evrcustompresenter.cpp | 40 +++++++++++++++++---------- src/plugins/common/evr/evrhelpers.h | 4 ++- 2 files changed, 28 insertions(+), 16 deletions(-) (limited to 'src/plugins/common/evr') diff --git a/src/plugins/common/evr/evrcustompresenter.cpp b/src/plugins/common/evr/evrcustompresenter.cpp index d5d9df14f..fd3054b0b 100644 --- a/src/plugins/common/evr/evrcustompresenter.cpp +++ b/src/plugins/common/evr/evrcustompresenter.cpp @@ -1365,18 +1365,21 @@ HRESULT EVRCustomPresenter::createOptimalVideoType(IMFMediaType *proposedType, I if (FAILED(hr)) goto done; - hr = mtOptimal->SetBlob(MF_MT_GEOMETRIC_APERTURE, (UINT8*)&displayArea, sizeof(displayArea)); + hr = mtOptimal->SetBlob(MF_MT_GEOMETRIC_APERTURE, reinterpret_cast(&displayArea), + sizeof(displayArea)); if (FAILED(hr)) goto done; // Set the pan/scan aperture and the minimum display aperture. We don't care // about them per se, but the mixer will reject the type if these exceed the // frame dimentions. - hr = mtOptimal->SetBlob(MF_MT_PAN_SCAN_APERTURE, (UINT8*)&displayArea, sizeof(displayArea)); + hr = mtOptimal->SetBlob(MF_MT_PAN_SCAN_APERTURE, reinterpret_cast(&displayArea), + sizeof(displayArea)); if (FAILED(hr)) goto done; - hr = mtOptimal->SetBlob(MF_MT_MINIMUM_DISPLAY_APERTURE, (UINT8*)&displayArea, sizeof(displayArea)); + hr = mtOptimal->SetBlob(MF_MT_MINIMUM_DISPLAY_APERTURE, reinterpret_cast(&displayArea), + sizeof(displayArea)); if (FAILED(hr)) goto done; @@ -1474,7 +1477,7 @@ HRESULT EVRCustomPresenter::isMediaTypeSupported(IMFMediaType *proposed) UINT32 width = 0, height = 0; // Validate the format. - HRESULT hr = qt_evr_getFourCC(proposed, (DWORD*)&d3dFormat); + HRESULT hr = qt_evr_getFourCC(proposed, reinterpret_cast(&d3dFormat)); if (FAILED(hr)) return hr; @@ -1503,7 +1506,7 @@ HRESULT EVRCustomPresenter::isMediaTypeSupported(IMFMediaType *proposed) return hr; // Reject interlaced formats. - hr = proposed->GetUINT32(MF_MT_INTERLACE_MODE, (UINT32*)&interlaceMode); + hr = proposed->GetUINT32(MF_MT_INTERLACE_MODE, reinterpret_cast(&interlaceMode)); if (FAILED(hr)) return hr; @@ -1518,15 +1521,21 @@ HRESULT EVRCustomPresenter::isMediaTypeSupported(IMFMediaType *proposed) // Any of these apertures may be unspecified in the media type, in which case // we ignore it. We just want to reject invalid apertures. - if (SUCCEEDED(proposed->GetBlob(MF_MT_PAN_SCAN_APERTURE, (UINT8*)&videoCropArea, sizeof(videoCropArea), NULL))) + if (SUCCEEDED(proposed->GetBlob(MF_MT_PAN_SCAN_APERTURE, + reinterpret_cast(&videoCropArea), + sizeof(videoCropArea), nullptr))) { hr = qt_evr_validateVideoArea(videoCropArea, width, height); - - if (SUCCEEDED(proposed->GetBlob(MF_MT_GEOMETRIC_APERTURE, (UINT8*)&videoCropArea, sizeof(videoCropArea), NULL))) + } + if (SUCCEEDED(proposed->GetBlob(MF_MT_GEOMETRIC_APERTURE, + reinterpret_cast(&videoCropArea), + sizeof(videoCropArea), nullptr))) { hr = qt_evr_validateVideoArea(videoCropArea, width, height); - - if (SUCCEEDED(proposed->GetBlob(MF_MT_MINIMUM_DISPLAY_APERTURE, (UINT8*)&videoCropArea, sizeof(videoCropArea), NULL))) + } + if (SUCCEEDED(proposed->GetBlob(MF_MT_MINIMUM_DISPLAY_APERTURE, + reinterpret_cast(&videoCropArea), + sizeof(videoCropArea), nullptr))) { hr = qt_evr_validateVideoArea(videoCropArea, width, height); - + } return hr; } @@ -1642,7 +1651,7 @@ HRESULT EVRCustomPresenter::processOutput() m_clock->GetCorrelatedTime(0, &mixerEndTime, &systemTime); LONGLONG latencyTime = mixerEndTime - mixerStartTime; - notifyEvent(EC_PROCESSING_LATENCY, (LONG_PTR)&latencyTime, 0); + notifyEvent(EC_PROCESSING_LATENCY, reinterpret_cast(&latencyTime), 0); } // Set up notification for when the sample is released. @@ -1734,7 +1743,7 @@ HRESULT EVRCustomPresenter::deliverFrameStepSample(IMFSample *sample) if (FAILED(hr)) goto done; - m_frameStep.sampleNoRef = (DWORD_PTR)unk; // No add-ref. + m_frameStep.sampleNoRef = reinterpret_cast(unk); // No add-ref. // NOTE: We do not AddRef the IUnknown pointer, because that would prevent the // sample from invoking the OnSampleFree callback after the sample is presented. @@ -1807,7 +1816,7 @@ HRESULT EVRCustomPresenter::onSampleFree(IMFAsyncResult *result) if (FAILED(hr)) goto done; - if (m_frameStep.sampleNoRef == (DWORD_PTR)unk) { + if (m_frameStep.sampleNoRef == reinterpret_cast(unk)) { // Notify the EVR. hr = completeFrameStep(sample); if (FAILED(hr)) @@ -1997,7 +2006,8 @@ HRESULT setMixerSourceRect(IMFTransform *mixer, const MFVideoNormalizedRect &sou HRESULT hr = mixer->GetAttributes(&attributes); if (SUCCEEDED(hr)) { - hr = attributes->SetBlob(video_ZOOM_RECT, (const UINT8*)&sourceRect, sizeof(sourceRect)); + hr = attributes->SetBlob(video_ZOOM_RECT, reinterpret_cast(&sourceRect), + sizeof(sourceRect)); attributes->Release(); } return hr; diff --git a/src/plugins/common/evr/evrhelpers.h b/src/plugins/common/evr/evrhelpers.h index 527612c45..b5bdf5ead 100644 --- a/src/plugins/common/evr/evrhelpers.h +++ b/src/plugins/common/evr/evrhelpers.h @@ -87,7 +87,9 @@ inline MFVideoArea qt_evr_makeMFArea(float x, float y, DWORD width, DWORD height inline HRESULT qt_evr_getFrameRate(IMFMediaType *pType, MFRatio *pRatio) { - return MFGetAttributeRatio(pType, MF_MT_FRAME_RATE, (UINT32*)&pRatio->Numerator, (UINT32*)&pRatio->Denominator); + return MFGetAttributeRatio(pType, MF_MT_FRAME_RATE, + reinterpret_cast(&pRatio->Numerator), + reinterpret_cast(&pRatio->Denominator)); } QVideoFrame::PixelFormat qt_evr_pixelFormatFromD3DFormat(DWORD format); -- cgit v1.2.3