mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-06 15:01:18 +12:00
31 lines
No EOL
641 B
C++
31 lines
No EOL
641 B
C++
#pragma once
|
|
#include <shared_mutex>
|
|
#include <openpnp-capture.h>
|
|
#include "util/helpers/Singleton.h"
|
|
|
|
class CameraManager : public Singleton<CameraManager>
|
|
{
|
|
CapContext m_ctx;
|
|
std::optional<CapDeviceID> m_device;
|
|
std::optional<CapStream> m_stream;
|
|
std::vector<uint8_t> m_rgbBuffer;
|
|
std::vector<uint8_t> m_nv12Buffer;
|
|
int m_refCount;
|
|
std::thread m_captureThread;
|
|
std::atomic_bool m_capturing;
|
|
mutable std::shared_mutex m_mutex;
|
|
|
|
public:
|
|
CameraManager();
|
|
~CameraManager();
|
|
|
|
void SetDevice(uint deviceNo);
|
|
|
|
bool Open(bool weak);
|
|
void Close();
|
|
|
|
void GetNV12Data(uint8_t* nv12Buffer) const;
|
|
|
|
private:
|
|
void CaptureWorker();
|
|
}; |