-
Notifications
You must be signed in to change notification settings - Fork 16
/
configure.h
114 lines (93 loc) · 3.82 KB
/
configure.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
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
#ifndef _CONFIGURE_H_
#define _CONFIGURE_H_
/** Configure holds settings like source folder, header info, packet 830 and magazine priority.
* It could also hold data about the teletext server that the client should connect to.
* /// @todo Rewrite this as a singleton
*
*/
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdint.h>
#include <cstring>
#include <sys/stat.h>
#include <vector>
#include <array>
#include <algorithm>
#include <stdexcept>
#include "debug.h"
#include "ttxline.h"
#define CONFIGFILE "vbit.conf" // default config file name
namespace ttx
{
class Configure
{
public:
enum OutputFormat
{
None,
T42,
Raw,
TS,
TSNPTS
};
//Configure();
/** Constructor can take overrides from the command line
*/
Configure(vbit::Debug *debug, int argc=0, char** argv=NULL);
~Configure();
inline std::string GetPageDirectory(){return _pageDir;};
std::string GetHeaderTemplate(){return _headerTemplate;}
bool GetRowAdaptive(){return _rowAdaptive;}
std::string GetServiceStatusString(){return _serviceStatusString;}
bool GetMultiplexedSignalFlag(){return _multiplexedSignalFlag;}
uint16_t GetNetworkIdentificationCode(){return _NetworkIdentificationCode;}
std::array<uint8_t, 4> GetReservedBytes(){return _reservedBytes;}
uint8_t GetInitialMag(){return _initialMag;}
uint8_t GetInitialPage(){return _initialPage;}
uint16_t GetInitialSubcode(){return _initialSubcode;}
uint8_t GetSubtitleRepeats(){return _subtitleRepeats;}
uint16_t GetCommandPort(){return _commandPort;}
bool GetCommandPortEnabled(){return _commandPortEnabled;}
uint16_t GetLinesPerField(){return _linesPerField;}
uint16_t GetDatacastLines(){return _datacastLines;}
bool GetReverseFlag(){return _reverseBits;}
int GetMagazinePriority(uint8_t mag){return _magazinePriority[mag];}
OutputFormat GetOutputFormat(){return _OutputFormat;}
uint16_t GetTSPID(){return _PID;}
uint16_t GetPacketServerPort(){return _packetServerPort;}
bool GetPacketServerEnabled(){return _packetServerPort != 0;}
uint16_t GetDatacastServerPort(){return _datacastServerPort;}
bool GetDatacastServerEnabled(){return _datacastServerPort != 0;}
private:
vbit::Debug* _debug;
int DirExists(std::string *path);
int LoadConfigFile(std::string filename);
// template string for generating header packets
std::string _headerTemplate;
uint16_t _commandPort;
bool _rowAdaptive;
uint16_t _linesPerField;
uint16_t _datacastLines;
// settings for generation of packet 8/30
bool _multiplexedSignalFlag; // false indicates teletext is multiplexed with video, true means full frame teletext.
int _magazinePriority[8];
uint8_t _initialMag;
uint8_t _initialPage;
uint16_t _initialSubcode;
uint16_t _NetworkIdentificationCode;
uint16_t _CountryNetworkIdentificationCode;
std::array<uint8_t, 4> _reservedBytes; // four bytes which the teletext specification marks reserved
std::string _serviceStatusString; /// 20 characters
std::string _configFile; /// Configuration file name --config
std::string _pageDir; /// Configuration file name --dir
uint8_t _subtitleRepeats; /// Number of times a subtitle repeats (typically 1 or 2).
bool _commandPortEnabled;
bool _reverseBits;
OutputFormat _OutputFormat;
uint16_t _PID;
uint16_t _packetServerPort;
uint16_t _datacastServerPort;
};
}
#endif