r1006: configure: Use libx264_pic instead of libx264 if available.
[cinelerra_cv/mob.git] / libmpeg3 / ifo.h
blob415fd8f9029ae4c2feb4cfd3b1fe67dff96174fa
1 #ifndef __IFO_H__
2 #define __IFO_H__
4 #ifndef DVD_VIDEO_LB_LEN
5 #define DVD_VIDEO_LB_LEN 2048
6 #endif
8 #define OFFSET_IFO 0x0000
9 #define OFFSET_VTS 0x0000
10 #define OFFSET_LEN 0x00C0
11 #define IFO_OFFSET_TAT 0x00C0
12 #define OFFSET_VTSI_MAT 0x0080
13 #define IFO_OFFSET_VIDEO 0x0100
14 #define IFO_OFFSET_AUDIO 0x0200
15 #define IFO_OFFSET_SUBPIC 0x0250
18 // for debug and error output
20 /**
21 * Video Info Table
24 typedef struct {
25 #if BYTE_ORDER == BIG_ENDIAN
26 u_char compression : 2;
27 u_char system : 2;
28 u_char ratio : 2;
29 u_char perm_displ : 2;
31 u_char line21_1 : 1;
32 u_char line21_2 : 1;
33 u_char source_res : 2;
34 u_char letterboxed : 1;
35 u_char mode : 1;
36 #else
37 u_char perm_displ : 2;
38 u_char ratio : 2;
39 u_char system : 2;
40 u_char compression : 2;
42 u_char mode : 1;
43 u_char letterboxed : 1;
44 u_char source_res : 2;
45 u_char line21_2 : 1;
46 u_char line21_1 : 1;
47 #endif
48 } ifo_video_info_t;
50 /**
51 * Audio Table
54 typedef struct {
55 #if MPEG3_LITTLE_ENDIAN
56 u_char num_channels : 3; // number of channels (n+1)
57 u_char sample_freq : 2; // sampling frequency
58 u_char quantization : 2; // quantization
59 u_char appl_mode2 : 1; // audio application mode
61 u_char appl_mode1 : 1; //
62 u_char type : 2; // audio type (language included?)
63 u_char multichannel_extension: 1;
64 u_char coding_mode : 2;
65 #else
66 u_char appl_mode2 : 1;
67 u_char quantization : 2;
68 u_char sample_freq : 2;
69 u_char num_channels : 3;
71 u_char coding_mode : 2;
72 u_char multichannel_extension: 1;
73 u_char type : 2;
74 u_char appl_mode1 : 1;
75 #endif
76 u_short lang_code : 16; // <char> description
77 u_int foo : 8; // 0x00000000 ?
78 u_int caption : 8;
79 u_int bar : 8; // 0x00000000 ?
80 } ifo_audio_t;
82 #define IFO_AUDIO_LEN 7
84 /**
85 * Subpicture Table
88 typedef struct {
89 u_short prefix : 16; // 0x0100 ?
90 u_short lang_code : 16; // <char> description
91 u_char foo : 8; // dont know
92 u_char caption : 8; // 0x00 ?
93 } ifo_spu_t;
96 /**
97 * Time Map Table header entry
100 #if 0
101 typedef struct {
102 u_char tu : 16; // time unit (in seconds)
103 u_int : 16; // don't know
104 } ifo_tmt_hdr_t;
105 #endif
107 typedef struct {
108 u_int : 24; // don't know
109 u_char tu : 8; // time unit (in seconds)
110 } ifoq_tmt_hdr_t;
112 //#define IFO_TMT_HDR_LEN 4
113 #define IFOQ_TMT_HDR_LEN 1
117 * hmm
120 typedef struct {
121 u_short vob_id : 16; // Video Object Identifier
122 u_char cell_id : 8; // Cell Identifier
123 u_char : 8; // don't know
124 u_int start : 32; // Cell start
125 u_int end : 32; // Cell end
126 } ifo_cell_addr_t;
129 typedef struct {
130 u_short vob_id : 16; // Video Object Identifier
131 u_short cell_id : 16; // Cell Identifier
132 } ifo_pgc_cell_pos_t;
135 * Part of Title AND Title set Cell Address
138 typedef struct {
139 u_short pgc; // Program Chain (PTT)
140 u_short pg; // Program (PTT)
141 u_long start; // Start of VOBU (VTS? CADDR)
142 u_long end; // End of VOBU (VTS? CADDR)
143 } ifo_ptt_data_t;
145 typedef struct {
146 u_int num; // Number of Chapters
147 ifo_ptt_data_t *data; // Data
148 } ifo_ptt_sub_t;
150 typedef struct {
151 u_int num; // Number of Titles
152 ifo_ptt_sub_t *title; // Titles
153 } ifo_ptt_t;
155 typedef struct {
156 u_char chain_info : 8; // 0x5e 0xde(2 angles, no overlay), 0x5f 0x9f 0x9f 0xdf(4 angles overlay), 0x2 0xa 0x8(1 angle)
157 u_char foo : 8; // parent control ??
158 u_char still_time : 8;
159 u_char cell_cmd : 8;
160 //u_int foo : 32;
161 u_int len_time : 32;
162 u_int vobu_start : 32; // 1st vobu start
163 u_int ilvu_end : 32;
164 u_int vobu_last_start : 32;
165 u_int vobu_last_end : 32;
166 } ifo_pgci_cell_addr_t;
168 #define PGCI_CELL_ADDR_LEN 24
170 #define ID_NUM_MENU_VOBS 0
171 #define ID_NUM_TITLE_VOBS 1
173 #define ID_MAT 0
174 #define ID_PTT 1
175 #define ID_TSP 1
176 #define ID_TITLE_PGCI 2
177 #define ID_MENU_PGCI 3
178 #define ID_TMT 4
179 #define ID_MENU_CELL_ADDR 5
180 #define ID_MENU_VOBU_ADDR_MAP 6
181 #define ID_TITLE_CELL_ADDR 7
182 #define ID_TITLE_VOBU_ADDR_MAP 8
186 * Information Table - for internal use only
189 typedef struct {
190 u_int num_menu_vobs;
191 u_int vob_start;
193 u_char *data[10];
195 int fd; // file descriptor
196 __off64_t pos; // offset of ifo file on device
197 } ifo_t;
201 * Generic header
204 #define IFO_HDR_LEN 8
205 #define IFOQ_HDR_LEN 2
207 typedef struct {
208 u_short num : 16; // number of entries
209 u_short : 16; // don't known (reserved?)
210 u_int len : 32; // length of table
211 } ifo_hdr_t;
213 typedef struct {
214 u_short : 16; // don't known (reserved?)
215 u_short num : 16; // number of entries
216 u_int len : 32; // length of table
217 } ifoq_hdr_t;
221 * Prototypes
224 ifo_t *ifoOpen (int fd, __off64_t pos);
225 int ifoClose (ifo_t *ifo);
227 u_int ifoGetVOBStart (ifo_t *ifo);
228 int ifoGetNumberOfTitles (ifo_t *ifo);
229 int ifoGetNumberOfParts (ifo_t *ifo);
231 int ifoGetVMGPTT (ifo_hdr_t *hdr, char **ptr);
232 int ifoGetPGCI (ifo_hdr_t *hdr, int title, char **ptr);
233 int ifoGetCLUT (char *pgc, char **ptr);
234 u_int ifoGetCellPlayInfo (u_char *pgc, u_char **ptr);
235 u_int ifoGetCellPos (u_char *pgc, u_char **ptr);
236 int ifoGetProgramMap (char *pgc, char **ptr);
237 int ifoGetCellAddr (char *cell_addr, char **ptr);
238 int ifoGetCellAddrNum (char *hdr);
240 int ifoGetAudio (char *hdr, char **ptr);
241 int ifoGetSPU (char *hdr, char **ptr);
243 ifo_ptt_t *ifo_get_ptt (ifo_t *ifo);
244 int ifo_get_num_title_pgci (ifo_t *ifo);
245 u_char *ifo_get_ptr_title_pgci (ifo_t *ifo, int index);
247 char *ifoDecodeLang (u_short descr);
249 int ifoIsVTS (ifo_t *ifo);
250 int ifoIsVMG (ifo_t *ifo);
252 void ifoPrintVideo (u_char *ptr);
254 void ifoPrintCellPlayInfo (u_char *ptr, u_int num);
255 void ifoPrintCellInfo (u_char *ptr, u_int num);
256 void ifoPrintCellPos (u_char *ptr, u_int num);
257 void ifoPrintCLUT (u_char *ptr);
258 void ifoPrintProgramMap (u_char *ptr, u_int num);
260 #ifdef PARSER
261 void ifoPrintAudio (ifo_audio_t *ptr, u_int num);
262 void ifoPrintSPU (ifo_spu_t *ptr, u_int num);
263 void ifoPrintTMT (ifo_t *ifo);
265 void ifoPrintVMOP (u_char *opcode);
267 void ifoPrint_ptt (ifo_ptt_t *ptt);
268 void ifoPrint_vts_vobu_addr_map (ifo_t *ifo);
269 void ifoPrint_vtsm_vobu_addr_map (ifo_t *ifo);
270 void ifoPrint_vts_cell_addr (ifo_t *ifo);
271 void ifoPrint_vtsm_cell_addr (ifo_t *ifo);
272 void ifoPrint_title_pgci (ifo_t *ifo);
273 void ifoPrint_pgc_cmd (u_char *pgc_ptr);
274 void ifoPrintTSP (u_char *toast);
275 void ifoPrint_pgc (u_char *ptr);
276 #endif
277 #endif