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

66 lines
1.4 KiB
C++

/*
* @Date: 2024-09-04 18:57:40
* @LastEditors: Jacky
* @LastEditTime: 2024-09-11 11:18:46
* @FilePath: /GeneralTracker/Universal/CModuleVo.cpp
*/
#include "CModuleVo.h"
int CModuleVo::create(const char* name){
m_pcName = std::string(name);
m_pSelfQueue.queueInit(m_pcName, QUEUE_SIZE);
return 0;
}
int CModuleVo::destroy(){
stop();
return 0;
}
int CModuleVo::set_data(const char* data, void* value){
return 0;
}
char* CModuleVo::get_data(){
return nullptr;
}
int CModuleVo::start(const char* data){
if(_vi_thread){
return -1;
}
_thread_flag = true;
_vi_thread = new std::thread(std::bind(&CModuleVo::moduleThread, std::ref(*this)));
return 0;
}
int CModuleVo::stop(){
if(_vi_thread){
_thread_flag = false;
_vi_thread->join();
delete _vi_thread;
_vi_thread = nullptr;
}
return 0;
}
void CModuleVo::push_data(DataProcessBase *src, pool::IMemoryBlock* block){
m_pSelfQueue.sendFrame(block);
}
int CModuleVo::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;
}