diff --git a/CMakeLists.txt b/CMakeLists.txt index f98c937b..1e10c9ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1148,8 +1148,8 @@ if(T_CHECK) # Encoders/Handlers "source/encoders/ffmpeg/handler.hpp" "source/encoders/ffmpeg/handler.cpp" - "source/encoders/ffmpeg/debug_handler.hpp" - "source/encoders/ffmpeg/debug_handler.cpp" + "source/encoders/ffmpeg/debug.hpp" + "source/encoders/ffmpeg/debug.cpp" ) list(APPEND PROJECT_DEFINITIONS ENABLE_ENCODER_FFMPEG diff --git a/source/encoders/ffmpeg/debug_handler.cpp b/source/encoders/ffmpeg/debug.cpp similarity index 91% rename from source/encoders/ffmpeg/debug_handler.cpp rename to source/encoders/ffmpeg/debug.cpp index 5d6e8fcf..d32c1c20 100644 --- a/source/encoders/ffmpeg/debug_handler.cpp +++ b/source/encoders/ffmpeg/debug.cpp @@ -3,8 +3,9 @@ // Copyright (C) 2020 Daniel Molkentin // AUTOGENERATED COPYRIGHT HEADER END -#include "debug_handler.hpp" +#include "debug.hpp" #include "common.hpp" +#include "../encoder-ffmpeg.hpp" #include "handler.hpp" #include "plugin.hpp" @@ -13,17 +14,10 @@ #include #include #include -#include "warning-enable.hpp" - extern "C" { -#include "warning-disable.hpp" #include -#include "warning-enable.hpp" } - -using namespace streamfx::encoder::ffmpeg::handler; - -void debug_handler::get_defaults(obs_data_t*, const AVCodec*, AVCodecContext*, bool) {} +#include "warning-enable.hpp" template std::string to_string(T value) @@ -55,9 +49,15 @@ std::string to_string(double_t value) return std::string(buf.data(), buf.data() + buf.size()); } -void debug_handler::get_properties(obs_properties_t*, const AVCodec* codec, AVCodecContext* context, bool) +using namespace streamfx::encoder::ffmpeg; + +debug::debug() : handler("") {} + +void debug::properties(ffmpeg_instance* instance, obs_properties_t* props) { - if (context) + const AVCodec* codec = instance->get_avcodec(); + + if (instance->get_avcodeccontext()) return; AVCodecContext* ctx = avcodec_alloc_context3(codec); @@ -161,4 +161,4 @@ void debug_handler::get_properties(obs_properties_t*, const AVCodec* codec, AVCo } } -void debug_handler::update(obs_data_t*, const AVCodec*, AVCodecContext*) {} +static debug handler(); diff --git a/source/encoders/ffmpeg/debug.hpp b/source/encoders/ffmpeg/debug.hpp new file mode 100644 index 00000000..d22ebcd2 --- /dev/null +++ b/source/encoders/ffmpeg/debug.hpp @@ -0,0 +1,12 @@ +#pragma once +#include "handler.hpp" + +namespace streamfx::encoder::ffmpeg { + class debug : public handler { + public: + debug(); + virtual ~debug(){}; + + virtual void properties(ffmpeg_instance* instance, obs_properties_t* props); + }; +} // namespace streamfx::encoder::ffmpeg diff --git a/source/encoders/ffmpeg/debug_handler.hpp b/source/encoders/ffmpeg/debug_handler.hpp deleted file mode 100644 index a66e79e2..00000000 --- a/source/encoders/ffmpeg/debug_handler.hpp +++ /dev/null @@ -1,19 +0,0 @@ -// AUTOGENERATED COPYRIGHT HEADER START -// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks -// AUTOGENERATED COPYRIGHT HEADER END - -#pragma once -#include "handler.hpp" - -namespace streamfx::encoder::ffmpeg::handler { - class debug_handler : public handler { - public: - virtual ~debug_handler(){}; - - virtual void get_defaults(obs_data_t* settings, const AVCodec* codec, AVCodecContext* context, bool hw_encode) override; - - virtual void get_properties(obs_properties_t* props, const AVCodec* codec, AVCodecContext* context, bool hw_encode) override; - - virtual void update(obs_data_t* settings, const AVCodec* codec, AVCodecContext* context) override; - }; -} // namespace streamfx::encoder::ffmpeg::handler