44 lines
1.0 KiB
C++
44 lines
1.0 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
enum class VideoBackendLifecycleState
|
|
{
|
|
Uninitialized,
|
|
Discovering,
|
|
Discovered,
|
|
Configuring,
|
|
Configured,
|
|
Prerolling,
|
|
Running,
|
|
Degraded,
|
|
Stopping,
|
|
Stopped,
|
|
Failed
|
|
};
|
|
|
|
struct VideoBackendLifecycleTransition
|
|
{
|
|
VideoBackendLifecycleState previous = VideoBackendLifecycleState::Uninitialized;
|
|
VideoBackendLifecycleState current = VideoBackendLifecycleState::Uninitialized;
|
|
bool accepted = false;
|
|
std::string reason;
|
|
std::string errorMessage;
|
|
};
|
|
|
|
class VideoBackendLifecycle
|
|
{
|
|
public:
|
|
VideoBackendLifecycleState State() const;
|
|
const std::string& FailureReason() const;
|
|
VideoBackendLifecycleTransition TransitionTo(VideoBackendLifecycleState next, const std::string& reason);
|
|
VideoBackendLifecycleTransition Fail(const std::string& reason);
|
|
|
|
static bool CanTransition(VideoBackendLifecycleState current, VideoBackendLifecycleState next);
|
|
static const char* StateName(VideoBackendLifecycleState state);
|
|
|
|
private:
|
|
VideoBackendLifecycleState mState = VideoBackendLifecycleState::Uninitialized;
|
|
std::string mFailureReason;
|
|
};
|