| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <functional> |
| 7 |
#include <memory> |
| 8 |
#include <string> |
| 9 |
#include <string_view> |
| 10 |
#include <utility> |
| 11 |
#include <vector> |
| 12 |
|
| 13 |
#ifdef _WIN32 |
| 14 |
#include "Common/WorkQueueThread.h" |
| 15 |
#endif |
| 16 |
|
| 17 |
struct cubeb; |
| 18 |
|
| 19 |
namespace CubebUtils |
| 20 |
{ |
| 21 |
std::shared_ptr<cubeb> GetContext(); |
| 22 |
std::vector<std::pair<std::string, std::string>> ListInputDevices(); |
| 23 |
const void* GetInputDeviceById(std::string_view id); |
| 24 |
std::vector<std::pair<std::string, std::string>> ListOutputDevices(); |
| 25 |
const void* GetOutputDeviceById(std::string_view id); |
| 26 |
|
| 27 |
|
| 28 |
class CoInitSyncWorker |
| 29 |
{ |
| 30 |
public: |
| 31 |
using FunctionType = std::function<void()>; |
| 32 |
|
| 33 |
CoInitSyncWorker(std::string worker_name); |
| 34 |
~CoInitSyncWorker(); |
| 35 |
|
| 36 |
bool Execute(FunctionType f); |
| 37 |
|
| 38 |
#ifdef _WIN32 |
| 39 |
private: |
| 40 |
Common::AsyncWorkThread m_work_queue; |
| 41 |
bool m_coinit_success = false; |
| 42 |
bool m_should_couninit = false; |
| 43 |
#endif |
| 44 |
}; |
| 45 |
} |