MythTV
master
mythtv
libs
libmythtv
format.h
Go to the documentation of this file.
1
/* format.h rh */
2
3
#ifndef FORMAT_H
4
#define FORMAT_H
5
6
#ifdef __GNUC__
7
#define MYTH_PACKED __attribute__((packed))
8
#else
9
#define MYTH_PACKED
10
#endif
11
12
// Prevent clang-tidy modernize-avoid-c-arrays warnings in these
13
// kernel structures
14
extern
"C"
{
15
16
struct
rtfileheader
17
{
18
char
finfo
[12];
// "NuppelVideo" + \0
19
char
version
[5];
// "0.05" + \0
20
int
width
;
21
int
height
;
22
int
desiredwidth
;
// 0 .. as it is
23
int
desiredheight
;
// 0 .. as it is
24
char
pimode
;
// P .. progressive
25
// I .. interlaced (2 half pics) [NI]
26
double
aspect
;
// physical aspect ratio
27
double
fps
;
28
int
videoblocks
;
// count of video-blocks -1 .. unknown 0 .. no video
29
int
audioblocks
;
// count of audio-blocks -1 .. unknown 0 .. no audio
30
int
textsblocks
;
// count of text-blocks -1 .. unknown 0 .. no text
31
int
keyframedist
;
32
};
33
34
struct
rtframeheader
35
{
36
char
frametype
;
// A .. Audio, V .. Video, S .. Sync, T .. Text
37
// R .. Seekpoint: String RTjjjjjjjj (use full packet)
38
// D .. Addition Data for Compressors
39
// ct: R .. RTjpeg Tables, F .. FFMpeg extradata
40
// X .. eXtended data, Q .. SeekTable
41
// K .. KFA table
42
43
char
comptype
;
// V: 0 .. raw YUV420
44
// 1 .. RTJpeg
45
// 2 .. RTJpeg with lzo afterwards
46
// 3 .. raw YUV420 with lzo afterwards
47
// 4 .. avcodec (fourcc in the extendeddata)
48
// N .. black frame
49
// L .. simply copy last frame (if lost frames)
50
// A: 0 .. Uncompressed (44100/sec 16bit 2ch)
51
// 1 .. lzo compression [NI]
52
// 2 .. layer2 (packet) [NI]
53
// 3 .. layer3 (packet)
54
// F .. flac (lossless) [NI]
55
// S .. shorten (lossless) [NI]
56
// A .. AC3 (packet)
57
// N .. null frame loudless
58
// L .. simply copy last frame (may sound bad) NI
59
// S: B .. Audio and Video sync point [NI]
60
// A .. Audio Sync Information
61
// timecode == effective dsp-frequency*100
62
// when reaching this audio sync point
63
// because many cheap soundcards are unexact
64
// and have a range from 44000 to 44250
65
// instead of the expected exact 44100 S./sec
66
// V .. Next Video Sync
67
// timecode == next video framenumber
68
// S .. Audio,Video,Text Correlation [NI]
69
// M .. New Header - format changed (only aspect now)
70
// T: C .. Closed Caption (US)
71
// T .. Teletext Subtitles (Europe)
72
char
keyframe
;
// 0 .. keyframe
73
// 1 .. nr of frame in gop => no keyframe
74
75
char
filters
;
// Every bit stands for one type of filter
76
// 1 .. Gauss 5 Pixel (8*m+2*l+2*r+2*a+2*b)/16 [NYI]
77
// 2 .. Gauss 5 Pixel (8*m+1*l+1*r+1*a+1*b)/12 [NYI]
78
// 4 .. Cartoon Filter [NI]
79
// 8 .. Reserverd Filter [NI]
80
// 16 .. Reserverd Filter [NI]
81
// 32 .. Reserverd Filter [NI]
82
// 64 .. Reserverd Filter [NI]
83
// 128 .. Reserverd Filter [NI]
84
85
int
timecode
;
// Timecodeinformation sec*1000 + msecs
86
87
int
packetlength
;
// V,A,T: length of following data in stream
88
// S: length of packet correl. information [NI]
89
// R: do not use here! (fixed 'RTjjjjjjjjjjjjjj')
90
}
MYTH_PACKED
;
91
92
// The fourcc's here are for the most part taken from libavcodec.
93
// As to their correctness, I have no idea. The audio ones are surely wrong,
94
// but I suppose it doesn't really matter as long as I'm consistant.
95
96
struct
extendeddata
97
{
98
int
version
;
// yes, this is repeated from the file header
99
int
video_fourcc
;
// video encoding method used
100
int
audio_fourcc
;
// audio encoding method used
101
// generic data
102
int
audio_sample_rate
;
103
int
audio_bits_per_sample
;
104
int
audio_channels
;
105
// codec specific
106
// mp3lame
107
int
audio_compression_ratio
;
108
int
audio_quality
;
109
// rtjpeg
110
int
rtjpeg_quality
;
111
int
rtjpeg_luma_filter
;
112
int
rtjpeg_chroma_filter
;
113
// libavcodec
114
int
lavc_bitrate
;
115
int
lavc_qmin
;
116
int
lavc_qmax
;
117
int
lavc_maxqdiff
;
118
// seek table offset
119
long
long
seektable_offset
;
120
// key frame adjust offset
121
long
long
keyframeadjust_offset
;
122
// unused for later -- total size of 128 integers.
123
// new fields must be added at the end, above this comment.
124
int
expansion
[109];
125
}
MYTH_PACKED
;
126
127
struct
seektable_entry
128
{
129
long
long
file_offset
;
130
int
keyframe_number
;
131
}
MYTH_PACKED
;
132
133
struct
kfatable_entry
134
{
135
int
adjust
;
136
int
keyframe_number
;
137
}
MYTH_PACKED
;
138
139
#define FRAMEHEADERSIZE sizeof(rtframeheader)
140
#define FILEHEADERSIZE sizeof(rtfileheader)
141
#define EXTENDEDSIZE sizeof(extendeddata)
142
143
struct
vidbuffertype
144
{
145
int
sample
;
146
std::chrono::milliseconds
timecode
;
147
int
freeToEncode
;
148
int
freeToBuffer
;
149
unsigned
char
*
buffer
;
150
int
bufferlen
;
151
bool
forcekey
;
152
};
153
154
struct
audbuffertype
155
{
156
int
sample
;
157
std::chrono::milliseconds
timecode
;
158
int
freeToEncode
;
159
int
freeToBuffer
;
160
unsigned
char
*
buffer
;
161
};
162
163
struct
txtbuffertype
164
{
165
std::chrono::milliseconds
timecode
;
166
int
pagenr
;
167
int
freeToEncode
;
168
int
freeToBuffer
;
169
unsigned
char
*
buffer
;
170
int
bufferlen
;
171
};
172
173
struct
teletextsubtitle
174
{
175
unsigned
char
row
;
176
unsigned
char
col
;
177
unsigned
char
dbl
;
178
unsigned
char
fg
;
179
unsigned
char
bg
;
180
unsigned
char
len
;
181
};
182
183
struct
ccsubtitle
184
{
185
unsigned
char
row
;
186
unsigned
char
rowcount
;
187
unsigned
char
resumedirect
;
188
unsigned
char
resumetext
;
189
unsigned
char
clr
;
// clear the display
190
unsigned
char
len
;
//length of string to follow
191
};
192
193
// resumedirect codes
194
enum
CC_STYLE
: std::uint8_t {
195
CC_STYLE_POPUP
= 0x00,
196
CC_STYLE_PAINT
= 0x01,
197
CC_STYLE_ROLLUP
= 0x02,
198
};
199
200
// resumetext special codes
201
static
constexpr uint8_t
CC_LINE_CONT
{ 0x02 };
202
static
constexpr uint8_t
CC_MODE_MASK
{ 0xf0 };
203
static
constexpr uint8_t
CC_TXT_MASK
{ 0x20 };
204
enum
CC_MODE
: std::uint8_t {
205
CC_CC1
= 0x00,
206
CC_CC2
= 0x10,
207
CC_TXT1
= 0x20,
208
CC_TXT2
= 0x30,
209
CC_CC3
= 0x40,
210
CC_CC4
= 0x50,
211
CC_TXT3
= 0x60,
212
CC_TXT4
= 0x70,
213
};
214
215
// end of kernel structures.
216
};
217
218
#endif
rtframeheader
Definition:
format.h:34
CC_CC1
@ CC_CC1
Definition:
format.h:205
extendeddata::version
int version
Definition:
format.h:98
rtfileheader::fps
double fps
Definition:
format.h:27
teletextsubtitle::row
unsigned char row
Definition:
format.h:175
vidbuffertype::buffer
unsigned char * buffer
Definition:
format.h:149
rtfileheader::height
int height
Definition:
format.h:21
vidbuffertype::bufferlen
int bufferlen
Definition:
format.h:150
vidbuffertype::freeToEncode
int freeToEncode
Definition:
format.h:147
extendeddata::lavc_maxqdiff
int lavc_maxqdiff
Definition:
format.h:117
seektable_entry::file_offset
long long file_offset
Definition:
format.h:129
rtfileheader::width
int width
Definition:
format.h:20
extendeddata::audio_channels
int audio_channels
Definition:
format.h:104
kfatable_entry::keyframe_number
int keyframe_number
Definition:
format.h:136
rtfileheader::textsblocks
int textsblocks
Definition:
format.h:30
rtfileheader::desiredheight
int desiredheight
Definition:
format.h:23
rtframeheader::timecode
int timecode
Definition:
format.h:85
CC_CC2
@ CC_CC2
Definition:
format.h:206
seektable_entry
Definition:
format.h:127
txtbuffertype::freeToEncode
int freeToEncode
Definition:
format.h:167
CC_TXT_MASK
static constexpr uint8_t CC_TXT_MASK
Definition:
format.h:203
kfatable_entry
Definition:
format.h:133
CC_TXT3
@ CC_TXT3
Definition:
format.h:211
CC_MODE_MASK
static constexpr uint8_t CC_MODE_MASK
Definition:
format.h:202
ccsubtitle::len
unsigned char len
Definition:
format.h:190
ccsubtitle::clr
unsigned char clr
Definition:
format.h:189
extendeddata::audio_fourcc
int audio_fourcc
Definition:
format.h:100
rtfileheader::desiredwidth
int desiredwidth
Definition:
format.h:22
extendeddata::rtjpeg_chroma_filter
int rtjpeg_chroma_filter
Definition:
format.h:112
audbuffertype
Definition:
format.h:154
rtfileheader
Definition:
format.h:16
ccsubtitle::resumetext
unsigned char resumetext
Definition:
format.h:188
rtframeheader::keyframe
char keyframe
Definition:
format.h:72
CC_STYLE
CC_STYLE
Definition:
format.h:194
txtbuffertype::buffer
unsigned char * buffer
Definition:
format.h:169
CC_STYLE_POPUP
@ CC_STYLE_POPUP
Definition:
format.h:195
txtbuffertype::bufferlen
int bufferlen
Definition:
format.h:170
txtbuffertype
Definition:
format.h:163
audbuffertype::timecode
std::chrono::milliseconds timecode
Definition:
format.h:157
MYTH_PACKED
#define MYTH_PACKED
Definition:
format.h:9
rtfileheader::videoblocks
int videoblocks
Definition:
format.h:28
extendeddata::audio_compression_ratio
int audio_compression_ratio
Definition:
format.h:107
extendeddata::expansion
int expansion[109]
Definition:
format.h:124
teletextsubtitle
Definition:
format.h:173
CC_TXT1
@ CC_TXT1
Definition:
format.h:207
rtframeheader::comptype
char comptype
Definition:
format.h:43
rtfileheader::pimode
char pimode
Definition:
format.h:24
vidbuffertype::timecode
std::chrono::milliseconds timecode
Definition:
format.h:146
CC_CC4
@ CC_CC4
Definition:
format.h:210
txtbuffertype::timecode
std::chrono::milliseconds timecode
Definition:
format.h:165
CC_TXT4
@ CC_TXT4
Definition:
format.h:212
rtfileheader::finfo
char finfo[12]
Definition:
format.h:18
CC_CC3
@ CC_CC3
Definition:
format.h:209
extendeddata::video_fourcc
int video_fourcc
Definition:
format.h:99
rtfileheader::audioblocks
int audioblocks
Definition:
format.h:29
extendeddata::audio_bits_per_sample
int audio_bits_per_sample
Definition:
format.h:103
extendeddata::lavc_bitrate
int lavc_bitrate
Definition:
format.h:114
CC_STYLE_ROLLUP
@ CC_STYLE_ROLLUP
Definition:
format.h:197
vidbuffertype::freeToBuffer
int freeToBuffer
Definition:
format.h:148
teletextsubtitle::dbl
unsigned char dbl
Definition:
format.h:177
extendeddata::lavc_qmin
int lavc_qmin
Definition:
format.h:115
vidbuffertype::sample
int sample
Definition:
format.h:145
extendeddata::keyframeadjust_offset
long long keyframeadjust_offset
Definition:
format.h:121
teletextsubtitle::len
unsigned char len
Definition:
format.h:180
rtframeheader::filters
char filters
Definition:
format.h:75
vidbuffertype::forcekey
bool forcekey
Definition:
format.h:151
audbuffertype::sample
int sample
Definition:
format.h:156
audbuffertype::freeToBuffer
int freeToBuffer
Definition:
format.h:159
txtbuffertype::pagenr
int pagenr
Definition:
format.h:166
ccsubtitle::rowcount
unsigned char rowcount
Definition:
format.h:186
extendeddata::audio_sample_rate
int audio_sample_rate
Definition:
format.h:102
rtframeheader::packetlength
int packetlength
Definition:
format.h:87
teletextsubtitle::col
unsigned char col
Definition:
format.h:176
rtfileheader::aspect
double aspect
Definition:
format.h:26
extendeddata
Definition:
format.h:96
extendeddata::rtjpeg_quality
int rtjpeg_quality
Definition:
format.h:110
CC_LINE_CONT
static constexpr uint8_t CC_LINE_CONT
Definition:
format.h:201
extendeddata::audio_quality
int audio_quality
Definition:
format.h:108
ccsubtitle::row
unsigned char row
Definition:
format.h:185
CC_MODE
CC_MODE
Definition:
format.h:204
extendeddata::rtjpeg_luma_filter
int rtjpeg_luma_filter
Definition:
format.h:111
rtfileheader::version
char version[5]
Definition:
format.h:19
CC_TXT2
@ CC_TXT2
Definition:
format.h:208
audbuffertype::buffer
unsigned char * buffer
Definition:
format.h:160
seektable_entry::keyframe_number
int keyframe_number
Definition:
format.h:130
extendeddata::lavc_qmax
int lavc_qmax
Definition:
format.h:116
ccsubtitle
Definition:
format.h:183
CC_STYLE_PAINT
@ CC_STYLE_PAINT
Definition:
format.h:196
vidbuffertype
Definition:
format.h:143
teletextsubtitle::bg
unsigned char bg
Definition:
format.h:179
kfatable_entry::adjust
int adjust
Definition:
format.h:135
audbuffertype::freeToEncode
int freeToEncode
Definition:
format.h:158
rtframeheader::frametype
char frametype
Definition:
format.h:36
rtfileheader::keyframedist
int keyframedist
Definition:
format.h:31
txtbuffertype::freeToBuffer
int freeToBuffer
Definition:
format.h:168
extendeddata::seektable_offset
long long seektable_offset
Definition:
format.h:119
ccsubtitle::resumedirect
unsigned char resumedirect
Definition:
format.h:187
teletextsubtitle::fg
unsigned char fg
Definition:
format.h:178
Generated on Sun Jan 19 2025 03:16:51 for MythTV by
1.8.17