qt_rtmp_demo/media/streamcontrol.cpp

67 lines
1.2 KiB
C++
Raw Normal View History

2024-06-16 16:14:06 +00:00
#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;
}