code: Migrate encoder::ffmpeg::debug to new loader

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2023-05-14 18:38:43 +02:00 committed by Xaymar
parent 85c8cdf8bd
commit 78310f9c63
4 changed files with 26 additions and 33 deletions

View file

@ -1148,8 +1148,8 @@ if(T_CHECK)
# Encoders/Handlers # Encoders/Handlers
"source/encoders/ffmpeg/handler.hpp" "source/encoders/ffmpeg/handler.hpp"
"source/encoders/ffmpeg/handler.cpp" "source/encoders/ffmpeg/handler.cpp"
"source/encoders/ffmpeg/debug_handler.hpp" "source/encoders/ffmpeg/debug.hpp"
"source/encoders/ffmpeg/debug_handler.cpp" "source/encoders/ffmpeg/debug.cpp"
) )
list(APPEND PROJECT_DEFINITIONS list(APPEND PROJECT_DEFINITIONS
ENABLE_ENCODER_FFMPEG ENABLE_ENCODER_FFMPEG

View file

@ -3,8 +3,9 @@
// Copyright (C) 2020 Daniel Molkentin <daniel@molkentin.de> // Copyright (C) 2020 Daniel Molkentin <daniel@molkentin.de>
// AUTOGENERATED COPYRIGHT HEADER END // AUTOGENERATED COPYRIGHT HEADER END
#include "debug_handler.hpp" #include "debug.hpp"
#include "common.hpp" #include "common.hpp"
#include "../encoder-ffmpeg.hpp"
#include "handler.hpp" #include "handler.hpp"
#include "plugin.hpp" #include "plugin.hpp"
@ -13,17 +14,10 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "warning-enable.hpp"
extern "C" { extern "C" {
#include "warning-disable.hpp"
#include <libavutil/opt.h> #include <libavutil/opt.h>
#include "warning-enable.hpp"
} }
#include "warning-enable.hpp"
using namespace streamfx::encoder::ffmpeg::handler;
void debug_handler::get_defaults(obs_data_t*, const AVCodec*, AVCodecContext*, bool) {}
template<typename T> template<typename T>
std::string to_string(T value) 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()); 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; return;
AVCodecContext* ctx = avcodec_alloc_context3(codec); 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();

View file

@ -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

View file

@ -1,19 +0,0 @@
// AUTOGENERATED COPYRIGHT HEADER START
// Copyright (C) 2020-2023 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
// 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