Phase 7 step 1
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#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;
|
||||
};
|
||||
Reference in New Issue
Block a user