[refactor] add namespace 'crossdesk' to codebase

This commit is contained in:
dijunkun
2025-10-27 17:10:01 +08:00
parent 3b34c26555
commit 73bbf642fa
68 changed files with 284 additions and 539 deletions

View File

@@ -9,6 +9,8 @@
#include "rd_log.h"
namespace crossdesk {
constexpr int kSampleRate = 48000;
constexpr pa_sample_format_t kFormat = PA_SAMPLE_S16LE;
constexpr int kChannels = 1;
@@ -265,4 +267,5 @@ int SpeakerCapturerLinux::Pause() {
int SpeakerCapturerLinux::Resume() {
paused_ = false;
return 0;
}
}
} // namespace crossdesk

View File

@@ -18,6 +18,8 @@
#include "speaker_capturer.h"
namespace crossdesk {
class SpeakerCapturerLinux : public SpeakerCapturer {
public:
SpeakerCapturerLinux();
@@ -50,5 +52,5 @@ class SpeakerCapturerLinux : public SpeakerCapturer {
std::mutex state_mtx_;
std::vector<uint8_t> frame_cache_;
};
} // namespace crossdesk
#endif

View File

@@ -12,6 +12,8 @@
#include "speaker_capturer.h"
namespace crossdesk {
class SpeakerCapturerMacosx : public SpeakerCapturer {
public:
SpeakerCapturerMacosx();
@@ -33,5 +35,5 @@ class SpeakerCapturerMacosx : public SpeakerCapturer {
class Impl;
Impl* impl_ = nullptr;
};
} // namespace crossdesk
#endif

View File

@@ -5,6 +5,8 @@
#include "rd_log.h"
#include "speaker_capturer_macosx.h"
namespace crossdesk {
@interface SpeakerCaptureDelegate : NSObject <SCStreamDelegate, SCStreamOutput>
@property(nonatomic, assign) SpeakerCapturerMacosx* owner;
- (instancetype)initWithOwner:(SpeakerCapturerMacosx*)owner;
@@ -262,3 +264,4 @@ int SpeakerCapturerMacosx::Destroy() {
int SpeakerCapturerMacosx::Pause() { return 0; }
int SpeakerCapturerMacosx::Resume() { return Start(); }
} // namespace crossdesk

View File

@@ -9,9 +9,11 @@
#include <functional>
namespace crossdesk {
class SpeakerCapturer {
public:
typedef std::function<void(unsigned char *, size_t, const char *)>
typedef std::function<void(unsigned char*, size_t, const char*)>
speaker_data_cb;
public:
@@ -23,5 +25,5 @@ class SpeakerCapturer {
virtual int Start() = 0;
virtual int Stop() = 0;
};
} // namespace crossdesk
#endif

View File

@@ -15,6 +15,8 @@
#include "speaker_capturer_macosx.h"
#endif
namespace crossdesk {
class SpeakerCapturerFactory {
public:
virtual ~SpeakerCapturerFactory() {}
@@ -32,5 +34,5 @@ class SpeakerCapturerFactory {
#endif
}
};
} // namespace crossdesk
#endif

View File

@@ -7,6 +7,8 @@
#define SAVE_AUDIO_FILE 0
namespace crossdesk {
static ma_device_config device_config_;
static ma_device device_;
static ma_format format_ = ma_format_s16;
@@ -99,3 +101,4 @@ int SpeakerCapturerWasapi::Destroy() {
}
int SpeakerCapturerWasapi::Pause() { return 0; }
} // namespace crossdesk

View File

@@ -9,6 +9,8 @@
#include "speaker_capturer.h"
namespace crossdesk {
class SpeakerCapturerWasapi : public SpeakerCapturer {
public:
SpeakerCapturerWasapi();
@@ -31,5 +33,5 @@ class SpeakerCapturerWasapi : public SpeakerCapturer {
private:
bool inited_ = false;
};
} // namespace crossdesk
#endif