Skip to content

Commit d5cf69c

Browse files
authored
typedefs
1 parent d42f1b6 commit d5cf69c

File tree

1 file changed

+37
-28
lines changed

1 file changed

+37
-28
lines changed

Diff for: src/compat.cpp

+37-28
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,24 @@
44
#include "recorder.hpp"
55

66
namespace ffmpeg {
7-
class FFMPEG_API_DLL AudioMixer {
7+
typedef class FFMPEG_API_DLL AudioMixer {
88
public:
9-
GEODE_NOINLINE void mixVideoAudio(std::filesystem::path videoFile, std::filesystem::path audioFile, std::filesystem::path outputMp4File) {
10-
(void) FFMPEG_API_VERSION_NS::AudioMixer::mixVideoAudio(std::move(videoFile), std::move(audioFile), std::move(outputMp4File));
11-
}
9+
void mixVideoAudio(std::filesystem::path videoFile, std::filesystem::path audioFile, std::filesystem::path outputMp4File);
10+
void mixVideoRaw(std::filesystem::path videoFile, const std::vector<float>& raw, std::filesystem::path outputMp4File, uint32_t sampleRate);
11+
void mixVideoRaw(const std::filesystem::path& videoFile, const std::vector<float>& raw, const std::filesystem::path &outputMp4File);
12+
} AudioMixerV1;
1213

13-
GEODE_NOINLINE void mixVideoRaw(std::filesystem::path videoFile, const std::vector<float>& raw, std::filesystem::path outputMp4File, uint32_t sampleRate) {
14-
(void) FFMPEG_API_VERSION_NS::AudioMixer::mixVideoRaw(videoFile, raw, outputMp4File);
15-
}
14+
void AudioMixerV1::mixVideoAudio(std::filesystem::path videoFile, std::filesystem::path audioFile, std::filesystem::path outputMp4File) {
15+
(void) FFMPEG_API_VERSION_NS::AudioMixer::mixVideoAudio(std::move(videoFile), std::move(audioFile), std::move(outputMp4File));
16+
}
1617

17-
GEODE_NOINLINE void mixVideoRaw(const std::filesystem::path& videoFile, const std::vector<float>& raw, const std::filesystem::path &outputMp4File) {
18-
(void) FFMPEG_API_VERSION_NS::AudioMixer::mixVideoRaw(videoFile, raw, outputMp4File);
19-
}
20-
};
18+
void AudioMixerV1::mixVideoRaw(std::filesystem::path videoFile, const std::vector<float>& raw, std::filesystem::path outputMp4File, uint32_t sampleRate) {
19+
(void) FFMPEG_API_VERSION_NS::AudioMixer::mixVideoRaw(videoFile, raw, outputMp4File);
20+
}
21+
22+
void AudioMixerV1::mixVideoRaw(const std::filesystem::path& videoFile, const std::vector<float>& raw, const std::filesystem::path &outputMp4File) {
23+
(void) FFMPEG_API_VERSION_NS::AudioMixer::mixVideoRaw(videoFile, raw, outputMp4File);
24+
}
2125

2226
typedef struct RenderSettings {
2327
HardwareAccelerationType m_hardwareAccelerationType;
@@ -46,27 +50,32 @@ namespace ffmpeg {
4650
}
4751
} RenderSettingsV1;
4852

49-
class FFMPEG_API_DLL Recorder {
50-
#define self reinterpret_cast<FFMPEG_API_VERSION_NS::Recorder*>(this)
53+
typedef class FFMPEG_API_DLL Recorder {
5154
public:
52-
GEODE_NOINLINE bool init(const RenderSettingsV1& settings) {
53-
auto res = self->init(settings.toV2());
54-
return res.isOk();
55-
}
55+
bool init(const RenderSettingsV1& settings);
56+
void stop();
57+
bool writeFrame(const std::vector<uint8_t>& frameData);
58+
std::vector<std::string> getAvailableCodecs();
59+
} RecorderV1;
5660

57-
GEODE_NOINLINE void stop() {
58-
self->stop();
59-
}
61+
#define self reinterpret_cast<FFMPEG_API_VERSION_NS::Recorder*>(this)
62+
bool RecorderV1::init(const RenderSettingsV1& settings) {
63+
auto res = self->init(settings.toV2());
64+
return res.isOk();
65+
}
6066

61-
GEODE_NOINLINE bool writeFrame(const std::vector<uint8_t>& frameData) {
62-
auto res = self->writeFrame(frameData);
63-
return res.isOk();
64-
}
67+
void RecorderV1::stop() {
68+
self->stop();
69+
}
6570

66-
GEODE_NOINLINE std::vector<std::string> getAvailableCodecs() {
67-
return FFMPEG_API_VERSION_NS::Recorder::getAvailableCodecs();
68-
}
71+
bool RecorderV1::writeFrame(const std::vector<uint8_t>& frameData) {
72+
auto res = self->writeFrame(frameData);
73+
return res.isOk();
74+
}
75+
76+
std::vector<std::string> RecorderV1::getAvailableCodecs() {
77+
return FFMPEG_API_VERSION_NS::Recorder::getAvailableCodecs();
78+
}
6979
#undef self
70-
};
7180

7281
}

0 commit comments

Comments
 (0)