1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
#ifndef TX_PLAYBACK_EVIDENCE_HPP_
#define TX_PLAYBACK_EVIDENCE_HPP_
#include <QMetaType>
#include <QString>
#include <QtGlobal>
#include "Audio/TxIdentity.hpp"
namespace TxEvidence
{
inline qint64 boundedCommittedEndSample (qint64 leadingSilentFrames,
qint64 firstSourceSample,
qint64 lastSourceSample) noexcept
{
if (leadingSilentFrames < 0 || firstSourceSample < 0 ||
lastSourceSample < firstSourceSample)
{
return -1;
}
return leadingSilentFrames + lastSourceSample - firstSourceSample;
}
inline qint64 interleavedFrameCount (qint64 scalarCount,
int channelCount) noexcept
{
if (scalarCount < 0 || channelCount <= 0 || scalarCount % channelCount)
{
return -1;
}
return scalarCount / channelCount;
}
enum class TxPlayoutTier
{
Unavailable,
DeadReckoning,
DeviceClock
};
enum class TxBackendState
{
Unavailable,
Active,
Idle,
Suspended,
Stopped,
Interrupted,
Unknown
};
enum class TxBackendError
{
None,
Open,
Io,
Underrun,
Fatal,
Unknown
};
enum class TxStopReason
{
NormalEnd,
UserHalt,
Watchdog,
Error,
ModeChange
};
struct TxStartSnapshot
{
TxSessionId session_id;
TxGeneration generation;
QString mode;
int sample_rate_hz {0};
qint64 committed_end_sample {-1};
bool target_known {false};
QString diagnostic;
};
struct TxRawPlayoutSnapshot
{
TxPlayoutTier tier {TxPlayoutTier::Unavailable};
qint64 backend_start_sequence {0};
bool start_event {false};
bool available {false};
TxBackendState state {TxBackendState::Unavailable};
TxBackendError error {TxBackendError::None};
qint64 available_bytes {-1};
qint64 buffered_bytes {-1};
qint64 capacity_bytes {-1};
qint64 processed_usecs {-1};
qint64 elapsed_usecs {-1};
qint64 successfully_written_frames {-1};
qint64 source_served_frames {-1};
qint64 source_total_frames {-1};
int channel_count {0};
int bytes_per_frame {0};
int sample_rate_hz {0};
int report_interval_ms {0};
QString diagnostic;
};
struct TxPlayoutSnapshot
{
TxSessionId session_id;
TxGeneration generation;
TxRawPlayoutSnapshot raw;
qint64 consumed_samples {-1};
qint64 uncertainty_samples {-1};
};
struct TxStopDecision
{
int tail_ms {0};
TxStopReason reason {TxStopReason::NormalEnd};
};
struct TxTerminalSession
{
TxSessionId session_id;
TxGeneration generation;
QString mode;
TxPlayoutTier tier {TxPlayoutTier::Unavailable};
bool target_known {false};
qint64 committed_end_sample {-1};
qint64 source_served_samples {-1};
qint64 consumed_samples {-1};
qint64 uncertainty_samples {-1};
bool underrun {false};
bool truncated_known {false};
bool truncated {false};
bool terminal_playout_observed {false};
qint64 backend_start_sequence {0};
TxStopDecision stop;
QString diagnostic;
};
}
Q_DECLARE_METATYPE (TxEvidence::TxStartSnapshot)
Q_DECLARE_METATYPE (TxEvidence::TxRawPlayoutSnapshot)
#endif
|