libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
framesyncdisposition.h
Go to the documentation of this file.
1
8#pragma once
9
10
11#include <promeki/config.h>
12#if PROMEKI_ENABLE_PROAV
13#include <cstdint>
14#include <promeki/namespace.h>
15
16PROMEKI_NAMESPACE_BEGIN
17
48class FrameSyncDisposition {
49 public:
57 enum Kind {
58 Play,
59 Drop,
60 Repeat
61 };
62
64 static constexpr uint8_t DefaultRepeatCount = 1;
65
67 static constexpr FrameSyncDisposition play() {
68 return FrameSyncDisposition(Play, 0);
69 }
70
72 static constexpr FrameSyncDisposition drop() {
73 return FrameSyncDisposition(Drop, 0);
74 }
75
84 static constexpr FrameSyncDisposition repeat(uint8_t count = DefaultRepeatCount) {
85 return FrameSyncDisposition(Repeat, count);
86 }
87
89 constexpr FrameSyncDisposition() = default;
90
92 constexpr Kind kind() const { return _kind; }
93
99 constexpr uint8_t repeatCount() const { return _repeatCount; }
100
102 constexpr bool operator==(const FrameSyncDisposition &other) const {
103 return _kind == other._kind && _repeatCount == other._repeatCount;
104 }
105
107 constexpr bool operator!=(const FrameSyncDisposition &other) const {
108 return !(*this == other);
109 }
110
111 private:
112 constexpr FrameSyncDisposition(Kind k, uint8_t c) : _kind(k), _repeatCount(c) {}
113
114 Kind _kind = Play;
115 uint8_t _repeatCount = 0;
116};
117
118PROMEKI_NAMESPACE_END
119
120#endif // PROMEKI_ENABLE_PROAV