67 lines
1.2 KiB
C++
67 lines
1.2 KiB
C++
#include "streamcontrol.h"
|
|
|
|
StreamControl::StreamControl()
|
|
{
|
|
this->mStatus = STOP;
|
|
this->mThread = nullptr;
|
|
}
|
|
|
|
int StreamControl::Process(void*data) {
|
|
|
|
return 0;
|
|
}
|
|
|
|
int StreamControl::Start(void *dat) {
|
|
|
|
switch (this->mStatus){
|
|
case RUNNING:
|
|
break;
|
|
case STOP:
|
|
if(nullptr != mThread){
|
|
|
|
}else{
|
|
this->mThread = new std::thread(
|
|
[&](){
|
|
while(true){
|
|
switch (this->mStatus) {
|
|
case STOP:
|
|
return;
|
|
case PAUSHED:
|
|
break;
|
|
case RUNNING:
|
|
this->Process(dat);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
break;
|
|
case PAUSHED:
|
|
break;
|
|
}
|
|
|
|
this->mStatus = RUNNING;
|
|
|
|
return 0;
|
|
}
|
|
|
|
int StreamControl::Stop()
|
|
{
|
|
this->mStatus = STOP;
|
|
return 0;
|
|
}
|
|
|
|
int StreamControl::Pause()
|
|
{
|
|
this->mStatus = PAUSHED;
|
|
return 0;
|
|
}
|
|
|
|
StreamControl::Status StreamControl::CurrentStatus()
|
|
{
|
|
return mStatus;
|
|
}
|
|
|