aboutsummaryrefslogtreecommitdiffstats
path: root/common/rfb/H264WinDecoderContext.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2024-04-02 16:13:23 +0200
committerPierre Ossman <ossman@cendio.se>2024-06-24 13:42:54 +0200
commit139f0e8a4b81fe3dcd9476ec5ee16ea5e74af901 (patch)
tree8d06ede9e14516516a44c5ed710058003088eec2 /common/rfb/H264WinDecoderContext.cxx
parent45198e5235f4b724277665b242cf855a0ff4518b (diff)
downloadtigervnc-139f0e8a4b81fe3dcd9476ec5ee16ea5e74af901.tar.gz
tigervnc-139f0e8a4b81fe3dcd9476ec5ee16ea5e74af901.zip
Use nullptr in all C++ code
It's more readable than 0, and a bit safer than NULL, so let's try to follow modern norms.
Diffstat (limited to 'common/rfb/H264WinDecoderContext.cxx')
-rw-r--r--common/rfb/H264WinDecoderContext.cxx22
1 files changed, 11 insertions, 11 deletions
diff --git a/common/rfb/H264WinDecoderContext.cxx b/common/rfb/H264WinDecoderContext.cxx
index bb29edb6..e2196520 100644
--- a/common/rfb/H264WinDecoderContext.cxx
+++ b/common/rfb/H264WinDecoderContext.cxx
@@ -21,7 +21,7 @@
#include <mfapi.h>
#include <mferror.h>
#include <wmcodecdsp.h>
-#define SAFE_RELEASE(obj) if (obj) { obj->Release(); obj = NULL; }
+#define SAFE_RELEASE(obj) if (obj) { obj->Release(); obj = nullptr; }
#include <os/Mutex.h>
#include <rfb/LogWriter.h>
@@ -41,17 +41,17 @@ bool H264WinDecoderContext::initCodec() {
return false;
}
- if (FAILED(CoCreateInstance(CLSID_CMSH264DecoderMFT, NULL, CLSCTX_INPROC_SERVER, IID_IMFTransform, (LPVOID*)&decoder)))
+ if (FAILED(CoCreateInstance(CLSID_CMSH264DecoderMFT, nullptr, CLSCTX_INPROC_SERVER, IID_IMFTransform, (LPVOID*)&decoder)))
{
vlog.error("MediaFoundation H264 codec not found");
return false;
}
GUID CLSID_VideoProcessorMFT = { 0x88753b26, 0x5b24, 0x49bd, { 0xb2, 0xe7, 0xc, 0x44, 0x5c, 0x78, 0xc9, 0x82 } };
- if (FAILED(CoCreateInstance(CLSID_VideoProcessorMFT, NULL, CLSCTX_INPROC_SERVER, IID_IMFTransform, (LPVOID*)&converter)))
+ if (FAILED(CoCreateInstance(CLSID_VideoProcessorMFT, nullptr, CLSCTX_INPROC_SERVER, IID_IMFTransform, (LPVOID*)&converter)))
{
vlog.error("Cannot create MediaFoundation Video Processor (available only on Windows 8+). Trying ColorConvert DMO.");
- if (FAILED(CoCreateInstance(CLSID_CColorConvertDMO, NULL, CLSCTX_INPROC_SERVER, IID_IMFTransform, (LPVOID*)&converter)))
+ if (FAILED(CoCreateInstance(CLSID_CColorConvertDMO, nullptr, CLSCTX_INPROC_SERVER, IID_IMFTransform, (LPVOID*)&converter)))
{
decoder->Release();
vlog.error("ColorConvert DMO not found");
@@ -87,7 +87,7 @@ bool H264WinDecoderContext::initCodec() {
// set decoder output type (NV12)
DWORD output_index = 0;
- IMFMediaType* output_type = NULL;
+ IMFMediaType* output_type = nullptr;
while (SUCCEEDED(decoder->GetOutputAvailableType(0, output_index++, &output_type)))
{
GUID subtype;
@@ -175,7 +175,7 @@ void H264WinDecoderContext::decode(const uint8_t* h264_buffer,
}
BYTE* locked;
- input_buffer->Lock(&locked, NULL, NULL);
+ input_buffer->Lock(&locked, nullptr, nullptr);
memcpy(locked, h264_buffer, len);
input_buffer->Unlock();
@@ -203,7 +203,7 @@ void H264WinDecoderContext::decode(const uint8_t* h264_buffer,
decoded_data.dwStreamID = 0;
decoded_data.pSample = decoded_sample;
decoded_data.dwStatus = 0;
- decoded_data.pEvents = NULL;
+ decoded_data.pEvents = nullptr;
DWORD status;
HRESULT hr = decoder->ProcessOutput(0, 1, &decoded_data, &status);
@@ -232,7 +232,7 @@ void H264WinDecoderContext::decode(const uint8_t* h264_buffer,
// need to setup output type and try decoding again
DWORD output_index = 0;
- IMFMediaType* output_type = NULL;
+ IMFMediaType* output_type = nullptr;
while (SUCCEEDED(decoder->GetOutputAvailableType(0, output_index++, &output_type)))
{
GUID subtype;
@@ -242,7 +242,7 @@ void H264WinDecoderContext::decode(const uint8_t* h264_buffer,
break;
}
output_type->Release();
- output_type = NULL;
+ output_type = nullptr;
}
// reinitialize output type (NV12) that now has correct properties (width/height/framerate)
@@ -327,7 +327,7 @@ void H264WinDecoderContext::decode(const uint8_t* h264_buffer,
converted_data.dwStreamID = 0;
converted_data.pSample = converted_sample;
converted_data.dwStatus = 0;
- converted_data.pEvents = NULL;
+ converted_data.pEvents = nullptr;
DWORD status;
HRESULT hr = converter->ProcessOutput(0, 1, &converted_data, &status);
@@ -343,7 +343,7 @@ void H264WinDecoderContext::decode(const uint8_t* h264_buffer,
BYTE* out;
DWORD len;
- converted_buffer->Lock(&out, NULL, &len);
+ converted_buffer->Lock(&out, nullptr, &len);
pb->imageRect(rect, out + offset_y * stride + offset_x * 4, (int)stride / 4);
converted_buffer->Unlock();
}