mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-15 08:15:06 +00:00
project: Code cleanup and reapply formatting
Changes applied: * Moved utility files to /util/. * Removed unused #includes. * Removed unused ::ffmpeg::tools function. * Removed unused variables. * Fixed missing parentheses in the version macro. * Fixed missing override on virtual function overrides and removed unnecessary virtual keyword from them. * Disabled additional warning for ATL headers on MSVC only. * Replaced direct printf parameters with their macro equivalent. * Replaced C-style casts with C++-style casts. * Applied clang-format again after an earlier change to the CMake file broke the integration for it.
This commit is contained in:
parent
6e02ee5fef
commit
d332007ae0
64 changed files with 174 additions and 236 deletions
|
@ -477,13 +477,13 @@ list(APPEND PROJECT_PRIVATE_SOURCE
|
||||||
"source/strings.hpp"
|
"source/strings.hpp"
|
||||||
"source/plugin.hpp"
|
"source/plugin.hpp"
|
||||||
"source/plugin.cpp"
|
"source/plugin.cpp"
|
||||||
"source/utility.hpp"
|
"source/util/utility.hpp"
|
||||||
"source/utility.cpp"
|
"source/util/utility.cpp"
|
||||||
"source/util-event.hpp"
|
"source/util/util-event.hpp"
|
||||||
"source/util-profiler.cpp"
|
"source/util/util-profiler.cpp"
|
||||||
"source/util-profiler.hpp"
|
"source/util/util-profiler.hpp"
|
||||||
"source/util-threadpool.cpp"
|
"source/util/util-threadpool.cpp"
|
||||||
"source/util-threadpool.hpp"
|
"source/util/util-threadpool.hpp"
|
||||||
|
|
||||||
# Graphics
|
# Graphics
|
||||||
"source/gfx/gfx-source-texture.hpp"
|
"source/gfx/gfx-source-texture.hpp"
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
|
|
||||||
#define STREAMFX_MAKE_VERSION(major,minor,patch,tweak) ((uint64_t(major) & 0xFFFFull) << 48ull) | ((uint64_t(minor) & 0xFFFFull) << 32ull) | ((uint64_t(patch) & 0xFFFFull) << 16ull) | ((uint64_t(tweak) & 0xFFFFull))
|
#define STREAMFX_MAKE_VERSION(major,minor,patch,tweak) (((uint64_t(major) & 0xFFFFull) << 48ull) | ((uint64_t(minor) & 0xFFFFull) << 32ull) | ((uint64_t(patch) & 0xFFFFull) << 16ull) | ((uint64_t(tweak) & 0xFFFFull)))
|
||||||
|
|
||||||
#define STREAMFX_MASK_MAJOR 0xFFFF000000000000ull
|
#define STREAMFX_MASK_MAJOR 0xFFFF000000000000ull
|
||||||
#define STREAMFX_MASK_COMPAT 0xFFFFFFFF00000000ull
|
#define STREAMFX_MASK_COMPAT 0xFFFFFFFF00000000ull
|
||||||
|
|
|
@ -46,9 +46,10 @@
|
||||||
// Common Plugin includes
|
// Common Plugin includes
|
||||||
#include "strings.hpp"
|
#include "strings.hpp"
|
||||||
#include "version.hpp"
|
#include "version.hpp"
|
||||||
#include "util-profiler.hpp"
|
#include "util/util-math.hpp"
|
||||||
#include "util-threadpool.hpp"
|
#include "util/util-profiler.hpp"
|
||||||
#include "utility.hpp"
|
#include "util/util-threadpool.hpp"
|
||||||
|
#include "util/utility.hpp"
|
||||||
|
|
||||||
// Common OBS includes
|
// Common OBS includes
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -53,7 +53,8 @@ streamfx::configuration::configuration() : _data(), _config_path()
|
||||||
if (!std::filesystem::exists(_config_path) || !std::filesystem::is_regular_file(_config_path)) {
|
if (!std::filesystem::exists(_config_path) || !std::filesystem::is_regular_file(_config_path)) {
|
||||||
throw std::runtime_error("Configuration does not exist.");
|
throw std::runtime_error("Configuration does not exist.");
|
||||||
} else {
|
} else {
|
||||||
obs_data_t* data = obs_data_create_from_json_file_safe(_config_path.string().c_str(), path_backup_ext.data());
|
obs_data_t* data =
|
||||||
|
obs_data_create_from_json_file_safe(_config_path.string().c_str(), path_backup_ext.data());
|
||||||
if (!data) {
|
if (!data) {
|
||||||
throw std::runtime_error("Failed to load configuration from disk.");
|
throw std::runtime_error("Failed to load configuration from disk.");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
// SOFTWARE.
|
// SOFTWARE.
|
||||||
|
|
||||||
#include "hevc.hpp"
|
#include "hevc.hpp"
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
using namespace streamfx::encoder::codec;
|
using namespace streamfx::encoder::codec;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#include "handlers/prores_aw_handler.hpp"
|
#include "handlers/prores_aw_handler.hpp"
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
#include "plugin.hpp"
|
#include "plugin.hpp"
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
|
@ -97,7 +96,8 @@ ffmpeg_instance::ffmpeg_instance(obs_data_t* settings, obs_encoder_t* self, bool
|
||||||
// Abort if user specified manual override.
|
// Abort if user specified manual override.
|
||||||
if ((static_cast<AVPixelFormat>(obs_data_get_int(settings, KEY_FFMPEG_COLORFORMAT)) != AV_PIX_FMT_NONE)
|
if ((static_cast<AVPixelFormat>(obs_data_get_int(settings, KEY_FFMPEG_COLORFORMAT)) != AV_PIX_FMT_NONE)
|
||||||
|| (obs_data_get_int(settings, KEY_FFMPEG_GPU) != -1) || (obs_encoder_scaling_enabled(_self))) {
|
|| (obs_data_get_int(settings, KEY_FFMPEG_GPU) != -1) || (obs_encoder_scaling_enabled(_self))) {
|
||||||
throw std::runtime_error("Selected settings prevent the use of hardware encoding, falling back to software.");
|
throw std::runtime_error(
|
||||||
|
"Selected settings prevent the use of hardware encoding, falling back to software.");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
@ -270,23 +270,24 @@ bool ffmpeg_instance::update(obs_data_t* settings)
|
||||||
|
|
||||||
DLOG_INFO("[%s] Video:", _codec->name);
|
DLOG_INFO("[%s] Video:", _codec->name);
|
||||||
if (_hwinst) {
|
if (_hwinst) {
|
||||||
DLOG_INFO("[%s] Texture: %ldx%ld %s %s %s", _codec->name, _context->width, _context->height,
|
DLOG_INFO("[%s] Texture: %" PRId32 "x%" PRId32 " %s %s %s", _codec->name, _context->width, _context->height,
|
||||||
::ffmpeg::tools::get_pixel_format_name(_context->sw_pix_fmt),
|
::ffmpeg::tools::get_pixel_format_name(_context->sw_pix_fmt),
|
||||||
::ffmpeg::tools::get_color_space_name(_context->colorspace),
|
::ffmpeg::tools::get_color_space_name(_context->colorspace),
|
||||||
av_color_range_name(_context->color_range));
|
av_color_range_name(_context->color_range));
|
||||||
} else {
|
} else {
|
||||||
DLOG_INFO("[%s] Input: %ldx%ld %s %s %s", _codec->name, _scaler.get_source_width(),
|
DLOG_INFO("[%s] Input: %" PRId32 "x%" PRId32 " %s %s %s", _codec->name, _scaler.get_source_width(),
|
||||||
_scaler.get_source_height(), ::ffmpeg::tools::get_pixel_format_name(_scaler.get_source_format()),
|
_scaler.get_source_height(), ::ffmpeg::tools::get_pixel_format_name(_scaler.get_source_format()),
|
||||||
::ffmpeg::tools::get_color_space_name(_scaler.get_source_colorspace()),
|
::ffmpeg::tools::get_color_space_name(_scaler.get_source_colorspace()),
|
||||||
_scaler.is_source_full_range() ? "Full" : "Partial");
|
_scaler.is_source_full_range() ? "Full" : "Partial");
|
||||||
DLOG_INFO("[%s] Output: %ldx%ld %s %s %s", _codec->name, _scaler.get_target_width(),
|
DLOG_INFO("[%s] Output: %" PRId32 "x%" PRId32 " %s %s %s", _codec->name, _scaler.get_target_width(),
|
||||||
_scaler.get_target_height(), ::ffmpeg::tools::get_pixel_format_name(_scaler.get_target_format()),
|
_scaler.get_target_height(), ::ffmpeg::tools::get_pixel_format_name(_scaler.get_target_format()),
|
||||||
::ffmpeg::tools::get_color_space_name(_scaler.get_target_colorspace()),
|
::ffmpeg::tools::get_color_space_name(_scaler.get_target_colorspace()),
|
||||||
_scaler.is_target_full_range() ? "Full" : "Partial");
|
_scaler.is_target_full_range() ? "Full" : "Partial");
|
||||||
if (!_hwinst)
|
if (!_hwinst)
|
||||||
DLOG_INFO("[%s] On GPU Index: %lli", _codec->name, obs_data_get_int(settings, KEY_FFMPEG_GPU));
|
DLOG_INFO("[%s] On GPU Index: %lli", _codec->name, obs_data_get_int(settings, KEY_FFMPEG_GPU));
|
||||||
}
|
}
|
||||||
DLOG_INFO("[%s] Framerate: %ld/%ld (%f FPS)", _codec->name, _context->time_base.den, _context->time_base.num,
|
DLOG_INFO("[%s] Framerate: %" PRId32 "/%" PRId32 " (%f FPS)", _codec->name, _context->time_base.den,
|
||||||
|
_context->time_base.num,
|
||||||
static_cast<double_t>(_context->time_base.den) / static_cast<double_t>(_context->time_base.num));
|
static_cast<double_t>(_context->time_base.den) / static_cast<double_t>(_context->time_base.num));
|
||||||
|
|
||||||
DLOG_INFO("[%s] Keyframes: ", _codec->name);
|
DLOG_INFO("[%s] Keyframes: ", _codec->name);
|
||||||
|
@ -360,7 +361,7 @@ bool ffmpeg_instance::encode_video(struct encoder_frame* frame, struct encoder_p
|
||||||
_scaler.convert(reinterpret_cast<std::uint8_t**>(frame->data), reinterpret_cast<int*>(frame->linesize),
|
_scaler.convert(reinterpret_cast<std::uint8_t**>(frame->data), reinterpret_cast<int*>(frame->linesize),
|
||||||
0, _context->height, vframe->data, vframe->linesize);
|
0, _context->height, vframe->data, vframe->linesize);
|
||||||
if (res <= 0) {
|
if (res <= 0) {
|
||||||
DLOG_ERROR("Failed to convert frame: %s (%ld).", ::ffmpeg::tools::get_error_description(res), res);
|
DLOG_ERROR("Failed to convert frame: %s (%" PRId32 ").", ::ffmpeg::tools::get_error_description(res), res);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -700,7 +701,7 @@ bool ffmpeg_instance::encode_avframe(std::shared_ptr<AVFrame> frame, encoder_pac
|
||||||
sent_frame = true;
|
sent_frame = true;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DLOG_ERROR("Failed to encode frame: %s (%ld).", ::ffmpeg::tools::get_error_description(res), res);
|
DLOG_ERROR("Failed to encode frame: %s (%" PRId32 ").", ::ffmpeg::tools::get_error_description(res), res);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -725,7 +726,7 @@ bool ffmpeg_instance::encode_avframe(std::shared_ptr<AVFrame> frame, encoder_pac
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DLOG_ERROR("Failed to receive packet: %s (%ld).", ::ffmpeg::tools::get_error_description(res), res);
|
DLOG_ERROR("Failed to receive packet: %s (%" PRId32 ").", ::ffmpeg::tools::get_error_description(res), res);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "handler.hpp"
|
#include "handler.hpp"
|
||||||
#include "plugin.hpp"
|
#include "plugin.hpp"
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <obs-properties.h>
|
#include <obs-properties.h>
|
||||||
|
@ -47,7 +46,7 @@ template<>
|
||||||
std::string to_string(int64_t value)
|
std::string to_string(int64_t value)
|
||||||
{
|
{
|
||||||
std::vector<char> buf(32);
|
std::vector<char> buf(32);
|
||||||
snprintf(buf.data(), buf.size(), "%lld", value);
|
snprintf(buf.data(), buf.size(), "%" PRId64, value);
|
||||||
return std::string(buf.data(), buf.data() + buf.size());
|
return std::string(buf.data(), buf.data() + buf.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +54,7 @@ template<>
|
||||||
std::string to_string(uint64_t value)
|
std::string to_string(uint64_t value)
|
||||||
{
|
{
|
||||||
std::vector<char> buf(32);
|
std::vector<char> buf(32);
|
||||||
snprintf(buf.data(), buf.size(), "%llu", value);
|
snprintf(buf.data(), buf.size(), "%" PRIu64, value);
|
||||||
return std::string(buf.data(), buf.data() + buf.size());
|
return std::string(buf.data(), buf.data() + buf.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +118,7 @@ void debug_handler::get_properties(obs_properties_t*, const AVCodec* codec, AVCo
|
||||||
} else {
|
} else {
|
||||||
auto unit_type = unit_types.find(opt->unit);
|
auto unit_type = unit_types.find(opt->unit);
|
||||||
if (unit_type == unit_types.end()) {
|
if (unit_type == unit_types.end()) {
|
||||||
DLOG_INFO(" [%s] Flag '%s' and help text '%s' with value '%lld'.", opt->unit, opt->name, opt->help,
|
DLOG_INFO(" [%s] Flag '%s' and help text '%s' with value '%" PRId64 "'.", opt->unit, opt->name, opt->help,
|
||||||
opt->default_val.i64);
|
opt->default_val.i64);
|
||||||
} else {
|
} else {
|
||||||
std::string out;
|
std::string out;
|
||||||
|
|
|
@ -60,7 +60,8 @@ namespace streamfx::encoder::ffmpeg {
|
||||||
virtual void get_properties(obs_properties_t* props, const AVCodec* codec, AVCodecContext* context,
|
virtual void get_properties(obs_properties_t* props, const AVCodec* codec, AVCodecContext* context,
|
||||||
bool hw_encode){};
|
bool hw_encode){};
|
||||||
|
|
||||||
virtual void migrate(obs_data_t* settings, std::uint64_t version, const AVCodec* codec, AVCodecContext* context){};
|
virtual void migrate(obs_data_t* settings, std::uint64_t version, const AVCodec* codec,
|
||||||
|
AVCodecContext* context){};
|
||||||
|
|
||||||
virtual void update(obs_data_t* settings, const AVCodec* codec, AVCodecContext* context){};
|
virtual void update(obs_data_t* settings, const AVCodec* codec, AVCodecContext* context){};
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include "ffmpeg/tools.hpp"
|
#include "ffmpeg/tools.hpp"
|
||||||
#include "nvenc_shared.hpp"
|
#include "nvenc_shared.hpp"
|
||||||
#include "plugin.hpp"
|
#include "plugin.hpp"
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include "ffmpeg/tools.hpp"
|
#include "ffmpeg/tools.hpp"
|
||||||
#include "nvenc_shared.hpp"
|
#include "nvenc_shared.hpp"
|
||||||
#include "plugin.hpp"
|
#include "plugin.hpp"
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <obs-module.h>
|
#include <obs-module.h>
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include "../encoder-ffmpeg.hpp"
|
#include "../encoder-ffmpeg.hpp"
|
||||||
#include "ffmpeg/tools.hpp"
|
#include "ffmpeg/tools.hpp"
|
||||||
#include "plugin.hpp"
|
#include "plugin.hpp"
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <obs-module.h>
|
#include <obs-module.h>
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <map>
|
#include <map>
|
||||||
#include "handler.hpp"
|
#include "handler.hpp"
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include "../codecs/prores.hpp"
|
#include "../codecs/prores.hpp"
|
||||||
#include "ffmpeg/tools.hpp"
|
#include "ffmpeg/tools.hpp"
|
||||||
#include "plugin.hpp"
|
#include "plugin.hpp"
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <obs-module.h>
|
#include <obs-module.h>
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
|
@ -88,8 +87,9 @@ std::list<device> d3d11::enumerate_adapters()
|
||||||
dxgi_adapter->GetDesc1(&desc);
|
dxgi_adapter->GetDesc1(&desc);
|
||||||
|
|
||||||
std::vector<char> buf(1024);
|
std::vector<char> buf(1024);
|
||||||
std::size_t len = snprintf(buf.data(), buf.size(), "%ls (VEN_%04x/DEV_%04x/SUB_%04x/REV_%04x)",
|
std::size_t len =
|
||||||
desc.Description, desc.VendorId, desc.DeviceId, desc.SubSysId, desc.Revision);
|
static_cast<size_t>(snprintf(buf.data(), buf.size(), "%ls (VEN_%04x/DEV_%04x/SUB_%04x/REV_%04x)",
|
||||||
|
desc.Description, desc.VendorId, desc.DeviceId, desc.SubSysId, desc.Revision));
|
||||||
|
|
||||||
device dev;
|
device dev;
|
||||||
dev.name = std::string(buf.data(), buf.data() + len);
|
dev.name = std::string(buf.data(), buf.data() + len);
|
||||||
|
|
|
@ -22,22 +22,17 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "base.hpp"
|
#include "base.hpp"
|
||||||
|
|
||||||
extern "C++" {
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4191)
|
#pragma warning(disable : 4191 4242 4244 4365 4777 4986 5039 5204)
|
||||||
#pragma warning(disable : 4242)
|
#endif
|
||||||
#pragma warning(disable : 4244)
|
|
||||||
#pragma warning(disable : 4365)
|
|
||||||
#pragma warning(disable : 4777)
|
|
||||||
#pragma warning(disable : 4986)
|
|
||||||
#pragma warning(disable : 5039)
|
|
||||||
#pragma warning(disable : 5204)
|
|
||||||
#include <atlutil.h>
|
#include <atlutil.h>
|
||||||
#include <d3d11.h>
|
#include <d3d11.h>
|
||||||
#include <d3d11_1.h>
|
#include <d3d11_1.h>
|
||||||
#include <dxgi.h>
|
#include <dxgi.h>
|
||||||
|
#ifdef _MSC_VER
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
}
|
#endif
|
||||||
|
|
||||||
namespace ffmpeg::hwapi {
|
namespace ffmpeg::hwapi {
|
||||||
class d3d11 : public ffmpeg::hwapi::base {
|
class d3d11 : public ffmpeg::hwapi::base {
|
||||||
|
|
|
@ -171,8 +171,10 @@ bool swscale::initialize(int flags)
|
||||||
throw std::invalid_argument("not all target parameters were set");
|
throw std::invalid_argument("not all target parameters were set");
|
||||||
}
|
}
|
||||||
|
|
||||||
this->context = sws_getContext(source_size.first, source_size.second, source_format, target_size.first,
|
this->context =
|
||||||
target_size.second, target_format, flags, nullptr, nullptr, nullptr);
|
sws_getContext(static_cast<int>(source_size.first), static_cast<int>(source_size.second), source_format,
|
||||||
|
static_cast<int>(target_size.first), static_cast<int>(target_size.second), target_format, flags,
|
||||||
|
nullptr, nullptr, nullptr);
|
||||||
if (!this->context) {
|
if (!this->context) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "plugin.hpp"
|
#include "plugin.hpp"
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
|
@ -39,44 +38,6 @@ extern "C" {
|
||||||
|
|
||||||
using namespace ffmpeg;
|
using namespace ffmpeg;
|
||||||
|
|
||||||
std::string tools::translate_encoder_capabilities(int capabilities)
|
|
||||||
{
|
|
||||||
// Sorted by relative importance.
|
|
||||||
std::pair<int, std::string> caps[] = {
|
|
||||||
{AV_CODEC_CAP_EXPERIMENTAL, "Experimental"},
|
|
||||||
|
|
||||||
// Quality
|
|
||||||
{AV_CODEC_CAP_LOSSLESS, "Lossless"},
|
|
||||||
|
|
||||||
// Features
|
|
||||||
{AV_CODEC_CAP_PARAM_CHANGE, "Dynamic Parameter Change"},
|
|
||||||
{AV_CODEC_CAP_SUBFRAMES, "Sub-Frames"},
|
|
||||||
{AV_CODEC_CAP_VARIABLE_FRAME_SIZE, "Variable Frame Size"},
|
|
||||||
{AV_CODEC_CAP_SMALL_LAST_FRAME, "Small Final Frame"},
|
|
||||||
|
|
||||||
// Other
|
|
||||||
{AV_CODEC_CAP_TRUNCATED, "Truncated"},
|
|
||||||
{AV_CODEC_CAP_CHANNEL_CONF, "AV_CODEC_CAP_CHANNEL_CONF"},
|
|
||||||
{AV_CODEC_CAP_DRAW_HORIZ_BAND, "AV_CODEC_CAP_DRAW_HORIZ_BAND"},
|
|
||||||
{AV_CODEC_CAP_AVOID_PROBING, "AV_CODEC_CAP_AVOID_PROBING"},
|
|
||||||
};
|
|
||||||
|
|
||||||
std::stringstream sstr;
|
|
||||||
for (auto const kv : caps) {
|
|
||||||
if (capabilities & kv.first) {
|
|
||||||
capabilities &= ~kv.first;
|
|
||||||
sstr << kv.second;
|
|
||||||
if (capabilities != 0) {
|
|
||||||
sstr << ", ";
|
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sstr.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* tools::get_pixel_format_name(AVPixelFormat v)
|
const char* tools::get_pixel_format_name(AVPixelFormat v)
|
||||||
{
|
{
|
||||||
return av_get_pix_fmt_name(v);
|
return av_get_pix_fmt_name(v);
|
||||||
|
@ -353,7 +314,7 @@ void tools::print_av_option_int(AVCodecContext* ctx_codec, void* ctx_option, con
|
||||||
ffmpeg::tools::get_error_description(err));
|
ffmpeg::tools::get_error_description(err));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DLOG_INFO("[%s] %s: %lld %s%s", ctx_codec->codec->name, text.c_str(), v, suffix.c_str(),
|
DLOG_INFO("[%s] %s: %" PRId64 " %s%s", ctx_codec->codec->name, text.c_str(), v, suffix.c_str(),
|
||||||
is_default ? " <Default>" : "");
|
is_default ? " <Default>" : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,8 +38,6 @@ extern "C" {
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ffmpeg::tools {
|
namespace ffmpeg::tools {
|
||||||
std::string translate_encoder_capabilities(int capabilities);
|
|
||||||
|
|
||||||
const char* get_pixel_format_name(AVPixelFormat v);
|
const char* get_pixel_format_name(AVPixelFormat v);
|
||||||
|
|
||||||
const char* get_color_space_name(AVColorSpace v);
|
const char* get_color_space_name(AVColorSpace v);
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "gfx/blur/gfx-blur-gaussian.hpp"
|
#include "gfx/blur/gfx-blur-gaussian.hpp"
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
#include "obs/obs-source-tracker.hpp"
|
#include "obs/obs-source-tracker.hpp"
|
||||||
#include "util-math.hpp"
|
|
||||||
|
|
||||||
// OBS
|
// OBS
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -399,7 +398,7 @@ void blur_instance::video_render(gs_effect_t* effect)
|
||||||
gs_stencil_op(GS_STENCIL_BOTH, GS_KEEP, GS_KEEP, GS_KEEP);
|
gs_stencil_op(GS_STENCIL_BOTH, GS_KEEP, GS_KEEP, GS_KEEP);
|
||||||
|
|
||||||
// Orthographic Camera and clear RenderTarget.
|
// Orthographic Camera and clear RenderTarget.
|
||||||
gs_ortho(0, (float)baseW, 0, (float)baseH, -1., 1.);
|
gs_ortho(0, static_cast<float>(baseW), 0, static_cast<float>(baseH), -1., 1.);
|
||||||
//gs_clear(GS_CLEAR_COLOR | GS_CLEAR_DEPTH, &black, 0, 0);
|
//gs_clear(GS_CLEAR_COLOR | GS_CLEAR_DEPTH, &black, 0, 0);
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "strings.hpp"
|
#include "strings.hpp"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
#include "util-math.hpp"
|
|
||||||
|
|
||||||
// OBS
|
// OBS
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
|
@ -233,7 +233,7 @@ void dynamic_mask_instance::video_render(gs_effect_t* in_effect)
|
||||||
gs_enable_stencil_write(false);
|
gs_enable_stencil_write(false);
|
||||||
gs_stencil_function(GS_STENCIL_BOTH, GS_ALWAYS);
|
gs_stencil_function(GS_STENCIL_BOTH, GS_ALWAYS);
|
||||||
gs_stencil_op(GS_STENCIL_BOTH, GS_KEEP, GS_KEEP, GS_KEEP);
|
gs_stencil_op(GS_STENCIL_BOTH, GS_KEEP, GS_KEEP, GS_KEEP);
|
||||||
gs_ortho(0, (float)width, 0, (float)height, -1., 1.);
|
gs_ortho(0, static_cast<float>(width), 0, static_cast<float>(height), -1., 1.);
|
||||||
|
|
||||||
obs_source_process_filter_end(_self, default_effect, width, height);
|
obs_source_process_filter_end(_self, default_effect, width, height);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include "nvidia/cuda/nvidia-cuda-context-stack.hpp"
|
#include "nvidia/cuda/nvidia-cuda-context-stack.hpp"
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
#include "obs/obs-tools.hpp"
|
#include "obs/obs-tools.hpp"
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
#define ST "Filter.Nvidia.FaceTracking"
|
#define ST "Filter.Nvidia.FaceTracking"
|
||||||
#define ST_ROI "Filter.Nvidia.FaceTracking.ROI"
|
#define ST_ROI "Filter.Nvidia.FaceTracking.ROI"
|
||||||
|
@ -76,10 +75,9 @@ face_tracking_instance::face_tracking_instance(obs_data_t* settings, obs_source_
|
||||||
{ // Create render target, vertex buffer, and CUDA stream.
|
{ // Create render target, vertex buffer, and CUDA stream.
|
||||||
auto gctx = gs::context{};
|
auto gctx = gs::context{};
|
||||||
_rt = std::make_shared<gs::rendertarget>(GS_RGBA, GS_ZS_NONE);
|
_rt = std::make_shared<gs::rendertarget>(GS_RGBA, GS_ZS_NONE);
|
||||||
_geometry = std::make_shared<gs::vertex_buffer>(4, 1);
|
_geometry = std::make_shared<gs::vertex_buffer>(uint32_t(4), uint8_t(1));
|
||||||
auto cctx = std::make_shared<::nvidia::cuda::context_stack>(_cuda, _cuda_ctx);
|
auto cctx = std::make_shared<::nvidia::cuda::context_stack>(_cuda, _cuda_ctx);
|
||||||
_cuda_stream =
|
_cuda_stream = std::make_shared<::nvidia::cuda::stream>(_cuda, ::nvidia::cuda::stream_flags::NON_BLOCKING, 0);
|
||||||
std::make_shared<::nvidia::cuda::stream>(_cuda, ::nvidia::cuda::stream_flags::NON_BLOCKING, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{ // Asynchronously load Face Tracking.
|
{ // Asynchronously load Face Tracking.
|
||||||
|
@ -235,7 +233,7 @@ void face_tracking_instance::async_track(std::shared_ptr<void> ptr)
|
||||||
gs::debug_marker marker{gs::debug_color_allocate, "Reallocate GPU Buffer"};
|
gs::debug_marker marker{gs::debug_color_allocate, "Reallocate GPU Buffer"};
|
||||||
#endif
|
#endif
|
||||||
_ar_texture =
|
_ar_texture =
|
||||||
std::make_shared<gs::texture>(_size.first, _size.second, GS_RGBA, 1, nullptr, gs::texture::flags::None);
|
std::make_shared<gs::texture>(_size.first, _size.second, GS_RGBA, uint32_t(1), nullptr, gs::texture::flags::None);
|
||||||
_ar_texture_cuda_fresh = false;
|
_ar_texture_cuda_fresh = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -312,7 +312,7 @@ void sdf_effects_instance::video_render(gs_effect_t* effect)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto op = _source_rt->render(baseW, baseH);
|
auto op = _source_rt->render(baseW, baseH);
|
||||||
gs_ortho(0, (float)baseW, 0, (float)baseH, -1, 1);
|
gs_ortho(0, static_cast<float>(baseW), 0, static_cast<float>(baseH), -1, 1);
|
||||||
gs_clear(GS_CLEAR_COLOR | GS_CLEAR_DEPTH, &color_transparent, 0, 0);
|
gs_clear(GS_CLEAR_COLOR | GS_CLEAR_DEPTH, &color_transparent, 0, 0);
|
||||||
|
|
||||||
if (obs_source_process_filter_begin(_self, GS_RGBA, OBS_ALLOW_DIRECT_RENDERING)) {
|
if (obs_source_process_filter_begin(_self, GS_RGBA, OBS_ALLOW_DIRECT_RENDERING)) {
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "strings.hpp"
|
#include "strings.hpp"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
#define ST "Filter.Shader"
|
#define ST "Filter.Shader"
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
#include "util-math.hpp"
|
|
||||||
|
|
||||||
// OBS
|
// OBS
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
@ -130,7 +129,7 @@ void transform_instance::update(obs_data_t* settings)
|
||||||
{
|
{
|
||||||
// Camera
|
// Camera
|
||||||
_camera_orthographic = obs_data_get_int(settings, ST_CAMERA) == 0;
|
_camera_orthographic = obs_data_get_int(settings, ST_CAMERA) == 0;
|
||||||
_camera_fov = (float)obs_data_get_double(settings, ST_CAMERA_FIELDOFVIEW);
|
_camera_fov = static_cast<float_t>(obs_data_get_double(settings, ST_CAMERA_FIELDOFVIEW));
|
||||||
|
|
||||||
// Source
|
// Source
|
||||||
_position->x = static_cast<float_t>(obs_data_get_double(settings, ST_POSITION_X) / 100.0);
|
_position->x = static_cast<float_t>(obs_data_get_double(settings, ST_POSITION_X) / 100.0);
|
||||||
|
@ -365,8 +364,9 @@ void transform_instance::video_render(gs_effect_t* effect)
|
||||||
|
|
||||||
std::size_t mip_levels = std::max(util::math::get_power_of_two_exponent_ceil(cache_width),
|
std::size_t mip_levels = std::max(util::math::get_power_of_two_exponent_ceil(cache_width),
|
||||||
util::math::get_power_of_two_exponent_ceil(cache_height));
|
util::math::get_power_of_two_exponent_ceil(cache_height));
|
||||||
_mipmap_texture = std::make_shared<gs::texture>(cache_width, cache_height, GS_RGBA, mip_levels, nullptr,
|
_mipmap_texture =
|
||||||
gs::texture::flags::None);
|
std::make_shared<gs::texture>(cache_width, cache_height, GS_RGBA, static_cast<uint32_t>(mip_levels),
|
||||||
|
nullptr, gs::texture::flags::None);
|
||||||
}
|
}
|
||||||
_mipmapper.rebuild(_cache_texture, _mipmap_texture);
|
_mipmapper.rebuild(_cache_texture, _mipmap_texture);
|
||||||
|
|
||||||
|
@ -457,7 +457,7 @@ const char* transform_factory::get_name()
|
||||||
|
|
||||||
void transform_factory::get_defaults2(obs_data_t* settings)
|
void transform_factory::get_defaults2(obs_data_t* settings)
|
||||||
{
|
{
|
||||||
obs_data_set_default_int(settings, ST_CAMERA, (int64_t)CameraMode::Orthographic);
|
obs_data_set_default_int(settings, ST_CAMERA, static_cast<int64_t>(CameraMode::Orthographic));
|
||||||
obs_data_set_default_double(settings, ST_CAMERA_FIELDOFVIEW, 90.0);
|
obs_data_set_default_double(settings, ST_CAMERA_FIELDOFVIEW, 90.0);
|
||||||
obs_data_set_default_double(settings, ST_POSITION_X, 0);
|
obs_data_set_default_double(settings, ST_POSITION_X, 0);
|
||||||
obs_data_set_default_double(settings, ST_POSITION_Y, 0);
|
obs_data_set_default_double(settings, ST_POSITION_Y, 0);
|
||||||
|
@ -465,7 +465,7 @@ void transform_factory::get_defaults2(obs_data_t* settings)
|
||||||
obs_data_set_default_double(settings, ST_ROTATION_X, 0);
|
obs_data_set_default_double(settings, ST_ROTATION_X, 0);
|
||||||
obs_data_set_default_double(settings, ST_ROTATION_Y, 0);
|
obs_data_set_default_double(settings, ST_ROTATION_Y, 0);
|
||||||
obs_data_set_default_double(settings, ST_ROTATION_Z, 0);
|
obs_data_set_default_double(settings, ST_ROTATION_Z, 0);
|
||||||
obs_data_set_default_int(settings, ST_ROTATION_ORDER, RotationOrder::ZXY);
|
obs_data_set_default_int(settings, ST_ROTATION_ORDER, static_cast<int64_t>(RotationOrder::ZXY));
|
||||||
obs_data_set_default_double(settings, ST_SCALE_X, 100);
|
obs_data_set_default_double(settings, ST_SCALE_X, 100);
|
||||||
obs_data_set_default_double(settings, ST_SCALE_Y, 100);
|
obs_data_set_default_double(settings, ST_SCALE_Y, 100);
|
||||||
obs_data_set_default_double(settings, ST_SHEAR_X, 0);
|
obs_data_set_default_double(settings, ST_SHEAR_X, 0);
|
||||||
|
@ -475,7 +475,7 @@ void transform_factory::get_defaults2(obs_data_t* settings)
|
||||||
|
|
||||||
static bool modified_properties(obs_properties_t* pr, obs_property_t*, obs_data_t* d) noexcept
|
static bool modified_properties(obs_properties_t* pr, obs_property_t*, obs_data_t* d) noexcept
|
||||||
try {
|
try {
|
||||||
switch ((CameraMode)obs_data_get_int(d, ST_CAMERA)) {
|
switch (static_cast<CameraMode>(obs_data_get_int(d, ST_CAMERA))) {
|
||||||
case CameraMode::Orthographic:
|
case CameraMode::Orthographic:
|
||||||
obs_property_set_visible(obs_properties_get(pr, ST_CAMERA_FIELDOFVIEW), false);
|
obs_property_set_visible(obs_properties_get(pr, ST_CAMERA_FIELDOFVIEW), false);
|
||||||
obs_property_set_visible(obs_properties_get(pr, ST_POSITION_Z), false);
|
obs_property_set_visible(obs_properties_get(pr, ST_POSITION_Z), false);
|
||||||
|
@ -507,8 +507,10 @@ obs_properties_t* transform_factory::get_properties2(transform_instance* data)
|
||||||
auto p = obs_properties_add_list(grp, ST_CAMERA, D_TRANSLATE(ST_CAMERA), OBS_COMBO_TYPE_LIST,
|
auto p = obs_properties_add_list(grp, ST_CAMERA, D_TRANSLATE(ST_CAMERA), OBS_COMBO_TYPE_LIST,
|
||||||
OBS_COMBO_FORMAT_INT);
|
OBS_COMBO_FORMAT_INT);
|
||||||
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_CAMERA)));
|
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_CAMERA)));
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(ST_CAMERA_ORTHOGRAPHIC), (int64_t)CameraMode::Orthographic);
|
obs_property_list_add_int(p, D_TRANSLATE(ST_CAMERA_ORTHOGRAPHIC),
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(ST_CAMERA_PERSPECTIVE), (int64_t)CameraMode::Perspective);
|
static_cast<int64_t>(CameraMode::Orthographic));
|
||||||
|
obs_property_list_add_int(p, D_TRANSLATE(ST_CAMERA_PERSPECTIVE),
|
||||||
|
static_cast<int64_t>(CameraMode::Perspective));
|
||||||
obs_property_set_modified_callback(p, modified_properties);
|
obs_property_set_modified_callback(p, modified_properties);
|
||||||
}
|
}
|
||||||
{ // Field Of View
|
{ // Field Of View
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
#include "plugin.hpp"
|
#include "plugin.hpp"
|
||||||
#include "util-math.hpp"
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
#include "plugin.hpp"
|
#include "plugin.hpp"
|
||||||
#include "util-math.hpp"
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
#include "plugin.hpp"
|
#include "plugin.hpp"
|
||||||
#include "util-math.hpp"
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
|
@ -260,7 +259,7 @@ std::shared_ptr<::gs::texture> gfx::blur::dual_filtering::render()
|
||||||
// Downsample
|
// Downsample
|
||||||
for (std::size_t n = 1; n <= actual_iterations; n++) {
|
for (std::size_t n = 1; n <= actual_iterations; n++) {
|
||||||
#ifdef ENABLE_PROFILING
|
#ifdef ENABLE_PROFILING
|
||||||
auto gdm = gs::debug_marker(gs::debug_color_azure_radiance, "Down %lld", n);
|
auto gdm = gs::debug_marker(gs::debug_color_azure_radiance, "Down %" PRIuMAX, n);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Select Texture
|
// Select Texture
|
||||||
|
@ -297,7 +296,7 @@ std::shared_ptr<::gs::texture> gfx::blur::dual_filtering::render()
|
||||||
// Upsample
|
// Upsample
|
||||||
for (std::size_t n = actual_iterations; n > 0; n--) {
|
for (std::size_t n = actual_iterations; n > 0; n--) {
|
||||||
#ifdef ENABLE_PROFILING
|
#ifdef ENABLE_PROFILING
|
||||||
auto gdm = gs::debug_marker(gs::debug_color_azure_radiance, "Up %lld", n);
|
auto gdm = gs::debug_marker(gs::debug_color_azure_radiance, "Up %" PRIuMAX, n);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Select Texture
|
// Select Texture
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "gfx-blur-gaussian-linear.hpp"
|
#include "gfx-blur-gaussian-linear.hpp"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
#include "util-math.hpp"
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
#include "plugin.hpp"
|
#include "plugin.hpp"
|
||||||
#include "util-math.hpp"
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
|
|
|
@ -123,10 +123,10 @@ std::shared_ptr<gs::texture> gfx::source_texture::render(std::size_t width, std:
|
||||||
auto cctr =
|
auto cctr =
|
||||||
gs::debug_marker(gs::debug_color_capture, "gfx::source_texture '%s'", obs_source_get_name(_child->get()));
|
gs::debug_marker(gs::debug_color_capture, "gfx::source_texture '%s'", obs_source_get_name(_child->get()));
|
||||||
#endif
|
#endif
|
||||||
auto op = _rt->render((uint32_t)width, (uint32_t)height);
|
auto op = _rt->render(static_cast<uint32_t>(width), static_cast<uint32_t>(height));
|
||||||
vec4 black;
|
vec4 black;
|
||||||
vec4_zero(&black);
|
vec4_zero(&black);
|
||||||
gs_ortho(0, (float_t)width, 0, (float_t)height, 0, 1);
|
gs_ortho(0, static_cast<float>(width), 0, static_cast<float_t>(height), 0, 1);
|
||||||
gs_clear(GS_CLEAR_COLOR, &black, 0, 0);
|
gs_clear(GS_CLEAR_COLOR, &black, 0, 0);
|
||||||
obs_source_video_render(_child->get());
|
obs_source_video_render(_child->get());
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,9 +96,9 @@ gfx::shader::basic_parameter::basic_parameter(gs::effect_parameter param, std::s
|
||||||
_keys[0] = get_key();
|
_keys[0] = get_key();
|
||||||
} else {
|
} else {
|
||||||
for (std::size_t idx = 0; idx < get_size(); idx++) {
|
for (std::size_t idx = 0; idx < get_size(); idx++) {
|
||||||
snprintf(string_buffer, sizeof(string_buffer), "[%d]", static_cast<int32_t>(idx));
|
snprintf(string_buffer, sizeof(string_buffer), "[%" PRId32 "]", static_cast<int32_t>(idx));
|
||||||
_names[idx] = std::string(string_buffer, string_buffer + strnlen(string_buffer, sizeof(string_buffer)));
|
_names[idx] = std::string(string_buffer, string_buffer + strnlen(string_buffer, sizeof(string_buffer)));
|
||||||
snprintf(string_buffer, sizeof(string_buffer), "%s[%d]", get_key().data(), static_cast<int32_t>(idx));
|
snprintf(string_buffer, sizeof(string_buffer), "%s[%" PRId32 "]", get_key().data(), static_cast<int32_t>(idx));
|
||||||
_keys[idx] = std::string(string_buffer, string_buffer + strnlen(string_buffer, sizeof(string_buffer)));
|
_keys[idx] = std::string(string_buffer, string_buffer + strnlen(string_buffer, sizeof(string_buffer)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,7 +203,7 @@ void gfx::shader::bool_parameter::update(obs_data_t* settings)
|
||||||
|
|
||||||
// TODO: Support for bool[]
|
// TODO: Support for bool[]
|
||||||
if (get_size() == 1) {
|
if (get_size() == 1) {
|
||||||
_data[0] = obs_data_get_int(settings, get_key().data());
|
_data[0] = static_cast<int32_t>(obs_data_get_int(settings, get_key().data()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,13 +101,13 @@ namespace gfx {
|
||||||
bool_parameter(gs::effect_parameter param, std::string prefix);
|
bool_parameter(gs::effect_parameter param, std::string prefix);
|
||||||
virtual ~bool_parameter();
|
virtual ~bool_parameter();
|
||||||
|
|
||||||
virtual void defaults(obs_data_t* settings);
|
void defaults(obs_data_t* settings) override;
|
||||||
|
|
||||||
virtual void properties(obs_properties_t* props, obs_data_t* settings) override;
|
void properties(obs_properties_t* props, obs_data_t* settings) override;
|
||||||
|
|
||||||
virtual void update(obs_data_t* settings) override;
|
void update(obs_data_t* settings) override;
|
||||||
|
|
||||||
virtual void assign() override;
|
void assign() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct float_parameter : public basic_parameter {
|
struct float_parameter : public basic_parameter {
|
||||||
|
@ -117,13 +117,13 @@ namespace gfx {
|
||||||
float_parameter(gs::effect_parameter param, std::string prefix);
|
float_parameter(gs::effect_parameter param, std::string prefix);
|
||||||
virtual ~float_parameter();
|
virtual ~float_parameter();
|
||||||
|
|
||||||
virtual void defaults(obs_data_t* settings);
|
void defaults(obs_data_t* settings) override;
|
||||||
|
|
||||||
virtual void properties(obs_properties_t* props, obs_data_t* settings) override;
|
void properties(obs_properties_t* props, obs_data_t* settings) override;
|
||||||
|
|
||||||
virtual void update(obs_data_t* settings) override;
|
void update(obs_data_t* settings) override;
|
||||||
|
|
||||||
virtual void assign() override;
|
void assign() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct int_parameter : public basic_parameter {
|
struct int_parameter : public basic_parameter {
|
||||||
|
@ -133,13 +133,13 @@ namespace gfx {
|
||||||
int_parameter(gs::effect_parameter param, std::string prefix);
|
int_parameter(gs::effect_parameter param, std::string prefix);
|
||||||
virtual ~int_parameter();
|
virtual ~int_parameter();
|
||||||
|
|
||||||
virtual void defaults(obs_data_t* settings);
|
void defaults(obs_data_t* settings) override;
|
||||||
|
|
||||||
virtual void properties(obs_properties_t* props, obs_data_t* settings) override;
|
void properties(obs_properties_t* props, obs_data_t* settings) override;
|
||||||
|
|
||||||
virtual void update(obs_data_t* settings) override;
|
void update(obs_data_t* settings) override;
|
||||||
|
|
||||||
virtual void assign() override;
|
void assign() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace shader
|
} // namespace shader
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4191 4365 4777 5039 5204)
|
#pragma warning(disable : 4191 4242 4244 4365 4777 4986 5039 5204)
|
||||||
#endif
|
#endif
|
||||||
#include <atlutil.h>
|
#include <atlutil.h>
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
|
@ -28,8 +28,7 @@ namespace nvidia::cuda {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
stream(std::shared_ptr<::nvidia::cuda::cuda> cuda,
|
stream(std::shared_ptr<::nvidia::cuda::cuda> cuda,
|
||||||
::nvidia::cuda::stream_flags flags = ::nvidia::cuda::stream_flags::DEFAULT,
|
::nvidia::cuda::stream_flags flags = ::nvidia::cuda::stream_flags::DEFAULT, std::int32_t priority = 0);
|
||||||
std::int32_t priority = 0);
|
|
||||||
~stream();
|
~stream();
|
||||||
|
|
||||||
::nvidia::cuda::stream_t get();
|
::nvidia::cuda::stream_t get();
|
||||||
|
|
|
@ -18,10 +18,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include "common.hpp"
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
|
|
|
@ -31,12 +31,12 @@ gs::index_buffer::index_buffer(std::uint32_t maximumVertices)
|
||||||
|
|
||||||
gs::index_buffer::index_buffer() : index_buffer(MAXIMUM_VERTICES) {}
|
gs::index_buffer::index_buffer() : index_buffer(MAXIMUM_VERTICES) {}
|
||||||
|
|
||||||
gs::index_buffer::index_buffer(index_buffer& other) : index_buffer((uint32_t)other.size())
|
gs::index_buffer::index_buffer(index_buffer& other) : index_buffer(static_cast<uint32_t>(other.size()))
|
||||||
{
|
{
|
||||||
std::copy(other.begin(), other.end(), this->end());
|
std::copy(other.begin(), other.end(), this->end());
|
||||||
}
|
}
|
||||||
|
|
||||||
gs::index_buffer::index_buffer(std::vector<uint32_t>& other) : index_buffer((uint32_t)other.size())
|
gs::index_buffer::index_buffer(std::vector<uint32_t>& other) : index_buffer(static_cast<uint32_t>(other.size()))
|
||||||
{
|
{
|
||||||
std::copy(other.begin(), other.end(), this->end());
|
std::copy(other.begin(), other.end(), this->end());
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4201 4365 5039)
|
#pragma warning(disable : 4191 4242 4244 4365 4777 4986 5039 5204)
|
||||||
#endif
|
#endif
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <atlutil.h>
|
#include <atlutil.h>
|
||||||
|
@ -118,7 +118,6 @@ void gs::mipmapper::rebuild(std::shared_ptr<gs::texture> source, std::shared_ptr
|
||||||
ID3D11Resource* d3d_source = nullptr;
|
ID3D11Resource* d3d_source = nullptr;
|
||||||
ID3D11Resource* d3d_target = nullptr;
|
ID3D11Resource* d3d_target = nullptr;
|
||||||
if (gs_get_device_type() == GS_DEVICE_DIRECT3D_11) {
|
if (gs_get_device_type() == GS_DEVICE_DIRECT3D_11) {
|
||||||
D3D11_TEXTURE2D_DESC td;
|
|
||||||
d3d_source = reinterpret_cast<ID3D11Resource*>(gs_texture_get_obj(source->get_object()));
|
d3d_source = reinterpret_cast<ID3D11Resource*>(gs_texture_get_obj(source->get_object()));
|
||||||
d3d_target = reinterpret_cast<ID3D11Resource*>(gs_texture_get_obj(target->get_object()));
|
d3d_target = reinterpret_cast<ID3D11Resource*>(gs_texture_get_obj(target->get_object()));
|
||||||
d3d_device = reinterpret_cast<ID3D11Device*>(gs_get_device_obj());
|
d3d_device = reinterpret_cast<ID3D11Device*>(gs_get_device_obj());
|
||||||
|
@ -138,14 +137,14 @@ void gs::mipmapper::rebuild(std::shared_ptr<gs::texture> source, std::shared_ptr
|
||||||
|
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_PROFILING
|
#ifdef ENABLE_PROFILING
|
||||||
auto cctr = gs::debug_marker(gs::debug_color_azure_radiance, "Mip Level %lld", 0);
|
auto cctr = gs::debug_marker(gs::debug_color_azure_radiance, "Mip Level %" PRId64 "", 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (gs_get_device_type() == GS_DEVICE_DIRECT3D_11) {
|
if (gs_get_device_type() == GS_DEVICE_DIRECT3D_11) {
|
||||||
{ // Retrieve maximum mip map level.
|
{ // Retrieve maximum mip map level.
|
||||||
D3D11_TEXTURE2D_DESC td;
|
D3D11_TEXTURE2D_DESC td;
|
||||||
reinterpret_cast<ID3D11Texture2D*>(d3d_target)->GetDesc(&td);
|
static_cast<ID3D11Texture2D*>(d3d_target)->GetDesc(&td);
|
||||||
max_mip_level = td.MipLevels;
|
max_mip_level = td.MipLevels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,13 +164,13 @@ void gs::mipmapper::rebuild(std::shared_ptr<gs::texture> source, std::shared_ptr
|
||||||
// Render each mip map level.
|
// Render each mip map level.
|
||||||
for (size_t mip = 1; mip < max_mip_level; mip++) {
|
for (size_t mip = 1; mip < max_mip_level; mip++) {
|
||||||
#ifdef ENABLE_PROFILING
|
#ifdef ENABLE_PROFILING
|
||||||
auto cctr = gs::debug_marker(gs::debug_color_azure_radiance, "Mip Level %lld", mip);
|
auto cctr = gs::debug_marker(gs::debug_color_azure_radiance, "Mip Level %" PRIuMAX, mip);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t cwidth = std::max<uint32_t>(width >> mip, 1);
|
uint32_t cwidth = std::max<uint32_t>(width >> mip, 1);
|
||||||
uint32_t cheight = std::max<uint32_t>(height >> mip, 1);
|
uint32_t cheight = std::max<uint32_t>(height >> mip, 1);
|
||||||
float_t iwidth = 1. / static_cast<float_t>(cwidth);
|
float_t iwidth = 1.f / static_cast<float_t>(cwidth);
|
||||||
float_t iheight = 1. / static_cast<float_t>(cheight);
|
float_t iheight = 1.f / static_cast<float_t>(cheight);
|
||||||
|
|
||||||
// Set up rendering state.
|
// Set up rendering state.
|
||||||
gs_load_vertexbuffer(_vb->update(false));
|
gs_load_vertexbuffer(_vb->update(false));
|
||||||
|
@ -187,7 +186,7 @@ void gs::mipmapper::rebuild(std::shared_ptr<gs::texture> source, std::shared_ptr
|
||||||
gs_set_cull_mode(GS_NEITHER);
|
gs_set_cull_mode(GS_NEITHER);
|
||||||
try {
|
try {
|
||||||
auto op = _rt->render(width, height);
|
auto op = _rt->render(width, height);
|
||||||
gs_set_viewport(0, 0, cwidth, cheight);
|
gs_set_viewport(0, 0, static_cast<int>(cwidth), static_cast<int>(cheight));
|
||||||
gs_ortho(0, 1, 0, 1, 0, 1);
|
gs_ortho(0, 1, 0, 1, 0, 1);
|
||||||
|
|
||||||
vec4 black = {1., 1., 1., 1};
|
vec4 black = {1., 1., 1., 1};
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#include "gs-sampler.hpp"
|
#include "gs-sampler.hpp"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
gs::sampler::sampler()
|
gs::sampler::sampler()
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
#include "util-math.hpp"
|
|
||||||
|
|
||||||
static std::uint32_t decode_flags(gs::texture::flags texture_flags)
|
static std::uint32_t decode_flags(gs::texture::flags texture_flags)
|
||||||
{
|
{
|
||||||
|
@ -74,9 +73,9 @@ gs::texture::texture(std::uint32_t width, std::uint32_t height, std::uint32_t de
|
||||||
throw std::logic_error("mip_levels must be at least 1");
|
throw std::logic_error("mip_levels must be at least 1");
|
||||||
|
|
||||||
if (mip_levels > 1 || ((texture_flags & flags::BuildMipMaps) == flags::BuildMipMaps)) {
|
if (mip_levels > 1 || ((texture_flags & flags::BuildMipMaps) == flags::BuildMipMaps)) {
|
||||||
bool isPOT = (util::math::is_equal(pow(2, (int64_t)floor(log(width) / log(2))), width)
|
bool isPOT = (util::math::is_equal(pow(2, static_cast<int64_t>(floor(log(width) / log(2)))), width)
|
||||||
&& util::math::is_equal(pow(2, (int64_t)floor(log(height) / log(2))), height)
|
&& util::math::is_equal(pow(2, static_cast<int64_t>(floor(log(height) / log(2)))), height)
|
||||||
&& util::math::is_equal(pow(2, (int64_t)floor(log(depth) / log(2))), depth));
|
&& util::math::is_equal(pow(2, static_cast<int64_t>(floor(log(depth) / log(2)))), depth));
|
||||||
if (!isPOT)
|
if (!isPOT)
|
||||||
throw std::logic_error("mip mapping requires power of two dimensions");
|
throw std::logic_error("mip mapping requires power of two dimensions");
|
||||||
}
|
}
|
||||||
|
@ -102,7 +101,7 @@ gs::texture::texture(std::uint32_t size, gs_color_format format, std::uint32_t m
|
||||||
throw std::logic_error("mip_levels must be at least 1");
|
throw std::logic_error("mip_levels must be at least 1");
|
||||||
|
|
||||||
if (mip_levels > 1 || ((texture_flags & flags::BuildMipMaps) == flags::BuildMipMaps)) {
|
if (mip_levels > 1 || ((texture_flags & flags::BuildMipMaps) == flags::BuildMipMaps)) {
|
||||||
bool isPOT = util::math::is_equal(pow(2, (int64_t)floor(log(size) / log(2))), size);
|
bool isPOT = util::math::is_equal(pow(2, static_cast<int64_t>(floor(log(size) / log(2)))), size);
|
||||||
if (!isPOT)
|
if (!isPOT)
|
||||||
throw std::logic_error("mip mapping requires power of two dimensions");
|
throw std::logic_error("mip mapping requires power of two dimensions");
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
namespace gs {
|
namespace gs {
|
||||||
class texture {
|
class texture {
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#include "gs-vertex.hpp"
|
#include "gs-vertex.hpp"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
gs::vertex::vertex()
|
gs::vertex::vertex()
|
||||||
: position(nullptr), normal(nullptr), tangent(nullptr), color(nullptr), _has_store(true), _store(nullptr)
|
: position(nullptr), normal(nullptr), tangent(nullptr), color(nullptr), _has_store(true), _store(nullptr)
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#include "gs-vertexbuffer.hpp"
|
#include "gs-vertexbuffer.hpp"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
void gs::vertex_buffer::initialize(uint32_t capacity, uint8_t layers)
|
void gs::vertex_buffer::initialize(uint32_t capacity, uint8_t layers)
|
||||||
{
|
{
|
||||||
|
@ -37,10 +36,10 @@ void gs::vertex_buffer::initialize(uint32_t capacity, uint8_t layers)
|
||||||
_data = std::make_shared<decltype(_data)::element_type>();
|
_data = std::make_shared<decltype(_data)::element_type>();
|
||||||
_data->num = _capacity;
|
_data->num = _capacity;
|
||||||
_data->num_tex = _layers;
|
_data->num_tex = _layers;
|
||||||
_data->points = _positions = (vec3*)util::malloc_aligned(16, sizeof(vec3) * _capacity);
|
_data->points = _positions = static_cast<vec3*>(util::malloc_aligned(16, sizeof(vec3) * _capacity));
|
||||||
_data->normals = _normals = (vec3*)util::malloc_aligned(16, sizeof(vec3) * _capacity);
|
_data->normals = _normals = static_cast<vec3*>(util::malloc_aligned(16, sizeof(vec3) * _capacity));
|
||||||
_data->tangents = _tangents = (vec3*)util::malloc_aligned(16, sizeof(vec3) * _capacity);
|
_data->tangents = _tangents = static_cast<vec3*>(util::malloc_aligned(16, sizeof(vec3) * _capacity));
|
||||||
_data->colors = _colors = (uint32_t*)util::malloc_aligned(16, sizeof(uint32_t) * _capacity);
|
_data->colors = _colors = static_cast<uint32_t*>(util::malloc_aligned(16, sizeof(uint32_t) * _capacity));
|
||||||
|
|
||||||
// Clear the allocated memory of any data.
|
// Clear the allocated memory of any data.
|
||||||
memset(_positions, 0, sizeof(vec3) * _capacity);
|
memset(_positions, 0, sizeof(vec3) * _capacity);
|
||||||
|
@ -51,9 +50,10 @@ void gs::vertex_buffer::initialize(uint32_t capacity, uint8_t layers)
|
||||||
if (_layers == 0) {
|
if (_layers == 0) {
|
||||||
_data->tvarray = nullptr;
|
_data->tvarray = nullptr;
|
||||||
} else {
|
} else {
|
||||||
_data->tvarray = _uv_layers = (gs_tvertarray*)util::malloc_aligned(16, sizeof(gs_tvertarray) * _layers);
|
_data->tvarray = _uv_layers =
|
||||||
|
static_cast<gs_tvertarray*>(util::malloc_aligned(16, sizeof(gs_tvertarray) * _layers));
|
||||||
for (uint8_t n = 0; n < _layers; n++) {
|
for (uint8_t n = 0; n < _layers; n++) {
|
||||||
_uv_layers[n].array = _uvs[n] = (vec4*)util::malloc_aligned(16, sizeof(vec4) * _capacity);
|
_uv_layers[n].array = _uvs[n] = static_cast<vec4*>(util::malloc_aligned(16, sizeof(vec4) * _capacity));
|
||||||
_uv_layers[n].width = 4;
|
_uv_layers[n].width = 4;
|
||||||
memset(_uvs[n], 0, sizeof(vec4) * _capacity);
|
memset(_uvs[n], 0, sizeof(vec4) * _capacity);
|
||||||
}
|
}
|
||||||
|
@ -62,8 +62,8 @@ void gs::vertex_buffer::initialize(uint32_t capacity, uint8_t layers)
|
||||||
// Allocate actual GPU vertex buffer.
|
// Allocate actual GPU vertex buffer.
|
||||||
{
|
{
|
||||||
auto gctx = gs::context();
|
auto gctx = gs::context();
|
||||||
_buffer =
|
_buffer = decltype(_buffer)(gs_vertexbuffer_create(_data.get(), GS_DYNAMIC | GS_DUP_BUFFER),
|
||||||
decltype(_buffer)(gs_vertexbuffer_create(_data.get(), GS_DYNAMIC | GS_DUP_BUFFER), [this](gs_vertbuffer_t* v) {
|
[this](gs_vertbuffer_t* v) {
|
||||||
try {
|
try {
|
||||||
auto gctx = gs::context();
|
auto gctx = gs::context();
|
||||||
gs_vertexbuffer_destroy(v);
|
gs_vertexbuffer_destroy(v);
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "gs-limits.hpp"
|
#include "gs-limits.hpp"
|
||||||
#include "gs-vertex.hpp"
|
#include "gs-vertex.hpp"
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
namespace gs {
|
namespace gs {
|
||||||
class vertex_buffer {
|
class vertex_buffer {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "util-event.hpp"
|
#include "util/util-event.hpp"
|
||||||
|
|
||||||
namespace obs {
|
namespace obs {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
|
@ -785,7 +785,7 @@ obs::deprecated_source& obs::deprecated_source::operator=(deprecated_source&& ot
|
||||||
obs_source_type obs::deprecated_source::type()
|
obs_source_type obs::deprecated_source::type()
|
||||||
{
|
{
|
||||||
if (!_self) {
|
if (!_self) {
|
||||||
return (obs_source_type)-1;
|
return static_cast<obs_source_type>(-1);
|
||||||
}
|
}
|
||||||
return obs_source_get_type(_self);
|
return obs_source_get_type(_self);
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
#include "util-event.hpp"
|
#include "util/util-event.hpp"
|
||||||
|
|
||||||
namespace obs {
|
namespace obs {
|
||||||
class deprecated_source {
|
class deprecated_source {
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "configuration.hpp"
|
#include "configuration.hpp"
|
||||||
#include "obs/obs-source-tracker.hpp"
|
|
||||||
#include "obs/gs/gs-vertexbuffer.hpp"
|
#include "obs/gs/gs-vertexbuffer.hpp"
|
||||||
|
#include "obs/obs-source-tracker.hpp"
|
||||||
|
|
||||||
#ifdef ENABLE_ENCODER_FFMPEG
|
#ifdef ENABLE_ENCODER_FFMPEG
|
||||||
#include "encoders/encoder-ffmpeg.hpp"
|
#include "encoders/encoder-ffmpeg.hpp"
|
||||||
|
@ -86,7 +86,7 @@ try {
|
||||||
|
|
||||||
// GS Stuff
|
// GS Stuff
|
||||||
{
|
{
|
||||||
_gs_fstri_vb = std::make_shared<gs::vertex_buffer>(3, 1);
|
_gs_fstri_vb = std::make_shared<gs::vertex_buffer>(uint32_t(3), uint8_t(1));
|
||||||
{
|
{
|
||||||
auto vtx = _gs_fstri_vb->at(0);
|
auto vtx = _gs_fstri_vb->at(0);
|
||||||
vec3_set(vtx.position, 0, 0, 0);
|
vec3_set(vtx.position, 0, 0, 0);
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include "strings.hpp"
|
#include "strings.hpp"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
#define ST "Source.Shader"
|
#define ST "Source.Shader"
|
||||||
|
|
||||||
|
|
|
@ -21,14 +21,13 @@
|
||||||
#include "strings.hpp"
|
#include "strings.hpp"
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
#include "utility.hpp"
|
|
||||||
|
|
||||||
#define ST "Transition.Shader"
|
#define ST "Transition.Shader"
|
||||||
|
|
||||||
using namespace streamfx::transition::shader;
|
using namespace streamfx::transition::shader;
|
||||||
|
|
||||||
shader_instance::shader_instance(obs_data_t* data, obs_source_t* self)
|
shader_instance::shader_instance(obs_data_t* data, obs_source_t* self)
|
||||||
: obs::source_instance(data, self), _is_main(false)
|
: obs::source_instance(data, self)
|
||||||
{
|
{
|
||||||
_fx = std::make_shared<gfx::shader::shader>(self, gfx::shader::shader_mode::Transition);
|
_fx = std::make_shared<gfx::shader::shader>(self, gfx::shader::shader_mode::Transition);
|
||||||
|
|
||||||
|
@ -110,7 +109,8 @@ bool shader_instance::audio_render(uint64_t* ts_out, obs_source_audio_mix* audio
|
||||||
[](void*, float_t t) { return t; });
|
[](void*, float_t t) { return t; });
|
||||||
}
|
}
|
||||||
|
|
||||||
void shader_instance::transition_start() {
|
void shader_instance::transition_start()
|
||||||
|
{
|
||||||
_fx->set_active(true);
|
_fx->set_active(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,6 @@ namespace streamfx::transition::shader {
|
||||||
class shader_instance : public obs::source_instance {
|
class shader_instance : public obs::source_instance {
|
||||||
std::shared_ptr<gfx::shader::shader> _fx;
|
std::shared_ptr<gfx::shader::shader> _fx;
|
||||||
|
|
||||||
bool _is_main;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
shader_instance(obs_data_t* data, obs_source_t* self);
|
shader_instance(obs_data_t* data, obs_source_t* self);
|
||||||
virtual ~shader_instance();
|
virtual ~shader_instance();
|
||||||
|
|
|
@ -70,6 +70,8 @@ streamfx::ui::about_entry::about_entry(QWidget* parent, streamfx::ui::about::ent
|
||||||
case streamfx::ui::about::role_type::CREATOR:
|
case streamfx::ui::about::role_type::CREATOR:
|
||||||
title->setText(D_TRANSLATE(i18n_role_creator.data()));
|
title->setText(D_TRANSLATE(i18n_role_creator.data()));
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::tuple<streamfx::ui::about::link_type, std::string, std::string, QPushButton*, QUrl&> els[]{
|
std::tuple<streamfx::ui::about::link_type, std::string, std::string, QPushButton*, QUrl&> els[]{
|
||||||
|
@ -99,6 +101,8 @@ streamfx::ui::about_entry::about_entry(QWidget* parent, streamfx::ui::about::ent
|
||||||
case streamfx::ui::about::link_type::SOCIAL_FACEBOOK:
|
case streamfx::ui::about::link_type::SOCIAL_FACEBOOK:
|
||||||
std::get<3>(el)->setIcon(QIcon(":/linktype/facebook"));
|
std::get<3>(el)->setIcon(QIcon(":/linktype/facebook"));
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
std::get<3>(el)->setText(QString::fromUtf8(std::get<2>(el).c_str()));
|
std::get<3>(el)->setText(QString::fromUtf8(std::get<2>(el).c_str()));
|
||||||
std::get<4>(el).setUrl(QString::fromStdString(std::get<1>(el)));
|
std::get<4>(el).setUrl(QString::fromStdString(std::get<1>(el)));
|
||||||
|
|
|
@ -34,7 +34,7 @@ void util::profiler::track(std::chrono::nanoseconds duration)
|
||||||
std::unique_lock<std::mutex> ul(_timings_lock);
|
std::unique_lock<std::mutex> ul(_timings_lock);
|
||||||
auto itr = _timings.find(duration);
|
auto itr = _timings.find(duration);
|
||||||
if (itr == _timings.end()) {
|
if (itr == _timings.end()) {
|
||||||
_timings.insert({duration, 1});
|
_timings.emplace(duration, 1u);
|
||||||
} else {
|
} else {
|
||||||
itr->second++;
|
itr->second++;
|
||||||
}
|
}
|
||||||
|
@ -113,10 +113,7 @@ std::chrono::nanoseconds util::profiler::percentile(double_t percentile, bool by
|
||||||
// Find largest and smallest time.
|
// Find largest and smallest time.
|
||||||
std::chrono::nanoseconds smallest = copy_timings.begin()->first;
|
std::chrono::nanoseconds smallest = copy_timings.begin()->first;
|
||||||
std::chrono::nanoseconds largest = copy_timings.rbegin()->first;
|
std::chrono::nanoseconds largest = copy_timings.rbegin()->first;
|
||||||
|
|
||||||
std::chrono::nanoseconds variance = largest - smallest;
|
std::chrono::nanoseconds variance = largest - smallest;
|
||||||
std::chrono::nanoseconds threshold =
|
|
||||||
std::chrono::nanoseconds(smallest.count() + int64_t(variance.count() * percentile));
|
|
||||||
|
|
||||||
for (auto kv : copy_timings) {
|
for (auto kv : copy_timings) {
|
||||||
double_t kv_pct = double_t((kv.first - smallest).count()) / double_t(variance.count());
|
double_t kv_pct = double_t((kv.first - smallest).count()) / double_t(variance.count());
|
|
@ -101,12 +101,14 @@ void util::threadpool::work()
|
||||||
try {
|
try {
|
||||||
local_work->_callback(local_work->_data);
|
local_work->_callback(local_work->_data);
|
||||||
} catch (std::exception const& ex) {
|
} catch (std::exception const& ex) {
|
||||||
DLOG_WARNING(LOCAL_PREFIX "Worker %lX caught exception from task (%tX, %tX) with message: %s",
|
DLOG_WARNING(LOCAL_PREFIX "Worker %" PRIx32 " caught exception from task (%" PRIxPTR ", %" PRIxPTR
|
||||||
local_number, local_work->_callback.target<ptrdiff_t>(),
|
") with message: %s",
|
||||||
|
local_number, reinterpret_cast<ptrdiff_t>(local_work->_callback.target<void>()),
|
||||||
reinterpret_cast<ptrdiff_t>(local_work->_data.get()), ex.what());
|
reinterpret_cast<ptrdiff_t>(local_work->_data.get()), ex.what());
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
DLOG_WARNING(LOCAL_PREFIX "Worker %lX caught exception of unknown type from task (%tX, %tX).",
|
DLOG_WARNING(LOCAL_PREFIX "Worker %" PRIx32 " caught exception of unknown type from task (%" PRIxPTR
|
||||||
local_number, local_work->_callback.target<ptrdiff_t>(),
|
", %" PRIxPTR ").",
|
||||||
|
local_number, reinterpret_cast<ptrdiff_t>(local_work->_callback.target<void>()),
|
||||||
reinterpret_cast<ptrdiff_t>(local_work->_data.get()));
|
reinterpret_cast<ptrdiff_t>(local_work->_data.get()));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue