forked from peterkvt80/vbit2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packetsubtitle.h
65 lines (52 loc) · 1.44 KB
/
packetsubtitle.h
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
/** Delivers subtitle packets
*/
#ifndef _PACKETSUBTITLE_H_
#define _PACKETSUBTITLE_H_
#include <thread>
#include <mutex>
#include "packetsource.h"
#include "ttxpage.h"
#include "configure.h"
namespace vbit{
/** Subtitles state machine
*/
enum SubtitleState
{
SUBTITLE_STATE_IDLE,
SUBTITLE_STATE_HEADER,
SUBTITLE_STATE_TEXT_ROW,
SUBTITLE_STATE_NUMBER_ITEMS
};
class PacketSubtitle : public PacketSource
{
public:
/** Default constructor */
PacketSubtitle(ttx::Configure *configure);
/** Default destructor */
virtual ~PacketSubtitle();
/** @todo Routines to link Newfor subtitles to here
*/
Packet* GetPacket(Packet* p) override;
/**
* Packet 830 must always wait for the correct field.
* @param force is ignored
*/
bool IsReady(bool force=false);
/**
* @brief Accept a page from another thread
* @param page - Pointer to another page object
*/
void SendSubtitle(TTXPage* page);
protected:
private:
std::mutex _mtx; // Mutex to interlock Mewfor thread
TTXPage _page[2];
uint8_t _swap;
SubtitleState _state; // Subtitle state machine
uint8_t _rowCount; // Used to iterate through the rows of the subtitle page
ttx::Configure* _configure; /// Configuration object
uint8_t _repeatCount; /// Counts repeat transmissions
bool _C8Flag; /// C8 Update flag. Set when new sub comes in, cleared when first header goes out.
};
}
#endif // _PACKETSUBTITLE_H_