mirror of
https://github.com/k4yt3x/video2x.git
synced 2025-01-15 12:18:52 +00:00
style(*): convert all uses of NULL to nullptr
Signed-off-by: k4yt3x <i@k4yt3x.com>
This commit is contained in:
parent
f38452ff94
commit
953147ede7
@ -20,7 +20,7 @@ static std::filesystem::path get_executable_directory() {
|
||||
std::vector<wchar_t> filepath(MAX_PATH);
|
||||
|
||||
// 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) {
|
||||
logger()->error("Error getting executable path: {}", GetLastError());
|
||||
return std::filesystem::path();
|
||||
@ -29,7 +29,7 @@ static std::filesystem::path get_executable_directory() {
|
||||
// Resize the buffer if necessary
|
||||
while (size >= filepath.size()) {
|
||||
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) {
|
||||
logger()->error("Error getting executable path: {}", GetLastError());
|
||||
return std::filesystem::path();
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include "libplacebo.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
|
||||
@ -31,7 +30,11 @@ int init_libplacebo(
|
||||
// Create the Vulkan hardware device context
|
||||
AVBufferRef* vk_hw_device_ctx = nullptr;
|
||||
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) {
|
||||
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;
|
||||
|
||||
// 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);
|
||||
} else {
|
||||
logger()->warn("Option 'colorspace' is not supported by the buffer filter.");
|
||||
}
|
||||
|
||||
// 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);
|
||||
} else {
|
||||
logger()->warn("Option 'range' is not supported by the buffer filter.");
|
||||
}
|
||||
|
||||
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) {
|
||||
logger()->error("Cannot create buffer source.");
|
||||
avfilter_graph_free(&graph);
|
||||
@ -114,7 +118,7 @@ int init_libplacebo(
|
||||
|
||||
AVFilterContext* libplacebo_ctx;
|
||||
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) {
|
||||
logger()->error("Cannot create libplacebo filter.");
|
||||
@ -140,7 +144,7 @@ int init_libplacebo(
|
||||
|
||||
// Create buffer sink
|
||||
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) {
|
||||
logger()->error("Cannot create buffer sink.");
|
||||
avfilter_graph_free(&graph);
|
||||
@ -156,7 +160,7 @@ int init_libplacebo(
|
||||
}
|
||||
|
||||
// Configure the filter graph
|
||||
ret = avfilter_graph_config(graph, NULL);
|
||||
ret = avfilter_graph_config(graph, nullptr);
|
||||
if (ret < 0) {
|
||||
logger()->error("Error configuring the filter graph.");
|
||||
avfilter_graph_free(&graph);
|
||||
|
@ -58,7 +58,7 @@ int VideoProcessor::process(
|
||||
// Initialize hardware device context
|
||||
if (hw_device_type_ != AV_HWDEVICE_TYPE_NONE) {
|
||||
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) {
|
||||
return handle_error(ret, "Error initializing hardware device context");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user