6 VTS_PTT_SRPT data[id_PTT]
9 idx - use_ptt_info(title)
10 0 ptt_pgcn(chapter) Program Chain number
11 ptt_pgn(chapter) Program number
12 .. nr_of_chapters(title)
16 VTS_PGCI data[id_TITLE_PGCI]
24 idx - use_program_chain(pgc)
39 cell_playback_offset()
40 cell_position_offset()
42 pgc_program_map()[program_no..nr_of_programs()]
44 idx - use_playback(pcell_no)
49 cell_stc_discontinuity()
57 cell_first_ilvu_end_sector()
58 cell_last_vobu_start_sector()
62 idx - use_position(pcell_no)
75 uint32_t vid_mpeg_version(uint8_t *p) { return (p[0]>>6) & 0x03; }
76 uint32_t vid_video_format(uint8_t *p) { return (p[0]>>4) & 0x03; }
77 uint32_t vid_display_aspect_ratio(uint8_t *p) { return (p[0]>>2) & 0x03; }
78 uint32_t vid_permitted_df(uint8_t *p) { return (p[0]>>0) & 0x03; }
79 uint32_t vid_line21_cc_1(uint8_t *p) { return (p[1]>>7) & 0x01; }
80 uint32_t vid_line21_cc_2(uint8_t *p) { return (p[1]>>6) & 0x01; }
81 uint32_t vid_bit_rate(uint8_t *p) { return (p[1]>>4) & 0x01; }
82 uint32_t vid_picture_size(uint8_t *p) { return (p[1]>>2) & 0x03; }
83 uint32_t vid_letterboxed(uint8_t *p) { return (p[1]>>1) & 0x01; }
84 uint32_t vid_film_mode(uint8_t *p) { return (p[1]>>0) & 0x01; }
87 uint32_t aud_audio_format(uint8_t *p) { return (p[0]>>5) & 0x07; }
88 uint32_t aud_multichannel_extension(uint8_t *p) { return (p[0]>>4) & 0x01; }
89 uint32_t aud_lang_type(uint8_t *p) { return (p[0]>>2) & 0x03; }
90 uint32_t aud_application_mode(uint8_t *p) { return (p[0]>>0) & 0x03; }
91 uint32_t aud_quantization(uint8_t *p) { return (p[1]>>6) & 0x03; }
92 uint32_t aud_sample_frequency(uint8_t *p) { return (p[1]>>4) & 0x03; }
93 uint32_t aud_channels(uint8_t *p) { return (p[1]>>0) & 0x07; }
94 uint32_t aud_lang_code(uint8_t *p) { return get2bytes(p + 0x02); }
95 uint32_t aud_lang_extension(uint8_t *p) { return p[4]; }
96 uint32_t aud_code_extension(uint8_t *p) { return p[5]; }
97 uint32_t aud_kar_channel_assignment(uint8_t *p) { return (p[7]>>4) & 0x07; }
98 uint32_t aud_kar_version(uint8_t *p) { return (p[7]>>2) & 0x03; }
99 uint32_t aud_kar_mc_intro(uint8_t *p) { return (p[7]>>1) & 0x01; }
100 uint32_t aud_kar_mode(uint8_t *p) { return (p[7]>>7) & 0x01; }
101 uint32_t aud_sur_dolby_encoded(uint8_t *p) { return (p[7]>>4) & 0x01; }
103 /* subtitle attribute */
104 uint32_t sub_code_mode(uint8_t *p) { return (p[0]>>5) & 0x07; }
105 uint32_t sub_type(uint8_t *p) { return (p[0]>>0) & 0x03; }
106 uint32_t sub_lang_code(uint8_t *p) { return get2bytes(p + 0x02); }
107 uint32_t sub_lang_extension(uint8_t *p) { return p[4]; }
108 uint32_t sub_code_extension(uint8_t *p) { return p[5]; }
110 /* multichannel attribute */
111 uint32_t mch_ach0_gme(uint8_t *p) { return (p[0]>>0) & 0x01; }
112 uint32_t mch_ach1_gme(uint8_t *p) { return (p[1]>>0) & 0x01; }
113 uint32_t mch_ach2_gv1e(uint8_t *p) { return (p[2]>>3) & 0x01; }
114 uint32_t mch_ach2_gv2e(uint8_t *p) { return (p[2]>>2) & 0x01; }
115 uint32_t mch_ach2_gm1e(uint8_t *p) { return (p[2]>>1) & 0x01; }
116 uint32_t mch_ach2_gm2e(uint8_t *p) { return (p[2]>>0) & 0x01; }
117 uint32_t mch_ach3_gv1e(uint8_t *p) { return (p[3]>>3) & 0x01; }
118 uint32_t mch_ach3_gv2e(uint8_t *p) { return (p[3]>>2) & 0x01; }
119 uint32_t mch_ach3_gmAe(uint8_t *p) { return (p[3]>>1) & 0x01; }
120 uint32_t mch_ach3_se2e(uint8_t *p) { return (p[3]>>0) & 0x01; }
121 uint32_t mch_ach4_gv1e(uint8_t *p) { return (p[4]>>3) & 0x01; }
122 uint32_t mch_ach4_gv2e(uint8_t *p) { return (p[4]>>2) & 0x01; }
123 uint32_t mch_ach4_gmBe(uint8_t *p) { return (p[4]>>1) & 0x01; }
124 uint32_t mch_ach4_seBe(uint8_t *p) { return (p[4]>>0) & 0x01; }
127 uint8_t *vmg_identifier() { return data[id_MAT] + 0x0000; }
128 uint32_t vmg_last_sector() { return get4bytes(data[id_MAT] + 0x000c); }
129 uint32_t vmgi_last_sector() { return get4bytes(data[id_MAT] + 0x001c); }
130 uint32_t vgm_specification_version() { return *(data[id_MAT] + 0x0021); }
131 uint32_t vmg_category() { return get4bytes(data[id_MAT] + 0x0022); }
132 uint32_t vmg_nr_of_volumes() { return get2bytes(data[id_MAT] + 0x0026); }
133 uint32_t vmg_this_volume_nr() { return get2bytes(data[id_MAT] + 0x0028); }
134 uint32_t disc_side() { return *(data[id_MAT] + 0x002a); }
135 uint32_t vmg_nr_of_title_sets() { return get2bytes(data[id_MAT] + 0x003e); }
136 uint8_t *provider_identifier() { return data[id_MAT] + 0x0040; }
137 uint64_t vmg_pos_code() { return get8bytes(data[id_MAT] + 0x0060); }
138 uint32_t vmgi_last_byte() { return get4bytes(data[id_MAT] + 0x0080); }
139 uint32_t first_play_pgc() { return get4bytes(data[id_MAT] + 0x0084); }
140 uint32_t vmgm_vobs() { return get4bytes(data[id_MAT] + 0x00c0); }
141 uint32_t tt_srpt() { return get4bytes(data[id_MAT] + 0x00c4); }
142 uint32_t vmgm_pgci_ut() { return get4bytes(data[id_MAT] + 0x00c8); }
143 uint32_t ptl_mait() { return get4bytes(data[id_MAT] + 0x00cc); }
144 uint32_t vts_atrt() { return get4bytes(data[id_MAT] + 0x00d0); }
145 uint32_t txtdt_mgi() { return get4bytes(data[id_MAT] + 0x00d4); }
146 uint32_t vmgm_c_adt() { return get4bytes(data[id_MAT] + 0x00d8); }
147 uint32_t vmgm_vobu_admap() { return get4bytes(data[id_MAT] + 0x00dc); }
148 uint8_t *vmgm_video_attr() { return data[id_MAT] + 0x0100; }
149 uint32_t nr_of_vmgm_audio_streams() { return *(data[id_MAT] + 0x0103); }
150 uint8_t *vmgm_audio_attr() { return data[id_MAT] + 0x0104; }
151 uint32_t nr_of_vmgm_subp_streams() { return *(data[id_MAT] + 0x0155); }
152 uint8_t *vmgm_subp_attr() { return data[id_MAT] + 0x0156; }
155 uint8_t *vts_identifier() { return data[id_MAT] + 0x0000; }
156 uint32_t vts_last_sector() { return get4bytes(data[id_MAT] + 0x000c); }
157 uint32_t vtsi_last_sector() { return get4bytes(data[id_MAT] + 0x001c); }
158 uint32_t vts_specification_version() { return *(data[id_MAT] + 0x0021); }
159 uint32_t vts_category() { return get4bytes(data[id_MAT] + 0x0022); }
160 uint32_t vtsi_last_byte() { return get4bytes(data[id_MAT] + 0x0080); }
161 /* sector addresses follow */
162 uint32_t vtsm_vobs() { return get4bytes(data[id_MAT] + 0x00c0); }
163 uint32_t vtstt_vobs() { return get4bytes(data[id_MAT] + 0x00c4); }
164 uint32_t vts_ptt_srpt() { return get4bytes(data[id_MAT] + 0x00c8); }
165 uint32_t vts_pgcit() { return get4bytes(data[id_MAT] + 0x00cc); }
166 uint32_t vtsm_pgci_ut() { return get4bytes(data[id_MAT] + 0x00d0); }
167 uint32_t vts_tmapt() { return get4bytes(data[id_MAT] + 0x00d4); }
168 uint32_t vtsm_c_adt() { return get4bytes(data[id_MAT] + 0x00d8); }
169 uint32_t vtsm_vobu_admap() { return get4bytes(data[id_MAT] + 0x00dc); }
170 /* end of sector addresses */
171 uint32_t vts_c_adt() { return get4bytes(data[id_MAT] + 0x00e0); }
172 uint32_t vts_vobu_admap() { return get4bytes(data[id_MAT] + 0x00e4); }
173 uint8_t *vtsm_video_attr() { return data[id_MAT] + 0x0100; }
174 uint32_t nr_of_vtsm_audio_streams() { return *(data[id_MAT] + 0x0103); }
175 uint8_t *vtsm_audio_attr() { return data[id_MAT] + 0x0104; }
176 uint32_t nr_of_vtsm_subp_streams() { return *(data[id_MAT] + 0x0155); }
177 uint8_t *vtsm_subp_attr() { return data[id_MAT] + 0x0156; }
178 uint32_t vts_video_attr() { return get2bytes(data[id_MAT] + 0x0200); }
179 uint32_t nr_of_vts_audio_streams() { return *(data[id_MAT] + 0x0203); }
180 uint8_t *vts_audio_attr(int i) { return data[id_MAT] + 0x0204 + 8*i; }
181 uint32_t nr_of_vts_subp_streams() { return *(data[id_MAT] + 0x0255); }
182 uint8_t *vts_subp_attr(int i) { return data[id_MAT] + 0x0256 + 6*i; }
183 uint8_t *vts_mu_audio_attr(int i) { return data[id_MAT] + 0x0316 + 24*i; }
186 uint32_t hdr_entries(uint8_t *p) { return get2bytes(p + 0x00); }
187 uint32_t hdr_length(uint8_t *p) { return get4bytes(p + 0x04)+1; }
190 uint32_t nr_of_pgci_srp() { return get2bytes(data[id_TITLE_PGCI] + 0x00); }
191 uint32_t pgci_length() { return get4bytes(data[id_TITLE_PGCI] + 0x04)+1; }
193 /* pgci search ptr */
194 uint32_t entry_id(int pgc) {
195 return *(data[id_TITLE_PGCI] + 8 + 8*pgc + 0x00);
197 uint32_t block_mode(int pgc) {
198 return (*(data[id_TITLE_PGCI] + 8 + 8*pgc + 0x01)>>6) & 0x03;
200 uint32_t block_type(int pgc) {
201 return (*(data[id_TITLE_PGCI] + 8 + 8*pgc + 0x01)>>4) & 0x03;
203 uint32_t ptl_id_mask(int pgc) {
204 return get2bytes(data[id_TITLE_PGCI] + 8 + 8*pgc + 0x02);
206 uint32_t pgc_start_offset(int pgc) {
207 return get4bytes(data[id_TITLE_PGCI] + 8 + 8*pgc + 0x04);
210 /* pgci unit table */
211 void use_program_chain(int pgc) {
212 zpgci = data[id_TITLE_PGCI] + pgc_start_offset(pgc);
214 uint32_t nr_of_programs() { return *(zpgci + 0x0002); }
215 uint32_t nr_of_cells() { return *(zpgci + 0x0003); }
216 uint8_t *playback_time() { return zpgci + 0x0004; }
217 uint8_t *prohibited_ops() { return zpgci + 0x0008; }
218 uint32_t audio_control(int i) { return get2bytes(zpgci + 0x000c + 2*i); }
219 uint32_t subp_control(int i) { return get4bytes(zpgci + 0x001c + 4*i); }
220 uint32_t next_pgc_nr() { return get2bytes(zpgci + 0x009c); }
221 uint32_t prev_pgc_nr() { return get2bytes(zpgci + 0x009e); }
222 uint32_t goup_pgc_nr() { return get2bytes(zpgci + 0x00a0); }
223 uint32_t still_time() { return *(zpgci + 0x00a2); }
224 uint32_t pg_playback_mode() { return *(zpgci + 0x00a3); }
225 uint8_t *palette() { return zpgci + 0x00a4; }
226 uint32_t command_tbl_offset() { return get2bytes(zpgci + 0x00e4); }
227 uint32_t program_map_offset() { return get2bytes(zpgci + 0x00e6); }
228 uint32_t cell_playback_offset() { return get2bytes(zpgci + 0x00e8); }
229 uint32_t cell_position_offset() { return get2bytes(zpgci + 0x00ea); }
230 uint8_t *pgc_command_tbl() { return zpgci + command_tbl_offset(); }
231 uint8_t *pgc_program_map() { return zpgci + program_map_offset(); }
232 uint8_t *pgc_cell_playback() { return zpgci + cell_playback_offset(); }
233 uint8_t *pgc_cell_position() { return zpgci + cell_position_offset(); }
236 /* 0: one sequential pgc title */
237 uint32_t multi_or_random_pgc_title(uint8_t v) { return ((v>>6) & 1); }
238 uint32_t jlc_exists_in_cell_cmd(uint8_t v) { return ((v>>5) & 1); }
239 uint32_t jlc_exists_in_prepost_cmd(uint8_t v) { return ((v>>4) & 1); }
240 uint32_t jlc_exists_in_button_cmd(uint8_t v) { return ((v>>3) & 1); }
241 uint32_t jlc_exists_in_tt_dom(uint8_t v) { return ((v>>2) & 1); }
243 uint32_t chapter_search_or_play(uint8_t v) { return ((v>>1) & 1); }
245 uint32_t title_or_time_play(uint8_t v) { return ((v>>0) & 1); }
247 /* search pointer table header */
248 uint32_t nr_of_titles() { return get2bytes(data[id_PTT] + 0x00); }
249 uint32_t srpt_last_byte() { return get4bytes(data[id_PTT] + 0x04); }
251 /* PTT information header */
252 uint32_t ptt_info_offset(int i) { return get4bytes(data[id_PTT] + 8 + 4*i); }
253 /* PTT information */
254 uint32_t nr_of_chapters(int title) {
255 uint32_t n = title+1 >= (int)nr_of_titles() ?
256 srpt_last_byte()+1 : ptt_info_offset(title+1);
257 return (n-ptt_info_offset(title)) / 4;
259 void use_ptt_info(int title) {
260 pinfo = data[id_PTT] + ptt_info_offset(title);
262 uint8_t *ptt_info(int i) { return pinfo + 4*i; }
263 uint32_t ptt_pgcn(int chapter) { return get2bytes(ptt_info(chapter) + 0x00); }
264 uint32_t ptt_pgn(int chapter) { return get2bytes(ptt_info(chapter) + 0x02); }
266 /* title information */
267 uint32_t tsp_nr_of_srpts() { return get2bytes(data[id_TSP] + 0x00); }
268 uint32_t tsp_last_byte() { return get4bytes(data[id_TSP] + 0x04); }
269 void use_title_info(int i) {
270 tinfo = data[id_TSP] + 8 * 12*i;
272 uint32_t ti_pb_ty() { return *(tinfo + 0x00); }
273 uint32_t ti_nr_of_angles() { return *(tinfo + 0x01); }
274 uint32_t ti_nr_of_ptts() { return get2bytes(tinfo + 0x02); }
275 uint32_t ti_parental_id() { return get2bytes(tinfo + 0x04); }
276 uint32_t ti_title_set_nr() { return *(tinfo + 0x06); }
277 uint32_t ti_vts_ttn() { return *(tinfo + 0x07); }
278 uint32_t ti_title_set_sector() { return get4bytes(tinfo + 0x08); }
281 uint32_t usr_video_pres_mode_change(uint8_t *p) { return (p[0]>>0) & 0x01; }
282 uint32_t usr_karaoke_audio_pres_mode_change(uint8_t *p) { return (p[1]>>7) & 0x01; }
283 uint32_t usr_angle_change(uint8_t *p) { return (p[1]>>6) & 0x01; }
284 uint32_t usr_subpic_stream_change(uint8_t *p) { return (p[1]>>5) & 0x01; }
285 uint32_t usr_audio_stream_change(uint8_t *p) { return (p[1]>>4) & 0x01; }
286 uint32_t usr_pause_on(uint8_t *p) { return (p[1]>>3) & 0x01; }
287 uint32_t usr_still_off(uint8_t *p) { return (p[1]>>2) & 0x01; }
288 uint32_t usr_button_select_or_activate(uint8_t *p) { return (p[1]>>1) & 0x01; }
289 uint32_t usr_resume(uint8_t *p) { return (p[1]>>0) & 0x01; }
290 uint32_t usr_chapter_menu_call(uint8_t *p) { return (p[2]>>7) & 0x01; }
291 uint32_t usr_angle_menu_call(uint8_t *p) { return (p[2]>>6) & 0x01; }
292 uint32_t usr_audio_menu_call(uint8_t *p) { return (p[2]>>5) & 0x01; }
293 uint32_t usr_subpic_menu_call(uint8_t *p) { return (p[2]>>4) & 0x01; }
294 uint32_t usr_root_menu_call(uint8_t *p) { return (p[2]>>3) & 0x01; }
295 uint32_t usr_title_menu_call(uint8_t *p) { return (p[2]>>2) & 0x01; }
296 uint32_t usr_backward_scan(uint8_t *p) { return (p[2]>>1) & 0x01; }
297 uint32_t usr_forward_scan(uint8_t *p) { return (p[2]>>0) & 0x01; }
298 uint32_t usr_next_pg_search(uint8_t *p) { return (p[3]>>7) & 0x01; }
299 uint32_t usr_prev_or_top_pg_search(uint8_t *p) { return (p[3]>>6) & 0x01; }
300 uint32_t usr_time_or_chapter_search(uint8_t *p) { return (p[3]>>5) & 0x01; }
301 uint32_t usr_go_up(uint8_t *p) { return (p[3]>>4) & 0x01; }
302 uint32_t usr_stop(uint8_t *p) { return (p[3]>>3) & 0x01; }
303 uint32_t usr_title_play(uint8_t *p) { return (p[3]>>2) & 0x01; }
304 uint32_t usr_chapter_search_or_play(uint8_t *p) { return (p[3]>>1) & 0x01; }
305 uint32_t usr_title_or_time_play(uint8_t *p) { return (p[3]>>0) & 0x01; }
308 void use_playback(int i) {
309 zcell = pgc_cell_playback() + 24*i;
311 enum { BTY_NONE = 0x0, BTY_ANGLE = 0x1,
312 BMD_NOT_IN_BLOCK = 0x0, BMD_FIRST_CELL = 0x1,
313 BMD_IN_BLOCK = 0x2, BMD_LAST_CELL = 0x3, };
314 uint32_t cell_block_mode() { return (zcell[0]>>6) & 0x03; }
315 uint32_t cell_block_type() { return (zcell[0]>>4) & 0x03; }
316 uint32_t cell_seamless_play() { return (zcell[0]>>3) & 0x01; }
317 uint32_t cell_interleaved() { return (zcell[0]>>2) & 0x01; }
318 uint32_t cell_stc_discontinuity() { return (zcell[0]>>1) & 0x01; }
319 uint32_t cell_seamless_angle() { return (zcell[0]>>0) & 0x01; }
320 uint32_t cell_playback_mode() { return (zcell[1]>>7) & 0x01; }
321 uint32_t cell_restricted() { return (zcell[1]>>6) & 0x01; }
322 uint32_t cell_still_time() { return zcell[2]; }
323 uint32_t cell_cmd_nr() { return zcell[3]; }
324 uint8_t *cell_playback_time() { return zcell + 0x04; }
325 uint32_t cell_first_sector() { return get4bytes(zcell + 0x08); }
326 uint32_t cell_first_ilvu_end_sector() { return get4bytes(zcell + 0x0c); }
327 uint32_t cell_last_vobu_start_sector() { return get4bytes(zcell + 0x10); }
328 uint32_t cell_last_sector() { return get4bytes(zcell + 0x14); }
331 void use_position(int i) {
332 zcell = pgc_cell_position() + 4*i;
334 uint32_t vob_id_nr() { return get2bytes(zcell + 0x0000); }
335 uint32_t cell_id_nr() { return *(zcell + 0x0003); }
338 uint32_t cadr_nr_of_vobs() {
339 return get2bytes(data[id_TITLE_CELL_ADDR] + 0x0000);
341 uint32_t cadr_last_byte() {
342 return get4bytes(data[id_TITLE_CELL_ADDR] + 0x0004);
344 void use_cell(int i) {
345 zcell = data[id_TITLE_CELL_ADDR] + 0x0008 + 12*i;
347 uint32_t cadr_vob_id() { return get2bytes(zcell + 0x00); }
348 uint32_t cadr_cell_id() { return *(zcell + 0x02); }
349 uint32_t cadr_start_sector() { return get4bytes(zcell + 0x04); }
350 uint32_t cadr_last_sector() { return get4bytes(zcell + 0x08); }
351 uint32_t cadr_length() { return (cadr_last_byte()+1 - 8) / 12; }