#pragma once
|
#include <queue>
|
#include <mutex>
|
#include <condition_variable>
|
#include <thread>
|
#include <atomic>
|
#include <vector>
|
#include <string>
|
#include <Windows.h>
|
|
struct SaveImgJob
|
{
|
std::string strPath;
|
std::vector<BYTE> vData;
|
int nWidth = 0;
|
int nHeight = 0;
|
int nStride = 0;
|
int nBpp = 1;
|
int nStartY = 0;
|
int nDimension = 0;
|
int nQuality = 80;
|
};
|
|
class CThread_SaveFullImg
|
{
|
public:
|
CThread_SaveFullImg();
|
~CThread_SaveFullImg();
|
|
void CreateThread();
|
void StopThread();
|
void Enqueue(SaveImgJob&& oJob);
|
size_t GetPendingCount() const;
|
|
private:
|
void ThreadProc();
|
BOOL SaveFullImageModern(const SaveImgJob& job);
|
|
private:
|
mutable std::mutex m_Mtx;
|
std::condition_variable m_Cv;
|
std::queue<SaveImgJob> m_Q;
|
std::thread m_Thread;
|
std::atomic<bool> m_bStop;
|
};
|