Skip to content

Commit

Permalink
uninline funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Prevter authored Feb 1, 2025
1 parent 88e13ba commit e151c55
Showing 1 changed file with 35 additions and 26 deletions.
61 changes: 35 additions & 26 deletions src/compat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@
namespace ffmpeg {
class FFMPEG_API_DLL AudioMixer {
public:
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<float>& raw, std::filesystem::path outputMp4File, uint32_t sampleRate);
void mixVideoRaw(const std::filesystem::path& videoFile, const std::vector<float>& raw, const std::filesystem::path &outputMp4File);
};

void mixVideoRaw(std::filesystem::path videoFile, const std::vector<float>& raw, std::filesystem::path outputMp4File, uint32_t sampleRate) {
(void) FFMPEG_API_VERSION_NS::AudioMixer::mixVideoRaw(videoFile, raw, outputMp4File);
}
void AudioMixer::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 mixVideoRaw(const std::filesystem::path& videoFile, const std::vector<float>& raw, const std::filesystem::path &outputMp4File) {
(void) FFMPEG_API_VERSION_NS::AudioMixer::mixVideoRaw(videoFile, raw, outputMp4File);
}
};
void AudioMixer::mixVideoRaw(std::filesystem::path videoFile, const std::vector<float>& raw, std::filesystem::path outputMp4File, uint32_t sampleRate) {
(void) FFMPEG_API_VERSION_NS::AudioMixer::mixVideoRaw(videoFile, raw, outputMp4File);
}

void AudioMixer::mixVideoRaw(const std::filesystem::path& videoFile, const std::vector<float>& raw, const std::filesystem::path &outputMp4File) {
(void) FFMPEG_API_VERSION_NS::AudioMixer::mixVideoRaw(videoFile, raw, outputMp4File);
}

typedef struct RenderSettings {
HardwareAccelerationType m_hardwareAccelerationType;
Expand Down Expand Up @@ -47,26 +51,31 @@ namespace ffmpeg {
} RenderSettingsV1;

class FFMPEG_API_DLL Recorder {
#define self reinterpret_cast<FFMPEG_API_VERSION_NS::Recorder*>(this)
public:
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<uint8_t>& frameData);
std::vector<std::string> getAvailableCodecs();
};

void stop() {
self->stop();
}
#define self reinterpret_cast<FFMPEG_API_VERSION_NS::Recorder*>(this)
bool Recorder::init(const RenderSettingsV1& settings) {
auto res = self->init(settings.toV2());
return res.isOk();
}

bool writeFrame(const std::vector<uint8_t>& frameData) {
auto res = self->writeFrame(frameData);
return res.isOk();
}
void Recorder::stop() {
self->stop();
}

std::vector<std::string> getAvailableCodecs() {
return FFMPEG_API_VERSION_NS::Recorder::getAvailableCodecs();
}
bool Recorder::writeFrame(const std::vector<uint8_t>& frameData) {
auto res = self->writeFrame(frameData);
return res.isOk();
}

std::vector<std::string> Recorder::getAvailableCodecs() {
return FFMPEG_API_VERSION_NS::Recorder::getAvailableCodecs();
}
#undef self
};

}

0 comments on commit e151c55

Please sign in to comment.