From d5cf69ca20a852d72aa746d90e0c84f41520a8de Mon Sep 17 00:00:00 2001 From: Oleksandr Nemesh Date: Sat, 1 Feb 2025 20:37:06 +0200 Subject: [PATCH] typedefs --- src/compat.cpp | 65 ++++++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 28 deletions(-) diff --git a/src/compat.cpp b/src/compat.cpp index fece604..dfa33cb 100644 --- a/src/compat.cpp +++ b/src/compat.cpp @@ -4,20 +4,24 @@ #include "recorder.hpp" namespace ffmpeg { - class FFMPEG_API_DLL AudioMixer { + typedef class FFMPEG_API_DLL AudioMixer { public: - GEODE_NOINLINE void mixVideoAudio(std::filesystem::path videoFile, std::filesystem::path audioFile, std::filesystem::path outputMp4File) { - (void) FFMPEG_API_VERSION_NS::AudioMixer::mixVideoAudio(std::move(videoFile), std::move(audioFile), std::move(outputMp4File)); - } + void mixVideoAudio(std::filesystem::path videoFile, std::filesystem::path audioFile, std::filesystem::path outputMp4File); + void mixVideoRaw(std::filesystem::path videoFile, const std::vector& raw, std::filesystem::path outputMp4File, uint32_t sampleRate); + void mixVideoRaw(const std::filesystem::path& videoFile, const std::vector& raw, const std::filesystem::path &outputMp4File); + } AudioMixerV1; - GEODE_NOINLINE void mixVideoRaw(std::filesystem::path videoFile, const std::vector& raw, std::filesystem::path outputMp4File, uint32_t sampleRate) { - (void) FFMPEG_API_VERSION_NS::AudioMixer::mixVideoRaw(videoFile, raw, outputMp4File); - } + void AudioMixerV1::mixVideoAudio(std::filesystem::path videoFile, std::filesystem::path audioFile, std::filesystem::path outputMp4File) { + (void) FFMPEG_API_VERSION_NS::AudioMixer::mixVideoAudio(std::move(videoFile), std::move(audioFile), std::move(outputMp4File)); + } - GEODE_NOINLINE void mixVideoRaw(const std::filesystem::path& videoFile, const std::vector& raw, const std::filesystem::path &outputMp4File) { - (void) FFMPEG_API_VERSION_NS::AudioMixer::mixVideoRaw(videoFile, raw, outputMp4File); - } - }; + void AudioMixerV1::mixVideoRaw(std::filesystem::path videoFile, const std::vector& raw, std::filesystem::path outputMp4File, uint32_t sampleRate) { + (void) FFMPEG_API_VERSION_NS::AudioMixer::mixVideoRaw(videoFile, raw, outputMp4File); + } + + void AudioMixerV1::mixVideoRaw(const std::filesystem::path& videoFile, const std::vector& raw, const std::filesystem::path &outputMp4File) { + (void) FFMPEG_API_VERSION_NS::AudioMixer::mixVideoRaw(videoFile, raw, outputMp4File); + } typedef struct RenderSettings { HardwareAccelerationType m_hardwareAccelerationType; @@ -46,27 +50,32 @@ namespace ffmpeg { } } RenderSettingsV1; - class FFMPEG_API_DLL Recorder { -#define self reinterpret_cast(this) + typedef class FFMPEG_API_DLL Recorder { public: - GEODE_NOINLINE bool init(const RenderSettingsV1& settings) { - auto res = self->init(settings.toV2()); - return res.isOk(); - } + bool init(const RenderSettingsV1& settings); + void stop(); + bool writeFrame(const std::vector& frameData); + std::vector getAvailableCodecs(); + } RecorderV1; - GEODE_NOINLINE void stop() { - self->stop(); - } +#define self reinterpret_cast(this) + bool RecorderV1::init(const RenderSettingsV1& settings) { + auto res = self->init(settings.toV2()); + return res.isOk(); + } - GEODE_NOINLINE bool writeFrame(const std::vector& frameData) { - auto res = self->writeFrame(frameData); - return res.isOk(); - } + void RecorderV1::stop() { + self->stop(); + } - GEODE_NOINLINE std::vector getAvailableCodecs() { - return FFMPEG_API_VERSION_NS::Recorder::getAvailableCodecs(); - } + bool RecorderV1::writeFrame(const std::vector& frameData) { + auto res = self->writeFrame(frameData); + return res.isOk(); + } + + std::vector RecorderV1::getAvailableCodecs() { + return FFMPEG_API_VERSION_NS::Recorder::getAvailableCodecs(); + } #undef self - }; } \ No newline at end of file