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