mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
[fix] fix compile error on Macosx and Linux
This commit is contained in:
13
src/speaker_capturer/linux/speaker_capturer_linux.cpp
Normal file
13
src/speaker_capturer/linux/speaker_capturer_linux.cpp
Normal file
@@ -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; }
|
||||||
38
src/speaker_capturer/linux/speaker_capturer_linux.h
Normal file
38
src/speaker_capturer/linux/speaker_capturer_linux.h
Normal file
@@ -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 <thread>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#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<std::thread> capture_thread_ = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
14
src/speaker_capturer/macosx/speaker_capturer_macosx.cpp
Normal file
14
src/speaker_capturer/macosx/speaker_capturer_macosx.cpp
Normal file
@@ -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; }
|
||||||
38
src/speaker_capturer/macosx/speaker_capturer_macosx.h
Normal file
38
src/speaker_capturer/macosx/speaker_capturer_macosx.h
Normal file
@@ -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 <thread>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#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<std::thread> capture_thread_ = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -10,7 +10,9 @@
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include "speaker_capturer_wasapi.h"
|
#include "speaker_capturer_wasapi.h"
|
||||||
#elif __linux__
|
#elif __linux__
|
||||||
|
#include "speaker_capturer_linux.h"
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
|
#include "speaker_capturer_macosx.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class SpeakerCapturerFactory {
|
class SpeakerCapturerFactory {
|
||||||
|
|||||||
@@ -86,11 +86,9 @@ target("speaker_capturer")
|
|||||||
add_files("src/speaker_capturer/windows/*.cpp")
|
add_files("src/speaker_capturer/windows/*.cpp")
|
||||||
add_includedirs("src/speaker_capturer/windows", {public = true})
|
add_includedirs("src/speaker_capturer/windows", {public = true})
|
||||||
elseif is_os("macosx") then
|
elseif is_os("macosx") then
|
||||||
add_packages("ffmpeg")
|
|
||||||
add_files("src/speaker_capturer/macosx/*.cpp")
|
add_files("src/speaker_capturer/macosx/*.cpp")
|
||||||
add_includedirs("src/speaker_capturer/macosx", {public = true})
|
add_includedirs("src/speaker_capturer/macosx", {public = true})
|
||||||
elseif is_os("linux") then
|
elseif is_os("linux") then
|
||||||
add_packages("ffmpeg")
|
|
||||||
add_files("src/speaker_capturer/linux/*.cpp")
|
add_files("src/speaker_capturer/linux/*.cpp")
|
||||||
add_includedirs("src/speaker_capturer/linux", {public = true})
|
add_includedirs("src/speaker_capturer/linux", {public = true})
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user