libpromeki 1.0.0-alpha
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
ltcdecoder.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 <vector>
14#include <promeki/namespace.h>
15#include <promeki/timecode.h>
16#include <promeki/list.h>
18#include <promeki/uniqueptr.h>
19#include <vtc/ltc_audio.h>
20
21PROMEKI_NAMESPACE_BEGIN
22
52class LtcDecoder {
53 public:
55 using UPtr = UniquePtr<LtcDecoder>;
56
67 struct DecodedTimecode {
68 Timecode timecode;
69 int64_t sampleStart;
70 int64_t sampleLength;
71 };
72
74 using DecodedList = ::promeki::List<DecodedTimecode>;
75
80 LtcDecoder(int sampleRate);
81
83 ~LtcDecoder() = default;
84
85 LtcDecoder(const LtcDecoder &) = delete;
86 LtcDecoder &operator=(const LtcDecoder &) = delete;
87 LtcDecoder(LtcDecoder &&) = default;
88 LtcDecoder &operator=(LtcDecoder &&) = default;
89
94 int sampleRate() const { return _decoder.sample_rate; }
95
101 void setThresholds(int8_t lower, int8_t upper);
102
107 void setFuzz(int fuzz);
108
115 DecodedList decode(const int8_t *samples, size_t count);
116
140 DecodedList decode(const PcmAudioPayload &audio, int channelIndex = 0);
141
147 void reset();
148
149 private:
150 VtcLTCDecoder _decoder;
151 DecodedList _results;
152
156 List<float> _floatScratch;
157 List<int8_t> _int8Scratch;
158
164 DecodedList decodeInterleaved(const AudioDesc &desc, const uint8_t *data, size_t samples,
165 int channelIndex);
166
167 static void decoderCallback(const VtcTimecode *tc, int64_t sampleStart, int64_t sampleLength,
168 void *userData);
169};
170
171PROMEKI_NAMESPACE_END
172
173#endif // PROMEKI_ENABLE_PROAV