mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-11 06:15:05 +00:00
project: Remove non-standard std:: prefix from types
This commit is contained in:
parent
4947ae9a13
commit
63a5873413
69 changed files with 349 additions and 357 deletions
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
using namespace streamfx::encoder::codec;
|
using namespace streamfx::encoder::codec;
|
||||||
|
|
||||||
enum class nal_unit_type : std::uint8_t { // 6 bits
|
enum class nal_unit_type : uint8_t { // 6 bits
|
||||||
TRAIL_N = 0,
|
TRAIL_N = 0,
|
||||||
TRAIL_R = 1,
|
TRAIL_R = 1,
|
||||||
TSA_N = 2,
|
TSA_N = 2,
|
||||||
|
@ -93,17 +93,17 @@ enum class nal_unit_type : std::uint8_t { // 6 bits
|
||||||
struct hevc_nal_unit_header {
|
struct hevc_nal_unit_header {
|
||||||
bool zero_bit : 1;
|
bool zero_bit : 1;
|
||||||
nal_unit_type nut : 6;
|
nal_unit_type nut : 6;
|
||||||
std::uint8_t layer_id : 6;
|
uint8_t layer_id : 6;
|
||||||
std::uint8_t temporal_id_plus1 : 3;
|
uint8_t temporal_id_plus1 : 3;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct hevc_nal {
|
struct hevc_nal {
|
||||||
hevc_nal_unit_header* header;
|
hevc_nal_unit_header* header;
|
||||||
std::size_t size = 0;
|
std::size_t size = 0;
|
||||||
std::uint8_t* data = nullptr;
|
uint8_t* data = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool is_nal(std::uint8_t* data, std::uint8_t* end)
|
bool is_nal(uint8_t* data, uint8_t* end)
|
||||||
{
|
{
|
||||||
std::size_t s = static_cast<size_t>(end - data);
|
std::size_t s = static_cast<size_t>(end - data);
|
||||||
if (s < 4)
|
if (s < 4)
|
||||||
|
@ -121,7 +121,7 @@ bool is_nal(std::uint8_t* data, std::uint8_t* end)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool seek_to_nal(std::uint8_t*& data, std::uint8_t* end)
|
bool seek_to_nal(uint8_t*& data, uint8_t* end)
|
||||||
{
|
{
|
||||||
if (data > end)
|
if (data > end)
|
||||||
return false;
|
return false;
|
||||||
|
@ -135,16 +135,16 @@ bool seek_to_nal(std::uint8_t*& data, std::uint8_t* end)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::size_t get_nal_size(std::uint8_t* data, std::uint8_t* end)
|
std::size_t get_nal_size(uint8_t* data, uint8_t* end)
|
||||||
{
|
{
|
||||||
std::uint8_t* ptr = data + 4;
|
uint8_t* ptr = data + 4;
|
||||||
if (!seek_to_nal(ptr, end)) {
|
if (!seek_to_nal(ptr, end)) {
|
||||||
return static_cast<size_t>(end - data);
|
return static_cast<size_t>(end - data);
|
||||||
}
|
}
|
||||||
return static_cast<size_t>(ptr - data);
|
return static_cast<size_t>(ptr - data);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_discard_marker(std::uint8_t* data, std::uint8_t* end)
|
bool is_discard_marker(uint8_t* data, uint8_t* end)
|
||||||
{
|
{
|
||||||
std::size_t s = static_cast<size_t>(end - data);
|
std::size_t s = static_cast<size_t>(end - data);
|
||||||
if (s < 4)
|
if (s < 4)
|
||||||
|
@ -179,7 +179,7 @@ bool is_discard_marker(std::uint8_t* data, std::uint8_t* end)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool should_discard_nal(std::uint8_t* data, std::uint8_t* end)
|
bool should_discard_nal(uint8_t* data, uint8_t* end)
|
||||||
{
|
{
|
||||||
if (data > end)
|
if (data > end)
|
||||||
return true;
|
return true;
|
||||||
|
@ -192,17 +192,17 @@ bool should_discard_nal(std::uint8_t* data, std::uint8_t* end)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void progress_parse(std::uint8_t*& ptr, std::uint8_t* end, size_t& sz)
|
void progress_parse(uint8_t*& ptr, uint8_t* end, size_t& sz)
|
||||||
{
|
{
|
||||||
ptr += sz;
|
ptr += sz;
|
||||||
sz = get_nal_size(ptr, end);
|
sz = get_nal_size(ptr, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
void hevc::extract_header_sei(std::uint8_t* data, std::size_t sz_data, std::vector<std::uint8_t>& header,
|
void hevc::extract_header_sei(uint8_t* data, std::size_t sz_data, std::vector<uint8_t>& header,
|
||||||
std::vector<std::uint8_t>& sei)
|
std::vector<uint8_t>& sei)
|
||||||
{
|
{
|
||||||
std::uint8_t* ptr = data;
|
uint8_t* ptr = data;
|
||||||
std::uint8_t* end = data + sz_data;
|
uint8_t* end = data + sz_data;
|
||||||
|
|
||||||
// Reserve enough memory to store the entire packet data if necessary.
|
// Reserve enough memory to store the entire packet data if necessary.
|
||||||
header.reserve(sz_data);
|
header.reserve(sz_data);
|
||||||
|
|
|
@ -59,6 +59,6 @@ namespace streamfx::encoder::codec::hevc {
|
||||||
UNKNOWN = -1,
|
UNKNOWN = -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
void extract_header_sei(std::uint8_t* data, std::size_t sz_data, std::vector<std::uint8_t>& header,
|
void extract_header_sei(uint8_t* data, std::size_t sz_data, std::vector<uint8_t>& header,
|
||||||
std::vector<std::uint8_t>& sei);
|
std::vector<uint8_t>& sei);
|
||||||
} // namespace streamfx::encoder::codec::hevc
|
} // namespace streamfx::encoder::codec::hevc
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#define P_PRORES_PROFILE_AP4X "Codec.ProRes.Profile.AP4X"
|
#define P_PRORES_PROFILE_AP4X "Codec.ProRes.Profile.AP4X"
|
||||||
|
|
||||||
namespace streamfx::encoder::codec::prores {
|
namespace streamfx::encoder::codec::prores {
|
||||||
enum class profile : std::int32_t {
|
enum class profile : int32_t {
|
||||||
APCO = 0,
|
APCO = 0,
|
||||||
Y422_PROXY = APCO,
|
Y422_PROXY = APCO,
|
||||||
APCS = 1,
|
APCS = 1,
|
||||||
|
|
|
@ -180,7 +180,7 @@ void ffmpeg_instance::get_properties(obs_properties_t* props)
|
||||||
obs_property_set_enabled(obs_properties_get(props, KEY_FFMPEG_GPU), false);
|
obs_property_set_enabled(obs_properties_get(props, KEY_FFMPEG_GPU), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ffmpeg_instance::migrate(obs_data_t* settings, std::uint64_t version)
|
void ffmpeg_instance::migrate(obs_data_t* settings, uint64_t version)
|
||||||
{
|
{
|
||||||
if (_handler)
|
if (_handler)
|
||||||
_handler->migrate(settings, version, _codec, _context);
|
_handler->migrate(settings, version, _codec, _context);
|
||||||
|
@ -314,15 +314,15 @@ static inline void copy_data(encoder_frame* frame, AVFrame* vframe)
|
||||||
|
|
||||||
std::size_t plane_height = static_cast<size_t>(vframe->height) >> (idx ? v_chroma_shift : 0);
|
std::size_t plane_height = static_cast<size_t>(vframe->height) >> (idx ? v_chroma_shift : 0);
|
||||||
|
|
||||||
if (static_cast<std::uint32_t>(vframe->linesize[idx]) == frame->linesize[idx]) {
|
if (static_cast<uint32_t>(vframe->linesize[idx]) == frame->linesize[idx]) {
|
||||||
std::memcpy(vframe->data[idx], frame->data[idx], frame->linesize[idx] * plane_height);
|
std::memcpy(vframe->data[idx], frame->data[idx], frame->linesize[idx] * plane_height);
|
||||||
} else {
|
} else {
|
||||||
std::size_t ls_in = static_cast<size_t>(frame->linesize[idx]);
|
std::size_t ls_in = static_cast<size_t>(frame->linesize[idx]);
|
||||||
std::size_t ls_out = static_cast<size_t>(vframe->linesize[idx]);
|
std::size_t ls_out = static_cast<size_t>(vframe->linesize[idx]);
|
||||||
std::size_t bytes = ls_in < ls_out ? ls_in : ls_out;
|
std::size_t bytes = ls_in < ls_out ? ls_in : ls_out;
|
||||||
|
|
||||||
std::uint8_t* to = vframe->data[idx];
|
uint8_t* to = vframe->data[idx];
|
||||||
std::uint8_t* from = frame->data[idx];
|
uint8_t* from = frame->data[idx];
|
||||||
|
|
||||||
for (std::size_t y = 0; y < plane_height; y++) {
|
for (std::size_t y = 0; y < plane_height; y++) {
|
||||||
std::memcpy(to, from, bytes);
|
std::memcpy(to, from, bytes);
|
||||||
|
@ -357,9 +357,8 @@ bool ffmpeg_instance::encode_video(struct encoder_frame* frame, struct encoder_p
|
||||||
&& (_scaler.get_source_format() == _scaler.get_target_format())) {
|
&& (_scaler.get_source_format() == _scaler.get_target_format())) {
|
||||||
copy_data(frame, vframe.get());
|
copy_data(frame, vframe.get());
|
||||||
} else {
|
} else {
|
||||||
int res =
|
int res = _scaler.convert(reinterpret_cast<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 (%" PRId32 ").", ::ffmpeg::tools::get_error_description(res),
|
DLOG_ERROR("Failed to convert frame: %s (%" PRId32 ").", ::ffmpeg::tools::get_error_description(res),
|
||||||
res);
|
res);
|
||||||
|
@ -447,13 +446,11 @@ void ffmpeg_instance::initialize_sw(obs_data_t* settings)
|
||||||
_context->framerate.num = _context->time_base.den = static_cast<int>(voi->fps_num);
|
_context->framerate.num = _context->time_base.den = static_cast<int>(voi->fps_num);
|
||||||
_context->framerate.den = _context->time_base.num = static_cast<int>(voi->fps_den);
|
_context->framerate.den = _context->time_base.num = static_cast<int>(voi->fps_den);
|
||||||
|
|
||||||
_scaler.set_source_size(static_cast<std::uint32_t>(_context->width),
|
_scaler.set_source_size(static_cast<uint32_t>(_context->width), static_cast<uint32_t>(_context->height));
|
||||||
static_cast<std::uint32_t>(_context->height));
|
|
||||||
_scaler.set_source_color(_context->color_range == AVCOL_RANGE_JPEG, _context->colorspace);
|
_scaler.set_source_color(_context->color_range == AVCOL_RANGE_JPEG, _context->colorspace);
|
||||||
_scaler.set_source_format(_pixfmt_source);
|
_scaler.set_source_format(_pixfmt_source);
|
||||||
|
|
||||||
_scaler.set_target_size(static_cast<std::uint32_t>(_context->width),
|
_scaler.set_target_size(static_cast<uint32_t>(_context->width), static_cast<uint32_t>(_context->height));
|
||||||
static_cast<std::uint32_t>(_context->height));
|
|
||||||
_scaler.set_target_color(_context->color_range == AVCOL_RANGE_JPEG, _context->colorspace);
|
_scaler.set_target_color(_context->color_range == AVCOL_RANGE_JPEG, _context->colorspace);
|
||||||
_scaler.set_target_format(_pixfmt_target);
|
_scaler.set_target_format(_pixfmt_target);
|
||||||
|
|
||||||
|
@ -603,10 +600,10 @@ int ffmpeg_instance::receive_packet(bool* received_packet, struct encoder_packet
|
||||||
|
|
||||||
if (!_have_first_frame) {
|
if (!_have_first_frame) {
|
||||||
if (_codec->id == AV_CODEC_ID_H264) {
|
if (_codec->id == AV_CODEC_ID_H264) {
|
||||||
std::uint8_t* tmp_packet;
|
uint8_t* tmp_packet;
|
||||||
std::uint8_t* tmp_header;
|
uint8_t* tmp_header;
|
||||||
std::uint8_t* tmp_sei;
|
uint8_t* tmp_sei;
|
||||||
std::size_t sz_packet, sz_header, sz_sei;
|
std::size_t sz_packet, sz_header, sz_sei;
|
||||||
|
|
||||||
obs_extract_avc_headers(_packet.data, static_cast<size_t>(_packet.size), &tmp_packet, &sz_packet,
|
obs_extract_avc_headers(_packet.data, static_cast<size_t>(_packet.size), &tmp_packet, &sz_packet,
|
||||||
&tmp_header, &sz_header, &tmp_sei, &sz_sei);
|
&tmp_header, &sz_header, &tmp_sei, &sz_sei);
|
||||||
|
@ -1025,13 +1022,13 @@ obs_properties_t* ffmpeg_factory::get_properties2(instance_t* data)
|
||||||
}
|
}
|
||||||
{ // Key-Frame Interval Seconds
|
{ // Key-Frame Interval Seconds
|
||||||
auto p = obs_properties_add_float(grp, KEY_KEYFRAMES_INTERVAL_SECONDS, D_TRANSLATE(ST_KEYFRAMES_INTERVAL),
|
auto p = obs_properties_add_float(grp, KEY_KEYFRAMES_INTERVAL_SECONDS, D_TRANSLATE(ST_KEYFRAMES_INTERVAL),
|
||||||
0.00, std::numeric_limits<std::int16_t>::max(), 0.01);
|
0.00, std::numeric_limits<int16_t>::max(), 0.01);
|
||||||
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_KEYFRAMES_INTERVAL)));
|
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_KEYFRAMES_INTERVAL)));
|
||||||
obs_property_float_set_suffix(p, " seconds");
|
obs_property_float_set_suffix(p, " seconds");
|
||||||
}
|
}
|
||||||
{ // Key-Frame Interval Frames
|
{ // Key-Frame Interval Frames
|
||||||
auto p = obs_properties_add_int(grp, KEY_KEYFRAMES_INTERVAL_FRAMES, D_TRANSLATE(ST_KEYFRAMES_INTERVAL), 0,
|
auto p = obs_properties_add_int(grp, KEY_KEYFRAMES_INTERVAL_FRAMES, D_TRANSLATE(ST_KEYFRAMES_INTERVAL), 0,
|
||||||
std::numeric_limits<std::int32_t>::max(), 1);
|
std::numeric_limits<int32_t>::max(), 1);
|
||||||
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_KEYFRAMES_INTERVAL)));
|
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_KEYFRAMES_INTERVAL)));
|
||||||
obs_property_int_set_suffix(p, " frames");
|
obs_property_int_set_suffix(p, " frames");
|
||||||
}
|
}
|
||||||
|
@ -1053,7 +1050,7 @@ obs_properties_t* ffmpeg_factory::get_properties2(instance_t* data)
|
||||||
|
|
||||||
if (_handler && _handler->is_hardware_encoder(this)) {
|
if (_handler && _handler->is_hardware_encoder(this)) {
|
||||||
auto p = obs_properties_add_int(grp, KEY_FFMPEG_GPU, D_TRANSLATE(ST_FFMPEG_GPU), -1,
|
auto p = obs_properties_add_int(grp, KEY_FFMPEG_GPU, D_TRANSLATE(ST_FFMPEG_GPU), -1,
|
||||||
std::numeric_limits<std::uint8_t>::max(), 1);
|
std::numeric_limits<uint8_t>::max(), 1);
|
||||||
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_FFMPEG_GPU)));
|
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_FFMPEG_GPU)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,9 +67,9 @@ namespace streamfx::encoder::ffmpeg {
|
||||||
std::size_t _sent_frames;
|
std::size_t _sent_frames;
|
||||||
|
|
||||||
// Extra Data
|
// Extra Data
|
||||||
bool _have_first_frame;
|
bool _have_first_frame;
|
||||||
std::vector<std::uint8_t> _extra_data;
|
std::vector<uint8_t> _extra_data;
|
||||||
std::vector<std::uint8_t> _sei_data;
|
std::vector<uint8_t> _sei_data;
|
||||||
|
|
||||||
// Frame Stack and Queue
|
// Frame Stack and Queue
|
||||||
std::stack<std::shared_ptr<AVFrame>> _free_frames;
|
std::stack<std::shared_ptr<AVFrame>> _free_frames;
|
||||||
|
@ -83,7 +83,7 @@ namespace streamfx::encoder::ffmpeg {
|
||||||
public:
|
public:
|
||||||
void get_properties(obs_properties_t* props);
|
void get_properties(obs_properties_t* props);
|
||||||
|
|
||||||
void migrate(obs_data_t* settings, std::uint64_t version) override;
|
void migrate(obs_data_t* settings, uint64_t version) override;
|
||||||
|
|
||||||
bool update(obs_data_t* settings) override;
|
bool update(obs_data_t* settings) override;
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ 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,
|
virtual void migrate(obs_data_t* settings, uint64_t version, const AVCodec* codec,
|
||||||
AVCodecContext* context){};
|
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){};
|
||||||
|
|
|
@ -178,7 +178,7 @@ void nvenc_h264_handler::get_runtime_properties(obs_properties_t* props, const A
|
||||||
nvenc::get_runtime_properties(props, codec, context);
|
nvenc::get_runtime_properties(props, codec, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void streamfx::encoder::ffmpeg::handler::nvenc_h264_handler::migrate(obs_data_t* settings, std::uint64_t version,
|
void streamfx::encoder::ffmpeg::handler::nvenc_h264_handler::migrate(obs_data_t* settings, uint64_t version,
|
||||||
const AVCodec* codec, AVCodecContext* context)
|
const AVCodec* codec, AVCodecContext* context)
|
||||||
{
|
{
|
||||||
nvenc::migrate(settings, version, codec, context);
|
nvenc::migrate(settings, version, codec, context);
|
||||||
|
|
|
@ -53,8 +53,7 @@ namespace streamfx::encoder::ffmpeg::handler {
|
||||||
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,
|
virtual void migrate(obs_data_t* settings, uint64_t version, const AVCodec* codec, AVCodecContext* context);
|
||||||
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);
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ void nvenc_hevc_handler::get_runtime_properties(obs_properties_t* props, const A
|
||||||
nvenc::get_runtime_properties(props, codec, context);
|
nvenc::get_runtime_properties(props, codec, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void streamfx::encoder::ffmpeg::handler::nvenc_hevc_handler::migrate(obs_data_t* settings, std::uint64_t version,
|
void streamfx::encoder::ffmpeg::handler::nvenc_hevc_handler::migrate(obs_data_t* settings, uint64_t version,
|
||||||
const AVCodec* codec, AVCodecContext* context)
|
const AVCodec* codec, AVCodecContext* context)
|
||||||
{
|
{
|
||||||
nvenc::migrate(settings, version, codec, context);
|
nvenc::migrate(settings, version, codec, context);
|
||||||
|
|
|
@ -53,8 +53,7 @@ namespace streamfx::encoder::ffmpeg::handler {
|
||||||
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,
|
virtual void migrate(obs_data_t* settings, uint64_t version, const AVCodec* codec, AVCodecContext* context);
|
||||||
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);
|
||||||
|
|
||||||
|
|
|
@ -345,21 +345,21 @@ void nvenc::get_properties_post(obs_properties_t* props, const AVCodec* codec)
|
||||||
{
|
{
|
||||||
auto p = obs_properties_add_int(grp, KEY_RATECONTROL_LIMITS_BITRATE_TARGET,
|
auto p = obs_properties_add_int(grp, KEY_RATECONTROL_LIMITS_BITRATE_TARGET,
|
||||||
D_TRANSLATE(ST_RATECONTROL_LIMITS_BITRATE_TARGET), -1,
|
D_TRANSLATE(ST_RATECONTROL_LIMITS_BITRATE_TARGET), -1,
|
||||||
std::numeric_limits<std::int32_t>::max(), 1);
|
std::numeric_limits<int32_t>::max(), 1);
|
||||||
obs_property_int_set_suffix(p, " kbit/s");
|
obs_property_int_set_suffix(p, " kbit/s");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto p = obs_properties_add_int(grp, KEY_RATECONTROL_LIMITS_BITRATE_MAXIMUM,
|
auto p = obs_properties_add_int(grp, KEY_RATECONTROL_LIMITS_BITRATE_MAXIMUM,
|
||||||
D_TRANSLATE(ST_RATECONTROL_LIMITS_BITRATE_MAXIMUM), -1,
|
D_TRANSLATE(ST_RATECONTROL_LIMITS_BITRATE_MAXIMUM), -1,
|
||||||
std::numeric_limits<std::int32_t>::max(), 1);
|
std::numeric_limits<int32_t>::max(), 1);
|
||||||
obs_property_int_set_suffix(p, " kbit/s");
|
obs_property_int_set_suffix(p, " kbit/s");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
auto p = obs_properties_add_int(grp, KEY_RATECONTROL_LIMITS_BUFFERSIZE,
|
auto p = obs_properties_add_int(grp, KEY_RATECONTROL_LIMITS_BUFFERSIZE,
|
||||||
D_TRANSLATE(ST_RATECONTROL_LIMITS_BUFFERSIZE), 0,
|
D_TRANSLATE(ST_RATECONTROL_LIMITS_BUFFERSIZE), 0,
|
||||||
std::numeric_limits<std::int32_t>::max(), 1);
|
std::numeric_limits<int32_t>::max(), 1);
|
||||||
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_RATECONTROL_LIMITS_BUFFERSIZE)));
|
obs_property_set_long_description(p, D_TRANSLATE(D_DESC(ST_RATECONTROL_LIMITS_BUFFERSIZE)));
|
||||||
obs_property_int_set_suffix(p, " kbit");
|
obs_property_int_set_suffix(p, " kbit");
|
||||||
}
|
}
|
||||||
|
@ -444,7 +444,7 @@ void nvenc::get_properties_post(obs_properties_t* props, const AVCodec* codec)
|
||||||
// H.264 does not support using all B-Frames as reference.
|
// H.264 does not support using all B-Frames as reference.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
obs_property_list_add_int(p, D_TRANSLATE(kv.second.c_str()), static_cast<std::int64_t>(kv.first));
|
obs_property_list_add_int(p, D_TRANSLATE(kv.second.c_str()), static_cast<int64_t>(kv.first));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ void prores_aw_handler::override_colorformat(AVPixelFormat& target_format, obs_d
|
||||||
std::pair{profile::AP4H, AV_PIX_FMT_YUV444P10}, std::pair{profile::AP4X, AV_PIX_FMT_YUV444P10},
|
std::pair{profile::AP4H, AV_PIX_FMT_YUV444P10}, std::pair{profile::AP4X, AV_PIX_FMT_YUV444P10},
|
||||||
};
|
};
|
||||||
|
|
||||||
const std::int64_t profile_id = obs_data_get_int(settings, P_PRORES_PROFILE);
|
const int64_t profile_id = obs_data_get_int(settings, P_PRORES_PROFILE);
|
||||||
for (auto kv : profile_to_format_map) {
|
for (auto kv : profile_to_format_map) {
|
||||||
if (kv.first == static_cast<profile>(profile_id)) {
|
if (kv.first == static_cast<profile>(profile_id)) {
|
||||||
target_format = kv.second;
|
target_format = kv.second;
|
||||||
|
|
|
@ -49,24 +49,24 @@ avframe_queue::~avframe_queue()
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void avframe_queue::set_resolution(std::int32_t const width, std::int32_t const height)
|
void avframe_queue::set_resolution(int32_t const width, int32_t const height)
|
||||||
{
|
{
|
||||||
this->_resolution.first = width;
|
this->_resolution.first = width;
|
||||||
this->_resolution.second = height;
|
this->_resolution.second = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void avframe_queue::get_resolution(std::int32_t& width, std::int32_t& height)
|
void avframe_queue::get_resolution(int32_t& width, int32_t& height)
|
||||||
{
|
{
|
||||||
width = this->_resolution.first;
|
width = this->_resolution.first;
|
||||||
height = this->_resolution.second;
|
height = this->_resolution.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::int32_t avframe_queue::get_width()
|
int32_t avframe_queue::get_width()
|
||||||
{
|
{
|
||||||
return this->_resolution.first;
|
return this->_resolution.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::int32_t avframe_queue::get_height()
|
int32_t avframe_queue::get_height()
|
||||||
{
|
{
|
||||||
return this->_resolution.second;
|
return this->_resolution.second;
|
||||||
}
|
}
|
||||||
|
@ -113,8 +113,8 @@ std::shared_ptr<AVFrame> avframe_queue::pop()
|
||||||
ret = create_frame();
|
ret = create_frame();
|
||||||
} else {
|
} else {
|
||||||
_frames.pop_front();
|
_frames.pop_front();
|
||||||
if ((static_cast<std::int32_t>(ret->width) != this->_resolution.first)
|
if ((static_cast<int32_t>(ret->width) != this->_resolution.first)
|
||||||
|| (static_cast<std::int32_t>(ret->height) != this->_resolution.second)
|
|| (static_cast<int32_t>(ret->height) != this->_resolution.second)
|
||||||
|| (ret->format != this->_format)) {
|
|| (ret->format != this->_format)) {
|
||||||
ret = nullptr;
|
ret = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,8 @@ namespace ffmpeg {
|
||||||
std::deque<std::shared_ptr<AVFrame>> _frames;
|
std::deque<std::shared_ptr<AVFrame>> _frames;
|
||||||
std::mutex _lock;
|
std::mutex _lock;
|
||||||
|
|
||||||
std::pair<std::int32_t, std::int32_t> _resolution;
|
std::pair<int32_t, int32_t> _resolution;
|
||||||
AVPixelFormat _format = AV_PIX_FMT_NONE;
|
AVPixelFormat _format = AV_PIX_FMT_NONE;
|
||||||
|
|
||||||
std::shared_ptr<AVFrame> create_frame();
|
std::shared_ptr<AVFrame> create_frame();
|
||||||
|
|
||||||
|
@ -49,10 +49,10 @@ namespace ffmpeg {
|
||||||
avframe_queue();
|
avframe_queue();
|
||||||
~avframe_queue();
|
~avframe_queue();
|
||||||
|
|
||||||
void set_resolution(std::int32_t width, std::int32_t height);
|
void set_resolution(int32_t width, int32_t height);
|
||||||
void get_resolution(std::int32_t& width, std::int32_t& height);
|
void get_resolution(int32_t& width, int32_t& height);
|
||||||
std::int32_t get_width();
|
int32_t get_width();
|
||||||
std::int32_t get_height();
|
int32_t get_height();
|
||||||
|
|
||||||
void set_pixel_format(AVPixelFormat format);
|
void set_pixel_format(AVPixelFormat format);
|
||||||
AVPixelFormat get_pixel_format();
|
AVPixelFormat get_pixel_format();
|
||||||
|
|
|
@ -50,10 +50,10 @@ namespace ffmpeg::hwapi {
|
||||||
|
|
||||||
virtual std::shared_ptr<AVFrame> allocate_frame(AVBufferRef* frames) = 0;
|
virtual std::shared_ptr<AVFrame> allocate_frame(AVBufferRef* frames) = 0;
|
||||||
|
|
||||||
virtual void copy_from_obs(AVBufferRef* frames, std::uint32_t handle, uint64_t lock_key,
|
virtual void copy_from_obs(AVBufferRef* frames, uint32_t handle, uint64_t lock_key, uint64_t* next_lock_key,
|
||||||
uint64_t* next_lock_key, std::shared_ptr<AVFrame> frame) = 0;
|
std::shared_ptr<AVFrame> frame) = 0;
|
||||||
|
|
||||||
virtual std::shared_ptr<AVFrame> avframe_from_obs(AVBufferRef* frames, std::uint32_t handle, uint64_t lock_key,
|
virtual std::shared_ptr<AVFrame> avframe_from_obs(AVBufferRef* frames, uint32_t handle, uint64_t lock_key,
|
||||||
uint64_t* next_lock_key) = 0;
|
uint64_t* next_lock_key) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ std::shared_ptr<AVFrame> d3d11_instance::allocate_frame(AVBufferRef* frames)
|
||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
void d3d11_instance::copy_from_obs(AVBufferRef*, std::uint32_t handle, uint64_t lock_key, uint64_t* next_lock_key,
|
void d3d11_instance::copy_from_obs(AVBufferRef*, uint32_t handle, uint64_t lock_key, uint64_t* next_lock_key,
|
||||||
std::shared_ptr<AVFrame> frame)
|
std::shared_ptr<AVFrame> frame)
|
||||||
{
|
{
|
||||||
auto gctx = gs::context();
|
auto gctx = gs::context();
|
||||||
|
@ -251,7 +251,7 @@ void d3d11_instance::copy_from_obs(AVBufferRef*, std::uint32_t handle, uint64_t
|
||||||
mutex->ReleaseSync(*next_lock_key);
|
mutex->ReleaseSync(*next_lock_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<AVFrame> d3d11_instance::avframe_from_obs(AVBufferRef* frames, std::uint32_t handle, uint64_t lock_key,
|
std::shared_ptr<AVFrame> d3d11_instance::avframe_from_obs(AVBufferRef* frames, uint32_t handle, uint64_t lock_key,
|
||||||
uint64_t* next_lock_key)
|
uint64_t* next_lock_key)
|
||||||
{
|
{
|
||||||
auto gctx = gs::context();
|
auto gctx = gs::context();
|
||||||
|
|
|
@ -74,10 +74,10 @@ namespace ffmpeg::hwapi {
|
||||||
|
|
||||||
virtual std::shared_ptr<AVFrame> allocate_frame(AVBufferRef* frames) override;
|
virtual std::shared_ptr<AVFrame> allocate_frame(AVBufferRef* frames) override;
|
||||||
|
|
||||||
virtual void copy_from_obs(AVBufferRef* frames, std::uint32_t handle, uint64_t lock_key,
|
virtual void copy_from_obs(AVBufferRef* frames, uint32_t handle, uint64_t lock_key, uint64_t* next_lock_key,
|
||||||
uint64_t* next_lock_key, std::shared_ptr<AVFrame> frame) override;
|
std::shared_ptr<AVFrame> frame) override;
|
||||||
|
|
||||||
virtual std::shared_ptr<AVFrame> avframe_from_obs(AVBufferRef* frames, std::uint32_t handle, uint64_t lock_key,
|
virtual std::shared_ptr<AVFrame> avframe_from_obs(AVBufferRef* frames, uint32_t handle, uint64_t lock_key,
|
||||||
uint64_t* next_lock_key) override;
|
uint64_t* next_lock_key) override;
|
||||||
};
|
};
|
||||||
} // namespace ffmpeg::hwapi
|
} // namespace ffmpeg::hwapi
|
||||||
|
|
|
@ -31,7 +31,7 @@ swscale::~swscale()
|
||||||
finalize();
|
finalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void swscale::set_source_size(std::uint32_t width, std::uint32_t height)
|
void swscale::set_source_size(uint32_t width, uint32_t height)
|
||||||
{
|
{
|
||||||
source_size.first = width;
|
source_size.first = width;
|
||||||
source_size.second = height;
|
source_size.second = height;
|
||||||
|
@ -48,12 +48,12 @@ std::pair<uint32_t, uint32_t> swscale::get_source_size()
|
||||||
return this->source_size;
|
return this->source_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t swscale::get_source_width()
|
uint32_t swscale::get_source_width()
|
||||||
{
|
{
|
||||||
return this->source_size.first;
|
return this->source_size.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t swscale::get_source_height()
|
uint32_t swscale::get_source_height()
|
||||||
{
|
{
|
||||||
return this->source_size.second;
|
return this->source_size.second;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ bool swscale::is_source_full_range()
|
||||||
return this->source_full_range;
|
return this->source_full_range;
|
||||||
}
|
}
|
||||||
|
|
||||||
void swscale::set_target_size(std::uint32_t width, std::uint32_t height)
|
void swscale::set_target_size(uint32_t width, uint32_t height)
|
||||||
{
|
{
|
||||||
target_size.first = width;
|
target_size.first = width;
|
||||||
target_size.second = height;
|
target_size.second = height;
|
||||||
|
@ -111,12 +111,12 @@ std::pair<uint32_t, uint32_t> swscale::get_target_size()
|
||||||
return this->target_size;
|
return this->target_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t swscale::get_target_width()
|
uint32_t swscale::get_target_width()
|
||||||
{
|
{
|
||||||
return this->target_size.first;
|
return this->target_size.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t swscale::get_target_height()
|
uint32_t swscale::get_target_height()
|
||||||
{
|
{
|
||||||
return this->target_size.second;
|
return this->target_size.second;
|
||||||
}
|
}
|
||||||
|
@ -196,8 +196,8 @@ bool swscale::finalize()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t swscale::convert(const std::uint8_t* const source_data[], const int source_stride[], int32_t source_row,
|
int32_t swscale::convert(const uint8_t* const source_data[], const int source_stride[], int32_t source_row,
|
||||||
int32_t source_rows, std::uint8_t* const target_data[], const int target_stride[])
|
int32_t source_rows, uint8_t* const target_data[], const int target_stride[])
|
||||||
{
|
{
|
||||||
if (!this->context) {
|
if (!this->context) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -53,11 +53,11 @@ namespace ffmpeg {
|
||||||
swscale();
|
swscale();
|
||||||
~swscale();
|
~swscale();
|
||||||
|
|
||||||
void set_source_size(std::uint32_t width, std::uint32_t height);
|
void set_source_size(uint32_t width, uint32_t height);
|
||||||
void get_source_size(uint32_t& width, uint32_t& height);
|
void get_source_size(uint32_t& width, uint32_t& height);
|
||||||
std::pair<uint32_t, uint32_t> get_source_size();
|
std::pair<uint32_t, uint32_t> get_source_size();
|
||||||
std::uint32_t get_source_width();
|
uint32_t get_source_width();
|
||||||
std::uint32_t get_source_height();
|
uint32_t get_source_height();
|
||||||
void set_source_format(AVPixelFormat format);
|
void set_source_format(AVPixelFormat format);
|
||||||
AVPixelFormat get_source_format();
|
AVPixelFormat get_source_format();
|
||||||
void set_source_color(bool full_range, AVColorSpace space);
|
void set_source_color(bool full_range, AVColorSpace space);
|
||||||
|
@ -66,11 +66,11 @@ namespace ffmpeg {
|
||||||
void set_source_full_range(bool full_range);
|
void set_source_full_range(bool full_range);
|
||||||
bool is_source_full_range();
|
bool is_source_full_range();
|
||||||
|
|
||||||
void set_target_size(std::uint32_t width, std::uint32_t height);
|
void set_target_size(uint32_t width, uint32_t height);
|
||||||
void get_target_size(uint32_t& width, uint32_t& height);
|
void get_target_size(uint32_t& width, uint32_t& height);
|
||||||
std::pair<uint32_t, uint32_t> get_target_size();
|
std::pair<uint32_t, uint32_t> get_target_size();
|
||||||
std::uint32_t get_target_width();
|
uint32_t get_target_width();
|
||||||
std::uint32_t get_target_height();
|
uint32_t get_target_height();
|
||||||
void set_target_format(AVPixelFormat format);
|
void set_target_format(AVPixelFormat format);
|
||||||
AVPixelFormat get_target_format();
|
AVPixelFormat get_target_format();
|
||||||
void set_target_color(bool full_range, AVColorSpace space);
|
void set_target_color(bool full_range, AVColorSpace space);
|
||||||
|
@ -82,7 +82,7 @@ namespace ffmpeg {
|
||||||
bool initialize(int flags);
|
bool initialize(int flags);
|
||||||
bool finalize();
|
bool finalize();
|
||||||
|
|
||||||
int32_t convert(const std::uint8_t* const source_data[], const int source_stride[], int32_t source_row,
|
int32_t convert(const uint8_t* const source_data[], const int source_stride[], int32_t source_row,
|
||||||
int32_t source_rows, std::uint8_t* const target_data[], const int target_stride[]);
|
int32_t source_rows, uint8_t* const target_data[], const int target_stride[]);
|
||||||
};
|
};
|
||||||
} // namespace ffmpeg
|
} // namespace ffmpeg
|
||||||
|
|
|
@ -199,7 +199,7 @@ void blur_instance::load(obs_data_t* settings)
|
||||||
update(settings);
|
update(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void blur_instance::migrate(obs_data_t* settings, std::uint64_t version)
|
void blur_instance::migrate(obs_data_t* settings, uint64_t version)
|
||||||
{
|
{
|
||||||
// Now we use a fall-through switch to gradually upgrade each known version change.
|
// Now we use a fall-through switch to gradually upgrade each known version change.
|
||||||
switch (version) {
|
switch (version) {
|
||||||
|
@ -292,12 +292,12 @@ void blur_instance::update(obs_data_t* settings)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ((_mask.type == mask_type::Image) || (_mask.type == mask_type::Source)) {
|
if ((_mask.type == mask_type::Image) || (_mask.type == mask_type::Source)) {
|
||||||
std::uint32_t color = static_cast<uint32_t>(obs_data_get_int(settings, ST_MASK_COLOR));
|
uint32_t color = static_cast<uint32_t>(obs_data_get_int(settings, ST_MASK_COLOR));
|
||||||
_mask.color.r = ((color >> 0) & 0xFF) / 255.0f;
|
_mask.color.r = ((color >> 0) & 0xFF) / 255.0f;
|
||||||
_mask.color.g = ((color >> 8) & 0xFF) / 255.0f;
|
_mask.color.g = ((color >> 8) & 0xFF) / 255.0f;
|
||||||
_mask.color.b = ((color >> 16) & 0xFF) / 255.0f;
|
_mask.color.b = ((color >> 16) & 0xFF) / 255.0f;
|
||||||
_mask.color.a = static_cast<float_t>(obs_data_get_double(settings, ST_MASK_ALPHA));
|
_mask.color.a = static_cast<float_t>(obs_data_get_double(settings, ST_MASK_ALPHA));
|
||||||
_mask.multiplier = float_t(obs_data_get_double(settings, ST_MASK_MULTIPLIER));
|
_mask.multiplier = float_t(obs_data_get_double(settings, ST_MASK_MULTIPLIER));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -357,8 +357,8 @@ void blur_instance::video_render(gs_effect_t* effect)
|
||||||
obs_source_t* parent = obs_filter_get_parent(this->_self);
|
obs_source_t* parent = obs_filter_get_parent(this->_self);
|
||||||
obs_source_t* target = obs_filter_get_target(this->_self);
|
obs_source_t* target = obs_filter_get_target(this->_self);
|
||||||
gs_effect_t* defaultEffect = obs_get_base_effect(obs_base_effect::OBS_EFFECT_DEFAULT);
|
gs_effect_t* defaultEffect = obs_get_base_effect(obs_base_effect::OBS_EFFECT_DEFAULT);
|
||||||
std::uint32_t baseW = obs_source_get_base_width(target);
|
uint32_t baseW = obs_source_get_base_width(target);
|
||||||
std::uint32_t baseH = obs_source_get_base_height(target);
|
uint32_t baseH = obs_source_get_base_height(target);
|
||||||
|
|
||||||
// Verify that we can actually run first.
|
// Verify that we can actually run first.
|
||||||
if (!target || !parent || !this->_self || !this->_blur || (baseW == 0) || (baseH == 0)) {
|
if (!target || !parent || !this->_self || !this->_blur || (baseW == 0) || (baseH == 0)) {
|
||||||
|
@ -474,8 +474,8 @@ void blur_instance::video_render(gs_effect_t* effect)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_mask.source.source_texture) {
|
if (_mask.source.source_texture) {
|
||||||
std::uint32_t source_width = obs_source_get_width(this->_mask.source.source_texture->get_object());
|
uint32_t source_width = obs_source_get_width(this->_mask.source.source_texture->get_object());
|
||||||
std::uint32_t source_height = obs_source_get_height(this->_mask.source.source_texture->get_object());
|
uint32_t source_height = obs_source_get_height(this->_mask.source.source_texture->get_object());
|
||||||
|
|
||||||
if (source_width == 0) {
|
if (source_width == 0) {
|
||||||
source_width = baseW;
|
source_width = baseW;
|
||||||
|
|
|
@ -100,7 +100,7 @@ namespace streamfx::filter::blur {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void load(obs_data_t* settings) override;
|
virtual void load(obs_data_t* settings) override;
|
||||||
virtual void migrate(obs_data_t* settings, std::uint64_t version) override;
|
virtual void migrate(obs_data_t* settings, uint64_t version) override;
|
||||||
virtual void update(obs_data_t* settings) override;
|
virtual void update(obs_data_t* settings) override;
|
||||||
|
|
||||||
virtual void video_tick(float_t time) override;
|
virtual void video_tick(float_t time) override;
|
||||||
|
|
|
@ -127,7 +127,7 @@ void color_grade_instance::load(obs_data_t* data)
|
||||||
update(data);
|
update(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void color_grade_instance::migrate(obs_data_t* data, std::uint64_t version) {}
|
void color_grade_instance::migrate(obs_data_t* data, uint64_t version) {}
|
||||||
|
|
||||||
void color_grade_instance::update(obs_data_t* data)
|
void color_grade_instance::update(obs_data_t* data)
|
||||||
{
|
{
|
||||||
|
@ -176,8 +176,8 @@ void color_grade_instance::video_render(gs_effect_t* effect)
|
||||||
// Grab initial values.
|
// Grab initial values.
|
||||||
obs_source_t* parent = obs_filter_get_parent(_self);
|
obs_source_t* parent = obs_filter_get_parent(_self);
|
||||||
obs_source_t* target = obs_filter_get_target(_self);
|
obs_source_t* target = obs_filter_get_target(_self);
|
||||||
std::uint32_t width = obs_source_get_base_width(target);
|
uint32_t width = obs_source_get_base_width(target);
|
||||||
std::uint32_t height = obs_source_get_base_height(target);
|
uint32_t height = obs_source_get_base_height(target);
|
||||||
gs_effect_t* effect_default = obs_get_base_effect(obs_base_effect::OBS_EFFECT_DEFAULT);
|
gs_effect_t* effect_default = obs_get_base_effect(obs_base_effect::OBS_EFFECT_DEFAULT);
|
||||||
|
|
||||||
// Skip filter if anything is wrong.
|
// Skip filter if anything is wrong.
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace streamfx::filter::color_grade {
|
||||||
virtual ~color_grade_instance();
|
virtual ~color_grade_instance();
|
||||||
|
|
||||||
virtual void load(obs_data_t* data) override;
|
virtual void load(obs_data_t* data) override;
|
||||||
virtual void migrate(obs_data_t* data, std::uint64_t version) override;
|
virtual void migrate(obs_data_t* data, uint64_t version) override;
|
||||||
virtual void update(obs_data_t* data) override;
|
virtual void update(obs_data_t* data) override;
|
||||||
|
|
||||||
virtual void video_tick(float_t time) override;
|
virtual void video_tick(float_t time) override;
|
||||||
|
|
|
@ -55,7 +55,7 @@ void displacement_instance::load(obs_data_t* settings)
|
||||||
update(settings);
|
update(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void displacement_instance::migrate(obs_data_t* data, std::uint64_t version)
|
void displacement_instance::migrate(obs_data_t* data, uint64_t version)
|
||||||
{
|
{
|
||||||
switch (version & STREAMFX_MASK_COMPAT) {
|
switch (version & STREAMFX_MASK_COMPAT) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
|
@ -33,15 +33,15 @@ namespace streamfx::filter::displacement {
|
||||||
float_t _scale_type;
|
float_t _scale_type;
|
||||||
|
|
||||||
// Cache
|
// Cache
|
||||||
std::uint32_t _width;
|
uint32_t _width;
|
||||||
std::uint32_t _height;
|
uint32_t _height;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
displacement_instance(obs_data_t*, obs_source_t*);
|
displacement_instance(obs_data_t*, obs_source_t*);
|
||||||
virtual ~displacement_instance();
|
virtual ~displacement_instance();
|
||||||
|
|
||||||
virtual void load(obs_data_t* settings) override;
|
virtual void load(obs_data_t* settings) override;
|
||||||
virtual void migrate(obs_data_t* data, std::uint64_t version) override;
|
virtual void migrate(obs_data_t* data, uint64_t version) override;
|
||||||
virtual void update(obs_data_t* settings) override;
|
virtual void update(obs_data_t* settings) override;
|
||||||
|
|
||||||
virtual void video_tick(float_t) override;
|
virtual void video_tick(float_t) override;
|
||||||
|
|
|
@ -79,7 +79,7 @@ void dynamic_mask_instance::load(obs_data_t* settings)
|
||||||
update(settings);
|
update(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dynamic_mask_instance::migrate(obs_data_t* data, std::uint64_t version) {}
|
void dynamic_mask_instance::migrate(obs_data_t* data, uint64_t version) {}
|
||||||
|
|
||||||
void dynamic_mask_instance::update(obs_data_t* settings)
|
void dynamic_mask_instance::update(obs_data_t* settings)
|
||||||
{
|
{
|
||||||
|
@ -191,8 +191,8 @@ void dynamic_mask_instance::video_render(gs_effect_t* in_effect)
|
||||||
{
|
{
|
||||||
obs_source_t* parent = obs_filter_get_parent(_self);
|
obs_source_t* parent = obs_filter_get_parent(_self);
|
||||||
obs_source_t* target = obs_filter_get_target(_self);
|
obs_source_t* target = obs_filter_get_target(_self);
|
||||||
std::uint32_t width = obs_source_get_base_width(target);
|
uint32_t width = obs_source_get_base_width(target);
|
||||||
std::uint32_t height = obs_source_get_base_height(target);
|
uint32_t height = obs_source_get_base_height(target);
|
||||||
|
|
||||||
if (!_self || !parent || !target || !width || !height || !_input || !_input_capture || !_effect) {
|
if (!_self || !parent || !target || !width || !height || !_input || !_input_capture || !_effect) {
|
||||||
obs_source_skip_video_filter(_self);
|
obs_source_skip_video_filter(_self);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#include "obs/obs-source.hpp"
|
#include "obs/obs-source.hpp"
|
||||||
|
|
||||||
namespace streamfx::filter::dynamic_mask {
|
namespace streamfx::filter::dynamic_mask {
|
||||||
enum class channel : std::int8_t { Invalid = -1, Red, Green, Blue, Alpha };
|
enum class channel : int8_t { Invalid = -1, Red, Green, Blue, Alpha };
|
||||||
|
|
||||||
class dynamic_mask_instance : public obs::source_instance {
|
class dynamic_mask_instance : public obs::source_instance {
|
||||||
std::map<std::tuple<channel, channel, std::string>, std::string> _translation_map;
|
std::map<std::tuple<channel, channel, std::string>, std::string> _translation_map;
|
||||||
|
@ -66,7 +66,7 @@ namespace streamfx::filter::dynamic_mask {
|
||||||
virtual ~dynamic_mask_instance();
|
virtual ~dynamic_mask_instance();
|
||||||
|
|
||||||
virtual void load(obs_data_t* settings) override;
|
virtual void load(obs_data_t* settings) override;
|
||||||
virtual void migrate(obs_data_t* data, std::uint64_t version) override;
|
virtual void migrate(obs_data_t* data, uint64_t version) override;
|
||||||
virtual void update(obs_data_t* settings) override;
|
virtual void update(obs_data_t* settings) override;
|
||||||
virtual void save(obs_data_t* settings) override;
|
virtual void save(obs_data_t* settings) override;
|
||||||
|
|
||||||
|
|
|
@ -172,7 +172,7 @@ void face_tracking_instance::async_initialize(std::shared_ptr<void> ptr)
|
||||||
// Create Bounding Boxes Data
|
// Create Bounding Boxes Data
|
||||||
_ar_bboxes_data.assign(1, {0., 0., 0., 0.});
|
_ar_bboxes_data.assign(1, {0., 0., 0., 0.});
|
||||||
_ar_bboxes.boxes = _ar_bboxes_data.data();
|
_ar_bboxes.boxes = _ar_bboxes_data.data();
|
||||||
_ar_bboxes.max_boxes = std::clamp<std::uint8_t>(static_cast<std::uint8_t>(_ar_bboxes_data.size()), 0, 255);
|
_ar_bboxes.max_boxes = std::clamp<uint8_t>(static_cast<uint8_t>(_ar_bboxes_data.size()), 0, 255);
|
||||||
_ar_bboxes.num_boxes = 0;
|
_ar_bboxes.num_boxes = 0;
|
||||||
_ar_bboxes_confidence.resize(_ar_bboxes_data.size());
|
_ar_bboxes_confidence.resize(_ar_bboxes_data.size());
|
||||||
if (NvCV_Status res = _ar_library->set_object(_ar_feature.get(), NvAR_Parameter_Output(BoundingBoxes),
|
if (NvCV_Status res = _ar_library->set_object(_ar_feature.get(), NvAR_Parameter_Output(BoundingBoxes),
|
||||||
|
@ -474,7 +474,7 @@ void face_tracking_instance::load(obs_data_t* data)
|
||||||
update(data);
|
update(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void face_tracking_instance::migrate(obs_data_t* data, std::uint64_t version) {}
|
void face_tracking_instance::migrate(obs_data_t* data, uint64_t version) {}
|
||||||
|
|
||||||
void face_tracking_instance::update(obs_data_t* data)
|
void face_tracking_instance::update(obs_data_t* data)
|
||||||
{
|
{
|
||||||
|
@ -592,7 +592,7 @@ bool face_tracking_instance::button_profile(obs_properties_t* props, obs_propert
|
||||||
for (auto& kv : profilers) {
|
for (auto& kv : profilers) {
|
||||||
DLOG_INFO(" %-20s: %8lldµs %10lld %8lldµs %8lldµs %8lldµs", kv.first.c_str(),
|
DLOG_INFO(" %-20s: %8lldµs %10lld %8lldµs %8lldµs %8lldµs", kv.first.c_str(),
|
||||||
std::chrono::duration_cast<std::chrono::microseconds>(kv.second->total_duration()).count(),
|
std::chrono::duration_cast<std::chrono::microseconds>(kv.second->total_duration()).count(),
|
||||||
kv.second->count(), static_cast<std::int64_t>(kv.second->average_duration() / 1000.0),
|
kv.second->count(), static_cast<int64_t>(kv.second->average_duration() / 1000.0),
|
||||||
std::chrono::duration_cast<std::chrono::microseconds>(kv.second->percentile(0.999)).count(),
|
std::chrono::duration_cast<std::chrono::microseconds>(kv.second->percentile(0.999)).count(),
|
||||||
std::chrono::duration_cast<std::chrono::microseconds>(kv.second->percentile(0.95)).count());
|
std::chrono::duration_cast<std::chrono::microseconds>(kv.second->percentile(0.95)).count());
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,9 @@
|
||||||
namespace streamfx::filter::nvidia {
|
namespace streamfx::filter::nvidia {
|
||||||
class face_tracking_instance : public obs::source_instance {
|
class face_tracking_instance : public obs::source_instance {
|
||||||
// Filter Cache
|
// Filter Cache
|
||||||
std::pair<std::uint32_t, std::uint32_t> _size;
|
std::pair<uint32_t, uint32_t> _size;
|
||||||
bool _rt_is_fresh;
|
bool _rt_is_fresh;
|
||||||
std::shared_ptr<gs::rendertarget> _rt;
|
std::shared_ptr<gs::rendertarget> _rt;
|
||||||
|
|
||||||
std::mutex _delete_protection;
|
std::mutex _delete_protection;
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ namespace streamfx::filter::nvidia {
|
||||||
|
|
||||||
virtual void load(obs_data_t* data) override;
|
virtual void load(obs_data_t* data) override;
|
||||||
|
|
||||||
virtual void migrate(obs_data_t* data, std::uint64_t version) override;
|
virtual void migrate(obs_data_t* data, uint64_t version) override;
|
||||||
|
|
||||||
virtual void update(obs_data_t* data) override;
|
virtual void update(obs_data_t* data) override;
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@ void sdf_effects_instance::load(obs_data_t* settings)
|
||||||
update(settings);
|
update(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sdf_effects_instance::migrate(obs_data_t* data, std::uint64_t version) {}
|
void sdf_effects_instance::migrate(obs_data_t* data, uint64_t version) {}
|
||||||
|
|
||||||
void sdf_effects_instance::update(obs_data_t* data)
|
void sdf_effects_instance::update(obs_data_t* data)
|
||||||
{
|
{
|
||||||
|
@ -132,12 +132,12 @@ void sdf_effects_instance::update(obs_data_t* data)
|
||||||
&& (obs_data_get_double(data, ST_SHADOW_OUTER_ALPHA) >= std::numeric_limits<double_t>::epsilon());
|
&& (obs_data_get_double(data, ST_SHADOW_OUTER_ALPHA) >= std::numeric_limits<double_t>::epsilon());
|
||||||
{
|
{
|
||||||
struct cs {
|
struct cs {
|
||||||
std::uint8_t r, g, b, a;
|
uint8_t r, g, b, a;
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
std::uint32_t color;
|
uint32_t color;
|
||||||
std::uint8_t channel[4];
|
uint8_t channel[4];
|
||||||
cs c;
|
cs c;
|
||||||
};
|
};
|
||||||
color = uint32_t(obs_data_get_int(data, ST_SHADOW_OUTER_COLOR));
|
color = uint32_t(obs_data_get_int(data, ST_SHADOW_OUTER_COLOR));
|
||||||
_outer_shadow_color.x = float_t(c.r / 255.0);
|
_outer_shadow_color.x = float_t(c.r / 255.0);
|
||||||
|
@ -157,12 +157,12 @@ void sdf_effects_instance::update(obs_data_t* data)
|
||||||
&& (obs_data_get_double(data, ST_SHADOW_INNER_ALPHA) >= std::numeric_limits<double_t>::epsilon());
|
&& (obs_data_get_double(data, ST_SHADOW_INNER_ALPHA) >= std::numeric_limits<double_t>::epsilon());
|
||||||
{
|
{
|
||||||
struct cs {
|
struct cs {
|
||||||
std::uint8_t r, g, b, a;
|
uint8_t r, g, b, a;
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
std::uint32_t color;
|
uint32_t color;
|
||||||
std::uint8_t channel[4];
|
uint8_t channel[4];
|
||||||
cs c;
|
cs c;
|
||||||
};
|
};
|
||||||
color = uint32_t(obs_data_get_int(data, ST_SHADOW_INNER_COLOR));
|
color = uint32_t(obs_data_get_int(data, ST_SHADOW_INNER_COLOR));
|
||||||
_inner_shadow_color.x = float_t(c.r / 255.0);
|
_inner_shadow_color.x = float_t(c.r / 255.0);
|
||||||
|
@ -181,12 +181,12 @@ void sdf_effects_instance::update(obs_data_t* data)
|
||||||
&& (obs_data_get_double(data, ST_GLOW_OUTER_ALPHA) >= std::numeric_limits<double_t>::epsilon());
|
&& (obs_data_get_double(data, ST_GLOW_OUTER_ALPHA) >= std::numeric_limits<double_t>::epsilon());
|
||||||
{
|
{
|
||||||
struct cs {
|
struct cs {
|
||||||
std::uint8_t r, g, b, a;
|
uint8_t r, g, b, a;
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
std::uint32_t color;
|
uint32_t color;
|
||||||
std::uint8_t channel[4];
|
uint8_t channel[4];
|
||||||
cs c;
|
cs c;
|
||||||
};
|
};
|
||||||
color = uint32_t(obs_data_get_int(data, ST_GLOW_OUTER_COLOR));
|
color = uint32_t(obs_data_get_int(data, ST_GLOW_OUTER_COLOR));
|
||||||
_outer_glow_color.x = float_t(c.r / 255.0);
|
_outer_glow_color.x = float_t(c.r / 255.0);
|
||||||
|
@ -207,12 +207,12 @@ void sdf_effects_instance::update(obs_data_t* data)
|
||||||
&& (obs_data_get_double(data, ST_GLOW_INNER_ALPHA) >= std::numeric_limits<double_t>::epsilon());
|
&& (obs_data_get_double(data, ST_GLOW_INNER_ALPHA) >= std::numeric_limits<double_t>::epsilon());
|
||||||
{
|
{
|
||||||
struct cs {
|
struct cs {
|
||||||
std::uint8_t r, g, b, a;
|
uint8_t r, g, b, a;
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
std::uint32_t color;
|
uint32_t color;
|
||||||
std::uint8_t channel[4];
|
uint8_t channel[4];
|
||||||
cs c;
|
cs c;
|
||||||
};
|
};
|
||||||
color = uint32_t(obs_data_get_int(data, ST_GLOW_INNER_COLOR));
|
color = uint32_t(obs_data_get_int(data, ST_GLOW_INNER_COLOR));
|
||||||
_inner_glow_color.x = float_t(c.r / 255.0);
|
_inner_glow_color.x = float_t(c.r / 255.0);
|
||||||
|
@ -233,12 +233,12 @@ void sdf_effects_instance::update(obs_data_t* data)
|
||||||
&& (obs_data_get_double(data, ST_OUTLINE_ALPHA) >= std::numeric_limits<double_t>::epsilon());
|
&& (obs_data_get_double(data, ST_OUTLINE_ALPHA) >= std::numeric_limits<double_t>::epsilon());
|
||||||
{
|
{
|
||||||
struct cs {
|
struct cs {
|
||||||
std::uint8_t r, g, b, a;
|
uint8_t r, g, b, a;
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
std::uint32_t color;
|
uint32_t color;
|
||||||
std::uint8_t channel[4];
|
uint8_t channel[4];
|
||||||
cs c;
|
cs c;
|
||||||
};
|
};
|
||||||
color = uint32_t(obs_data_get_int(data, ST_OUTLINE_COLOR));
|
color = uint32_t(obs_data_get_int(data, ST_OUTLINE_COLOR));
|
||||||
_outline_color.x = float_t(c.r / 255.0);
|
_outline_color.x = float_t(c.r / 255.0);
|
||||||
|
@ -271,8 +271,8 @@ void sdf_effects_instance::video_render(gs_effect_t* effect)
|
||||||
{
|
{
|
||||||
obs_source_t* parent = obs_filter_get_parent(_self);
|
obs_source_t* parent = obs_filter_get_parent(_self);
|
||||||
obs_source_t* target = obs_filter_get_target(_self);
|
obs_source_t* target = obs_filter_get_target(_self);
|
||||||
std::uint32_t baseW = obs_source_get_base_width(target);
|
uint32_t baseW = obs_source_get_base_width(target);
|
||||||
std::uint32_t baseH = obs_source_get_base_height(target);
|
uint32_t baseH = obs_source_get_base_height(target);
|
||||||
gs_effect_t* final_effect = effect ? effect : obs_get_base_effect(obs_base_effect::OBS_EFFECT_DEFAULT);
|
gs_effect_t* final_effect = effect ? effect : obs_get_base_effect(obs_base_effect::OBS_EFFECT_DEFAULT);
|
||||||
gs_effect_t* default_effect = obs_get_base_effect(obs_base_effect::OBS_EFFECT_DEFAULT);
|
gs_effect_t* default_effect = obs_get_base_effect(obs_base_effect::OBS_EFFECT_DEFAULT);
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ namespace streamfx::filter::sdf_effects {
|
||||||
virtual ~sdf_effects_instance();
|
virtual ~sdf_effects_instance();
|
||||||
|
|
||||||
virtual void load(obs_data_t* settings) override;
|
virtual void load(obs_data_t* settings) override;
|
||||||
virtual void migrate(obs_data_t* data, std::uint64_t version) override;
|
virtual void migrate(obs_data_t* data, uint64_t version) override;
|
||||||
virtual void update(obs_data_t* settings) override;
|
virtual void update(obs_data_t* settings) override;
|
||||||
|
|
||||||
virtual void video_tick(float_t) override;
|
virtual void video_tick(float_t) override;
|
||||||
|
|
|
@ -34,12 +34,12 @@ shader_instance::shader_instance(obs_data_t* data, obs_source_t* self) : obs::so
|
||||||
|
|
||||||
shader_instance::~shader_instance() {}
|
shader_instance::~shader_instance() {}
|
||||||
|
|
||||||
std::uint32_t shader_instance::get_width()
|
uint32_t shader_instance::get_width()
|
||||||
{
|
{
|
||||||
return _fx->width();
|
return _fx->width();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t shader_instance::get_height()
|
uint32_t shader_instance::get_height()
|
||||||
{
|
{
|
||||||
return _fx->height();
|
return _fx->height();
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ void shader_instance::load(obs_data_t* data)
|
||||||
update(data);
|
update(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void shader_instance::migrate(obs_data_t* data, std::uint64_t version) {}
|
void shader_instance::migrate(obs_data_t* data, uint64_t version) {}
|
||||||
|
|
||||||
void shader_instance::update(obs_data_t* data)
|
void shader_instance::update(obs_data_t* data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,13 +32,13 @@ namespace streamfx::filter::shader {
|
||||||
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();
|
||||||
|
|
||||||
virtual std::uint32_t get_width() override;
|
virtual uint32_t get_width() override;
|
||||||
virtual std::uint32_t get_height() override;
|
virtual uint32_t get_height() override;
|
||||||
|
|
||||||
void properties(obs_properties_t* props);
|
void properties(obs_properties_t* props);
|
||||||
|
|
||||||
virtual void load(obs_data_t* data) override;
|
virtual void load(obs_data_t* data) override;
|
||||||
virtual void migrate(obs_data_t* data, std::uint64_t version) override;
|
virtual void migrate(obs_data_t* data, uint64_t version) override;
|
||||||
virtual void update(obs_data_t* data) override;
|
virtual void update(obs_data_t* data) override;
|
||||||
|
|
||||||
virtual void video_tick(float_t sec_since_last) override;
|
virtual void video_tick(float_t sec_since_last) override;
|
||||||
|
|
|
@ -85,7 +85,7 @@ transform_instance::transform_instance(obs_data_t* data, obs_source_t* context)
|
||||||
{
|
{
|
||||||
_cache_rt = std::make_shared<gs::rendertarget>(GS_RGBA, GS_ZS_NONE);
|
_cache_rt = std::make_shared<gs::rendertarget>(GS_RGBA, GS_ZS_NONE);
|
||||||
_source_rt = std::make_shared<gs::rendertarget>(GS_RGBA, GS_ZS_NONE);
|
_source_rt = std::make_shared<gs::rendertarget>(GS_RGBA, GS_ZS_NONE);
|
||||||
_vertex_buffer = std::make_shared<gs::vertex_buffer>(uint32_t(4u), std::uint8_t(1u));
|
_vertex_buffer = std::make_shared<gs::vertex_buffer>(uint32_t(4u), uint8_t(1u));
|
||||||
|
|
||||||
_position = std::make_unique<util::vec3a>();
|
_position = std::make_unique<util::vec3a>();
|
||||||
_rotation = std::make_unique<util::vec3a>();
|
_rotation = std::make_unique<util::vec3a>();
|
||||||
|
@ -116,7 +116,7 @@ void transform_instance::load(obs_data_t* settings)
|
||||||
update(settings);
|
update(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void transform_instance::migrate(obs_data_t* data, std::uint64_t version)
|
void transform_instance::migrate(obs_data_t* data, uint64_t version)
|
||||||
{
|
{
|
||||||
switch (version & STREAMFX_MASK_COMPAT) {
|
switch (version & STREAMFX_MASK_COMPAT) {
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -154,8 +154,8 @@ void transform_instance::update(obs_data_t* settings)
|
||||||
|
|
||||||
void transform_instance::video_tick(float_t)
|
void transform_instance::video_tick(float_t)
|
||||||
{
|
{
|
||||||
std::uint32_t width = 0;
|
uint32_t width = 0;
|
||||||
std::uint32_t height = 0;
|
uint32_t height = 0;
|
||||||
|
|
||||||
// Grab parent and target.
|
// Grab parent and target.
|
||||||
obs_source_t* target = obs_filter_get_target(_self);
|
obs_source_t* target = obs_filter_get_target(_self);
|
||||||
|
@ -274,8 +274,8 @@ void transform_instance::video_render(gs_effect_t* effect)
|
||||||
{
|
{
|
||||||
obs_source_t* parent = obs_filter_get_parent(_self);
|
obs_source_t* parent = obs_filter_get_parent(_self);
|
||||||
obs_source_t* target = obs_filter_get_target(_self);
|
obs_source_t* target = obs_filter_get_target(_self);
|
||||||
std::uint32_t base_width = obs_source_get_base_width(target);
|
uint32_t base_width = obs_source_get_base_width(target);
|
||||||
std::uint32_t base_height = obs_source_get_base_height(target);
|
uint32_t base_height = obs_source_get_base_height(target);
|
||||||
gs_effect_t* default_effect = obs_get_base_effect(OBS_EFFECT_DEFAULT);
|
gs_effect_t* default_effect = obs_get_base_effect(OBS_EFFECT_DEFAULT);
|
||||||
if (!effect)
|
if (!effect)
|
||||||
effect = default_effect;
|
effect = default_effect;
|
||||||
|
@ -290,8 +290,8 @@ void transform_instance::video_render(gs_effect_t* effect)
|
||||||
obs_source_get_name(obs_filter_get_parent(_self))};
|
obs_source_get_name(obs_filter_get_parent(_self))};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::uint32_t cache_width = base_width;
|
uint32_t cache_width = base_width;
|
||||||
std::uint32_t cache_height = base_height;
|
uint32_t cache_height = base_height;
|
||||||
|
|
||||||
if (_mipmap_enabled) {
|
if (_mipmap_enabled) {
|
||||||
double_t aspect = double_t(base_width) / double_t(base_height);
|
double_t aspect = double_t(base_width) / double_t(base_height);
|
||||||
|
|
|
@ -48,7 +48,7 @@ namespace streamfx::filter::transform {
|
||||||
// Mesh
|
// Mesh
|
||||||
bool _update_mesh;
|
bool _update_mesh;
|
||||||
std::shared_ptr<gs::vertex_buffer> _vertex_buffer;
|
std::shared_ptr<gs::vertex_buffer> _vertex_buffer;
|
||||||
std::uint32_t _rotation_order;
|
uint32_t _rotation_order;
|
||||||
std::unique_ptr<util::vec3a> _position;
|
std::unique_ptr<util::vec3a> _position;
|
||||||
std::unique_ptr<util::vec3a> _rotation;
|
std::unique_ptr<util::vec3a> _rotation;
|
||||||
std::unique_ptr<util::vec3a> _scale;
|
std::unique_ptr<util::vec3a> _scale;
|
||||||
|
@ -63,7 +63,7 @@ namespace streamfx::filter::transform {
|
||||||
virtual ~transform_instance() override;
|
virtual ~transform_instance() override;
|
||||||
|
|
||||||
virtual void load(obs_data_t* settings) override;
|
virtual void load(obs_data_t* settings) override;
|
||||||
virtual void migrate(obs_data_t* data, std::uint64_t version) override;
|
virtual void migrate(obs_data_t* data, uint64_t version) override;
|
||||||
virtual void update(obs_data_t*) override;
|
virtual void update(obs_data_t*) override;
|
||||||
|
|
||||||
virtual void video_tick(float_t) override;
|
virtual void video_tick(float_t) override;
|
||||||
|
|
|
@ -271,8 +271,8 @@ std::shared_ptr<::gs::texture> gfx::blur::dual_filtering::render()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reduce Size
|
// Reduce Size
|
||||||
std::uint32_t owidth = width >> n;
|
uint32_t owidth = width >> n;
|
||||||
std::uint32_t oheight = height >> n;
|
uint32_t oheight = height >> n;
|
||||||
if ((owidth <= 0) || (oheight <= 0)) {
|
if ((owidth <= 0) || (oheight <= 0)) {
|
||||||
actual_iterations = n - 1;
|
actual_iterations = n - 1;
|
||||||
break;
|
break;
|
||||||
|
@ -303,10 +303,10 @@ std::shared_ptr<::gs::texture> gfx::blur::dual_filtering::render()
|
||||||
std::shared_ptr<gs::texture> tex_in = _rts[n]->get_texture();
|
std::shared_ptr<gs::texture> tex_in = _rts[n]->get_texture();
|
||||||
|
|
||||||
// Get Size
|
// Get Size
|
||||||
std::uint32_t iwidth = width >> n;
|
uint32_t iwidth = width >> n;
|
||||||
std::uint32_t iheight = height >> n;
|
uint32_t iheight = height >> n;
|
||||||
std::uint32_t owidth = width >> (n - 1);
|
uint32_t owidth = width >> (n - 1);
|
||||||
std::uint32_t oheight = height >> (n - 1);
|
uint32_t oheight = height >> (n - 1);
|
||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
effect.get_parameter("pImage").set_texture(tex_in);
|
effect.get_parameter("pImage").set_texture(tex_in);
|
||||||
|
|
|
@ -33,9 +33,9 @@ namespace gfx {
|
||||||
|
|
||||||
struct basic_data {
|
struct basic_data {
|
||||||
union {
|
union {
|
||||||
int32_t i32;
|
int32_t i32;
|
||||||
std::uint32_t ui32;
|
uint32_t ui32;
|
||||||
float_t f32;
|
float_t f32;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ namespace gfx {
|
||||||
|
|
||||||
struct bool_parameter : public basic_parameter {
|
struct bool_parameter : public basic_parameter {
|
||||||
// std::vector<bool> doesn't allow .data()
|
// std::vector<bool> doesn't allow .data()
|
||||||
std::vector<std::int32_t> _data;
|
std::vector<int32_t> _data;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool_parameter(gs::effect_parameter param, std::string prefix);
|
bool_parameter(gs::effect_parameter param, std::string prefix);
|
||||||
|
|
|
@ -375,7 +375,7 @@ void gfx::shader::shader::update(obs_data_t* data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t gfx::shader::shader::width()
|
uint32_t gfx::shader::shader::width()
|
||||||
{
|
{
|
||||||
switch (_mode) {
|
switch (_mode) {
|
||||||
case shader_mode::Transition:
|
case shader_mode::Transition:
|
||||||
|
@ -399,7 +399,7 @@ std::uint32_t gfx::shader::shader::width()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t gfx::shader::shader::height()
|
uint32_t gfx::shader::shader::height()
|
||||||
{
|
{
|
||||||
switch (_mode) {
|
switch (_mode) {
|
||||||
case shader_mode::Transition:
|
case shader_mode::Transition:
|
||||||
|
@ -423,12 +423,12 @@ std::uint32_t gfx::shader::shader::height()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t gfx::shader::shader::base_width()
|
uint32_t gfx::shader::shader::base_width()
|
||||||
{
|
{
|
||||||
return _base_width;
|
return _base_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t gfx::shader::shader::base_height()
|
uint32_t gfx::shader::shader::base_height()
|
||||||
{
|
{
|
||||||
return _base_height;
|
return _base_height;
|
||||||
}
|
}
|
||||||
|
@ -537,7 +537,7 @@ void gfx::shader::shader::render()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfx::shader::shader::set_size(std::uint32_t w, std::uint32_t h)
|
void gfx::shader::shader::set_size(uint32_t w, uint32_t h)
|
||||||
{
|
{
|
||||||
_base_width = w;
|
_base_width = w;
|
||||||
_base_height = h;
|
_base_height = h;
|
||||||
|
@ -595,7 +595,7 @@ void gfx::shader::shader::set_transition_time(float_t t)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfx::shader::shader::set_transition_size(std::uint32_t w, std::uint32_t h)
|
void gfx::shader::shader::set_transition_size(uint32_t w, uint32_t h)
|
||||||
{
|
{
|
||||||
if (!_shader)
|
if (!_shader)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -44,10 +44,10 @@ namespace gfx {
|
||||||
obs_source_t* _self;
|
obs_source_t* _self;
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
shader_mode _mode;
|
shader_mode _mode;
|
||||||
std::uint32_t _base_width;
|
uint32_t _base_width;
|
||||||
std::uint32_t _base_height;
|
uint32_t _base_height;
|
||||||
bool _active;
|
bool _active;
|
||||||
|
|
||||||
// Shader
|
// Shader
|
||||||
gs::effect _shader;
|
gs::effect _shader;
|
||||||
|
@ -100,13 +100,13 @@ namespace gfx {
|
||||||
|
|
||||||
void update(obs_data_t* data);
|
void update(obs_data_t* data);
|
||||||
|
|
||||||
std::uint32_t width();
|
uint32_t width();
|
||||||
|
|
||||||
std::uint32_t height();
|
uint32_t height();
|
||||||
|
|
||||||
std::uint32_t base_width();
|
uint32_t base_width();
|
||||||
|
|
||||||
std::uint32_t base_height();
|
uint32_t base_height();
|
||||||
|
|
||||||
bool tick(float_t time);
|
bool tick(float_t time);
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ namespace gfx {
|
||||||
void render();
|
void render();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void set_size(std::uint32_t w, std::uint32_t h);
|
void set_size(uint32_t w, uint32_t h);
|
||||||
|
|
||||||
void set_input_a(std::shared_ptr<gs::texture> tex);
|
void set_input_a(std::shared_ptr<gs::texture> tex);
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ namespace gfx {
|
||||||
|
|
||||||
void set_transition_time(float_t t);
|
void set_transition_time(float_t t);
|
||||||
|
|
||||||
void set_transition_size(std::uint32_t w, std::uint32_t h);
|
void set_transition_size(uint32_t w, uint32_t h);
|
||||||
|
|
||||||
void set_active(bool active);
|
void set_active(bool active);
|
||||||
};
|
};
|
||||||
|
|
|
@ -38,37 +38,37 @@ namespace nvidia::ar {
|
||||||
inline NvCV_Status get(std::string name, T& value);
|
inline NvCV_Status get(std::string name, T& value);
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline NvCV_Status set(std::string name, std::int32_t value)
|
inline NvCV_Status set(std::string name, int32_t value)
|
||||||
{
|
{
|
||||||
return _ar->set_int32(_feature.get(), name.c_str(), value);
|
return _ar->set_int32(_feature.get(), name.c_str(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline NvCV_Status get(std::string name, std::int32_t& value)
|
inline NvCV_Status get(std::string name, int32_t& value)
|
||||||
{
|
{
|
||||||
return _ar->get_int32(_feature.get(), name.c_str(), &value);
|
return _ar->get_int32(_feature.get(), name.c_str(), &value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline NvCV_Status set(std::string name, std::uint32_t value)
|
inline NvCV_Status set(std::string name, uint32_t value)
|
||||||
{
|
{
|
||||||
return _ar->set_uint32(_feature.get(), name.c_str(), value);
|
return _ar->set_uint32(_feature.get(), name.c_str(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline NvCV_Status get(std::string name, std::uint32_t& value)
|
inline NvCV_Status get(std::string name, uint32_t& value)
|
||||||
{
|
{
|
||||||
return _ar->get_uint32(_feature.get(), name.c_str(), &value);
|
return _ar->get_uint32(_feature.get(), name.c_str(), &value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline NvCV_Status set(std::string name, std::uint64_t value)
|
inline NvCV_Status set(std::string name, uint64_t value)
|
||||||
{
|
{
|
||||||
return _ar->set_uint64(_feature.get(), name.c_str(), value);
|
return _ar->set_uint64(_feature.get(), name.c_str(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
inline NvCV_Status get(std::string name, std::uint64_t& value)
|
inline NvCV_Status get(std::string name, uint64_t& value)
|
||||||
{
|
{
|
||||||
return _ar->get_uint64(_feature.get(), name.c_str(), &value);
|
return _ar->get_uint64(_feature.get(), name.c_str(), &value);
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ namespace nvidia::ar {
|
||||||
inline NvCV_Status set(std::string name, std::vector<std::float_t> value)
|
inline NvCV_Status set(std::string name, std::vector<std::float_t> value)
|
||||||
{
|
{
|
||||||
return _ar->set_float32_array(_feature.get(), name.c_str(), value.data(),
|
return _ar->set_float32_array(_feature.get(), name.c_str(), value.data(),
|
||||||
static_cast<std::int32_t>(value.size()));
|
static_cast<int32_t>(value.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
nvidia::cuda::stream::stream(std::shared_ptr<::nvidia::cuda::cuda> cuda, ::nvidia::cuda::stream_flags flags,
|
nvidia::cuda::stream::stream(std::shared_ptr<::nvidia::cuda::cuda> cuda, ::nvidia::cuda::stream_flags flags,
|
||||||
std::int32_t priority)
|
int32_t priority)
|
||||||
: _cuda(cuda)
|
: _cuda(cuda)
|
||||||
{
|
{
|
||||||
nvidia::cuda::result res;
|
nvidia::cuda::result res;
|
||||||
|
|
|
@ -28,7 +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, std::int32_t priority = 0);
|
::nvidia::cuda::stream_flags flags = ::nvidia::cuda::stream_flags::DEFAULT, int32_t priority = 0);
|
||||||
~stream();
|
~stream();
|
||||||
|
|
||||||
::nvidia::cuda::stream_t get();
|
::nvidia::cuda::stream_t get();
|
||||||
|
|
|
@ -58,14 +58,14 @@ namespace nvidia::cuda {
|
||||||
// Still missing some.
|
// Still missing some.
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class memory_type : std::uint32_t {
|
enum class memory_type : uint32_t {
|
||||||
HOST = 1,
|
HOST = 1,
|
||||||
DEVICE = 2,
|
DEVICE = 2,
|
||||||
ARRAY = 3,
|
ARRAY = 3,
|
||||||
UNIFIED = 4,
|
UNIFIED = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class array_format : std::uint32_t {
|
enum class array_format : uint32_t {
|
||||||
UNSIGNED_INT8 = 0b00000001,
|
UNSIGNED_INT8 = 0b00000001,
|
||||||
UNSIGNED_INT16 = 0b00000010,
|
UNSIGNED_INT16 = 0b00000010,
|
||||||
UNSIGNED_INT32 = 0b00000011,
|
UNSIGNED_INT32 = 0b00000011,
|
||||||
|
@ -76,7 +76,7 @@ namespace nvidia::cuda {
|
||||||
FLOAT = 0b00100000,
|
FLOAT = 0b00100000,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class context_flags : std::uint32_t {
|
enum class context_flags : uint32_t {
|
||||||
SCHEDULER_AUTO = 0x0,
|
SCHEDULER_AUTO = 0x0,
|
||||||
SCHEDULER_SPIN = 0x1,
|
SCHEDULER_SPIN = 0x1,
|
||||||
SCHEDULER_YIELD = 0x2,
|
SCHEDULER_YIELD = 0x2,
|
||||||
|
@ -85,17 +85,17 @@ namespace nvidia::cuda {
|
||||||
LOCAL_MEMORY_RESIZE_TO_MAXIMUM = 0x10,
|
LOCAL_MEMORY_RESIZE_TO_MAXIMUM = 0x10,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class stream_flags : std::uint32_t {
|
enum class stream_flags : uint32_t {
|
||||||
DEFAULT = 0x0,
|
DEFAULT = 0x0,
|
||||||
NON_BLOCKING = 0x1,
|
NON_BLOCKING = 0x1,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void* array_t;
|
typedef void* array_t;
|
||||||
typedef void* context_t;
|
typedef void* context_t;
|
||||||
typedef std::uint64_t device_ptr_t;
|
typedef uint64_t device_ptr_t;
|
||||||
typedef void* graphics_resource_t;
|
typedef void* graphics_resource_t;
|
||||||
typedef void* stream_t;
|
typedef void* stream_t;
|
||||||
typedef std::int32_t device_t;
|
typedef int32_t device_t;
|
||||||
|
|
||||||
struct memcpy2d_t {
|
struct memcpy2d_t {
|
||||||
std::size_t src_x_in_bytes;
|
std::size_t src_x_in_bytes;
|
||||||
|
@ -121,10 +121,10 @@ namespace nvidia::cuda {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct array_descriptor_t {
|
struct array_descriptor_t {
|
||||||
std::size_t width;
|
std::size_t width;
|
||||||
std::size_t height;
|
std::size_t height;
|
||||||
std::uint32_t num_channels;
|
uint32_t num_channels;
|
||||||
array_format format;
|
array_format format;
|
||||||
};
|
};
|
||||||
|
|
||||||
class cuda {
|
class cuda {
|
||||||
|
@ -137,10 +137,10 @@ namespace nvidia::cuda {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Initialization
|
// Initialization
|
||||||
CUDA_DEFINE_FUNCTION(cuInit, std::int32_t flags);
|
CUDA_DEFINE_FUNCTION(cuInit, int32_t flags);
|
||||||
|
|
||||||
// Version Management
|
// Version Management
|
||||||
CUDA_DEFINE_FUNCTION(cuDriverGetVersion, std::int32_t* driverVersion);
|
CUDA_DEFINE_FUNCTION(cuDriverGetVersion, int32_t* driverVersion);
|
||||||
|
|
||||||
// Device Management
|
// Device Management
|
||||||
// cuDeviceGet
|
// cuDeviceGet
|
||||||
|
@ -169,7 +169,7 @@ namespace nvidia::cuda {
|
||||||
// cuCtxGetFlags
|
// cuCtxGetFlags
|
||||||
// cuCtxGetLimit
|
// cuCtxGetLimit
|
||||||
// cuCtxGetSharedMemConfig
|
// cuCtxGetSharedMemConfig
|
||||||
CUDA_DEFINE_FUNCTION(cuCtxGetStreamPriorityRange, std::int32_t* lowestPriority, std::int32_t* highestPriority);
|
CUDA_DEFINE_FUNCTION(cuCtxGetStreamPriorityRange, int32_t* lowestPriority, int32_t* highestPriority);
|
||||||
CUDA_DEFINE_FUNCTION(cuCtxPopCurrent, context_t* ctx);
|
CUDA_DEFINE_FUNCTION(cuCtxPopCurrent, context_t* ctx);
|
||||||
CUDA_DEFINE_FUNCTION(cuCtxPushCurrent, context_t ctx);
|
CUDA_DEFINE_FUNCTION(cuCtxPushCurrent, context_t ctx);
|
||||||
// cuCtxSetCacheConfig
|
// cuCtxSetCacheConfig
|
||||||
|
@ -214,13 +214,13 @@ namespace nvidia::cuda {
|
||||||
// cuMemAllocHost_v2
|
// cuMemAllocHost_v2
|
||||||
// cuMemAllocManaged
|
// cuMemAllocManaged
|
||||||
CUDA_DEFINE_FUNCTION(cuMemAllocPitch, device_ptr_t* ptr, std::size_t* pitch, std::size_t width_in_bytes,
|
CUDA_DEFINE_FUNCTION(cuMemAllocPitch, device_ptr_t* ptr, std::size_t* pitch, std::size_t width_in_bytes,
|
||||||
std::size_t height, std::uint32_t element_size_bytes);
|
std::size_t height, uint32_t element_size_bytes);
|
||||||
CUDA_DEFINE_FUNCTION(cuMemFree, device_ptr_t ptr);
|
CUDA_DEFINE_FUNCTION(cuMemFree, device_ptr_t ptr);
|
||||||
// cuMemFreeHost
|
// cuMemFreeHost
|
||||||
// cuMemGetAddressRange_v2
|
// cuMemGetAddressRange_v2
|
||||||
// cuMemGetInfo_v2
|
// cuMemGetInfo_v2
|
||||||
// cuMemHostAlloc
|
// cuMemHostAlloc
|
||||||
CUDA_DEFINE_FUNCTION(cuMemHostGetDevicePointer, device_ptr_t* devptr, void* ptr, std::uint32_t flags);
|
CUDA_DEFINE_FUNCTION(cuMemHostGetDevicePointer, device_ptr_t* devptr, void* ptr, uint32_t flags);
|
||||||
// cuMemHostGetFlags
|
// cuMemHostGetFlags
|
||||||
// cuMemHostRegister_v2
|
// cuMemHostRegister_v2
|
||||||
// cuMemHostUnregister
|
// cuMemHostUnregister
|
||||||
|
@ -292,7 +292,7 @@ namespace nvidia::cuda {
|
||||||
// cuStreamAttachMemAsync
|
// cuStreamAttachMemAsync
|
||||||
// cuStreamBeginCapture_v2
|
// cuStreamBeginCapture_v2
|
||||||
CUDA_DEFINE_FUNCTION(cuStreamCreate, stream_t* stream, stream_flags flags);
|
CUDA_DEFINE_FUNCTION(cuStreamCreate, stream_t* stream, stream_flags flags);
|
||||||
CUDA_DEFINE_FUNCTION(cuStreamCreateWithPriority, stream_t* stream, stream_flags flags, std::int32_t priority);
|
CUDA_DEFINE_FUNCTION(cuStreamCreateWithPriority, stream_t* stream, stream_flags flags, int32_t priority);
|
||||||
CUDA_DEFINE_FUNCTION(cuStreamDestroy, stream_t stream);
|
CUDA_DEFINE_FUNCTION(cuStreamDestroy, stream_t stream);
|
||||||
// cuStreamEndCapture
|
// cuStreamEndCapture
|
||||||
// cuStreamGetCaptureInfo
|
// cuStreamGetCaptureInfo
|
||||||
|
@ -356,15 +356,13 @@ namespace nvidia::cuda {
|
||||||
// Todo
|
// Todo
|
||||||
|
|
||||||
// Graphics Interoperability
|
// Graphics Interoperability
|
||||||
CUDA_DEFINE_FUNCTION(cuGraphicsMapResources, std::uint32_t count, graphics_resource_t* resources,
|
CUDA_DEFINE_FUNCTION(cuGraphicsMapResources, uint32_t count, graphics_resource_t* resources, stream_t stream);
|
||||||
stream_t stream);
|
|
||||||
// cuGraphicsResourcesGetMappedMipmappedArray
|
// cuGraphicsResourcesGetMappedMipmappedArray
|
||||||
// cuGraphicsResourcesGetMappedPointer_v2
|
// cuGraphicsResourcesGetMappedPointer_v2
|
||||||
// cuGraphicsResourcesSetMapFlags_v2
|
// cuGraphicsResourcesSetMapFlags_v2
|
||||||
CUDA_DEFINE_FUNCTION(cuGraphicsSubResourceGetMappedArray, array_t* array, graphics_resource_t resource,
|
CUDA_DEFINE_FUNCTION(cuGraphicsSubResourceGetMappedArray, array_t* array, graphics_resource_t resource,
|
||||||
std::uint32_t index, std::uint32_t level);
|
uint32_t index, uint32_t level);
|
||||||
CUDA_DEFINE_FUNCTION(cuGraphicsUnmapResources, std::uint32_t count, graphics_resource_t* resources,
|
CUDA_DEFINE_FUNCTION(cuGraphicsUnmapResources, uint32_t count, graphics_resource_t* resources, stream_t stream);
|
||||||
stream_t stream);
|
|
||||||
CUDA_DEFINE_FUNCTION(cuGraphicsUnregisterResource, graphics_resource_t resource);
|
CUDA_DEFINE_FUNCTION(cuGraphicsUnregisterResource, graphics_resource_t resource);
|
||||||
|
|
||||||
// Profile Control
|
// Profile Control
|
||||||
|
@ -394,7 +392,7 @@ namespace nvidia::cuda {
|
||||||
CUDA_DEFINE_FUNCTION(cuD3D11GetDevice, device_t* device, IDXGIAdapter* adapter);
|
CUDA_DEFINE_FUNCTION(cuD3D11GetDevice, device_t* device, IDXGIAdapter* adapter);
|
||||||
// cuD3D11GetDevices
|
// cuD3D11GetDevices
|
||||||
CUDA_DEFINE_FUNCTION(cuGraphicsD3D11RegisterResource, graphics_resource_t* resource,
|
CUDA_DEFINE_FUNCTION(cuGraphicsD3D11RegisterResource, graphics_resource_t* resource,
|
||||||
ID3D11Resource* d3dresource, std::uint32_t flags);
|
ID3D11Resource* d3dresource, uint32_t flags);
|
||||||
#endif
|
#endif
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<cuda> get();
|
static std::shared_ptr<cuda> get();
|
||||||
|
|
|
@ -293,7 +293,7 @@ void gs::effect_parameter::get_float2(float_t& x, float_t& y)
|
||||||
{
|
{
|
||||||
if (get_type() != type::Float2)
|
if (get_type() != type::Float2)
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
x = *reinterpret_cast<float_t*>(ptr);
|
x = *reinterpret_cast<float_t*>(ptr);
|
||||||
y = *reinterpret_cast<float_t*>(ptr + sizeof(float_t));
|
y = *reinterpret_cast<float_t*>(ptr + sizeof(float_t));
|
||||||
|
@ -307,7 +307,7 @@ void gs::effect_parameter::get_default_float2(float_t& x, float_t& y)
|
||||||
{
|
{
|
||||||
if (get_type() != type::Float2)
|
if (get_type() != type::Float2)
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_default_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_default_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
x = *reinterpret_cast<float_t*>(ptr);
|
x = *reinterpret_cast<float_t*>(ptr);
|
||||||
y = *reinterpret_cast<float_t*>(ptr + sizeof(float_t));
|
y = *reinterpret_cast<float_t*>(ptr + sizeof(float_t));
|
||||||
|
@ -346,7 +346,7 @@ void gs::effect_parameter::get_float3(float_t& x, float_t& y, float_t& z)
|
||||||
{
|
{
|
||||||
if (get_type() != type::Float3)
|
if (get_type() != type::Float3)
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
x = *reinterpret_cast<float_t*>(ptr);
|
x = *reinterpret_cast<float_t*>(ptr);
|
||||||
y = *reinterpret_cast<float_t*>(ptr + sizeof(float_t));
|
y = *reinterpret_cast<float_t*>(ptr + sizeof(float_t));
|
||||||
|
@ -361,7 +361,7 @@ void gs::effect_parameter::get_default_float3(float_t& x, float_t& y, float_t& z
|
||||||
{
|
{
|
||||||
if (get_type() != type::Float3)
|
if (get_type() != type::Float3)
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_default_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_default_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
x = *reinterpret_cast<float_t*>(ptr);
|
x = *reinterpret_cast<float_t*>(ptr);
|
||||||
y = *reinterpret_cast<float_t*>(ptr + sizeof(float_t));
|
y = *reinterpret_cast<float_t*>(ptr + sizeof(float_t));
|
||||||
|
@ -401,7 +401,7 @@ void gs::effect_parameter::get_float4(float_t& x, float_t& y, float_t& z, float_
|
||||||
{
|
{
|
||||||
if (get_type() != type::Float4)
|
if (get_type() != type::Float4)
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
x = *reinterpret_cast<float_t*>(ptr);
|
x = *reinterpret_cast<float_t*>(ptr);
|
||||||
y = *reinterpret_cast<float_t*>(ptr + sizeof(float_t));
|
y = *reinterpret_cast<float_t*>(ptr + sizeof(float_t));
|
||||||
|
@ -417,7 +417,7 @@ void gs::effect_parameter::get_default_float4(float_t& x, float_t& y, float_t& z
|
||||||
{
|
{
|
||||||
if (get_type() != type::Float4)
|
if (get_type() != type::Float4)
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_default_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_default_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
x = *reinterpret_cast<float_t*>(ptr);
|
x = *reinterpret_cast<float_t*>(ptr);
|
||||||
y = *reinterpret_cast<float_t*>(ptr + sizeof(float_t));
|
y = *reinterpret_cast<float_t*>(ptr + sizeof(float_t));
|
||||||
|
@ -440,7 +440,7 @@ void gs::effect_parameter::get_int(int32_t& x)
|
||||||
{
|
{
|
||||||
if ((get_type() != type::Integer) && (get_type() != type::Unknown))
|
if ((get_type() != type::Integer) && (get_type() != type::Unknown))
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
x = *reinterpret_cast<int32_t*>(ptr);
|
x = *reinterpret_cast<int32_t*>(ptr);
|
||||||
bfree(ptr);
|
bfree(ptr);
|
||||||
|
@ -453,7 +453,7 @@ void gs::effect_parameter::get_default_int(int32_t& x)
|
||||||
{
|
{
|
||||||
if ((get_type() != type::Integer) && (get_type() != type::Unknown))
|
if ((get_type() != type::Integer) && (get_type() != type::Unknown))
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_default_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_default_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
x = *reinterpret_cast<int32_t*>(ptr);
|
x = *reinterpret_cast<int32_t*>(ptr);
|
||||||
bfree(ptr);
|
bfree(ptr);
|
||||||
|
@ -474,7 +474,7 @@ void gs::effect_parameter::get_int2(int32_t& x, int32_t& y)
|
||||||
{
|
{
|
||||||
if ((get_type() != type::Integer2) && (get_type() != type::Unknown))
|
if ((get_type() != type::Integer2) && (get_type() != type::Unknown))
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
x = *reinterpret_cast<int32_t*>(ptr);
|
x = *reinterpret_cast<int32_t*>(ptr);
|
||||||
y = *reinterpret_cast<int32_t*>(ptr + sizeof(int32_t));
|
y = *reinterpret_cast<int32_t*>(ptr + sizeof(int32_t));
|
||||||
|
@ -488,7 +488,7 @@ void gs::effect_parameter::get_default_int2(int32_t& x, int32_t& y)
|
||||||
{
|
{
|
||||||
if ((get_type() != type::Integer2) && (get_type() != type::Unknown))
|
if ((get_type() != type::Integer2) && (get_type() != type::Unknown))
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_default_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_default_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
x = *reinterpret_cast<int32_t*>(ptr);
|
x = *reinterpret_cast<int32_t*>(ptr);
|
||||||
y = *reinterpret_cast<int32_t*>(ptr + sizeof(int32_t));
|
y = *reinterpret_cast<int32_t*>(ptr + sizeof(int32_t));
|
||||||
|
@ -510,7 +510,7 @@ void gs::effect_parameter::get_int3(int32_t& x, int32_t& y, int32_t& z)
|
||||||
{
|
{
|
||||||
if ((get_type() != type::Integer3) && (get_type() != type::Unknown))
|
if ((get_type() != type::Integer3) && (get_type() != type::Unknown))
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
x = *reinterpret_cast<int32_t*>(ptr);
|
x = *reinterpret_cast<int32_t*>(ptr);
|
||||||
y = *reinterpret_cast<int32_t*>(ptr + sizeof(int32_t));
|
y = *reinterpret_cast<int32_t*>(ptr + sizeof(int32_t));
|
||||||
|
@ -525,7 +525,7 @@ void gs::effect_parameter::get_default_int3(int32_t& x, int32_t& y, int32_t& z)
|
||||||
{
|
{
|
||||||
if ((get_type() != type::Integer3) && (get_type() != type::Unknown))
|
if ((get_type() != type::Integer3) && (get_type() != type::Unknown))
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_default_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_default_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
x = *reinterpret_cast<int32_t*>(ptr);
|
x = *reinterpret_cast<int32_t*>(ptr);
|
||||||
y = *reinterpret_cast<int32_t*>(ptr + sizeof(int32_t));
|
y = *reinterpret_cast<int32_t*>(ptr + sizeof(int32_t));
|
||||||
|
@ -548,7 +548,7 @@ void gs::effect_parameter::get_int4(int32_t& x, int32_t& y, int32_t& z, int32_t&
|
||||||
{
|
{
|
||||||
if ((get_type() != type::Integer4) && (get_type() != type::Unknown))
|
if ((get_type() != type::Integer4) && (get_type() != type::Unknown))
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
x = *reinterpret_cast<int32_t*>(ptr);
|
x = *reinterpret_cast<int32_t*>(ptr);
|
||||||
y = *reinterpret_cast<int32_t*>(ptr + sizeof(int32_t));
|
y = *reinterpret_cast<int32_t*>(ptr + sizeof(int32_t));
|
||||||
|
@ -564,7 +564,7 @@ void gs::effect_parameter::get_default_int4(int32_t& x, int32_t& y, int32_t& z,
|
||||||
{
|
{
|
||||||
if ((get_type() != type::Integer4) && (get_type() != type::Unknown))
|
if ((get_type() != type::Integer4) && (get_type() != type::Unknown))
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_default_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_default_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
x = *reinterpret_cast<int32_t*>(ptr);
|
x = *reinterpret_cast<int32_t*>(ptr);
|
||||||
y = *reinterpret_cast<int32_t*>(ptr + sizeof(int32_t));
|
y = *reinterpret_cast<int32_t*>(ptr + sizeof(int32_t));
|
||||||
|
@ -587,7 +587,7 @@ void gs::effect_parameter::get_matrix(matrix4& v)
|
||||||
{
|
{
|
||||||
if (get_type() != type::Matrix)
|
if (get_type() != type::Matrix)
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
v.x.x = *reinterpret_cast<float_t*>(ptr + sizeof(float_t) * 0);
|
v.x.x = *reinterpret_cast<float_t*>(ptr + sizeof(float_t) * 0);
|
||||||
v.x.y = *reinterpret_cast<float_t*>(ptr + sizeof(float_t) * 1);
|
v.x.y = *reinterpret_cast<float_t*>(ptr + sizeof(float_t) * 1);
|
||||||
|
@ -618,7 +618,7 @@ void gs::effect_parameter::get_default_matrix(matrix4& v)
|
||||||
{
|
{
|
||||||
if (get_type() != type::Matrix)
|
if (get_type() != type::Matrix)
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_default_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_default_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
v.x.x = *reinterpret_cast<float_t*>(ptr + sizeof(float_t) * 0);
|
v.x.x = *reinterpret_cast<float_t*>(ptr + sizeof(float_t) * 0);
|
||||||
v.x.y = *reinterpret_cast<float_t*>(ptr + sizeof(float_t) * 1);
|
v.x.y = *reinterpret_cast<float_t*>(ptr + sizeof(float_t) * 1);
|
||||||
|
@ -684,10 +684,10 @@ void gs::effect_parameter::get_string(std::string& v)
|
||||||
{
|
{
|
||||||
if (get_type() != type::String)
|
if (get_type() != type::String)
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::size_t ptr_len = gs_effect_get_val_size(get());
|
std::size_t ptr_len = gs_effect_get_val_size(get());
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
v = std::string(reinterpret_cast<std::int8_t*>(ptr), reinterpret_cast<std::int8_t*>(ptr) + ptr_len - 1);
|
v = std::string(reinterpret_cast<int8_t*>(ptr), reinterpret_cast<int8_t*>(ptr) + ptr_len - 1);
|
||||||
bfree(ptr);
|
bfree(ptr);
|
||||||
} else {
|
} else {
|
||||||
v = "";
|
v = "";
|
||||||
|
@ -698,10 +698,10 @@ void gs::effect_parameter::get_default_string(std::string& v)
|
||||||
{
|
{
|
||||||
if (get_type() != type::String)
|
if (get_type() != type::String)
|
||||||
throw std::bad_cast();
|
throw std::bad_cast();
|
||||||
std::size_t ptr_len = gs_effect_get_default_val_size(get());
|
std::size_t ptr_len = gs_effect_get_default_val_size(get());
|
||||||
std::uint8_t* ptr = static_cast<std::uint8_t*>(gs_effect_get_default_val(get()));
|
uint8_t* ptr = static_cast<uint8_t*>(gs_effect_get_default_val(get()));
|
||||||
if (ptr) {
|
if (ptr) {
|
||||||
v = std::string(reinterpret_cast<std::int8_t*>(ptr), reinterpret_cast<std::int8_t*>(ptr) + ptr_len - 1);
|
v = std::string(reinterpret_cast<int8_t*>(ptr), reinterpret_cast<int8_t*>(ptr) + ptr_len - 1);
|
||||||
bfree(ptr);
|
bfree(ptr);
|
||||||
} else {
|
} else {
|
||||||
v = "";
|
v = "";
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "gs-limits.hpp"
|
#include "gs-limits.hpp"
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
|
|
||||||
gs::index_buffer::index_buffer(std::uint32_t maximumVertices)
|
gs::index_buffer::index_buffer(uint32_t maximumVertices)
|
||||||
{
|
{
|
||||||
this->reserve(maximumVertices);
|
this->reserve(maximumVertices);
|
||||||
auto gctx = gs::context();
|
auto gctx = gs::context();
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
namespace gs {
|
namespace gs {
|
||||||
class index_buffer : public std::vector<uint32_t> {
|
class index_buffer : public std::vector<uint32_t> {
|
||||||
public:
|
public:
|
||||||
index_buffer(std::uint32_t maximumVertices);
|
index_buffer(uint32_t maximumVertices);
|
||||||
index_buffer();
|
index_buffer();
|
||||||
index_buffer(index_buffer& other);
|
index_buffer(index_buffer& other);
|
||||||
index_buffer(std::vector<uint32_t>& other);
|
index_buffer(std::vector<uint32_t>& other);
|
||||||
|
|
|
@ -21,6 +21,6 @@
|
||||||
#include "common.hpp"
|
#include "common.hpp"
|
||||||
|
|
||||||
namespace gs {
|
namespace gs {
|
||||||
static const std::uint32_t MAXIMUM_VERTICES = 0xFFFFFFu;
|
static const uint32_t MAXIMUM_VERTICES = 0xFFFFFFu;
|
||||||
static const std::uint32_t MAXIMUM_UVW_LAYERS = 8u;
|
static const uint32_t MAXIMUM_UVW_LAYERS = 8u;
|
||||||
} // namespace gs
|
} // namespace gs
|
||||||
|
|
|
@ -45,7 +45,7 @@ gs::mipmapper::~mipmapper()
|
||||||
|
|
||||||
gs::mipmapper::mipmapper()
|
gs::mipmapper::mipmapper()
|
||||||
{
|
{
|
||||||
_vb = std::make_unique<gs::vertex_buffer>(uint32_t(3u), std::uint8_t(1u));
|
_vb = std::make_unique<gs::vertex_buffer>(uint32_t(3u), uint8_t(1u));
|
||||||
|
|
||||||
{
|
{
|
||||||
auto vtx = _vb->at(0);
|
auto vtx = _vb->at(0);
|
||||||
|
@ -211,7 +211,7 @@ void gs::mipmapper::rebuild(std::shared_ptr<gs::texture> source, std::shared_ptr
|
||||||
if (gs_get_device_type() == GS_DEVICE_DIRECT3D_11) {
|
if (gs_get_device_type() == GS_DEVICE_DIRECT3D_11) {
|
||||||
ID3D11Texture2D* rtt =
|
ID3D11Texture2D* rtt =
|
||||||
reinterpret_cast<ID3D11Texture2D*>(gs_texture_get_obj(_rt->get_texture()->get_object()));
|
reinterpret_cast<ID3D11Texture2D*>(gs_texture_get_obj(_rt->get_texture()->get_object()));
|
||||||
std::uint32_t level = uint32_t(D3D11CalcSubresource(UINT(mip), 0, UINT(max_mip_level)));
|
uint32_t level = uint32_t(D3D11CalcSubresource(UINT(mip), 0, UINT(max_mip_level)));
|
||||||
|
|
||||||
D3D11_BOX box = {0, 0, 0, cwidth, cheight, 1};
|
D3D11_BOX box = {0, 0, 0, cwidth, cheight, 1};
|
||||||
d3d_context->CopySubresourceRegion(d3d_target, level, 0, 0, 0, rtt, 0, &box);
|
d3d_context->CopySubresourceRegion(d3d_target, level, 0, 0, 0, rtt, 0, &box);
|
||||||
|
|
|
@ -38,7 +38,7 @@ gs::rendertarget::rendertarget(gs_color_format colorFormat, gs_zstencil_format z
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gs::rendertarget_op gs::rendertarget::render(std::uint32_t width, std::uint32_t height)
|
gs::rendertarget_op gs::rendertarget::render(uint32_t width, uint32_t height)
|
||||||
{
|
{
|
||||||
return {this, width, height};
|
return {this, width, height};
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ gs_zstencil_format gs::rendertarget::get_zstencil_format()
|
||||||
return _zstencil_format;
|
return _zstencil_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
gs::rendertarget_op::rendertarget_op(gs::rendertarget* rt, std::uint32_t width, std::uint32_t height) : parent(rt)
|
gs::rendertarget_op::rendertarget_op(gs::rendertarget* rt, uint32_t width, uint32_t height) : parent(rt)
|
||||||
{
|
{
|
||||||
if (parent == nullptr)
|
if (parent == nullptr)
|
||||||
throw std::invalid_argument("rt");
|
throw std::invalid_argument("rt");
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace gs {
|
||||||
|
|
||||||
gs_zstencil_format get_zstencil_format();
|
gs_zstencil_format get_zstencil_format();
|
||||||
|
|
||||||
gs::rendertarget_op render(std::uint32_t width, std::uint32_t height);
|
gs::rendertarget_op render(uint32_t width, uint32_t height);
|
||||||
};
|
};
|
||||||
|
|
||||||
class rendertarget_op {
|
class rendertarget_op {
|
||||||
|
@ -62,7 +62,7 @@ namespace gs {
|
||||||
public:
|
public:
|
||||||
~rendertarget_op();
|
~rendertarget_op();
|
||||||
|
|
||||||
rendertarget_op(gs::rendertarget* rt, std::uint32_t width, std::uint32_t height);
|
rendertarget_op(gs::rendertarget* rt, uint32_t width, uint32_t height);
|
||||||
|
|
||||||
// Move Constructor
|
// Move Constructor
|
||||||
rendertarget_op(gs::rendertarget_op&&);
|
rendertarget_op(gs::rendertarget_op&&);
|
||||||
|
|
|
@ -77,36 +77,36 @@ gs_address_mode gs::sampler::get_address_mode_w()
|
||||||
return _sampler_info.address_w;
|
return _sampler_info.address_w;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gs::sampler::set_max_anisotropy(std::int32_t v)
|
void gs::sampler::set_max_anisotropy(int32_t v)
|
||||||
{
|
{
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
_sampler_info.max_anisotropy = v;
|
_sampler_info.max_anisotropy = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::int32_t gs::sampler::get_max_anisotropy()
|
int32_t gs::sampler::get_max_anisotropy()
|
||||||
{
|
{
|
||||||
return _sampler_info.max_anisotropy;
|
return _sampler_info.max_anisotropy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gs::sampler::set_border_color(std::uint32_t v)
|
void gs::sampler::set_border_color(uint32_t v)
|
||||||
{
|
{
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
_sampler_info.border_color = v;
|
_sampler_info.border_color = v;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gs::sampler::set_border_color(std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a)
|
void gs::sampler::set_border_color(uint8_t r, uint8_t g, uint8_t b, uint8_t a)
|
||||||
{
|
{
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
_sampler_info.border_color = (static_cast<std::uint32_t>(a) << 24) | (static_cast<std::uint32_t>(r) << 16)
|
_sampler_info.border_color = (static_cast<uint32_t>(a) << 24) | (static_cast<uint32_t>(r) << 16)
|
||||||
| (static_cast<std::uint32_t>(g) << 8) | static_cast<std::uint32_t>(b);
|
| (static_cast<uint32_t>(g) << 8) | static_cast<uint32_t>(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t gs::sampler::get_border_color()
|
uint32_t gs::sampler::get_border_color()
|
||||||
{
|
{
|
||||||
return _sampler_info.border_color;
|
return _sampler_info.border_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint8_t gs::sampler::get_border_color(bool r, bool g, bool b, bool a)
|
uint8_t gs::sampler::get_border_color(bool r, bool g, bool b, bool a)
|
||||||
{
|
{
|
||||||
if (a)
|
if (a)
|
||||||
return (_sampler_info.border_color >> 24) & 0xFF;
|
return (_sampler_info.border_color >> 24) & 0xFF;
|
||||||
|
|
|
@ -38,13 +38,13 @@ namespace gs {
|
||||||
void set_address_mode_w(gs_address_mode v);
|
void set_address_mode_w(gs_address_mode v);
|
||||||
gs_address_mode get_address_mode_w();
|
gs_address_mode get_address_mode_w();
|
||||||
|
|
||||||
void set_max_anisotropy(std::int32_t v);
|
void set_max_anisotropy(int32_t v);
|
||||||
int get_max_anisotropy();
|
int get_max_anisotropy();
|
||||||
|
|
||||||
void set_border_color(std::uint32_t v);
|
void set_border_color(uint32_t v);
|
||||||
void set_border_color(std::uint8_t r, std::uint8_t g, std::uint8_t b, std::uint8_t a);
|
void set_border_color(uint8_t r, uint8_t g, uint8_t b, uint8_t a);
|
||||||
std::uint32_t get_border_color();
|
uint32_t get_border_color();
|
||||||
std::uint8_t get_border_color(bool r, bool g, bool b, bool a);
|
uint8_t get_border_color(bool r, bool g, bool b, bool a);
|
||||||
|
|
||||||
gs_sampler_state* refresh();
|
gs_sampler_state* refresh();
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,9 @@
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include "obs/gs/gs-helper.hpp"
|
#include "obs/gs/gs-helper.hpp"
|
||||||
|
|
||||||
static std::uint32_t decode_flags(gs::texture::flags texture_flags)
|
static uint32_t decode_flags(gs::texture::flags texture_flags)
|
||||||
{
|
{
|
||||||
std::uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
if (exact(texture_flags, gs::texture::flags::Dynamic))
|
if (exact(texture_flags, gs::texture::flags::Dynamic))
|
||||||
flags |= GS_DYNAMIC;
|
flags |= GS_DYNAMIC;
|
||||||
if (exact(texture_flags, gs::texture::flags::BuildMipMaps))
|
if (exact(texture_flags, gs::texture::flags::BuildMipMaps))
|
||||||
|
@ -33,8 +33,8 @@ static std::uint32_t decode_flags(gs::texture::flags texture_flags)
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
gs::texture::texture(std::uint32_t width, std::uint32_t height, gs_color_format format, std::uint32_t mip_levels,
|
gs::texture::texture(uint32_t width, uint32_t height, gs_color_format format, uint32_t mip_levels,
|
||||||
const std::uint8_t** mip_data, gs::texture::flags texture_flags)
|
const uint8_t** mip_data, gs::texture::flags texture_flags)
|
||||||
{
|
{
|
||||||
if (width == 0)
|
if (width == 0)
|
||||||
throw std::logic_error("width must be at least 1");
|
throw std::logic_error("width must be at least 1");
|
||||||
|
@ -60,8 +60,8 @@ gs::texture::texture(std::uint32_t width, std::uint32_t height, gs_color_format
|
||||||
_type = type::Normal;
|
_type = type::Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
gs::texture::texture(std::uint32_t width, std::uint32_t height, std::uint32_t depth, gs_color_format format,
|
gs::texture::texture(uint32_t width, uint32_t height, uint32_t depth, gs_color_format format, uint32_t mip_levels,
|
||||||
std::uint32_t mip_levels, const std::uint8_t** mip_data, gs::texture::flags texture_flags)
|
const uint8_t** mip_data, gs::texture::flags texture_flags)
|
||||||
{
|
{
|
||||||
if (width == 0)
|
if (width == 0)
|
||||||
throw std::logic_error("width must be at least 1");
|
throw std::logic_error("width must be at least 1");
|
||||||
|
@ -92,8 +92,8 @@ gs::texture::texture(std::uint32_t width, std::uint32_t height, std::uint32_t de
|
||||||
_type = type::Volume;
|
_type = type::Volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
gs::texture::texture(std::uint32_t size, gs_color_format format, std::uint32_t mip_levels,
|
gs::texture::texture(uint32_t size, gs_color_format format, uint32_t mip_levels, const uint8_t** mip_data,
|
||||||
const std::uint8_t** mip_data, gs::texture::flags texture_flags)
|
gs::texture::flags texture_flags)
|
||||||
{
|
{
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
throw std::logic_error("size must be at least 1");
|
throw std::logic_error("size must be at least 1");
|
||||||
|
@ -149,7 +149,7 @@ gs::texture::~texture()
|
||||||
_texture = nullptr;
|
_texture = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gs::texture::load(std::int32_t unit)
|
void gs::texture::load(int32_t unit)
|
||||||
{
|
{
|
||||||
auto gctx = gs::context();
|
auto gctx = gs::context();
|
||||||
gs_load_texture(_texture, unit);
|
gs_load_texture(_texture, unit);
|
||||||
|
@ -160,7 +160,7 @@ gs_texture_t* gs::texture::get_object()
|
||||||
return _texture;
|
return _texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t gs::texture::get_width()
|
uint32_t gs::texture::get_width()
|
||||||
{
|
{
|
||||||
switch (_type) {
|
switch (_type) {
|
||||||
case type::Normal:
|
case type::Normal:
|
||||||
|
@ -173,7 +173,7 @@ std::uint32_t gs::texture::get_width()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t gs::texture::get_height()
|
uint32_t gs::texture::get_height()
|
||||||
{
|
{
|
||||||
switch (_type) {
|
switch (_type) {
|
||||||
case type::Normal:
|
case type::Normal:
|
||||||
|
@ -186,7 +186,7 @@ std::uint32_t gs::texture::get_height()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t gs::texture::get_depth()
|
uint32_t gs::texture::get_depth()
|
||||||
{
|
{
|
||||||
switch (_type) {
|
switch (_type) {
|
||||||
case type::Normal:
|
case type::Normal:
|
||||||
|
|
|
@ -23,9 +23,9 @@
|
||||||
namespace gs {
|
namespace gs {
|
||||||
class texture {
|
class texture {
|
||||||
public:
|
public:
|
||||||
enum class type : std::uint8_t { Normal, Volume, Cube };
|
enum class type : uint8_t { Normal, Volume, Cube };
|
||||||
|
|
||||||
enum class flags : std::uint8_t {
|
enum class flags : uint8_t {
|
||||||
None,
|
None,
|
||||||
Dynamic,
|
Dynamic,
|
||||||
BuildMipMaps,
|
BuildMipMaps,
|
||||||
|
@ -49,8 +49,8 @@ namespace gs {
|
||||||
* \param mip_data Texture data including mipmaps
|
* \param mip_data Texture data including mipmaps
|
||||||
* \param texture_flags Texture Flags
|
* \param texture_flags Texture Flags
|
||||||
*/
|
*/
|
||||||
texture(std::uint32_t width, std::uint32_t height, gs_color_format format, std::uint32_t mip_levels,
|
texture(uint32_t width, uint32_t height, gs_color_format format, uint32_t mip_levels, const uint8_t** mip_data,
|
||||||
const std::uint8_t** mip_data, gs::texture::flags texture_flags);
|
gs::texture::flags texture_flags);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Create a 3D Texture
|
* \brief Create a 3D Texture
|
||||||
|
@ -63,8 +63,8 @@ namespace gs {
|
||||||
* \param mip_data Texture data including mipmaps
|
* \param mip_data Texture data including mipmaps
|
||||||
* \param texture_flags Texture Flags
|
* \param texture_flags Texture Flags
|
||||||
*/
|
*/
|
||||||
texture(std::uint32_t width, std::uint32_t height, std::uint32_t depth, gs_color_format format,
|
texture(uint32_t width, uint32_t height, uint32_t depth, gs_color_format format, uint32_t mip_levels,
|
||||||
std::uint32_t mip_levels, const std::uint8_t** mip_data, gs::texture::flags texture_flags);
|
const uint8_t** mip_data, gs::texture::flags texture_flags);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Create a Cube Texture
|
* \brief Create a Cube Texture
|
||||||
|
@ -75,7 +75,7 @@ namespace gs {
|
||||||
* \param mip_data Texture data including mipmaps
|
* \param mip_data Texture data including mipmaps
|
||||||
* \param texture_flags Texture Flags
|
* \param texture_flags Texture Flags
|
||||||
*/
|
*/
|
||||||
texture(std::uint32_t size, gs_color_format format, std::uint32_t mip_levels, const std::uint8_t** mip_data,
|
texture(uint32_t size, gs_color_format format, uint32_t mip_levels, const uint8_t** mip_data,
|
||||||
gs::texture::flags texture_flags);
|
gs::texture::flags texture_flags);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@ -95,15 +95,15 @@ namespace gs {
|
||||||
*/
|
*/
|
||||||
texture(gs_texture_t* tex, bool takeOwnership = false) : _texture(tex), _is_owner(takeOwnership) {}
|
texture(gs_texture_t* tex, bool takeOwnership = false) : _texture(tex), _is_owner(takeOwnership) {}
|
||||||
|
|
||||||
void load(std::int32_t unit);
|
void load(int32_t unit);
|
||||||
|
|
||||||
gs_texture_t* get_object();
|
gs_texture_t* get_object();
|
||||||
|
|
||||||
std::uint32_t get_width();
|
uint32_t get_width();
|
||||||
|
|
||||||
std::uint32_t get_height();
|
uint32_t get_height();
|
||||||
|
|
||||||
std::uint32_t get_depth();
|
uint32_t get_depth();
|
||||||
|
|
||||||
gs::texture::type get_type();
|
gs::texture::type get_type();
|
||||||
|
|
||||||
|
|
|
@ -173,9 +173,9 @@ namespace obs {
|
||||||
try {
|
try {
|
||||||
auto priv = reinterpret_cast<instance_t*>(data);
|
auto priv = reinterpret_cast<instance_t*>(data);
|
||||||
if (priv) {
|
if (priv) {
|
||||||
std::uint64_t version = static_cast<std::uint64_t>(obs_data_get_int(settings, S_VERSION));
|
uint64_t version = static_cast<uint64_t>(obs_data_get_int(settings, S_VERSION));
|
||||||
priv->migrate(settings, version);
|
priv->migrate(settings, version);
|
||||||
obs_data_set_int(settings, S_VERSION, static_cast<std::int64_t>(STREAMFX_VERSION));
|
obs_data_set_int(settings, S_VERSION, static_cast<int64_t>(STREAMFX_VERSION));
|
||||||
obs_data_set_string(settings, S_COMMIT, STREAMFX_COMMIT);
|
obs_data_set_string(settings, S_COMMIT, STREAMFX_COMMIT);
|
||||||
return priv->update(settings);
|
return priv->update(settings);
|
||||||
}
|
}
|
||||||
|
@ -303,7 +303,7 @@ namespace obs {
|
||||||
encoder_instance(obs_data_t* settings, obs_encoder_t* self, bool is_hw) : _self(self) {}
|
encoder_instance(obs_data_t* settings, obs_encoder_t* self, bool is_hw) : _self(self) {}
|
||||||
virtual ~encoder_instance(){};
|
virtual ~encoder_instance(){};
|
||||||
|
|
||||||
virtual void migrate(obs_data_t* settings, std::uint64_t version) {}
|
virtual void migrate(obs_data_t* settings, uint64_t version) {}
|
||||||
|
|
||||||
virtual bool update(obs_data_t* settings)
|
virtual bool update(obs_data_t* settings)
|
||||||
{
|
{
|
||||||
|
|
|
@ -241,7 +241,7 @@ namespace obs {
|
||||||
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
DLOG_ERROR("Unexpected exception in function '%s'.", __FUNCTION_NAME__);
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::uint32_t _get_width(void* data) noexcept
|
static uint32_t _get_width(void* data) noexcept
|
||||||
try {
|
try {
|
||||||
if (data)
|
if (data)
|
||||||
return reinterpret_cast<_instance*>(data)->get_width();
|
return reinterpret_cast<_instance*>(data)->get_width();
|
||||||
|
@ -254,7 +254,7 @@ namespace obs {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::uint32_t _get_height(void* data) noexcept
|
static uint32_t _get_height(void* data) noexcept
|
||||||
try {
|
try {
|
||||||
if (data)
|
if (data)
|
||||||
return reinterpret_cast<_instance*>(data)->get_height();
|
return reinterpret_cast<_instance*>(data)->get_height();
|
||||||
|
@ -367,9 +367,9 @@ namespace obs {
|
||||||
try {
|
try {
|
||||||
auto priv = reinterpret_cast<_instance*>(data);
|
auto priv = reinterpret_cast<_instance*>(data);
|
||||||
if (priv) {
|
if (priv) {
|
||||||
std::uint64_t version = static_cast<std::uint64_t>(obs_data_get_int(settings, S_VERSION));
|
uint64_t version = static_cast<uint64_t>(obs_data_get_int(settings, S_VERSION));
|
||||||
priv->migrate(settings, version);
|
priv->migrate(settings, version);
|
||||||
obs_data_set_int(settings, S_VERSION, static_cast<std::int64_t>(STREAMFX_VERSION));
|
obs_data_set_int(settings, S_VERSION, static_cast<int64_t>(STREAMFX_VERSION));
|
||||||
obs_data_set_string(settings, S_COMMIT, STREAMFX_COMMIT);
|
obs_data_set_string(settings, S_COMMIT, STREAMFX_COMMIT);
|
||||||
priv->load(settings);
|
priv->load(settings);
|
||||||
}
|
}
|
||||||
|
@ -393,7 +393,7 @@ namespace obs {
|
||||||
try {
|
try {
|
||||||
if (data) {
|
if (data) {
|
||||||
reinterpret_cast<_instance*>(data)->save(settings);
|
reinterpret_cast<_instance*>(data)->save(settings);
|
||||||
obs_data_set_int(settings, S_VERSION, static_cast<std::int64_t>(STREAMFX_VERSION));
|
obs_data_set_int(settings, S_VERSION, static_cast<int64_t>(STREAMFX_VERSION));
|
||||||
obs_data_set_string(settings, S_COMMIT, STREAMFX_COMMIT);
|
obs_data_set_string(settings, S_COMMIT, STREAMFX_COMMIT);
|
||||||
}
|
}
|
||||||
} catch (const std::exception& ex) {
|
} catch (const std::exception& ex) {
|
||||||
|
@ -403,7 +403,7 @@ namespace obs {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _mouse_click(void* data, const struct obs_mouse_event* event, int32_t type, bool mouse_up,
|
static void _mouse_click(void* data, const struct obs_mouse_event* event, int32_t type, bool mouse_up,
|
||||||
std::uint32_t click_count) noexcept
|
uint32_t click_count) noexcept
|
||||||
try {
|
try {
|
||||||
if (data)
|
if (data)
|
||||||
reinterpret_cast<_instance*>(data)->mouse_click(event, type, mouse_up, click_count);
|
reinterpret_cast<_instance*>(data)->mouse_click(event, type, mouse_up, click_count);
|
||||||
|
@ -464,7 +464,7 @@ namespace obs {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool _audio_render(void* data, uint64_t* ts_out, struct obs_source_audio_mix* audio_output,
|
static bool _audio_render(void* data, uint64_t* ts_out, struct obs_source_audio_mix* audio_output,
|
||||||
std::uint32_t mixers, std::size_t channels, std::size_t sample_rate) noexcept
|
uint32_t mixers, std::size_t channels, std::size_t sample_rate) noexcept
|
||||||
try {
|
try {
|
||||||
if (data)
|
if (data)
|
||||||
return reinterpret_cast<_instance*>(data)->audio_render(ts_out, audio_output, mixers, channels,
|
return reinterpret_cast<_instance*>(data)->audio_render(ts_out, audio_output, mixers, channels,
|
||||||
|
@ -549,12 +549,12 @@ namespace obs {
|
||||||
source_instance(obs_data_t* settings, obs_source_t* source) : _self(source) {}
|
source_instance(obs_data_t* settings, obs_source_t* source) : _self(source) {}
|
||||||
virtual ~source_instance(){};
|
virtual ~source_instance(){};
|
||||||
|
|
||||||
virtual std::uint32_t get_width()
|
virtual uint32_t get_width()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::uint32_t get_height()
|
virtual uint32_t get_height()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -585,19 +585,18 @@ namespace obs {
|
||||||
|
|
||||||
virtual void load(obs_data_t* settings) {}
|
virtual void load(obs_data_t* settings) {}
|
||||||
|
|
||||||
virtual void migrate(obs_data_t* settings, std::uint64_t version) {}
|
virtual void migrate(obs_data_t* settings, uint64_t version) {}
|
||||||
|
|
||||||
virtual void update(obs_data_t* settings) {}
|
virtual void update(obs_data_t* settings) {}
|
||||||
|
|
||||||
virtual void save(obs_data_t* settings) {}
|
virtual void save(obs_data_t* settings) {}
|
||||||
|
|
||||||
virtual void mouse_click(const struct obs_mouse_event* event, std::int32_t type, bool mouse_up,
|
virtual void mouse_click(const struct obs_mouse_event* event, int32_t type, bool mouse_up, uint32_t click_count)
|
||||||
std::uint32_t click_count)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
virtual void mouse_move(const struct obs_mouse_event* event, bool mouse_leave) {}
|
virtual void mouse_move(const struct obs_mouse_event* event, bool mouse_leave) {}
|
||||||
|
|
||||||
virtual void mouse_wheel(const struct obs_mouse_event* event, std::int32_t x_delta, std::int32_t y_delta) {}
|
virtual void mouse_wheel(const struct obs_mouse_event* event, int32_t x_delta, int32_t y_delta) {}
|
||||||
|
|
||||||
virtual void focus(bool focus) {}
|
virtual void focus(bool focus) {}
|
||||||
|
|
||||||
|
@ -605,8 +604,8 @@ namespace obs {
|
||||||
|
|
||||||
virtual void filter_remove(obs_source_t* source) {}
|
virtual void filter_remove(obs_source_t* source) {}
|
||||||
|
|
||||||
virtual bool audio_render(std::uint64_t* ts_out, struct obs_source_audio_mix* audio_output,
|
virtual bool audio_render(uint64_t* ts_out, struct obs_source_audio_mix* audio_output, uint32_t mixers,
|
||||||
std::uint32_t mixers, std::size_t channels, std::size_t sample_rate)
|
std::size_t channels, std::size_t sample_rate)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -617,7 +616,7 @@ namespace obs {
|
||||||
|
|
||||||
virtual void transition_stop() {}
|
virtual void transition_stop() {}
|
||||||
|
|
||||||
virtual bool audio_mix(std::uint64_t* ts_out, struct audio_output_data* audio_output, std::size_t channels,
|
virtual bool audio_mix(uint64_t* ts_out, struct audio_output_data* audio_output, std::size_t channels,
|
||||||
std::size_t sample_rate)
|
std::size_t sample_rate)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -190,13 +190,13 @@ bool obs::source_tracker::filter_sources(std::string, obs_source_t* source)
|
||||||
|
|
||||||
bool obs::source_tracker::filter_audio_sources(std::string, obs_source_t* source)
|
bool obs::source_tracker::filter_audio_sources(std::string, obs_source_t* source)
|
||||||
{
|
{
|
||||||
std::uint32_t flags = obs_source_get_output_flags(source);
|
uint32_t flags = obs_source_get_output_flags(source);
|
||||||
return !(flags & OBS_SOURCE_AUDIO) || (obs_source_get_type(source) != OBS_SOURCE_TYPE_INPUT);
|
return !(flags & OBS_SOURCE_AUDIO) || (obs_source_get_type(source) != OBS_SOURCE_TYPE_INPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool obs::source_tracker::filter_video_sources(std::string, obs_source_t* source)
|
bool obs::source_tracker::filter_video_sources(std::string, obs_source_t* source)
|
||||||
{
|
{
|
||||||
std::uint32_t flags = obs_source_get_output_flags(source);
|
uint32_t flags = obs_source_get_output_flags(source);
|
||||||
return !(flags & OBS_SOURCE_VIDEO) || (obs_source_get_type(source) != OBS_SOURCE_TYPE_INPUT);
|
return !(flags & OBS_SOURCE_VIDEO) || (obs_source_get_type(source) != OBS_SOURCE_TYPE_INPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -798,7 +798,7 @@ void* obs::deprecated_source::type_data()
|
||||||
return obs_source_get_type_data(_self);
|
return obs_source_get_type_data(_self);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t obs::deprecated_source::width()
|
uint32_t obs::deprecated_source::width()
|
||||||
{
|
{
|
||||||
if (!_self) {
|
if (!_self) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -806,7 +806,7 @@ std::uint32_t obs::deprecated_source::width()
|
||||||
return obs_source_get_width(_self);
|
return obs_source_get_width(_self);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t obs::deprecated_source::height()
|
uint32_t obs::deprecated_source::height()
|
||||||
{
|
{
|
||||||
if (!_self) {
|
if (!_self) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -76,8 +76,8 @@ namespace obs {
|
||||||
|
|
||||||
void* type_data();
|
void* type_data();
|
||||||
|
|
||||||
std::uint32_t width();
|
uint32_t width();
|
||||||
std::uint32_t height();
|
uint32_t height();
|
||||||
|
|
||||||
bool destroyed();
|
bool destroyed();
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ struct _hack_obs_property {
|
||||||
struct _hack_obs_properties {
|
struct _hack_obs_properties {
|
||||||
void* param;
|
void* param;
|
||||||
void (*destroy)(void* param);
|
void (*destroy)(void* param);
|
||||||
std::uint32_t flags;
|
uint32_t flags;
|
||||||
|
|
||||||
struct _hack_obs_property* first_property;
|
struct _hack_obs_property* first_property;
|
||||||
struct _hack_obs_property** last;
|
struct _hack_obs_property** last;
|
||||||
|
|
|
@ -81,12 +81,12 @@ mirror_instance::~mirror_instance()
|
||||||
release();
|
release();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t mirror_instance::get_width()
|
uint32_t mirror_instance::get_width()
|
||||||
{
|
{
|
||||||
return _source_size.first;
|
return _source_size.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t mirror_instance::get_height()
|
uint32_t mirror_instance::get_height()
|
||||||
{
|
{
|
||||||
return _source_size.second;
|
return _source_size.second;
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ void mirror_instance::load(obs_data_t* data)
|
||||||
update(data);
|
update(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mirror_instance::migrate(obs_data_t* data, std::uint64_t version)
|
void mirror_instance::migrate(obs_data_t* data, uint64_t version)
|
||||||
{
|
{
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
|
@ -36,8 +36,8 @@ namespace streamfx::source::mirror {
|
||||||
struct mirror_audio_data {
|
struct mirror_audio_data {
|
||||||
mirror_audio_data(const audio_data*, speaker_layout);
|
mirror_audio_data(const audio_data*, speaker_layout);
|
||||||
|
|
||||||
obs_source_audio osa;
|
obs_source_audio osa;
|
||||||
std::vector<std::vector<std::uint8_t>> data;
|
std::vector<std::vector<uint8_t>> data;
|
||||||
};
|
};
|
||||||
|
|
||||||
class mirror_instance : public obs::source_instance {
|
class mirror_instance : public obs::source_instance {
|
||||||
|
@ -58,11 +58,11 @@ namespace streamfx::source::mirror {
|
||||||
mirror_instance(obs_data_t* settings, obs_source_t* self);
|
mirror_instance(obs_data_t* settings, obs_source_t* self);
|
||||||
virtual ~mirror_instance();
|
virtual ~mirror_instance();
|
||||||
|
|
||||||
virtual std::uint32_t get_width() override;
|
virtual uint32_t get_width() override;
|
||||||
virtual std::uint32_t get_height() override;
|
virtual uint32_t get_height() override;
|
||||||
|
|
||||||
virtual void load(obs_data_t*) override;
|
virtual void load(obs_data_t*) override;
|
||||||
virtual void migrate(obs_data_t*, std::uint64_t) override;
|
virtual void migrate(obs_data_t*, uint64_t) override;
|
||||||
virtual void update(obs_data_t*) override;
|
virtual void update(obs_data_t*) override;
|
||||||
virtual void save(obs_data_t*) override;
|
virtual void save(obs_data_t*) override;
|
||||||
|
|
||||||
|
|
|
@ -35,12 +35,12 @@ shader_instance::shader_instance(obs_data_t* data, obs_source_t* self) : obs::so
|
||||||
|
|
||||||
shader_instance::~shader_instance() {}
|
shader_instance::~shader_instance() {}
|
||||||
|
|
||||||
std::uint32_t shader_instance::get_width()
|
uint32_t shader_instance::get_width()
|
||||||
{
|
{
|
||||||
return _fx->width();
|
return _fx->width();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t shader_instance::get_height()
|
uint32_t shader_instance::get_height()
|
||||||
{
|
{
|
||||||
return _fx->height();
|
return _fx->height();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,8 @@ namespace streamfx::source::shader {
|
||||||
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();
|
||||||
|
|
||||||
virtual std::uint32_t get_width() override;
|
virtual uint32_t get_width() override;
|
||||||
virtual std::uint32_t get_height() override;
|
virtual uint32_t get_height() override;
|
||||||
|
|
||||||
void properties(obs_properties_t* props);
|
void properties(obs_properties_t* props);
|
||||||
|
|
||||||
|
|
|
@ -35,12 +35,12 @@ shader_instance::shader_instance(obs_data_t* data, obs_source_t* self) : obs::so
|
||||||
|
|
||||||
shader_instance::~shader_instance() {}
|
shader_instance::~shader_instance() {}
|
||||||
|
|
||||||
std::uint32_t shader_instance::get_width()
|
uint32_t shader_instance::get_width()
|
||||||
{
|
{
|
||||||
return _fx->width();
|
return _fx->width();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::uint32_t shader_instance::get_height()
|
uint32_t shader_instance::get_height()
|
||||||
{
|
{
|
||||||
return _fx->height();
|
return _fx->height();
|
||||||
}
|
}
|
||||||
|
@ -84,13 +84,13 @@ void shader_instance::video_render(gs_effect_t* effect)
|
||||||
gs::debug_marker gdmp{gs::debug_color_source, "Shader Transition '%s'", obs_source_get_name(_self)};
|
gs::debug_marker gdmp{gs::debug_color_source, "Shader Transition '%s'", obs_source_get_name(_self)};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
obs_transition_video_render(
|
obs_transition_video_render(_self,
|
||||||
_self, [](void* data, gs_texture_t* a, gs_texture_t* b, float t, std::uint32_t cx, std::uint32_t cy) {
|
[](void* data, gs_texture_t* a, gs_texture_t* b, float t, uint32_t cx, uint32_t cy) {
|
||||||
reinterpret_cast<shader_instance*>(data)->transition_render(a, b, t, cx, cy);
|
reinterpret_cast<shader_instance*>(data)->transition_render(a, b, t, cx, cy);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void shader_instance::transition_render(gs_texture_t* a, gs_texture_t* b, float_t t, std::uint32_t cx, std::uint32_t cy)
|
void shader_instance::transition_render(gs_texture_t* a, gs_texture_t* b, float_t t, uint32_t cx, uint32_t cy)
|
||||||
{
|
{
|
||||||
_fx->set_input_a(std::make_shared<::gs::texture>(a, false));
|
_fx->set_input_a(std::make_shared<::gs::texture>(a, false));
|
||||||
_fx->set_input_b(std::make_shared<::gs::texture>(b, false));
|
_fx->set_input_b(std::make_shared<::gs::texture>(b, false));
|
||||||
|
@ -100,7 +100,7 @@ void shader_instance::transition_render(gs_texture_t* a, gs_texture_t* b, float_
|
||||||
_fx->render();
|
_fx->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool shader_instance::audio_render(uint64_t* ts_out, obs_source_audio_mix* audio_output, std::uint32_t mixers,
|
bool shader_instance::audio_render(uint64_t* ts_out, obs_source_audio_mix* audio_output, uint32_t mixers,
|
||||||
std::size_t channels, std::size_t sample_rate)
|
std::size_t channels, std::size_t sample_rate)
|
||||||
{
|
{
|
||||||
return obs_transition_audio_render(
|
return obs_transition_audio_render(
|
||||||
|
|
|
@ -32,8 +32,8 @@ namespace streamfx::transition::shader {
|
||||||
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();
|
||||||
|
|
||||||
virtual std::uint32_t get_width() override;
|
virtual uint32_t get_width() override;
|
||||||
virtual std::uint32_t get_height() override;
|
virtual uint32_t get_height() override;
|
||||||
|
|
||||||
void properties(obs_properties_t* props);
|
void properties(obs_properties_t* props);
|
||||||
|
|
||||||
|
@ -43,9 +43,9 @@ namespace streamfx::transition::shader {
|
||||||
virtual void video_tick(float_t sec_since_last) override;
|
virtual void video_tick(float_t sec_since_last) override;
|
||||||
virtual void video_render(gs_effect_t* effect) override;
|
virtual void video_render(gs_effect_t* effect) override;
|
||||||
|
|
||||||
void transition_render(gs_texture_t* a, gs_texture_t* b, float_t t, std::uint32_t cx, std::uint32_t cy);
|
void transition_render(gs_texture_t* a, gs_texture_t* b, float_t t, uint32_t cx, uint32_t cy);
|
||||||
|
|
||||||
virtual bool audio_render(uint64_t* ts_out, struct obs_source_audio_mix* audio_output, std::uint32_t mixers,
|
virtual bool audio_render(uint64_t* ts_out, struct obs_source_audio_mix* audio_output, uint32_t mixers,
|
||||||
std::size_t channels, std::size_t sample_rate) override;
|
std::size_t channels, std::size_t sample_rate) override;
|
||||||
|
|
||||||
virtual void transition_start() override;
|
virtual void transition_start() override;
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace streamfx::ui {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum class role_type : std::int32_t {
|
enum class role_type : int32_t {
|
||||||
NONE,
|
NONE,
|
||||||
SPACER,
|
SPACER,
|
||||||
THANKYOU,
|
THANKYOU,
|
||||||
|
@ -49,7 +49,7 @@ namespace streamfx::ui {
|
||||||
CREATOR,
|
CREATOR,
|
||||||
|
|
||||||
};
|
};
|
||||||
enum class link_type : std::int32_t {
|
enum class link_type : int32_t {
|
||||||
NONE,
|
NONE,
|
||||||
GENERIC,
|
GENERIC,
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace util {
|
||||||
|
|
||||||
void track(std::chrono::nanoseconds duration);
|
void track(std::chrono::nanoseconds duration);
|
||||||
|
|
||||||
std::uint64_t count();
|
uint64_t count();
|
||||||
|
|
||||||
std::chrono::nanoseconds total_duration();
|
std::chrono::nanoseconds total_duration();
|
||||||
|
|
||||||
|
|
|
@ -98,17 +98,17 @@ namespace util {
|
||||||
|
|
||||||
obs_property_t* obs_properties_add_tristate(obs_properties_t* props, const char* name, const char* desc);
|
obs_property_t* obs_properties_add_tristate(obs_properties_t* props, const char* name, const char* desc);
|
||||||
|
|
||||||
inline bool is_tristate_enabled(std::int64_t tristate)
|
inline bool is_tristate_enabled(int64_t tristate)
|
||||||
{
|
{
|
||||||
return tristate == 1;
|
return tristate == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_tristate_disabled(std::int64_t tristate)
|
inline bool is_tristate_disabled(int64_t tristate)
|
||||||
{
|
{
|
||||||
return tristate == 0;
|
return tristate == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool is_tristate_default(std::int64_t tristate)
|
inline bool is_tristate_default(int64_t tristate)
|
||||||
{
|
{
|
||||||
return tristate == -1;
|
return tristate == -1;
|
||||||
}
|
}
|
||||||
|
@ -178,27 +178,27 @@ namespace util {
|
||||||
{ \
|
{ \
|
||||||
return is_power_of_two_loop(v); \
|
return is_power_of_two_loop(v); \
|
||||||
}
|
}
|
||||||
P_IS_POWER_OF_TWO_AS_LOOP(std::int8_t)
|
P_IS_POWER_OF_TWO_AS_LOOP(int8_t)
|
||||||
P_IS_POWER_OF_TWO_AS_LOOP(std::uint8_t)
|
P_IS_POWER_OF_TWO_AS_LOOP(uint8_t)
|
||||||
P_IS_POWER_OF_TWO_AS_LOOP(std::int16_t)
|
P_IS_POWER_OF_TWO_AS_LOOP(int16_t)
|
||||||
P_IS_POWER_OF_TWO_AS_LOOP(std::uint16_t)
|
P_IS_POWER_OF_TWO_AS_LOOP(uint16_t)
|
||||||
P_IS_POWER_OF_TWO_AS_LOOP(std::int32_t)
|
P_IS_POWER_OF_TWO_AS_LOOP(int32_t)
|
||||||
P_IS_POWER_OF_TWO_AS_LOOP(std::uint32_t)
|
P_IS_POWER_OF_TWO_AS_LOOP(uint32_t)
|
||||||
P_IS_POWER_OF_TWO_AS_LOOP(std::int64_t)
|
P_IS_POWER_OF_TWO_AS_LOOP(int64_t)
|
||||||
P_IS_POWER_OF_TWO_AS_LOOP(std::uint64_t)
|
P_IS_POWER_OF_TWO_AS_LOOP(uint64_t)
|
||||||
#undef P_IS_POWER_OF_TWO_AS_LOOP
|
#undef P_IS_POWER_OF_TWO_AS_LOOP
|
||||||
#pragma pop_macro("P_IS_POWER_OF_TWO_AS_LOOP")
|
#pragma pop_macro("P_IS_POWER_OF_TWO_AS_LOOP")
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline std::uint64_t get_power_of_two_exponent_floor(T v)
|
inline uint64_t get_power_of_two_exponent_floor(T v)
|
||||||
{
|
{
|
||||||
return std::uint64_t(floor(log10(T(v)) / log10(2.0)));
|
return uint64_t(floor(log10(T(v)) / log10(2.0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline std::uint64_t get_power_of_two_exponent_ceil(T v)
|
inline uint64_t get_power_of_two_exponent_ceil(T v)
|
||||||
{
|
{
|
||||||
return std::uint64_t(ceil(log10(T(v)) / log10(2.0)));
|
return uint64_t(ceil(log10(T(v)) / log10(2.0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, typename C>
|
template<typename T, typename C>
|
||||||
|
|
Loading…
Reference in a new issue