Files
2026-02-01 22:23:06 +08:00

67 lines
1.4 KiB
C++

/*
* @Date: 2024-09-04 18:58:05
* @LastEditors: Jacky
* @LastEditTime: 2024-09-11 11:18:52
* @FilePath: /GeneralTracker/Universal/CModuleVpss.cpp
*/
#include "CModuleVpss.h"
int CModuleVpss::create(const char* name){
m_pcName = std::string(name);
m_pSelfQueue.queueInit(m_pcName, QUEUE_SIZE);
return 0;
}
int CModuleVpss::destroy(){
stop();
return 0;
}
int CModuleVpss::set_data(const char* data, void* value){
return 0;
}
char* CModuleVpss::get_data(){
return nullptr;
}
int CModuleVpss::start(const char* data){
if(_vi_thread){
return -1;
}
_thread_flag = true;
_vi_thread = new std::thread(std::bind(&CModuleVpss::moduleThread, std::ref(*this)));
return 0;
}
int CModuleVpss::stop(){
if(_vi_thread){
_thread_flag = false;
_vi_thread->join();
delete _vi_thread;
_vi_thread = nullptr;
}
return 0;
}
void CModuleVpss::push_data(DataProcessBase *src, pool::IMemoryBlock* block){
m_pSelfQueue.sendFrame(block);
}
int CModuleVpss::moduleThread(){
int timeout = 100;
while(_thread_flag){
pool::IMemoryBlock* mb = m_pSelfQueue.getFrame(timeout);
if(mb){
AdditionalImp* imp = mb->data();
GD_VIDEO_FRAME_S *frame = mb->yuv();
//图像处理
push_input_pipe(mb);
m_pSelfQueue.releaseFrame(mb);
}
}
return 0;
}