style(*): convert all uses of NULL to nullptr
Some checks failed
Build / ubuntu (push) Has been cancelled
Build / windows (push) Has been cancelled
Build / container (push) Has been cancelled

Signed-off-by: k4yt3x <i@k4yt3x.com>
This commit is contained in:
k4yt3x 2025-01-04 00:00:00 +00:00
parent f38452ff94
commit 953147ede7
No known key found for this signature in database
3 changed files with 15 additions and 11 deletions

View File

@ -20,7 +20,7 @@ static std::filesystem::path get_executable_directory() {
std::vector<wchar_t> filepath(MAX_PATH); std::vector<wchar_t> filepath(MAX_PATH);
// Get the executable path, expanding the buffer if necessary // Get the executable path, expanding the buffer if necessary
DWORD size = GetModuleFileNameW(NULL, filepath.data(), static_cast<DWORD>(filepath.size())); DWORD size = GetModuleFileNameW(nullptr, filepath.data(), static_cast<DWORD>(filepath.size()));
if (size == 0) { if (size == 0) {
logger()->error("Error getting executable path: {}", GetLastError()); logger()->error("Error getting executable path: {}", GetLastError());
return std::filesystem::path(); return std::filesystem::path();
@ -29,7 +29,7 @@ static std::filesystem::path get_executable_directory() {
// Resize the buffer if necessary // Resize the buffer if necessary
while (size >= filepath.size()) { while (size >= filepath.size()) {
filepath.resize(filepath.size() * 2); filepath.resize(filepath.size() * 2);
size = GetModuleFileNameW(NULL, filepath.data(), static_cast<DWORD>(filepath.size())); size = GetModuleFileNameW(nullptr, filepath.data(), static_cast<DWORD>(filepath.size()));
if (size == 0) { if (size == 0) {
logger()->error("Error getting executable path: {}", GetLastError()); logger()->error("Error getting executable path: {}", GetLastError());
return std::filesystem::path(); return std::filesystem::path();

View File

@ -1,6 +1,5 @@
#include "libplacebo.h" #include "libplacebo.h"
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string> #include <string>
@ -31,7 +30,11 @@ int init_libplacebo(
// Create the Vulkan hardware device context // Create the Vulkan hardware device context
AVBufferRef* vk_hw_device_ctx = nullptr; AVBufferRef* vk_hw_device_ctx = nullptr;
ret = av_hwdevice_ctx_create( ret = av_hwdevice_ctx_create(
&vk_hw_device_ctx, AV_HWDEVICE_TYPE_VULKAN, std::to_string(vk_device_index).c_str(), NULL, 0 &vk_hw_device_ctx,
AV_HWDEVICE_TYPE_VULKAN,
std::to_string(vk_device_index).c_str(),
nullptr,
0
); );
if (ret < 0) { if (ret < 0) {
logger()->error("Failed to create Vulkan hardware device context for libplacebo."); logger()->error("Failed to create Vulkan hardware device context for libplacebo.");
@ -68,21 +71,22 @@ int init_libplacebo(
AVClass* priv_class_copy_ptr = &priv_class_copy; AVClass* priv_class_copy_ptr = &priv_class_copy;
// Check if the colorspace option is supported // Check if the colorspace option is supported
if (av_opt_find(&priv_class_copy_ptr, "colorspace", NULL, 0, AV_OPT_SEARCH_FAKE_OBJ)) { if (av_opt_find(&priv_class_copy_ptr, "colorspace", nullptr, 0, AV_OPT_SEARCH_FAKE_OBJ)) {
args += ":colorspace=" + std::to_string(dec_ctx->colorspace); args += ":colorspace=" + std::to_string(dec_ctx->colorspace);
} else { } else {
logger()->warn("Option 'colorspace' is not supported by the buffer filter."); logger()->warn("Option 'colorspace' is not supported by the buffer filter.");
} }
// Check if the range option is supported // Check if the range option is supported
if (av_opt_find(&priv_class_copy_ptr, "range", NULL, 0, AV_OPT_SEARCH_FAKE_OBJ)) { if (av_opt_find(&priv_class_copy_ptr, "range", nullptr, 0, AV_OPT_SEARCH_FAKE_OBJ)) {
args += ":range=" + std::to_string(dec_ctx->color_range); args += ":range=" + std::to_string(dec_ctx->color_range);
} else { } else {
logger()->warn("Option 'range' is not supported by the buffer filter."); logger()->warn("Option 'range' is not supported by the buffer filter.");
} }
logger()->debug("Buffer source args: {}", args); logger()->debug("Buffer source args: {}", args);
ret = avfilter_graph_create_filter(buffersrc_ctx, buffersrc, "in", args.c_str(), NULL, graph); ret =
avfilter_graph_create_filter(buffersrc_ctx, buffersrc, "in", args.c_str(), nullptr, graph);
if (ret < 0) { if (ret < 0) {
logger()->error("Cannot create buffer source."); logger()->error("Cannot create buffer source.");
avfilter_graph_free(&graph); avfilter_graph_free(&graph);
@ -114,7 +118,7 @@ int init_libplacebo(
AVFilterContext* libplacebo_ctx; AVFilterContext* libplacebo_ctx;
ret = avfilter_graph_create_filter( ret = avfilter_graph_create_filter(
&libplacebo_ctx, libplacebo_filter, "libplacebo", filter_args.c_str(), NULL, graph &libplacebo_ctx, libplacebo_filter, "libplacebo", filter_args.c_str(), nullptr, graph
); );
if (ret < 0) { if (ret < 0) {
logger()->error("Cannot create libplacebo filter."); logger()->error("Cannot create libplacebo filter.");
@ -140,7 +144,7 @@ int init_libplacebo(
// Create buffer sink // Create buffer sink
const AVFilter* buffersink = avfilter_get_by_name("buffersink"); const AVFilter* buffersink = avfilter_get_by_name("buffersink");
ret = avfilter_graph_create_filter(buffersink_ctx, buffersink, "out", NULL, NULL, graph); ret = avfilter_graph_create_filter(buffersink_ctx, buffersink, "out", nullptr, nullptr, graph);
if (ret < 0) { if (ret < 0) {
logger()->error("Cannot create buffer sink."); logger()->error("Cannot create buffer sink.");
avfilter_graph_free(&graph); avfilter_graph_free(&graph);
@ -156,7 +160,7 @@ int init_libplacebo(
} }
// Configure the filter graph // Configure the filter graph
ret = avfilter_graph_config(graph, NULL); ret = avfilter_graph_config(graph, nullptr);
if (ret < 0) { if (ret < 0) {
logger()->error("Error configuring the filter graph."); logger()->error("Error configuring the filter graph.");
avfilter_graph_free(&graph); avfilter_graph_free(&graph);

View File

@ -58,7 +58,7 @@ int VideoProcessor::process(
// Initialize hardware device context // Initialize hardware device context
if (hw_device_type_ != AV_HWDEVICE_TYPE_NONE) { if (hw_device_type_ != AV_HWDEVICE_TYPE_NONE) {
AVBufferRef* tmp_hw_ctx = nullptr; AVBufferRef* tmp_hw_ctx = nullptr;
ret = av_hwdevice_ctx_create(&tmp_hw_ctx, hw_device_type_, NULL, NULL, 0); ret = av_hwdevice_ctx_create(&tmp_hw_ctx, hw_device_type_, nullptr, nullptr, 0);
if (ret < 0) { if (ret < 0) {
return handle_error(ret, "Error initializing hardware device context"); return handle_error(ret, "Error initializing hardware device context");
} }