mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-07 15:31:18 +12:00
Separate camera code
This commit is contained in:
parent
cdd178d68d
commit
95238d60b7
8 changed files with 281 additions and 189 deletions
29
src/camera/CameraManager.h
Normal file
29
src/camera/CameraManager.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
#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();
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue