diff --git a/src/speaker_capturer/linux/speaker_capturer_linux.cpp b/src/speaker_capturer/linux/speaker_capturer_linux.cpp new file mode 100644 index 0000000..7fc1227 --- /dev/null +++ b/src/speaker_capturer/linux/speaker_capturer_linux.cpp @@ -0,0 +1,13 @@ +#include "speaker_capturer_linux.h" + +SpeakerCapturerLinux::SpeakerCapturerLinux() {} + +SpeakerCapturerLinux::~SpeakerCapturerLinux() {} + +int SpeakerCapturerLinux::Init(speaker_data_cb cb) { return 0; } +int SpeakerCapturerLinux::Destroy() { return 0; } +int SpeakerCapturerLinux::Start() { return 0; } +int SpeakerCapturerLinux::Stop() { return 0; } + +int SpeakerCapturerLinux::Pause() { return 0; } +int SpeakerCapturerLinux::Resume() { return 0; } \ No newline at end of file diff --git a/src/speaker_capturer/linux/speaker_capturer_linux.h b/src/speaker_capturer/linux/speaker_capturer_linux.h new file mode 100644 index 0000000..9840da0 --- /dev/null +++ b/src/speaker_capturer/linux/speaker_capturer_linux.h @@ -0,0 +1,38 @@ +/* + * @Author: DI JUNKUN + * @Date: 2024-08-02 + * Copyright (c) 2024 by DI JUNKUN, All Rights Reserved. + */ + +#ifndef _SPEAKER_CAPTURER_LINUX_H_ +#define _SPEAKER_CAPTURER_LINUX_H_ + +#include +#include + +#include "speaker_capturer.h" + +class SpeakerCapturerLinux : public SpeakerCapturer { + public: + SpeakerCapturerLinux(); + ~SpeakerCapturerLinux(); + + public: + virtual int Init(speaker_data_cb cb); + virtual int Destroy(); + virtual int Start(); + virtual int Stop(); + + int Pause(); + int Resume(); + + private: + speaker_data_cb cb_ = nullptr; + + private: + bool inited_ = false; + // thread + std::unique_ptr capture_thread_ = nullptr; +}; + +#endif \ No newline at end of file diff --git a/src/speaker_capturer/macosx/speaker_capturer_macosx.cpp b/src/speaker_capturer/macosx/speaker_capturer_macosx.cpp new file mode 100644 index 0000000..c33f74c --- /dev/null +++ b/src/speaker_capturer/macosx/speaker_capturer_macosx.cpp @@ -0,0 +1,14 @@ + +#include "speaker_capturer_macosx.h" + +SpeakerCapturerMacosx::SpeakerCapturerMacosx() {} + +SpeakerCapturerMacosx::~SpeakerCapturerMacosx() {} + +int SpeakerCapturerMacosx::Init(speaker_data_cb cb) { return 0; } +int SpeakerCapturerMacosx::Destroy() { return 0; } +int SpeakerCapturerMacosx::Start() { return 0; } +int SpeakerCapturerMacosx::Stop() { return 0; } + +int SpeakerCapturerMacosx::Pause() { return 0; } +int SpeakerCapturerMacosx::Resume() { return 0; } \ No newline at end of file diff --git a/src/speaker_capturer/macosx/speaker_capturer_macosx.h b/src/speaker_capturer/macosx/speaker_capturer_macosx.h new file mode 100644 index 0000000..749f5dd --- /dev/null +++ b/src/speaker_capturer/macosx/speaker_capturer_macosx.h @@ -0,0 +1,38 @@ +/* + * @Author: DI JUNKUN + * @Date: 2024-08-02 + * Copyright (c) 2024 by DI JUNKUN, All Rights Reserved. + */ + +#ifndef _SPEAKER_CAPTURER_MACOSX_H_ +#define _SPEAKER_CAPTURER_MACOSX_H_ + +#include +#include + +#include "speaker_capturer.h" + +class SpeakerCapturerMacosx : public SpeakerCapturer { + public: + SpeakerCapturerMacosx(); + ~SpeakerCapturerMacosx(); + + public: + virtual int Init(speaker_data_cb cb); + virtual int Destroy(); + virtual int Start(); + virtual int Stop(); + + int Pause(); + int Resume(); + + private: + speaker_data_cb cb_ = nullptr; + + private: + bool inited_ = false; + // thread + std::unique_ptr capture_thread_ = nullptr; +}; + +#endif \ No newline at end of file diff --git a/src/speaker_capturer/speaker_capturer_factory.h b/src/speaker_capturer/speaker_capturer_factory.h index 8c9a8fe..dc89a55 100644 --- a/src/speaker_capturer/speaker_capturer_factory.h +++ b/src/speaker_capturer/speaker_capturer_factory.h @@ -10,7 +10,9 @@ #ifdef _WIN32 #include "speaker_capturer_wasapi.h" #elif __linux__ +#include "speaker_capturer_linux.h" #elif __APPLE__ +#include "speaker_capturer_macosx.h" #endif class SpeakerCapturerFactory { diff --git a/xmake.lua b/xmake.lua index 7d699f1..51ebecb 100644 --- a/xmake.lua +++ b/xmake.lua @@ -86,11 +86,9 @@ target("speaker_capturer") add_files("src/speaker_capturer/windows/*.cpp") add_includedirs("src/speaker_capturer/windows", {public = true}) elseif is_os("macosx") then - add_packages("ffmpeg") add_files("src/speaker_capturer/macosx/*.cpp") add_includedirs("src/speaker_capturer/macosx", {public = true}) elseif is_os("linux") then - add_packages("ffmpeg") add_files("src/speaker_capturer/linux/*.cpp") add_includedirs("src/speaker_capturer/linux", {public = true}) end