Skip to content

fix abi for android/macos #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 1, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 37 additions & 28 deletions src/compat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@
#include "recorder.hpp"

namespace ffmpeg {
class FFMPEG_API_DLL AudioMixer {
typedef 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);
} AudioMixerV1;

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 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));
}

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 AudioMixerV1::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 AudioMixerV1::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 @@ -46,27 +50,32 @@ namespace ffmpeg {
}
} RenderSettingsV1;

class FFMPEG_API_DLL Recorder {
#define self reinterpret_cast<FFMPEG_API_VERSION_NS::Recorder*>(this)
typedef class FFMPEG_API_DLL Recorder {
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();
} RecorderV1;

void stop() {
self->stop();
}
#define self reinterpret_cast<FFMPEG_API_VERSION_NS::Recorder*>(this)
bool RecorderV1::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 RecorderV1::stop() {
self->stop();
}

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

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

}