Skip to content

Commit 46e68fc

Browse files
committed
support old abi, refactor few things
1 parent a9d771e commit 46e68fc

File tree

9 files changed

+237
-250
lines changed

9 files changed

+237
-250
lines changed

CMakeLists.txt

+2-6
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,8 @@ endif()
1111

1212
project(ffmpeg-api VERSION 1.0.0)
1313

14-
add_library(${PROJECT_NAME} SHARED
15-
src/recorder.cpp
16-
src/audio_mixer.cpp
17-
src/utils.cpp
18-
# Add any extra C++ source files here
19-
)
14+
file(GLOB_RECURSE SOURCES CONFIGURE_DEPENDS src/*.cpp)
15+
add_library(${PROJECT_NAME} SHARED ${SOURCES})
2016

2117
set_property(TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Final>:Final>")
2218
set_property(TARGET ${PROJECT_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)

include/audio_mixer.hpp

+8-22
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@
66

77
#include <filesystem>
88

9-
namespace ffmpeg {
9+
BEGIN_FFMPEG_NAMESPACE_V
1010

1111
class FFMPEG_API_DLL AudioMixer {
1212
public:
13+
AudioMixer() = delete;
14+
AudioMixer(const AudioMixer&) = delete;
15+
AudioMixer(AudioMixer&&) = delete;
16+
1317
/**
1418
* @brief Mixes a video file and an audio file into a single MP4 output.
1519
*
@@ -23,25 +27,7 @@ class FFMPEG_API_DLL AudioMixer {
2327
* @warning The audio file is expected to contain stereo (dual-channel) audio. Using other formats might lead to unexpected results.
2428
* @warning The video file is expected to contain a single video stream. Only the first video stream will be copied.
2529
*/
26-
geode::Result<void> mixVideoAudio(std::filesystem::path videoFile, std::filesystem::path audioFile, std::filesystem::path outputMp4File);
27-
28-
/**
29-
* @deprecated sampleRate parameter is no longer used. Use the other overload of this function instead.
30-
*
31-
* @brief Mixes a video file and raw audio data into a single MP4 output.
32-
*
33-
* This function takes an input video file and raw audio data (in the form of a vector of floating-point samples),
34-
* and merges them into a single MP4 output file.
35-
*
36-
* @param videoFile The path to the input video file.
37-
* @param raw A vector containing the raw audio data (floating-point samples).
38-
* @param outputMp4File The path where the output MP4 file will be saved.
39-
* @param sampleRate The sample rate of the raw audio data.
40-
*
41-
* @warning The raw audio data is expected to be stereo (dual-channel). Using mono or multi-channel audio might lead to issues.
42-
* @warning The video file is expected to contain a single video stream. Only the first video stream will be copied.
43-
*/
44-
[[deprecated]] void mixVideoRaw(std::filesystem::path videoFile, const std::vector<float>& raw, std::filesystem::path outputMp4File, uint32_t sampleRate);
30+
static geode::Result<> mixVideoAudio(std::filesystem::path videoFile, std::filesystem::path audioFile, std::filesystem::path outputMp4File);
4531

4632
/**
4733
* @brief Mixes a video file and raw audio data into a single MP4 output.
@@ -56,7 +42,7 @@ class FFMPEG_API_DLL AudioMixer {
5642
* @warning The raw audio data is expected to be stereo (dual-channel). Using mono or multi-channel audio might lead to issues.
5743
* @warning The video file is expected to contain a single video stream. Only the first video stream will be copied.
5844
*/
59-
geode::Result<void> mixVideoRaw(const std::filesystem::path& videoFile, const std::vector<float>& raw, const std::filesystem::path &outputMp4File);
45+
static geode::Result<> mixVideoRaw(const std::filesystem::path& videoFile, const std::vector<float>& raw, const std::filesystem::path &outputMp4File);
6046
};
6147

62-
}
48+
END_FFMPEG_NAMESPACE_V

0 commit comments

Comments
 (0)