Mercurial > libdvdnav.hg
annotate vm.c @ 114:b6834e6359cf src
big libdvdnav cleanup, quoting the ChangeLog:
* some bugfixes
* code cleanup
* build process polishing
* more sensible event order in get_next_block to ensure useful event delivery
* VOBU level resume
* fixed: seeking in a multiangle feature briefly showed the wrong angle
author | mroi |
---|---|
date | Thu, 20 Feb 2003 15:32:21 +0000 |
parents | ec2df154be56 |
children | 66ca475e2a5a |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright (C) 2000, 2001 Håkan Hjort | |
3 * Copyright (C) 2001 Rich Wareham <richwareham@users.sourceforge.net> | |
4 * | |
5 * This file is part of libdvdnav, a DVD navigation library. It is modified | |
6 * from a file originally part of the Ogle DVD player. | |
7 * | |
8 * libdvdnav is free software; you can redistribute it and/or modify | |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * libdvdnav is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | |
21 * | |
22 * $Id$ | |
23 * | |
24 */ | |
25 | |
26 #ifdef HAVE_CONFIG_H | |
27 #include "config.h" | |
28 #endif | |
29 | |
30 #include <stdio.h> | |
31 #include <string.h> | |
32 #include <stdlib.h> | |
33 #include <unistd.h> | |
34 #include <inttypes.h> | |
35 #include <assert.h> | |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
36 #include <sys/types.h> |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
37 #include <sys/stat.h> |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
38 #include <fcntl.h> |
0 | 39 |
40 #include <dvdread/ifo_types.h> | |
41 #include <dvdread/ifo_read.h> | |
42 | |
43 #include "decoder.h" | |
44 #include "vmcmd.h" | |
45 #include "vm.h" | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
19
diff
changeset
|
46 #include "dvdnav_internal.h" |
0 | 47 |
114 | 48 /* |
75 | 49 #define STRICT |
114 | 50 */ |
75 | 51 |
0 | 52 /* Local prototypes */ |
53 | |
114 | 54 /* get_XYZ returns a value. |
55 * set_XYZ sets state using passed parameters. | |
56 * returns success/failure. | |
57 */ | |
58 | |
59 /* Play */ | |
6 | 60 static link_t play_PGC(vm_t *vm); |
38 | 61 static link_t play_PGC_PG(vm_t *vm, int pgN); |
10
6f0fb88d1463
Added some debug info, to hopefully help in tracking bugs in libdvdnav.
jcdutton
parents:
9
diff
changeset
|
62 static link_t play_PGC_post(vm_t *vm); |
6 | 63 static link_t play_PG(vm_t *vm); |
64 static link_t play_Cell(vm_t *vm); | |
65 static link_t play_Cell_post(vm_t *vm); | |
114 | 66 |
67 /* Process link - returns 1 if a hop has been performed */ | |
68 static int process_command(vm_t *vm,link_t link_values); | |
0 | 69 |
114 | 70 /* Set */ |
71 static int set_TT(vm_t *vm, int tt); | |
72 static int set_VTS_TT(vm_t *vm, int vtsN, int vts_ttn); | |
73 static int set_VTS_PTT(vm_t *vm, int vtsN, int vts_ttn, int part); | |
74 static int set_FP_PGC(vm_t *vm); | |
75 static int set_MENU(vm_t *vm, int menu); | |
76 static int set_PGCN(vm_t *vm, int pgcN); | |
77 static int set_PGN(vm_t *vm); /* Set PGN based on (vm->state).CellN */ | |
78 static void set_RSMinfo(vm_t *vm, int cellN, int blockN); | |
79 | |
80 /* Get */ | |
81 static int get_TT(vm_t *vm, int vtsN, int vts_ttn); | |
82 static int get_ID(vm_t *vm, int id); | |
83 static int get_PGCN(vm_t *vm); | |
84 | |
85 static pgcit_t* get_MENU_PGCIT(vm_t *vm, ifo_handle_t *h, uint16_t lang); | |
6 | 86 static pgcit_t* get_PGCIT(vm_t *vm); |
0 | 87 |
88 | |
114 | 89 /* Helper functions */ |
0 | 90 |
114 | 91 #ifdef TRACE |
6 | 92 static void vm_print_current_domain_state(vm_t *vm) { |
93 switch((vm->state).domain) { | |
0 | 94 case VTS_DOMAIN: |
76 | 95 fprintf(MSG_OUT, "libdvdnav: Video Title Domain: -\n"); |
0 | 96 break; |
97 | |
98 case VTSM_DOMAIN: | |
76 | 99 fprintf(MSG_OUT, "libdvdnav: Video Title Menu Domain: -\n"); |
0 | 100 break; |
101 | |
102 case VMGM_DOMAIN: | |
76 | 103 fprintf(MSG_OUT, "libdvdnav: Video Manager Menu Domain: -\n"); |
0 | 104 break; |
105 | |
106 case FP_DOMAIN: | |
76 | 107 fprintf(MSG_OUT, "libdvdnav: First Play Domain: -\n"); |
0 | 108 break; |
109 | |
110 default: | |
76 | 111 fprintf(MSG_OUT, "libdvdnav: Unknown Domain: -\n"); |
0 | 112 break; |
113 } | |
85
aa14e5673881
Add a bit more debug info. Now print PGCN in debug.
jcdutton
parents:
83
diff
changeset
|
114 fprintf(MSG_OUT, "libdvdnav: VTS:%d PGC:%d PG:%u CELL:%u BLOCK:%u VTS_TTN:%u TTN:%u TT_PGCN:%u\n", |
6 | 115 (vm->state).vtsN, |
85
aa14e5673881
Add a bit more debug info. Now print PGCN in debug.
jcdutton
parents:
83
diff
changeset
|
116 get_PGCN(vm), |
6 | 117 (vm->state).pgN, |
118 (vm->state).cellN, | |
119 (vm->state).blockN, | |
120 (vm->state).VTS_TTN_REG, | |
121 (vm->state).TTN_REG, | |
122 (vm->state).TT_PGCN_REG); | |
0 | 123 } |
114 | 124 #endif |
0 | 125 |
114 | 126 void dvd_read_name( vm_t *this, const char *devname) { |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
127 int fd, i; |
114 | 128 #ifndef __FreeBSD__ |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
129 off64_t off; |
114 | 130 #else |
131 off_t off; | |
132 #endif | |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
133 uint8_t data[DVD_VIDEO_LB_LEN]; |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
134 |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
135 /* Read DVD name */ |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
136 fd=open(devname, O_RDONLY); |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
137 if (fd > 0) { |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
138 off = lseek64( fd, 32 * (int64_t) DVD_VIDEO_LB_LEN, SEEK_SET ); |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
139 if( off == ( 32 * (int64_t) DVD_VIDEO_LB_LEN ) ) { |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
140 off = read( fd, data, DVD_VIDEO_LB_LEN ); |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
141 close(fd); |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
142 if (off == ( (int64_t) DVD_VIDEO_LB_LEN )) { |
114 | 143 fprintf(MSG_OUT, "libdvdnav: DVD Title: "); |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
144 for(i=25; i < 73; i++ ) { |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
145 if((data[i] == 0)) break; |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
146 if((data[i] > 32) && (data[i] < 127)) { |
114 | 147 fprintf(MSG_OUT, "%c", data[i]); |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
148 } else { |
114 | 149 fprintf(MSG_OUT, " "); |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
150 } |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
151 } |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
152 strncpy(&this->dvd_name[0], &data[25], 48); |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
153 this->dvd_name[48]=0; |
114 | 154 fprintf(MSG_OUT, "\nlibdvdnav: DVD Serial Number: "); |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
155 for(i=73; i < 89; i++ ) { |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
156 if((data[i] == 0)) break; |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
157 if((data[i] > 32) && (data[i] < 127)) { |
114 | 158 fprintf(MSG_OUT, "%c", data[i]); |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
159 } else { |
114 | 160 fprintf(MSG_OUT, " "); |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
161 } |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
162 } |
114 | 163 fprintf(MSG_OUT, "\nlibdvdnav: DVD Title (Alternative): "); |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
164 for(i=89; i < 128; i++ ) { |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
165 if((data[i] == 0)) break; |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
166 if((data[i] > 32) && (data[i] < 127)) { |
114 | 167 fprintf(MSG_OUT, "%c", data[i]); |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
168 } else { |
114 | 169 fprintf(MSG_OUT, " "); |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
170 } |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
171 } |
114 | 172 fprintf(MSG_OUT, "\n"); |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
173 } else { |
114 | 174 fprintf(MSG_OUT, "libdvdnav: Can't read name block. Probably not a DVD-ROM device.\n"); |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
175 } |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
176 } else { |
114 | 177 fprintf(MSG_OUT, "libdvdnav: Can't seek to block %u\n", 32 ); |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
178 } |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
179 close(fd); |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
180 } else { |
114 | 181 fprintf(MSG_OUT, "NAME OPEN FAILED\n"); |
0 | 182 } |
183 } | |
184 | |
114 | 185 static void ifoOpenNewVTSI(vm_t *vm, dvd_reader_t *dvd, int vtsN) { |
6 | 186 if((vm->state).vtsN == vtsN) { |
0 | 187 return; /* We alread have it */ |
188 } | |
189 | |
6 | 190 if(vm->vtsi != NULL) |
191 ifoClose(vm->vtsi); | |
0 | 192 |
6 | 193 vm->vtsi = ifoOpenVTSI(dvd, vtsN); |
194 if(vm->vtsi == NULL) { | |
76 | 195 fprintf(MSG_OUT, "libdvdnav: ifoOpenVTSI failed - CRASHING!!!\n"); |
6 | 196 assert(0); |
0 | 197 } |
6 | 198 if(!ifoRead_VTS_PTT_SRPT(vm->vtsi)) { |
76 | 199 fprintf(MSG_OUT, "libdvdnav: ifoRead_VTS_PTT_SRPT failed - CRASHING!!!\n"); |
6 | 200 assert(0); |
0 | 201 } |
6 | 202 if(!ifoRead_PGCIT(vm->vtsi)) { |
76 | 203 fprintf(MSG_OUT, "libdvdnav: ifoRead_PGCIT failed - CRASHING!!!\n"); |
6 | 204 assert(0); |
0 | 205 } |
6 | 206 if(!ifoRead_PGCI_UT(vm->vtsi)) { |
76 | 207 fprintf(MSG_OUT, "libdvdnav: ifoRead_PGCI_UT failed - CRASHING!!!\n"); |
6 | 208 assert(0); |
0 | 209 } |
6 | 210 if(!ifoRead_VOBU_ADMAP(vm->vtsi)) { |
76 | 211 fprintf(MSG_OUT, "libdvdnav: ifoRead_VOBU_ADMAP vtsi failed - CRASHING\n"); |
6 | 212 assert(0); |
0 | 213 } |
6 | 214 if(!ifoRead_TITLE_VOBU_ADMAP(vm->vtsi)) { |
76 | 215 fprintf(MSG_OUT, "libdvdnav: ifoRead_TITLE_VOBU_ADMAP vtsi failed - CRASHING\n"); |
6 | 216 assert(0); |
0 | 217 } |
6 | 218 (vm->state).vtsN = vtsN; |
0 | 219 } |
220 | |
114 | 221 |
222 /* Initialisation & Destruction */ | |
223 | |
224 vm_t* vm_new_vm() { | |
225 return (vm_t*)calloc(sizeof(vm_t), sizeof(char)); | |
226 } | |
227 | |
228 void vm_free_vm(vm_t *vm) { | |
229 vm_stop(vm); | |
230 free(vm); | |
231 } | |
232 | |
233 | |
234 /* IFO Access */ | |
235 | |
236 ifo_handle_t *vm_get_vmgi(vm_t *vm) { | |
237 return vm->vmgi; | |
238 } | |
239 | |
240 ifo_handle_t *vm_get_vtsi(vm_t *vm) { | |
241 return vm->vtsi; | |
242 } | |
243 | |
244 | |
245 /* Reader Access */ | |
246 | |
247 dvd_reader_t *vm_get_dvd_reader(vm_t *vm) { | |
248 return vm->dvd; | |
249 } | |
250 | |
251 | |
252 /* Basic Handling */ | |
253 | |
254 void vm_start(vm_t *vm) | |
0 | 255 { |
114 | 256 /* Set pgc to FP (First Play) pgc */ |
257 set_FP_PGC(vm); | |
258 process_command(vm, play_PGC(vm)); | |
259 } | |
260 | |
261 void vm_stop(vm_t *vm) { | |
262 if(vm->vmgi) { | |
263 ifoClose(vm->vmgi); | |
264 vm->vmgi=NULL; | |
265 } | |
266 if(vm->vtsi) { | |
267 ifoClose(vm->vtsi); | |
268 vm->vmgi=NULL; | |
269 } | |
270 if(vm->dvd) { | |
271 DVDClose(vm->dvd); | |
272 vm->dvd=NULL; | |
273 } | |
274 vm->stopped = 1; | |
275 } | |
276 | |
277 int vm_reset(vm_t *vm, const char *dvdroot) { | |
278 /* Setup State */ | |
279 memset((vm->state).registers.SPRM, 0, sizeof((vm->state).registers.SPRM)); | |
280 memset((vm->state).registers.GPRM, 0, sizeof((vm->state).registers.GPRM)); | |
281 memset((vm->state).registers.GPRM_mode, 0, sizeof((vm->state).registers.GPRM_mode)); | |
282 memset((vm->state).registers.GPRM_mode, 0, sizeof((vm->state).registers.GPRM_mode)); | |
283 memset((vm->state).registers.GPRM_time, 0, sizeof((vm->state).registers.GPRM_time)); | |
284 (vm->state).registers.SPRM[0] = ('e'<<8)|'n'; /* Player Menu Languange code */ | |
285 (vm->state).AST_REG = 15; /* 15 why? */ | |
286 (vm->state).SPST_REG = 62; /* 62 why? */ | |
287 (vm->state).AGL_REG = 1; | |
288 (vm->state).TTN_REG = 1; | |
289 (vm->state).VTS_TTN_REG = 1; | |
290 /* (vm->state).TT_PGCN_REG = 0 */ | |
291 (vm->state).PTTN_REG = 1; | |
292 (vm->state).HL_BTNN_REG = 1 << 10; | |
293 (vm->state).PTL_REG = 15; /* Parental Level */ | |
294 (vm->state).registers.SPRM[12] = ('U'<<8)|'S'; /* Parental Management Country Code */ | |
295 (vm->state).registers.SPRM[16] = ('e'<<8)|'n'; /* Initial Language Code for Audio */ | |
296 (vm->state).registers.SPRM[18] = ('e'<<8)|'n'; /* Initial Language Code for Spu */ | |
297 (vm->state).registers.SPRM[20] = 0x1; /* Player Regional Code Mask. Region free! */ | |
298 (vm->state).registers.SPRM[14] = 0x100; /* Try Pan&Scan */ | |
299 | |
300 (vm->state).pgN = 0; | |
301 (vm->state).cellN = 0; | |
302 (vm->state).cell_restart = 0; | |
303 | |
304 (vm->state).domain = FP_DOMAIN; | |
305 (vm->state).rsm_vtsN = 0; | |
306 (vm->state).rsm_cellN = 0; | |
307 (vm->state).rsm_blockN = 0; | |
308 | |
309 (vm->state).vtsN = -1; | |
310 | |
311 if (vm->dvd && dvdroot) { | |
312 /* a new dvd device has been requested */ | |
313 vm_stop(vm); | |
314 } | |
315 if (!vm->dvd) { | |
316 vm->dvd = DVDOpen(dvdroot); | |
317 if(!vm->dvd) { | |
318 fprintf(MSG_OUT, "libdvdnav: vm: faild to open/read the DVD\n"); | |
319 return 0; | |
320 } | |
321 dvd_read_name(vm, dvdroot); | |
322 vm->map = remap_loadmap(vm->dvd_name); | |
323 vm->vmgi = ifoOpenVMGI(vm->dvd); | |
324 if(!vm->vmgi) { | |
325 fprintf(MSG_OUT, "libdvdnav: vm: faild to read VIDEO_TS.IFO\n"); | |
326 return 0; | |
327 } | |
328 if(!ifoRead_FP_PGC(vm->vmgi)) { | |
329 fprintf(MSG_OUT, "libdvdnav: vm: ifoRead_FP_PGC failed\n"); | |
330 return 0; | |
331 } | |
332 if(!ifoRead_TT_SRPT(vm->vmgi)) { | |
333 fprintf(MSG_OUT, "libdvdnav: vm: ifoRead_TT_SRPT failed\n"); | |
334 return 0; | |
335 } | |
336 if(!ifoRead_PGCI_UT(vm->vmgi)) { | |
337 fprintf(MSG_OUT, "libdvdnav: vm: ifoRead_PGCI_UT failed\n"); | |
338 return 0; | |
339 } | |
340 if(!ifoRead_PTL_MAIT(vm->vmgi)) { | |
341 fprintf(MSG_OUT, "libdvdnav: vm: ifoRead_PTL_MAIT failed\n"); | |
342 /* return 0; Not really used for now.. */ | |
343 } | |
344 if(!ifoRead_VTS_ATRT(vm->vmgi)) { | |
345 fprintf(MSG_OUT, "libdvdnav: vm: ifoRead_VTS_ATRT failed\n"); | |
346 /* return 0; Not really used for now.. */ | |
347 } | |
348 if(!ifoRead_VOBU_ADMAP(vm->vmgi)) { | |
349 fprintf(MSG_OUT, "libdvdnav: vm: ifoRead_VOBU_ADMAP vgmi failed\n"); | |
350 /* return 0; Not really used for now.. */ | |
351 } | |
352 /* ifoRead_TXTDT_MGI(vmgi); Not implemented yet */ | |
353 } | |
354 if (vm->vmgi) { | |
355 int i, mask; | |
356 fprintf(MSG_OUT, "libdvdnav: DVD disk reports itself with Region mask 0x%08x. Regions:", | |
357 vm->vmgi->vmgi_mat->vmg_category); | |
358 for (i = 1, mask = 1; i <= 8; i++, mask <<= 1) | |
359 if (((vm->vmgi->vmgi_mat->vmg_category >> 16) & mask) == 0) | |
360 fprintf(MSG_OUT, " %d", i); | |
361 fprintf(MSG_OUT, "\n"); | |
362 } | |
363 return 1; | |
364 } | |
365 | |
366 | |
367 /* regular playback */ | |
368 | |
369 void vm_position_get(vm_t *vm, vm_position_t *position) { | |
370 position->button = (vm->state).HL_BTNN_REG >> 10; | |
371 position->vts = (vm->state).vtsN; | |
372 position->domain = (vm->state).domain; | |
373 position->spu_channel = (vm->state).SPST_REG; | |
374 position->audio_channel = (vm->state).AST_REG; | |
375 position->angle_channel = (vm->state).AGL_REG; | |
376 position->hop_channel = vm->hop_channel; /* Increases by one on each hop */ | |
377 position->cell = (vm->state).cellN; | |
378 position->cell_restart = (vm->state).cell_restart; | |
379 position->cell_start = (vm->state).pgc->cell_playback[(vm->state).cellN - 1].first_sector; | |
380 position->still = (vm->state).pgc->cell_playback[(vm->state).cellN - 1].still_time; | |
381 position->block = (vm->state).blockN; | |
382 | |
383 /* still already detrmined or not at PGC end */ | |
384 if (position->still || (vm->state).cellN < (vm->state).pgc->nr_of_cells) | |
385 return; | |
386 /* handle PGC stills */ | |
387 if ((vm->state).pgc->still_time) { | |
388 position->still = (vm->state).pgc->still_time; | |
389 return; | |
390 } | |
391 /* This is a rough fix for some strange still situations on some strange DVDs. | |
392 * There are discs (like the German "Back to the Future" RC2) where the only | |
393 * indication of a still is a cell playback time higher than the time the frames | |
394 * in this cell actually take to play (like 1 frame with 1 minute playback time). | |
395 * On the said BTTF disc, for these cells last_sector and last_vobu_start_sector | |
396 * are equal and the cells are very short, so we abuse these conditions to | |
397 * detect such discs. I consider these discs broken, so the fix is somewhat | |
398 * broken, too. */ | |
399 if (((vm->state).pgc->cell_playback[(vm->state).cellN - 1].last_sector == | |
400 (vm->state).pgc->cell_playback[(vm->state).cellN - 1].last_vobu_start_sector) && | |
401 ((vm->state).pgc->cell_playback[(vm->state).cellN - 1].last_sector - | |
402 (vm->state).pgc->cell_playback[(vm->state).cellN - 1].first_sector < 250)) { | |
403 int time; | |
404 time = ((vm->state).pgc->cell_playback[(vm->state).cellN - 1].playback_time.hour & 0xf0) * 36000; | |
405 time += ((vm->state).pgc->cell_playback[(vm->state).cellN - 1].playback_time.hour & 0x0f) * 3600; | |
406 time += ((vm->state).pgc->cell_playback[(vm->state).cellN - 1].playback_time.minute & 0xf0) * 600; | |
407 time += ((vm->state).pgc->cell_playback[(vm->state).cellN - 1].playback_time.minute & 0x0f) * 60; | |
408 time += ((vm->state).pgc->cell_playback[(vm->state).cellN - 1].playback_time.second & 0xf0) * 10; | |
409 time += ((vm->state).pgc->cell_playback[(vm->state).cellN - 1].playback_time.second & 0x0f) * 1; | |
410 if (time > 0xff) time = 0xff; | |
411 position->still = time; | |
412 } | |
413 } | |
414 | |
415 void vm_get_next_cell(vm_t *vm) { | |
416 process_command(vm, play_Cell_post(vm)); | |
417 } | |
418 | |
419 | |
420 /* Jumping */ | |
421 | |
422 int vm_jump_pg(vm_t *vm, int pg) { | |
423 (vm->state).pgN = pg; | |
424 process_command(vm, play_PG(vm)); | |
425 return 1; | |
426 } | |
427 | |
428 int vm_jump_title_part(vm_t *vm, int title, int part) { | |
429 int vtsN; | |
430 | |
431 vtsN = vm->vmgi->tt_srpt->title[title - 1].title_set_nr; | |
432 | |
433 if(!set_VTS_PTT(vm, vtsN, title, part)) | |
434 return 0; | |
435 process_command(vm, play_PGC_PG(vm, (vm->state).pgN)); | |
436 vm->hop_channel++; | |
437 return 1; | |
438 } | |
439 | |
440 int vm_jump_top_pg(vm_t *vm) { | |
441 process_command(vm, play_PG(vm)); | |
442 return 1; | |
443 } | |
444 | |
445 int vm_jump_next_pg(vm_t *vm) { | |
446 if((vm->state).pgN >= (vm->state).pgc->nr_of_programs) { | |
447 /* last program -> move to TailPGC */ | |
448 process_command(vm, play_PGC_post(vm)); | |
449 return 1; | |
450 } else { | |
451 vm_jump_pg(vm, (vm->state).pgN + 1); | |
452 return 1; | |
453 } | |
454 } | |
455 | |
456 int vm_jump_prev_pg(vm_t *vm) { | |
457 if ((vm->state).pgN <= 1) { | |
458 /* first program -> move to last program of previous PGC */ | |
459 if ((vm->state).pgc->prev_pgc_nr && set_PGCN(vm, (vm->state).pgc->prev_pgc_nr)) { | |
460 process_command(vm, play_PGC(vm)); | |
461 return 1; | |
462 } | |
463 return 0; | |
464 } else { | |
465 vm_jump_pg(vm, (vm->state).pgN - 1); | |
466 return 1; | |
467 } | |
468 } | |
469 | |
470 int vm_jump_up(vm_t *vm) { | |
471 if((vm->state).pgc->goup_pgc_nr && set_PGCN(vm, (vm->state).pgc->goup_pgc_nr)) { | |
472 process_command(vm, play_PGC(vm)); | |
473 return 1; | |
474 } | |
475 return 0; | |
476 } | |
477 | |
478 int vm_jump_menu(vm_t *vm, DVDMenuID_t menuid) { | |
479 domain_t old_domain = (vm->state).domain; | |
480 | |
481 switch ((vm->state).domain) { | |
482 case VTS_DOMAIN: | |
483 set_RSMinfo(vm, 0, (vm->state).blockN); | |
484 /* FALL THROUGH */ | |
485 case VTSM_DOMAIN: | |
486 case VMGM_DOMAIN: | |
487 switch(menuid) { | |
488 case DVD_MENU_Title: | |
489 (vm->state).domain = VMGM_DOMAIN; | |
490 break; | |
491 case DVD_MENU_Root: | |
492 case DVD_MENU_Subpicture: | |
493 case DVD_MENU_Audio: | |
494 case DVD_MENU_Angle: | |
495 case DVD_MENU_Part: | |
496 (vm->state).domain = VTSM_DOMAIN; | |
497 break; | |
498 } | |
499 if(get_PGCIT(vm) && set_MENU(vm, menuid)) { | |
500 process_command(vm, play_PGC(vm)); | |
501 return 1; /* Jump */ | |
502 } else { | |
503 (vm->state).domain = old_domain; | |
504 } | |
505 break; | |
506 case FP_DOMAIN: /* FIXME XXX $$$ What should we do here? */ | |
507 break; | |
508 } | |
509 | |
510 return 0; | |
511 } | |
512 | |
513 int vm_exec_cmd(vm_t *vm, vm_cmd_t *cmd) { | |
514 link_t link_values; | |
515 | |
516 if(vmEval_CMD(cmd, 1, &(vm->state).registers, &link_values)) | |
517 return process_command(vm, link_values); | |
518 else | |
519 return 0; /* It updated some state thats all... */ | |
520 } | |
521 | |
522 | |
523 /* getting information */ | |
524 | |
525 int vm_get_current_title_part(vm_t *vm, int *title_result, int *part_result) { | |
526 vts_ptt_srpt_t *vts_ptt_srpt; | |
527 int title, part = 0, vts_ttn; | |
528 int found; | |
529 int16_t pgcN, pgN; | |
530 | |
531 vts_ptt_srpt = vm->vtsi->vts_ptt_srpt; | |
532 pgcN = get_PGCN(vm); | |
533 pgN = vm->state.pgN; | |
534 | |
535 found = 0; | |
536 for (vts_ttn = 0; (vts_ttn < vts_ptt_srpt->nr_of_srpts) && !found; vts_ttn++) { | |
537 for (part = 0; (part < vts_ptt_srpt->title[vts_ttn].nr_of_ptts) && !found; part++) { | |
538 if ((vts_ptt_srpt->title[vts_ttn].ptt[part].pgcn == pgcN) && | |
539 (vts_ptt_srpt->title[vts_ttn].ptt[part].pgn == pgN )) { | |
540 found = 1; | |
541 break; | |
542 } | |
543 } | |
544 if (found) break; | |
545 } | |
546 vts_ttn++; | |
547 part++; | |
548 | |
549 title = get_TT(vm, vm->state.vtsN, vts_ttn); | |
550 | |
551 #ifdef TRACE | |
552 if (title) { | |
553 fprintf(MSG_OUT, "libdvdnav: ************ this chapter FOUND!\n"); | |
554 fprintf(MSG_OUT, "libdvdnav: VTS_PTT_SRPT - Title %3i part %3i: PGC: %3i PG: %3i\n", | |
555 title, part, | |
556 vts_ptt_srpt->title[ttn-1].ptt[part-1].pgcn , | |
557 vts_ptt_srpt->title[ttn-1].ptt[part-1].pgn ); | |
558 } else { | |
559 fprintf(MSG_OUT, "libdvdnav: ************ this chapter NOT FOUND!\n"); | |
560 } | |
561 #endif | |
562 if (!title) | |
563 return 0; | |
564 *title_result = title; | |
565 *part_result = part; | |
566 return 1; | |
567 } | |
568 | |
569 /* Return the substream id for 'logical' audio stream audioN. | |
570 * 0 <= audioN < 8 | |
571 */ | |
572 int vm_get_audio_stream(vm_t *vm, int audioN) { | |
573 int streamN = -1; | |
574 | |
575 #ifdef TRACE | |
576 fprintf(MSG_OUT, "libdvdnav: vm.c:get_audio_stream audioN=%d\n",audioN); | |
577 #endif | |
578 | |
579 if((vm->state).domain != VTS_DOMAIN) | |
580 audioN = 0; | |
581 | |
582 if(audioN < 8) { | |
583 /* Is there any contol info for this logical stream */ | |
584 if((vm->state).pgc->audio_control[audioN] & (1<<15)) { | |
585 streamN = ((vm->state).pgc->audio_control[audioN] >> 8) & 0x07; | |
586 } | |
587 } | |
588 | |
589 if((vm->state).domain != VTS_DOMAIN && streamN == -1) | |
590 streamN = 0; | |
591 | |
592 /* FIXME: Should also check in vtsi/vmgi status what kind of stream | |
593 * it is (ac3/lpcm/dts/sdds...) to find the right (sub)stream id */ | |
594 return streamN; | |
595 } | |
596 | |
597 /* Return the substream id for 'logical' subpicture stream subpN and given mode. | |
598 * 0 <= subpN < 32 | |
599 * mode == 0 - widescreen | |
600 * mode == 1 - letterbox | |
601 * mode == 2 - pan&scan | |
602 */ | |
603 int vm_get_subp_stream(vm_t *vm, int subpN, int mode) { | |
604 int streamN = -1; | |
605 int source_aspect = vm_get_video_aspect(vm); | |
606 | |
607 if((vm->state).domain != VTS_DOMAIN) | |
608 subpN = 0; | |
609 | |
610 if(subpN < 32) { /* a valid logical stream */ | |
611 /* Is this logical stream present */ | |
612 if((vm->state).pgc->subp_control[subpN] & (1<<31)) { | |
613 if(source_aspect == 0) /* 4:3 */ | |
614 streamN = ((vm->state).pgc->subp_control[subpN] >> 24) & 0x1f; | |
615 if(source_aspect == 3) /* 16:9 */ | |
616 switch (mode) { | |
617 case 0: | |
618 streamN = ((vm->state).pgc->subp_control[subpN] >> 16) & 0x1f; | |
619 break; | |
620 case 1: | |
621 streamN = ((vm->state).pgc->subp_control[subpN] >> 8) & 0x1f; | |
622 break; | |
623 case 2: | |
624 streamN = (vm->state).pgc->subp_control[subpN] & 0x1f; | |
625 } | |
626 } | |
627 } | |
628 | |
629 if((vm->state).domain != VTS_DOMAIN && streamN == -1) | |
630 streamN = 0; | |
631 | |
632 /* FIXME: Should also check in vtsi/vmgi status what kind of stream it is. */ | |
633 return streamN; | |
634 } | |
635 | |
636 int vm_get_audio_active_stream(vm_t *vm) { | |
637 int audioN; | |
638 int streamN; | |
639 audioN = (vm->state).AST_REG ; | |
640 streamN = vm_get_audio_stream(vm, audioN); | |
641 | |
642 /* If no such stream, then select the first one that exists. */ | |
643 if(streamN == -1) { | |
644 for(audioN = 0; audioN < 8; audioN++) { | |
645 if((vm->state).pgc->audio_control[audioN] & (1<<15)) { | |
646 if ((streamN = vm_get_audio_stream(vm, audioN)) >= 0) | |
647 break; | |
648 } | |
649 } | |
650 } | |
651 | |
652 return streamN; | |
653 } | |
654 | |
655 int vm_get_subp_active_stream(vm_t *vm, int mode) { | |
656 int subpN; | |
657 int streamN; | |
658 subpN = (vm->state).SPST_REG & ~0x40; | |
659 streamN = vm_get_subp_stream(vm, subpN, mode); | |
660 | |
661 /* If no such stream, then select the first one that exists. */ | |
662 if(streamN == -1) { | |
663 for(subpN = 0; subpN < 32; subpN++) { | |
664 if((vm->state).pgc->subp_control[subpN] & (1<<31)) { | |
665 if ((streamN = vm_get_subp_stream(vm, subpN, mode)) >= 0) | |
666 break; | |
667 } | |
668 } | |
669 } | |
670 | |
671 if((vm->state).domain == VTS_DOMAIN && !((vm->state).SPST_REG & 0x40)) | |
672 /* Bit 7 set means hide, and only let Forced display show */ | |
673 return (streamN | 0x80); | |
674 else | |
675 return streamN; | |
676 } | |
677 | |
678 void vm_get_angle_info(vm_t *vm, int *current, int *num_avail) { | |
679 *num_avail = 1; | |
680 *current = 1; | |
681 | |
682 if((vm->state).domain == VTS_DOMAIN) { | |
683 title_info_t *title; | |
684 /* TTN_REG does not allways point to the correct title.. */ | |
685 if((vm->state).TTN_REG > vm->vmgi->tt_srpt->nr_of_srpts) | |
686 return; | |
687 title = &vm->vmgi->tt_srpt->title[(vm->state).TTN_REG - 1]; | |
688 if(title->title_set_nr != (vm->state).vtsN || | |
689 title->vts_ttn != (vm->state).VTS_TTN_REG) | |
690 return; | |
691 *num_avail = title->nr_of_angles; | |
692 *current = (vm->state).AGL_REG; | |
693 } | |
694 } | |
695 | |
696 #if 0 | |
697 /* currently unused */ | |
698 void vm_get_audio_info(vm_t *vm, int *current, int *num_avail) { | |
699 switch ((vm->state).domain) { | |
700 case VTS_DOMAIN: | |
701 *num_avail = vm->vtsi->vtsi_mat->nr_of_vts_audio_streams; | |
702 *current = (vm->state).AST_REG; | |
703 break; | |
704 case VTSM_DOMAIN: | |
705 *num_avail = vm->vtsi->vtsi_mat->nr_of_vtsm_audio_streams; /* 1 */ | |
706 *current = 1; | |
707 break; | |
708 case VMGM_DOMAIN: | |
709 case FP_DOMAIN: | |
710 *num_avail = vm->vmgi->vmgi_mat->nr_of_vmgm_audio_streams; /* 1 */ | |
711 *current = 1; | |
712 break; | |
713 } | |
714 } | |
715 | |
716 /* currently unused */ | |
717 void vm_get_subp_info(vm_t *vm, int *current, int *num_avail) { | |
718 switch ((vm->state).domain) { | |
719 case VTS_DOMAIN: | |
720 *num_avail = vm->vtsi->vtsi_mat->nr_of_vts_subp_streams; | |
721 *current = (vm->state).SPST_REG; | |
722 break; | |
723 case VTSM_DOMAIN: | |
724 *num_avail = vm->vtsi->vtsi_mat->nr_of_vtsm_subp_streams; /* 1 */ | |
725 *current = 0x41; | |
726 break; | |
727 case VMGM_DOMAIN: | |
728 case FP_DOMAIN: | |
729 *num_avail = vm->vmgi->vmgi_mat->nr_of_vmgm_subp_streams; /* 1 */ | |
730 *current = 0x41; | |
731 break; | |
732 } | |
733 } | |
734 | |
735 /* currently unused */ | |
736 void vm_get_video_res(vm_t *vm, int *width, int *height) { | |
737 video_attr_t attr = vm_get_video_attr(vm); | |
738 | |
739 if(attr.video_format != 0) | |
740 *height = 576; | |
741 else | |
742 *height = 480; | |
743 switch(attr.picture_size) { | |
744 case 0: | |
745 *width = 720; | |
746 break; | |
747 case 1: | |
748 *width = 704; | |
749 break; | |
750 case 2: | |
751 *width = 352; | |
752 break; | |
753 case 3: | |
754 *width = 352; | |
755 *height /= 2; | |
756 break; | |
757 } | |
758 } | |
759 #endif | |
760 | |
761 int vm_get_video_aspect(vm_t *vm) { | |
762 int aspect = vm_get_video_attr(vm).display_aspect_ratio; | |
763 | |
764 assert(aspect == 0 || aspect == 3); | |
765 (vm->state).registers.SPRM[14] &= ~(0x3 << 10); | |
766 (vm->state).registers.SPRM[14] |= aspect << 10; | |
767 | |
768 return aspect; | |
769 } | |
770 | |
771 int vm_get_video_scale_permission(vm_t *vm) { | |
772 return vm_get_video_attr(vm).permitted_df; | |
773 } | |
774 | |
775 video_attr_t vm_get_video_attr(vm_t *vm) { | |
776 switch ((vm->state).domain) { | |
777 case VTS_DOMAIN: | |
778 return vm->vtsi->vtsi_mat->vts_video_attr; | |
779 case VTSM_DOMAIN: | |
780 return vm->vtsi->vtsi_mat->vtsm_video_attr; | |
781 case VMGM_DOMAIN: | |
782 case FP_DOMAIN: | |
783 return vm->vmgi->vmgi_mat->vmgm_video_attr; | |
784 } | |
785 assert(0); | |
786 } | |
787 | |
788 audio_attr_t vm_get_audio_attr(vm_t *vm, int streamN) { | |
789 switch ((vm->state).domain) { | |
790 case VTS_DOMAIN: | |
791 return vm->vtsi->vtsi_mat->vts_audio_attr[streamN]; | |
792 case VTSM_DOMAIN: | |
793 return vm->vtsi->vtsi_mat->vtsm_audio_attr; | |
794 case VMGM_DOMAIN: | |
795 case FP_DOMAIN: | |
796 return vm->vmgi->vmgi_mat->vmgm_audio_attr; | |
797 } | |
798 assert(0); | |
799 } | |
800 | |
801 subp_attr_t vm_get_subp_attr(vm_t *vm, int streamN) { | |
802 switch ((vm->state).domain) { | |
803 case VTS_DOMAIN: | |
804 return vm->vtsi->vtsi_mat->vts_subp_attr[streamN]; | |
805 case VTSM_DOMAIN: | |
806 return vm->vtsi->vtsi_mat->vtsm_subp_attr; | |
807 case VMGM_DOMAIN: | |
808 case FP_DOMAIN: | |
809 return vm->vmgi->vmgi_mat->vmgm_subp_attr; | |
810 } | |
811 assert(0); | |
812 } | |
813 | |
814 | |
815 /* Playback control */ | |
816 | |
817 static link_t play_PGC(vm_t *vm) { | |
818 link_t link_values; | |
819 | |
820 #ifdef TRACE | |
821 fprintf(MSG_OUT, "libdvdnav: vm: play_PGC:"); | |
822 if((vm->state).domain != FP_DOMAIN) { | |
823 fprintf(MSG_OUT, " (vm->state).pgcN (%i)\n", get_PGCN(vm)); | |
824 } else { | |
825 fprintf(MSG_OUT, " first_play_pgc\n"); | |
826 } | |
827 #endif | |
828 | |
829 /* This must be set before the pre-commands are executed because they | |
830 * might contain a CallSS that will save resume state */ | |
831 | |
832 /* FIXME: This may be only a temporary fix for something... */ | |
833 (vm->state).pgN = 1; | |
834 (vm->state).cellN = 0; | |
835 (vm->state).blockN = 0; | |
836 | |
837 /* eval -> updates the state and returns either | |
838 - some kind of jump (Jump(TT/SS/VTS_TTN/CallSS/link C/PG/PGC/PTTN) | |
839 - just play video i.e first PG | |
840 (This is what happens if you fall of the end of the pre_cmds) | |
841 - or an error (are there more cases?) */ | |
842 if((vm->state).pgc->command_tbl && (vm->state).pgc->command_tbl->nr_of_pre) { | |
843 if(vmEval_CMD((vm->state).pgc->command_tbl->pre_cmds, | |
844 (vm->state).pgc->command_tbl->nr_of_pre, | |
845 &(vm->state).registers, &link_values)) { | |
846 /* link_values contains the 'jump' return value */ | |
847 return link_values; | |
848 } else { | |
849 #ifdef TRACE | |
850 fprintf(MSG_OUT, "libdvdnav: PGC pre commands didn't do a Jump, Link or Call\n"); | |
851 #endif | |
852 } | |
853 } | |
854 return play_PG(vm); | |
855 } | |
856 | |
857 static link_t play_PGC_PG(vm_t *vm, int pgN) { | |
858 link_t link_values; | |
859 | |
860 #ifdef TRACE | |
861 fprintf(MSG_OUT, "libdvdnav: vm: play_PGC:"); | |
862 if((vm->state).domain != FP_DOMAIN) { | |
863 fprintf(MSG_OUT, " (vm->state).pgcN (%i)\n", get_PGCN(vm)); | |
864 } else { | |
865 fprintf(MSG_OUT, " first_play_pgc\n"); | |
866 } | |
867 #endif | |
868 | |
869 /* This must be set before the pre-commands are executed because they | |
870 * might contain a CallSS that will save resume state */ | |
871 | |
872 /* FIXME: This may be only a temporary fix for something... */ | |
873 (vm->state).pgN = pgN; | |
874 (vm->state).cellN = 0; | |
875 (vm->state).blockN = 0; | |
876 | |
877 /* eval -> updates the state and returns either | |
878 - some kind of jump (Jump(TT/SS/VTS_TTN/CallSS/link C/PG/PGC/PTTN) | |
879 - just play video i.e first PG | |
880 (This is what happens if you fall of the end of the pre_cmds) | |
881 - or an error (are there more cases?) */ | |
882 if((vm->state).pgc->command_tbl && (vm->state).pgc->command_tbl->nr_of_pre) { | |
883 if(vmEval_CMD((vm->state).pgc->command_tbl->pre_cmds, | |
884 (vm->state).pgc->command_tbl->nr_of_pre, | |
885 &(vm->state).registers, &link_values)) { | |
886 /* link_values contains the 'jump' return value */ | |
887 return link_values; | |
888 } else { | |
889 #ifdef TRACE | |
890 fprintf(MSG_OUT, "libdvdnav: PGC pre commands didn't do a Jump, Link or Call\n"); | |
891 #endif | |
892 } | |
893 } | |
894 return play_PG(vm); | |
895 } | |
896 | |
897 static link_t play_PGC_post(vm_t *vm) { | |
898 link_t link_values; | |
899 | |
900 #ifdef TRACE | |
901 fprintf(MSG_OUT, "libdvdnav: play_PGC_post:\n"); | |
902 #endif | |
903 | |
904 /* FIXME: Implement PGC Stills. Currently only Cell stills work */ | |
905 assert((vm->state).pgc->still_time == 0); | |
906 | |
907 /* eval -> updates the state and returns either | |
908 - some kind of jump (Jump(TT/SS/VTS_TTN/CallSS/link C/PG/PGC/PTTN) | |
909 - just go to next PGC | |
910 (This is what happens if you fall of the end of the post_cmds) | |
911 - or an error (are there more cases?) */ | |
912 if((vm->state).pgc->command_tbl && | |
913 vmEval_CMD((vm->state).pgc->command_tbl->post_cmds, | |
914 (vm->state).pgc->command_tbl->nr_of_post, | |
915 &(vm->state).registers, &link_values)) { | |
916 return link_values; | |
917 } | |
918 | |
919 #ifdef TRACE | |
920 fprintf(MSG_OUT, "libdvdnav: ** Fell of the end of the pgc, continuing in NextPGC\n"); | |
921 #endif | |
922 assert((vm->state).pgc->next_pgc_nr != 0); | |
923 /* Should end up in the STOP_DOMAIN if next_pgc is 0. */ | |
924 if(!set_PGCN(vm, (vm->state).pgc->next_pgc_nr)) | |
925 assert(0); | |
926 return play_PGC(vm); | |
927 } | |
928 | |
929 static link_t play_PG(vm_t *vm) { | |
930 #ifdef TRACE | |
931 fprintf(MSG_OUT, "libdvdnav: play_PG: (vm->state).pgN (%i)\n", (vm->state).pgN); | |
932 #endif | |
933 | |
934 assert((vm->state).pgN > 0); | |
935 if((vm->state).pgN > (vm->state).pgc->nr_of_programs) { | |
936 #ifdef TRACE | |
937 fprintf(MSG_OUT, "libdvdnav: play_PG: (vm->state).pgN (%i) > pgc->nr_of_programs (%i)\n", | |
938 (vm->state).pgN, (vm->state).pgc->nr_of_programs ); | |
939 #endif | |
940 assert((vm->state).pgN == (vm->state).pgc->nr_of_programs + 1); | |
941 return play_PGC_post(vm); | |
942 } | |
943 | |
944 (vm->state).cellN = (vm->state).pgc->program_map[(vm->state).pgN - 1]; | |
945 | |
946 return play_Cell(vm); | |
947 } | |
948 | |
949 static link_t play_Cell(vm_t *vm) { | |
950 static const link_t play_this = {PlayThis, /* Block in Cell */ 0, 0, 0}; | |
951 | |
952 #ifdef TRACE | |
953 fprintf(MSG_OUT, "libdvdnav: play_Cell: (vm->state).cellN (%i)\n", (vm->state).cellN); | |
954 #endif | |
955 | |
956 assert((vm->state).cellN > 0); | |
957 if((vm->state).cellN > (vm->state).pgc->nr_of_cells) { | |
958 #ifdef TRACE | |
959 fprintf(MSG_OUT, "libdvdnav: (vm->state).cellN (%i) > pgc->nr_of_cells (%i)\n", | |
960 (vm->state).cellN, (vm->state).pgc->nr_of_cells ); | |
961 #endif | |
962 assert((vm->state).cellN == (vm->state).pgc->nr_of_cells + 1); | |
963 return play_PGC_post(vm); | |
964 } | |
965 | |
966 /* Multi angle/Interleaved */ | |
967 switch((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode) { | |
968 case 0: /* Normal */ | |
969 assert((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type == 0); | |
970 break; | |
971 case 1: /* The first cell in the block */ | |
972 switch((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type) { | |
973 case 0: /* Not part of a block */ | |
974 assert(0); | |
975 case 1: /* Angle block */ | |
976 /* Loop and check each cell instead? So we don't get outside the block? */ | |
977 (vm->state).cellN += (vm->state).AGL_REG - 1; | |
978 #ifdef STRICT | |
979 assert((vm->state).cellN <= (vm->state).pgc->nr_of_cells); | |
980 assert((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode != 0); | |
981 assert((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type == 1); | |
982 #else | |
983 if (!((vm->state).cellN <= (vm->state).pgc->nr_of_cells) || | |
984 !((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode != 0) || | |
985 !((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type == 1)) { | |
986 fprintf(MSG_OUT, "libdvdnav: Invalid angle block\n"); | |
987 (vm->state).cellN -= (vm->state).AGL_REG - 1; | |
988 } | |
989 #endif | |
990 break; | |
991 case 2: /* ?? */ | |
992 case 3: /* ?? */ | |
993 default: | |
994 fprintf(MSG_OUT, "libdvdnav: Invalid? Cell block_mode (%d), block_type (%d)\n", | |
995 (vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode, | |
996 (vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type); | |
997 assert(0); | |
998 } | |
999 break; | |
1000 case 2: /* Cell in the block */ | |
1001 case 3: /* Last cell in the block */ | |
1002 /* These might perhaps happen for RSM or LinkC commands? */ | |
1003 default: | |
1004 fprintf(MSG_OUT, "libdvdnav: Cell is in block but did not enter at first cell!\n"); | |
1005 } | |
1006 | |
1007 /* Updates (vm->state).pgN and PTTN_REG */ | |
1008 if(!set_PGN(vm)) { | |
1009 /* Should not happen */ | |
1010 assert(0); | |
1011 return play_PGC_post(vm); | |
1012 } | |
1013 (vm->state).cell_restart++; | |
1014 (vm->state).blockN = 0; | |
1015 #ifdef TRACE | |
1016 fprintf(MSG_OUT, "libdvdnav: Cell should restart here\n"); | |
1017 #endif | |
1018 return play_this; | |
1019 } | |
1020 | |
1021 static link_t play_Cell_post(vm_t *vm) { | |
1022 cell_playback_t *cell; | |
1023 | |
1024 #ifdef TRACE | |
1025 fprintf(MSG_OUT, "libdvdnav: play_Cell_post: (vm->state).cellN (%i)\n", (vm->state).cellN); | |
1026 #endif | |
1027 | |
1028 cell = &(vm->state).pgc->cell_playback[(vm->state).cellN - 1]; | |
1029 | |
1030 /* Still time is already taken care of before we get called. */ | |
1031 | |
1032 /* Deal with a Cell command, if any */ | |
1033 if(cell->cell_cmd_nr != 0) { | |
1034 link_t link_values; | |
1035 | |
1036 /* These asserts are now not needed. | |
1037 * Some DVDs have no cell commands listed in the PGC, | |
1038 * but the Cell itself points to a cell command that does not exist. | |
1039 * For this situation, just ignore the cell command and continue. | |
1040 * | |
1041 * assert((vm->state).pgc->command_tbl != NULL); | |
1042 * assert((vm->state).pgc->command_tbl->nr_of_cell >= cell->cell_cmd_nr); | |
1043 */ | |
1044 | |
1045 if ((vm->state).pgc->command_tbl != NULL && | |
1046 (vm->state).pgc->command_tbl->nr_of_cell >= cell->cell_cmd_nr) { | |
1047 #ifdef TRACE | |
1048 fprintf(MSG_OUT, "libdvdnav: Cell command present, executing\n"); | |
1049 #endif | |
1050 if(vmEval_CMD(&(vm->state).pgc->command_tbl->cell_cmds[cell->cell_cmd_nr - 1], 1, | |
1051 &(vm->state).registers, &link_values)) { | |
1052 return link_values; | |
1053 } else { | |
1054 #ifdef TRACE | |
1055 fprintf(MSG_OUT, "libdvdnav: Cell command didn't do a Jump, Link or Call\n"); | |
1056 #endif | |
1057 } | |
1058 } else { | |
1059 #ifdef TRACE | |
1060 fprintf(MSG_OUT, "libdvdnav: Invalid Cell command\n"); | |
1061 #endif | |
1062 } | |
1063 } | |
1064 | |
1065 /* Where to continue after playing the cell... */ | |
1066 /* Multi angle/Interleaved */ | |
1067 switch((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode) { | |
1068 case 0: /* Normal */ | |
1069 assert((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type == 0); | |
1070 (vm->state).cellN++; | |
1071 break; | |
1072 case 1: /* The first cell in the block */ | |
1073 case 2: /* A cell in the block */ | |
1074 case 3: /* The last cell in the block */ | |
1075 default: | |
1076 switch((vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type) { | |
1077 case 0: /* Not part of a block */ | |
1078 assert(0); | |
1079 case 1: /* Angle block */ | |
1080 /* Skip the 'other' angles */ | |
1081 (vm->state).cellN++; | |
1082 while((vm->state).cellN <= (vm->state).pgc->nr_of_cells && | |
1083 (vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode >= 2) { | |
1084 (vm->state).cellN++; | |
1085 } | |
1086 break; | |
1087 case 2: /* ?? */ | |
1088 case 3: /* ?? */ | |
1089 default: | |
1090 fprintf(MSG_OUT, "libdvdnav: Invalid? Cell block_mode (%d), block_type (%d)\n", | |
1091 (vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_mode, | |
1092 (vm->state).pgc->cell_playback[(vm->state).cellN - 1].block_type); | |
1093 assert(0); | |
1094 } | |
1095 break; | |
1096 } | |
1097 | |
1098 /* Figure out the correct pgN for the new cell */ | |
1099 if(!set_PGN(vm)) { | |
1100 #ifdef TRACE | |
1101 fprintf(MSG_OUT, "libdvdnav: last cell in this PGC\n"); | |
1102 #endif | |
1103 return play_PGC_post(vm); | |
1104 } | |
1105 return play_Cell(vm); | |
1106 } | |
1107 | |
1108 | |
1109 /* link processing */ | |
1110 | |
1111 static int process_command(vm_t *vm, link_t link_values) { | |
1112 | |
1113 while(link_values.command != PlayThis) { | |
1114 | |
1115 #ifdef TRACE | |
1116 fprintf(MSG_OUT, "libdvdnav: Before printout starts:\n"); | |
1117 vmPrint_LINK(link_values); | |
1118 fprintf(MSG_OUT, "libdvdnav: Link values %i %i %i %i\n", link_values.command, | |
1119 link_values.data1, link_values.data2, link_values.data3); | |
1120 vm_print_current_domain_state(vm); | |
1121 fprintf(MSG_OUT, "libdvdnav: Before printout ends.\n"); | |
1122 #endif | |
1123 | |
1124 switch(link_values.command) { | |
1125 case LinkNoLink: | |
1126 /* BUTTON number:data1 */ | |
1127 if(link_values.data1 != 0) | |
1128 (vm->state).HL_BTNN_REG = link_values.data1 << 10; | |
1129 return 0; /* no actual jump */ | |
1130 | |
1131 case LinkTopC: | |
1132 /* Restart playing from the beginning of the current Cell. */ | |
1133 /* BUTTON number:data1 */ | |
1134 if(link_values.data1 != 0) | |
1135 (vm->state).HL_BTNN_REG = link_values.data1 << 10; | |
1136 link_values = play_Cell(vm); | |
1137 break; | |
1138 case LinkNextC: | |
1139 /* Link to Next Cell */ | |
1140 /* BUTTON number:data1 */ | |
1141 if(link_values.data1 != 0) | |
1142 (vm->state).HL_BTNN_REG = link_values.data1 << 10; | |
1143 assert((vm->state).cellN > 1); | |
1144 (vm->state).cellN += 1; | |
1145 link_values = play_Cell(vm); | |
1146 break; | |
1147 case LinkPrevC: | |
1148 /* Link to Previous Cell */ | |
1149 /* BUTTON number:data1 */ | |
1150 if(link_values.data1 != 0) | |
1151 (vm->state).HL_BTNN_REG = link_values.data1 << 10; | |
1152 (vm->state).cellN -= 1; | |
1153 link_values = play_Cell(vm); | |
1154 break; | |
1155 | |
1156 case LinkTopPG: | |
1157 /* Link to Top of Program */ | |
1158 /* BUTTON number:data1 */ | |
1159 fprintf(MSG_OUT, "libdvdnav: FIXME: LinkTopPG. This should start the current PG again.\n"); | |
1160 if(link_values.data1 != 0) | |
1161 (vm->state).HL_BTNN_REG = link_values.data1 << 10; | |
1162 link_values = play_PG(vm); | |
1163 break; | |
1164 case LinkNextPG: | |
1165 /* Link to Next Program */ | |
1166 /* BUTTON number:data1 */ | |
1167 if(link_values.data1 != 0) | |
1168 (vm->state).HL_BTNN_REG = link_values.data1 << 10; | |
1169 (vm->state).pgN += 1; | |
1170 link_values = play_PG(vm); | |
1171 break; | |
1172 case LinkPrevPG: | |
1173 /* Link to Previous Program */ | |
1174 /* BUTTON number:data1 */ | |
1175 if(link_values.data1 != 0) | |
1176 (vm->state).HL_BTNN_REG = link_values.data1 << 10; | |
1177 assert((vm->state).pgN > 1); | |
1178 (vm->state).pgN -= 1; | |
1179 link_values = play_PG(vm); | |
1180 break; | |
1181 | |
1182 case LinkTopPGC: | |
1183 /* Restart playing from beginning of current Program Chain */ | |
1184 /* BUTTON number:data1 */ | |
1185 if(link_values.data1 != 0) | |
1186 (vm->state).HL_BTNN_REG = link_values.data1 << 10; | |
1187 link_values = play_PGC(vm); | |
1188 break; | |
1189 case LinkNextPGC: | |
1190 /* Link to Next Program Chain */ | |
1191 /* BUTTON number:data1 */ | |
1192 if(link_values.data1 != 0) | |
1193 (vm->state).HL_BTNN_REG = link_values.data1 << 10; | |
1194 assert((vm->state).pgc->next_pgc_nr != 0); | |
1195 if(!set_PGCN(vm, (vm->state).pgc->next_pgc_nr)) | |
1196 assert(0); | |
1197 link_values = play_PGC(vm); | |
1198 break; | |
1199 case LinkPrevPGC: | |
1200 /* Link to Previous Program Chain */ | |
1201 /* BUTTON number:data1 */ | |
1202 if(link_values.data1 != 0) | |
1203 (vm->state).HL_BTNN_REG = link_values.data1 << 10; | |
1204 assert((vm->state).pgc->prev_pgc_nr != 0); | |
1205 if(!set_PGCN(vm, (vm->state).pgc->prev_pgc_nr)) | |
1206 assert(0); | |
1207 link_values = play_PGC(vm); | |
1208 break; | |
1209 case LinkGoUpPGC: | |
1210 /* Link to GoUp Program Chain */ | |
1211 /* BUTTON number:data1 */ | |
1212 if(link_values.data1 != 0) | |
1213 (vm->state).HL_BTNN_REG = link_values.data1 << 10; | |
1214 assert((vm->state).pgc->goup_pgc_nr != 0); | |
1215 if(!set_PGCN(vm, (vm->state).pgc->goup_pgc_nr)) | |
1216 assert(0); | |
1217 link_values = play_PGC(vm); | |
1218 break; | |
1219 case LinkTailPGC: | |
1220 /* Link to Tail of Program Chain */ | |
1221 /* BUTTON number:data1 */ | |
1222 if(link_values.data1 != 0) | |
1223 (vm->state).HL_BTNN_REG = link_values.data1 << 10; | |
1224 link_values = play_PGC_post(vm); | |
1225 break; | |
1226 | |
1227 case LinkRSM: | |
1228 { | |
1229 /* Link to Resume point */ | |
1230 int i; | |
1231 | |
1232 /* Check and see if there is any rsm info!! */ | |
1233 assert((vm->state).rsm_vtsN); | |
1234 (vm->state).domain = VTS_DOMAIN; | |
1235 ifoOpenNewVTSI(vm, vm->dvd, (vm->state).rsm_vtsN); | |
1236 set_PGCN(vm, (vm->state).rsm_pgcN); | |
1237 | |
1238 /* These should never be set in SystemSpace and/or MenuSpace */ | |
1239 /* (vm->state).TTN_REG = rsm_tt; ?? */ | |
1240 /* (vm->state).TT_PGCN_REG = (vm->state).rsm_pgcN; ?? */ | |
1241 for(i = 0; i < 5; i++) { | |
1242 (vm->state).registers.SPRM[4 + i] = (vm->state).rsm_regs[i]; | |
1243 } | |
1244 | |
1245 if(link_values.data1 != 0) | |
1246 (vm->state).HL_BTNN_REG = link_values.data1 << 10; | |
1247 | |
1248 if((vm->state).rsm_cellN == 0) { | |
1249 assert((vm->state).cellN); /* Checking if this ever happens */ | |
1250 (vm->state).pgN = 1; | |
1251 link_values = play_PG(vm); | |
1252 } else { | |
1253 /* (vm->state).pgN = ?? this gets the righ value in set_PGN() below */ | |
1254 (vm->state).cellN = (vm->state).rsm_cellN; | |
1255 link_values.command = PlayThis; | |
1256 link_values.data1 = (vm->state).rsm_blockN; | |
1257 if(!set_PGN(vm)) { | |
1258 /* Were at the end of the PGC, should not happen for a RSM */ | |
1259 assert(0); | |
1260 link_values.command = LinkTailPGC; | |
1261 link_values.data1 = 0; /* No button */ | |
1262 } | |
1263 } | |
1264 } | |
1265 break; | |
1266 case LinkPGCN: | |
1267 /* Link to Program Chain Number:data1 */ | |
1268 if(!set_PGCN(vm, link_values.data1)) | |
1269 assert(0); | |
1270 link_values = play_PGC(vm); | |
1271 break; | |
1272 case LinkPTTN: | |
1273 /* Link to Part of current Title Number:data1 */ | |
1274 /* BUTTON number:data2 */ | |
1275 assert((vm->state).domain == VTS_DOMAIN); | |
1276 if(link_values.data2 != 0) | |
1277 (vm->state).HL_BTNN_REG = link_values.data2 << 10; | |
1278 if(!set_VTS_PTT(vm, (vm->state).vtsN, (vm->state).VTS_TTN_REG, link_values.data1)) | |
1279 assert(0); | |
1280 link_values = play_PG(vm); | |
1281 break; | |
1282 case LinkPGN: | |
1283 /* Link to Program Number:data1 */ | |
1284 /* BUTTON number:data2 */ | |
1285 if(link_values.data2 != 0) | |
1286 (vm->state).HL_BTNN_REG = link_values.data2 << 10; | |
1287 /* Update any other state, PTTN perhaps? */ | |
1288 (vm->state).pgN = link_values.data1; | |
1289 link_values = play_PG(vm); | |
1290 break; | |
1291 case LinkCN: | |
1292 /* Link to Cell Number:data1 */ | |
1293 /* BUTTON number:data2 */ | |
1294 if(link_values.data2 != 0) | |
1295 (vm->state).HL_BTNN_REG = link_values.data2 << 10; | |
1296 /* Update any other state, pgN, PTTN perhaps? */ | |
1297 (vm->state).cellN = link_values.data1; | |
1298 link_values = play_Cell(vm); | |
1299 break; | |
1300 | |
1301 case Exit: | |
1302 fprintf(MSG_OUT, "libdvdnav: FIXME:in trouble...Link Exit - CRASHING!!!\n"); | |
1303 assert(0); /* What should we do here?? */ | |
1304 | |
1305 case JumpTT: | |
1306 /* Jump to VTS Title Domain */ | |
1307 /* Only allowed from the First Play domain(PGC) */ | |
1308 /* or the Video Manager domain (VMG) */ | |
1309 assert((vm->state).domain == VMGM_DOMAIN || (vm->state).domain == FP_DOMAIN); /* ?? */ | |
1310 if(!set_TT(vm, link_values.data1)) | |
1311 assert(0); | |
1312 link_values = play_PGC(vm); | |
1313 break; | |
1314 case JumpVTS_TT: | |
1315 /* Jump to Title:data1 in same VTS Title Domain */ | |
1316 /* Only allowed from the VTS Menu Domain(VTSM) */ | |
1317 /* or the Video Title Set Domain(VTS) */ | |
1318 assert((vm->state).domain == VTSM_DOMAIN || (vm->state).domain == VTS_DOMAIN); /* ?? */ | |
1319 if(!set_VTS_TT(vm, (vm->state).vtsN, link_values.data1)) | |
1320 assert(0); | |
1321 link_values = play_PGC(vm); | |
1322 break; | |
1323 case JumpVTS_PTT: | |
1324 /* Jump to Part:data2 of Title:data1 in same VTS Title Domain */ | |
1325 /* Only allowed from the VTS Menu Domain(VTSM) */ | |
1326 /* or the Video Title Set Domain(VTS) */ | |
1327 assert((vm->state).domain == VTSM_DOMAIN || (vm->state).domain == VTS_DOMAIN); /* ?? */ | |
1328 if(!set_VTS_PTT(vm, (vm->state).vtsN, link_values.data1, link_values.data2)) | |
1329 assert(0); | |
1330 link_values = play_PGC_PG(vm, (vm->state).pgN); | |
1331 break; | |
1332 | |
1333 case JumpSS_FP: | |
1334 /* Jump to First Play Domain */ | |
1335 /* Only allowed from the VTS Menu Domain(VTSM) */ | |
1336 /* or the Video Manager domain (VMG) */ | |
1337 assert((vm->state).domain == VMGM_DOMAIN || (vm->state).domain == VTSM_DOMAIN); /* ?? */ | |
1338 if (!set_FP_PGC(vm)) | |
1339 assert(0); | |
1340 link_values = play_PGC(vm); | |
1341 break; | |
1342 case JumpSS_VMGM_MENU: | |
1343 /* Jump to Video Manger domain - Title Menu:data1 or any PGC in VMG */ | |
1344 /* Allowed from anywhere except the VTS Title domain */ | |
1345 assert((vm->state).domain != VTS_DOMAIN); /* ?? */ | |
1346 (vm->state).domain = VMGM_DOMAIN; | |
1347 if(!set_MENU(vm, link_values.data1)) | |
1348 assert(0); | |
1349 link_values = play_PGC(vm); | |
1350 break; | |
1351 case JumpSS_VTSM: | |
1352 /* Jump to a menu in Video Title domain, */ | |
1353 /* or to a Menu is the current VTS */ | |
1354 /* FIXME: This goes badly wrong for some DVDs. */ | |
1355 /* FIXME: Keep in touch with ogle people regarding what to do here */ | |
1356 /* ifoOpenNewVTSI:data1 */ | |
1357 /* VTS_TTN_REG:data2 */ | |
1358 /* get_MENU:data3 */ | |
1359 #ifdef TRACE | |
1360 fprintf(MSG_OUT, "libdvdnav: BUG TRACKING *******************************************************************\n"); | |
1361 fprintf(MSG_OUT, "libdvdnav: data1=%u data2=%u data3=%u\n", | |
1362 link_values.data1, | |
1363 link_values.data2, | |
1364 link_values.data3); | |
1365 fprintf(MSG_OUT, "libdvdnav: *******************************************************************\n"); | |
1366 #endif | |
1367 | |
1368 if(link_values.data1 != 0) { | |
1369 assert((vm->state).domain == VMGM_DOMAIN || (vm->state).domain == FP_DOMAIN); /* ?? */ | |
1370 (vm->state).domain = VTSM_DOMAIN; | |
1371 ifoOpenNewVTSI(vm, vm->dvd, link_values.data1); /* Also sets (vm->state).vtsN */ | |
1372 } else { | |
1373 /* This happens on 'The Fifth Element' region 2. */ | |
1374 assert((vm->state).domain == VTSM_DOMAIN); | |
1375 } | |
1376 /* I don't know what title is supposed to be used for. */ | |
1377 /* Alien or Aliens has this != 1, I think. */ | |
1378 /* assert(link_values.data2 == 1); */ | |
1379 (vm->state).VTS_TTN_REG = link_values.data2; | |
1380 if(!set_MENU(vm, link_values.data3)) | |
1381 assert(0); | |
1382 link_values = play_PGC(vm); | |
1383 break; | |
1384 case JumpSS_VMGM_PGC: | |
1385 /* set_PGCN:data1 */ | |
1386 assert((vm->state).domain != VTS_DOMAIN); /* ?? */ | |
1387 (vm->state).domain = VMGM_DOMAIN; | |
1388 if(!set_PGCN(vm, link_values.data1)) | |
1389 assert(0); | |
1390 link_values = play_PGC(vm); | |
1391 break; | |
1392 | |
1393 case CallSS_FP: | |
1394 /* set_RSMinfo:data1 */ | |
1395 assert((vm->state).domain == VTS_DOMAIN); /* ?? */ | |
1396 /* Must be called before domain is changed */ | |
1397 set_RSMinfo(vm, link_values.data1, /* We dont have block info */ 0); | |
1398 set_FP_PGC(vm); | |
1399 link_values = play_PGC(vm); | |
1400 break; | |
1401 case CallSS_VMGM_MENU: | |
1402 /* set_MENU:data1 */ | |
1403 /* set_RSMinfo:data2 */ | |
1404 assert((vm->state).domain == VTS_DOMAIN); /* ?? */ | |
1405 /* Must be called before domain is changed */ | |
1406 set_RSMinfo(vm, link_values.data2, /* We dont have block info */ 0); | |
1407 (vm->state).domain = VMGM_DOMAIN; | |
1408 if(!set_MENU(vm, link_values.data1)) | |
1409 assert(0); | |
1410 link_values = play_PGC(vm); | |
1411 break; | |
1412 case CallSS_VTSM: | |
1413 /* set_MENU:data1 */ | |
1414 /* set_RSMinfo:data2 */ | |
1415 assert((vm->state).domain == VTS_DOMAIN); /* ?? */ | |
1416 /* Must be called before domain is changed */ | |
1417 set_RSMinfo(vm, link_values.data2, /* We dont have block info */ 0); | |
1418 (vm->state).domain = VTSM_DOMAIN; | |
1419 if(!set_MENU(vm, link_values.data1)) | |
1420 assert(0); | |
1421 link_values = play_PGC(vm); | |
1422 break; | |
1423 case CallSS_VMGM_PGC: | |
1424 /* set_PGC:data1 */ | |
1425 /* set_RSMinfo:data2 */ | |
1426 assert((vm->state).domain == VTS_DOMAIN); /* ?? */ | |
1427 /* Must be called before domain is changed */ | |
1428 set_RSMinfo(vm, link_values.data2, /* We dont have block info */ 0); | |
1429 (vm->state).domain = VMGM_DOMAIN; | |
1430 if(!set_PGCN(vm, link_values.data1)) | |
1431 assert(0); | |
1432 link_values = play_PGC(vm); | |
1433 break; | |
1434 case PlayThis: | |
1435 /* Should never happen. */ | |
1436 assert(0); | |
1437 break; | |
1438 } | |
1439 | |
1440 #ifdef TRACE | |
1441 fprintf(MSG_OUT, "libdvdnav: After printout starts:\n"); | |
1442 vm_print_current_domain_state(vm); | |
1443 fprintf(MSG_OUT, "libdvdnav: After printout ends.\n"); | |
1444 #endif | |
1445 | |
1446 } | |
1447 (vm->state).blockN = link_values.data1; | |
1448 return 1; | |
1449 } | |
1450 | |
1451 | |
1452 /* Set functions */ | |
1453 | |
1454 static int set_TT(vm_t *vm, int tt) { | |
1455 assert(tt <= vm->vmgi->tt_srpt->nr_of_srpts); | |
1456 (vm->state).TTN_REG = tt; | |
1457 return set_VTS_TT(vm, vm->vmgi->tt_srpt->title[tt - 1].title_set_nr, | |
1458 vm->vmgi->tt_srpt->title[tt - 1].vts_ttn); | |
1459 } | |
1460 | |
1461 static int set_VTS_TT(vm_t *vm, int vtsN, int vts_ttn) { | |
1462 return set_VTS_PTT(vm, vtsN, vts_ttn, 1); | |
1463 } | |
1464 | |
1465 static int set_VTS_PTT(vm_t *vm, int vtsN, int vts_ttn, int part) { | |
1466 int pgcN, pgN, res; | |
1467 | |
1468 (vm->state).domain = VTS_DOMAIN; | |
1469 | |
1470 if(vtsN != (vm->state).vtsN) | |
1471 ifoOpenNewVTSI(vm, vm->dvd, vtsN); /* Also sets (vm->state).vtsN */ | |
1472 | |
1473 if ((vts_ttn < 1) || (vts_ttn > vm->vtsi->vts_ptt_srpt->nr_of_srpts) || | |
1474 (part < 1) || (part > vm->vtsi->vts_ptt_srpt->title[vts_ttn - 1].nr_of_ptts) ) { | |
1475 return 0; | |
1476 } | |
1477 | |
1478 pgcN = vm->vtsi->vts_ptt_srpt->title[vts_ttn - 1].ptt[part - 1].pgcn; | |
1479 pgN = vm->vtsi->vts_ptt_srpt->title[vts_ttn - 1].ptt[part - 1].pgn; | |
1480 | |
1481 (vm->state).TT_PGCN_REG = pgcN; | |
1482 (vm->state).PTTN_REG = pgN; | |
1483 (vm->state).TTN_REG = get_TT(vm, vtsN, vts_ttn); | |
1484 assert( (vm->state.TTN_REG) != 0 ); | |
1485 (vm->state).VTS_TTN_REG = vts_ttn; | |
1486 (vm->state).vtsN = vtsN; /* Not sure about this one. We can get to it easily from TTN_REG */ | |
1487 /* Any other registers? */ | |
1488 | |
1489 res = set_PGCN(vm, pgcN); /* This clobber's state.pgN (sets it to 1), but we don't want clobbering here. */ | |
1490 (vm->state).pgN = pgN; | |
1491 return res; | |
1492 } | |
1493 | |
1494 static int set_FP_PGC(vm_t *vm) { | |
1495 (vm->state).domain = FP_DOMAIN; | |
1496 (vm->state).pgc = vm->vmgi->first_play_pgc; | |
1497 return 1; | |
1498 } | |
1499 | |
1500 | |
1501 static int set_MENU(vm_t *vm, int menu) { | |
1502 assert((vm->state).domain == VMGM_DOMAIN || (vm->state).domain == VTSM_DOMAIN); | |
1503 return set_PGCN(vm, get_ID(vm, menu)); | |
1504 } | |
1505 | |
1506 static int set_PGCN(vm_t *vm, int pgcN) { | |
1507 pgcit_t *pgcit; | |
1508 | |
1509 pgcit = get_PGCIT(vm); | |
1510 assert(pgcit != NULL); /* ?? Make this return -1 instead */ | |
1511 | |
1512 if(pgcN < 1 || pgcN > pgcit->nr_of_pgci_srp) { | |
1513 #ifdef TRACE | |
1514 fprintf(MSG_OUT, "libdvdnav: ** No such pgcN = %d\n", pgcN); | |
1515 #endif | |
1516 return 0; | |
1517 } | |
1518 | |
1519 (vm->state).pgc = pgcit->pgci_srp[pgcN - 1].pgc; | |
1520 (vm->state).pgN = 1; | |
1521 | |
1522 if((vm->state).domain == VTS_DOMAIN) | |
1523 (vm->state).TT_PGCN_REG = pgcN; | |
1524 | |
1525 return 1; | |
1526 } | |
1527 | |
1528 /* Figure out the correct pgN from the cell and update (vm->state). */ | |
1529 static int set_PGN(vm_t *vm) { | |
1530 int new_pgN = 0; | |
1531 | |
1532 while(new_pgN < (vm->state).pgc->nr_of_programs | |
1533 && (vm->state).cellN >= (vm->state).pgc->program_map[new_pgN]) | |
1534 new_pgN++; | |
1535 | |
1536 if(new_pgN == (vm->state).pgc->nr_of_programs) /* We are at the last program */ | |
1537 if((vm->state).cellN > (vm->state).pgc->nr_of_cells) | |
1538 return 0; /* We are past the last cell */ | |
1539 | |
1540 (vm->state).pgN = new_pgN; | |
1541 | |
1542 if((vm->state).domain == VTS_DOMAIN) { | |
1543 playback_type_t *pb_ty; | |
1544 if((vm->state).TTN_REG > vm->vmgi->tt_srpt->nr_of_srpts) | |
1545 return 0; /* ?? */ | |
1546 pb_ty = &vm->vmgi->tt_srpt->title[(vm->state).TTN_REG - 1].pb_ty; | |
1547 if(pb_ty->multi_or_random_pgc_title == /* One_Sequential_PGC_Title */ 0) { | |
1548 int dummy; | |
1549 #if 0 | |
1550 /* TTN_REG can't be trusted to have a correct value here... */ | |
1551 vts_ptt_srpt_t *ptt_srpt = vtsi->vts_ptt_srpt; | |
1552 assert((vm->state).VTS_TTN_REG <= ptt_srpt->nr_of_srpts); | |
1553 assert(get_PGCN() == ptt_srpt->title[(vm->state).VTS_TTN_REG - 1].ptt[0].pgcn); | |
1554 assert(1 == ptt_srpt->title[(vm->state).VTS_TTN_REG - 1].ptt[0].pgn); | |
1555 #endif | |
1556 vm_get_current_title_part(vm, &dummy, &(vm->state).pgN); | |
1557 (vm->state).PTTN_REG = (vm->state).pgN; | |
1558 } else { | |
1559 /* FIXME: Handle RANDOM or SHUFFLE titles. */ | |
1560 fprintf(MSG_OUT, "libdvdnav: RANDOM or SHUFFLE titles are NOT handled yet.\n"); | |
1561 } | |
1562 } | |
1563 return 1; | |
1564 } | |
1565 | |
1566 /* Must be called before domain is changed (set_PGCN()) */ | |
1567 static void set_RSMinfo(vm_t *vm, int cellN, int blockN) { | |
1568 int i; | |
1569 | |
1570 if(cellN) { | |
1571 (vm->state).rsm_cellN = cellN; | |
1572 (vm->state).rsm_blockN = blockN; | |
1573 } else { | |
1574 (vm->state).rsm_cellN = (vm->state).cellN; | |
1575 (vm->state).rsm_blockN = blockN; | |
1576 } | |
1577 (vm->state).rsm_vtsN = (vm->state).vtsN; | |
1578 (vm->state).rsm_pgcN = get_PGCN(vm); | |
1579 | |
1580 /* assert((vm->state).rsm_pgcN == (vm->state).TT_PGCN_REG); for VTS_DOMAIN */ | |
1581 | |
1582 for(i = 0; i < 5; i++) { | |
1583 (vm->state).rsm_regs[i] = (vm->state).registers.SPRM[4 + i]; | |
1584 } | |
1585 } | |
1586 | |
1587 | |
1588 /* Get functions */ | |
1589 | |
1590 /* Searches the TT tables, to find the current TT. | |
1591 * returns the current TT. | |
1592 * returns 0 if not found. | |
1593 */ | |
1594 static int get_TT(vm_t *vm, int vtsN, int vts_ttn) { | |
1595 int i; | |
1596 int tt=0; | |
1597 | |
1598 for(i = 1; i <= vm->vmgi->tt_srpt->nr_of_srpts; i++) { | |
1599 if( vm->vmgi->tt_srpt->title[i - 1].title_set_nr == vtsN && | |
1600 vm->vmgi->tt_srpt->title[i - 1].vts_ttn == vts_ttn) { | |
1601 tt=i; | |
1602 break; | |
1603 } | |
1604 } | |
1605 return tt; | |
1606 } | |
1607 | |
1608 /* Search for entry_id match of the PGC Category in the current VTS PGCIT table. | |
1609 * Return pgcN based on entry_id match. | |
1610 */ | |
1611 static int get_ID(vm_t *vm, int id) { | |
1612 int pgcN, i; | |
1613 pgcit_t *pgcit; | |
1614 | |
1615 /* Relies on state to get the correct pgcit. */ | |
1616 pgcit = get_PGCIT(vm); | |
1617 assert(pgcit != NULL); | |
1618 #ifdef TRACE | |
1619 fprintf(MSG_OUT, "libdvdnav: ** Searching for menu (0x%x) entry PGC\n", id); | |
1620 #endif | |
1621 | |
1622 /* Force high bit set. */ | |
1623 id |=0x80; | |
1624 | |
1625 /* Get menu/title */ | |
1626 for(i = 0; i < pgcit->nr_of_pgci_srp; i++) { | |
1627 if( (pgcit->pgci_srp[i].entry_id) == id) { | |
1628 pgcN = i + 1; | |
1629 #ifdef TRACE | |
1630 fprintf(MSG_OUT, "libdvdnav: Found menu.\n"); | |
1631 #endif | |
1632 return pgcN; | |
1633 } | |
1634 } | |
1635 #ifdef TRACE | |
1636 fprintf(MSG_OUT, "libdvdnav: ** No such id/menu (0x%02x) entry PGC\n", id & 0x7f); | |
1637 for(i = 0; i < pgcit->nr_of_pgci_srp; i++) { | |
1638 if ( (pgcit->pgci_srp[i].entry_id & 0x80) == 0x80) { | |
1639 fprintf(MSG_OUT, "libdvdnav: Available menus: 0x%x\n", | |
1640 pgcit->pgci_srp[i].entry_id & 0x7f); | |
1641 } | |
1642 } | |
1643 #endif | |
1644 return 0; /* error */ | |
1645 } | |
1646 | |
1647 static int get_PGCN(vm_t *vm) { | |
1648 pgcit_t *pgcit; | |
1649 int pgcN = 1; | |
1650 | |
1651 pgcit = get_PGCIT(vm); | |
1652 assert(pgcit != NULL); | |
1653 | |
1654 while(pgcN <= pgcit->nr_of_pgci_srp) { | |
1655 if(pgcit->pgci_srp[pgcN - 1].pgc == (vm->state).pgc) | |
1656 return pgcN; | |
1657 pgcN++; | |
1658 } | |
1659 fprintf(MSG_OUT, "libdvdnav: get_PGCN failed. Was trying to find pgcN in domain %d\n", | |
1660 (vm->state).domain); | |
1661 /* assert(0);*/ | |
1662 return 0; /* error */ | |
1663 } | |
1664 | |
1665 static pgcit_t* get_MENU_PGCIT(vm_t *vm, ifo_handle_t *h, uint16_t lang) { | |
0 | 1666 int i; |
1667 | |
1668 if(h == NULL || h->pgci_ut == NULL) { | |
76 | 1669 fprintf(MSG_OUT, "libdvdnav: *** pgci_ut handle is NULL ***\n"); |
0 | 1670 return NULL; /* error? */ |
1671 } | |
1672 | |
1673 i = 0; | |
1674 while(i < h->pgci_ut->nr_of_lus | |
1675 && h->pgci_ut->lu[i].lang_code != lang) | |
1676 i++; | |
1677 if(i == h->pgci_ut->nr_of_lus) { | |
76 | 1678 fprintf(MSG_OUT, "libdvdnav: Language '%c%c' not found, using '%c%c' instead\n", |
0 | 1679 (char)(lang >> 8), (char)(lang & 0xff), |
1680 (char)(h->pgci_ut->lu[0].lang_code >> 8), | |
1681 (char)(h->pgci_ut->lu[0].lang_code & 0xff)); | |
76 | 1682 fprintf(MSG_OUT, "libdvdnav: Menu Languages available: "); |
114 | 1683 for(i = 0; i < h->pgci_ut->nr_of_lus; i++) { |
76 | 1684 fprintf(MSG_OUT, "%c%c ", |
114 | 1685 (char)(h->pgci_ut->lu[i].lang_code >> 8), |
1686 (char)(h->pgci_ut->lu[i].lang_code & 0xff)); | |
53 | 1687 } |
76 | 1688 fprintf(MSG_OUT, "\n"); |
0 | 1689 i = 0; /* error? */ |
1690 } | |
1691 | |
1692 return h->pgci_ut->lu[i].pgcit; | |
1693 } | |
1694 | |
1695 /* Uses state to decide what to return */ | |
6 | 1696 static pgcit_t* get_PGCIT(vm_t *vm) { |
0 | 1697 pgcit_t *pgcit; |
1698 | |
50
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
42
diff
changeset
|
1699 switch ((vm->state).domain) { |
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
42
diff
changeset
|
1700 case VTS_DOMAIN: |
6 | 1701 pgcit = vm->vtsi->vts_pgcit; |
50
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
42
diff
changeset
|
1702 break; |
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
42
diff
changeset
|
1703 case VTSM_DOMAIN: |
6 | 1704 pgcit = get_MENU_PGCIT(vm, vm->vtsi, (vm->state).registers.SPRM[0]); |
50
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
42
diff
changeset
|
1705 break; |
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
42
diff
changeset
|
1706 case VMGM_DOMAIN: |
85
aa14e5673881
Add a bit more debug info. Now print PGCN in debug.
jcdutton
parents:
83
diff
changeset
|
1707 case FP_DOMAIN: |
6 | 1708 pgcit = get_MENU_PGCIT(vm, vm->vmgi, (vm->state).registers.SPRM[0]); |
50
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
42
diff
changeset
|
1709 break; |
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
42
diff
changeset
|
1710 default: |
0 | 1711 pgcit = NULL; /* Should never hapen */ |
76 | 1712 fprintf(MSG_OUT, "libdvdnav: get_PGCIT: Unknown domain:%d\n", |
50
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
42
diff
changeset
|
1713 (vm->state).domain); |
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
42
diff
changeset
|
1714 assert(0); |
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
42
diff
changeset
|
1715 break; |
0 | 1716 } |
1717 | |
1718 return pgcit; | |
1719 } | |
1720 | |
114 | 1721 |
1722 /* Debug functions */ | |
1723 | |
1724 #ifdef TRACE | |
1725 void vm_position_print(vm_t *vm, vm_position_t *position) { | |
1726 fprintf(MSG_OUT, "libdvdnav: But=%x Spu=%x Aud=%x Ang=%x Hop=%x vts=%x dom=%x cell=%x cell_restart=%x cell_start=%x still=%x block=%x\n", | |
1727 position->button, | |
1728 position->spu_channel, | |
1729 position->audio_channel, | |
1730 position->angle_channel, | |
1731 position->hop_channel, | |
1732 position->vts, | |
1733 position->domain, | |
1734 position->cell, | |
1735 position->cell_restart, | |
1736 position->cell_start, | |
1737 position->still, | |
1738 position->block); | |
1739 } | |
1740 #endif | |
1741 | |
1742 | |
0 | 1743 /* |
1744 * $Log$ | |
114 | 1745 * Revision 1.43 2003/02/20 15:32:19 mroi |
1746 * big libdvdnav cleanup, quoting the ChangeLog: | |
1747 * * some bugfixes | |
1748 * * code cleanup | |
1749 * * build process polishing | |
1750 * * more sensible event order in get_next_block to ensure useful event delivery | |
1751 * * VOBU level resume | |
1752 * * fixed: seeking in a multiangle feature briefly showed the wrong angle | |
1753 * | |
113 | 1754 * Revision 1.42 2003/01/13 13:33:45 mroi |
1755 * slightly improved logic of program skipping: | |
1756 * previous program: | |
1757 * -> if PG > 1, jump to PG - 1 | |
1758 * -> otherwise, if prev_PGC is set, jump to last PG of prev_PGC | |
1759 * -> otherwise fail | |
1760 * next program: | |
1761 * -> if PG < last_PG, jump to PG + 1 | |
1762 * -> otherwise, if next_PGC is set, jump to first PG of next_PGC | |
1763 * -> otherwise, move to last Cell of current PG and ask the VM for the next Cell | |
1764 * | |
112 | 1765 * Revision 1.41 2003/01/06 19:59:28 mroi |
1766 * implement LinkNoLink | |
1767 * (in this whole lot of DVDs I watched with libdvdnav, Disney's | |
1768 * "Beauty an the Beast" deluxe is the first one to use LinkNoLink...) | |
1769 * | |
111
0c1f0c7eec1d
loosening this test a bit makes "Spy Game" German RC2 work
mroi
parents:
110
diff
changeset
|
1770 * Revision 1.40 2002/11/24 15:09:18 mroi |
0c1f0c7eec1d
loosening this test a bit makes "Spy Game" German RC2 work
mroi
parents:
110
diff
changeset
|
1771 * loosening this test a bit makes "Spy Game" German RC2 work |
0c1f0c7eec1d
loosening this test a bit makes "Spy Game" German RC2 work
mroi
parents:
110
diff
changeset
|
1772 * |
110
ac50954e1345
patch from Marco Z«ählke for reporting correct title number
mroi
parents:
109
diff
changeset
|
1773 * Revision 1.39 2002/11/23 11:05:45 mroi |
ac50954e1345
patch from Marco Z«ählke for reporting correct title number
mroi
parents:
109
diff
changeset
|
1774 * patch from Marco Zühlke for reporting correct title number |
ac50954e1345
patch from Marco Z«ählke for reporting correct title number
mroi
parents:
109
diff
changeset
|
1775 * |
109
f41eae322bd1
warning: ugly fix ahead! (see comment in the code for details)
mroi
parents:
106
diff
changeset
|
1776 * Revision 1.38 2002/11/22 17:14:26 mroi |
f41eae322bd1
warning: ugly fix ahead! (see comment in the code for details)
mroi
parents:
106
diff
changeset
|
1777 * warning: ugly fix ahead! (see comment in the code for details) |
f41eae322bd1
warning: ugly fix ahead! (see comment in the code for details)
mroi
parents:
106
diff
changeset
|
1778 * But I hate it when DVDs do not work with libdvdnav and after checking a bunch of |
f41eae322bd1
warning: ugly fix ahead! (see comment in the code for details)
mroi
parents:
106
diff
changeset
|
1779 * other DVDs it seems that this fix is unlikely to break anything else, so I |
f41eae322bd1
warning: ugly fix ahead! (see comment in the code for details)
mroi
parents:
106
diff
changeset
|
1780 * decided to commit it. "Back to the Future" menus are working fine now. |
f41eae322bd1
warning: ugly fix ahead! (see comment in the code for details)
mroi
parents:
106
diff
changeset
|
1781 * |
106
e984044bbe7b
port Stephen's comment fixing to avoid problems when syncing xine-lib's copy of
mroi
parents:
101
diff
changeset
|
1782 * Revision 1.37 2002/10/23 11:38:09 mroi |
e984044bbe7b
port Stephen's comment fixing to avoid problems when syncing xine-lib's copy of
mroi
parents:
101
diff
changeset
|
1783 * port Stephen's comment fixing to avoid problems when syncing xine-lib's copy of |
e984044bbe7b
port Stephen's comment fixing to avoid problems when syncing xine-lib's copy of
mroi
parents:
101
diff
changeset
|
1784 * libdvdnav |
e984044bbe7b
port Stephen's comment fixing to avoid problems when syncing xine-lib's copy of
mroi
parents:
101
diff
changeset
|
1785 * |
101 | 1786 * Revision 1.36 2002/09/22 11:53:32 mroi |
1787 * small output beautification | |
1788 * | |
97
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
1789 * Revision 1.35 2002/09/17 11:00:22 jcdutton |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
1790 * First patch for personalized dvd viewing. I have not tested it yet. |
c1dff1899bda
First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents:
90
diff
changeset
|
1791 * |
90 | 1792 * Revision 1.34 2002/09/03 07:50:45 jcdutton |
1793 * Improve chapter selection functions. | |
1794 * | |
88 | 1795 * Revision 1.33 2002/09/02 03:20:01 jcdutton |
1796 * Implement proper prev/next chapter/part. | |
1797 * I don't know why someone has not noticed the problem until now. | |
1798 * | |
87 | 1799 * Revision 1.32 2002/09/02 00:27:14 jcdutton |
1800 * Fix bug in JumpVTS_PTT command. | |
1801 * | |
85
aa14e5673881
Add a bit more debug info. Now print PGCN in debug.
jcdutton
parents:
83
diff
changeset
|
1802 * Revision 1.31 2002/09/01 10:57:15 jcdutton |
aa14e5673881
Add a bit more debug info. Now print PGCN in debug.
jcdutton
parents:
83
diff
changeset
|
1803 * Add a bit more debug info. Now print PGCN in debug. |
aa14e5673881
Add a bit more debug info. Now print PGCN in debug.
jcdutton
parents:
83
diff
changeset
|
1804 * |
83 | 1805 * Revision 1.30 2002/08/31 10:51:01 jcdutton |
1806 * Handle badly written DVDs better. | |
1807 * If a Cell has a Cell command pointer, but the PGC Cell command list does not have an | |
1808 * entry for it, assume that the cell has no cell commands and continue instead of | |
1809 * assert(). | |
1810 * | |
82 | 1811 * Revision 1.29 2002/08/31 02:50:27 jcdutton |
1812 * Improve some debug messages. | |
1813 * Add some comments about dvdnav_open memory leaks. | |
1814 * | |
80 | 1815 * Revision 1.28 2002/08/29 05:33:54 jcdutton |
1816 * Slight changes to help debugging. | |
1817 * | |
77
731834155645
Remove an assert() so that user initiated jumps to particlar menus does not seg fault if
jcdutton
parents:
76
diff
changeset
|
1818 * Revision 1.27 2002/08/29 04:01:43 jcdutton |
731834155645
Remove an assert() so that user initiated jumps to particlar menus does not seg fault if
jcdutton
parents:
76
diff
changeset
|
1819 * Remove an assert() so that user initiated jumps to particlar menus does not seg fault if |
731834155645
Remove an assert() so that user initiated jumps to particlar menus does not seg fault if
jcdutton
parents:
76
diff
changeset
|
1820 * the menu requested does not exist. |
731834155645
Remove an assert() so that user initiated jumps to particlar menus does not seg fault if
jcdutton
parents:
76
diff
changeset
|
1821 * |
76 | 1822 * Revision 1.26 2002/08/27 19:15:08 mroi |
1823 * more consistent console output | |
1824 * | |
75 | 1825 * Revision 1.25 2002/08/21 15:25:50 mroi |
1826 * fix playback of the following dvds | |
1827 * - Bram Stoker's Dracula RC2 | |
1828 * - The Cell RC2, German FSK16 | |
1829 * | |
55
5674fbd44f26
report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents:
54
diff
changeset
|
1830 * Revision 1.24 2002/07/05 14:18:55 mroi |
5674fbd44f26
report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents:
54
diff
changeset
|
1831 * report all spu types (widescreen, letterbox and pan&scan), not widescreen |
5674fbd44f26
report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents:
54
diff
changeset
|
1832 * only and report the stream's scale permissions to detect pan&scan material |
5674fbd44f26
report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents:
54
diff
changeset
|
1833 * |
54 | 1834 * Revision 1.23 2002/07/05 01:42:30 jcdutton |
1835 * Add more debug info for Menu language selection. | |
1836 * Only do vm_start when we have to. | |
1837 * | |
53 | 1838 * Revision 1.22 2002/07/04 00:38:51 jcdutton |
1839 * Add some menu language printf's. | |
1840 * | |
52 | 1841 * Revision 1.21 2002/07/03 02:41:31 jcdutton |
1842 * Fix another long standing bug. | |
1843 * Now changing PGC will force a start at the first PG of the PGC. | |
1844 * | |
50
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
42
diff
changeset
|
1845 * Revision 1.20 2002/07/02 22:57:10 jcdutton |
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
42
diff
changeset
|
1846 * Rename some of the functions in vm.c to help readability. |
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
42
diff
changeset
|
1847 * Hopefully fix __FUNCTION__ problem. Use __func_ as recommended in C99. |
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
42
diff
changeset
|
1848 * Fix bug where libdvdnav would not immeadiately replay the same cell due to menu buttons. |
578ce1d41479
Rename some of the functions in vm.c to help readability.
jcdutton
parents:
42
diff
changeset
|
1849 * |
42 | 1850 * Revision 1.19 2002/06/04 13:35:16 richwareham |
1851 * Removed more C++ style comments | |
1852 * | |
38 | 1853 * Revision 1.18 2002/05/30 19:25:08 richwareham |
1854 * Another small fix | |
1855 * | |
37
832ca4921e04
Fixed (what appears to be) an error in JumpVTS_PTT implementation, it didn't call play_PGC after jumping.
richwareham
parents:
31
diff
changeset
|
1856 * Revision 1.17 2002/05/30 15:56:41 richwareham |
832ca4921e04
Fixed (what appears to be) an error in JumpVTS_PTT implementation, it didn't call play_PGC after jumping.
richwareham
parents:
31
diff
changeset
|
1857 * Fixed (what appears to be) an error in JumpVTS_PTT implementation, it didn't call play_PGC after jumping. |
832ca4921e04
Fixed (what appears to be) an error in JumpVTS_PTT implementation, it didn't call play_PGC after jumping.
richwareham
parents:
31
diff
changeset
|
1858 * |
31 | 1859 * Revision 1.16 2002/04/24 21:15:25 jcdutton |
1860 * Quiet please!!! | |
1861 * | |
27
fcfbaf8dbfb4
Insert some assert commands to hopefully catch a DVD which will give us information on what to do if these values are != 0.
jcdutton
parents:
25
diff
changeset
|
1862 * Revision 1.15 2002/04/23 13:18:31 jcdutton |
fcfbaf8dbfb4
Insert some assert commands to hopefully catch a DVD which will give us information on what to do if these values are != 0.
jcdutton
parents:
25
diff
changeset
|
1863 * Insert some assert commands to hopefully catch a DVD which will give us information on what to do if these values are != 0. |
fcfbaf8dbfb4
Insert some assert commands to hopefully catch a DVD which will give us information on what to do if these values are != 0.
jcdutton
parents:
25
diff
changeset
|
1864 * |
25
df024077cbc1
Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents:
24
diff
changeset
|
1865 * Revision 1.14 2002/04/23 12:34:39 f1rmb |
df024077cbc1
Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents:
24
diff
changeset
|
1866 * Why rewrite vm function, use it instead (this remark is for me, of course ;-) ). |
df024077cbc1
Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents:
24
diff
changeset
|
1867 * Comment unused var, shut compiler warnings. |
df024077cbc1
Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents:
24
diff
changeset
|
1868 * |
24 | 1869 * Revision 1.13 2002/04/23 02:12:27 jcdutton |
1870 * Re-implemented seeking. | |
1871 * | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
19
diff
changeset
|
1872 * Revision 1.12 2002/04/22 22:00:48 jcdutton |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
19
diff
changeset
|
1873 * Start of rewrite of libdvdnav. Still need to re-implement seeking. |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
19
diff
changeset
|
1874 * |
19
7e8628911b4f
Implement General Register Counters or GPRM counters.
jcdutton
parents:
18
diff
changeset
|
1875 * Revision 1.11 2002/04/12 20:06:41 jcdutton |
7e8628911b4f
Implement General Register Counters or GPRM counters.
jcdutton
parents:
18
diff
changeset
|
1876 * Implement General Register Counters or GPRM counters. |
7e8628911b4f
Implement General Register Counters or GPRM counters.
jcdutton
parents:
18
diff
changeset
|
1877 * Navigation timers are not supported yet. SPRM[9] and SPRM[10]. |
7e8628911b4f
Implement General Register Counters or GPRM counters.
jcdutton
parents:
18
diff
changeset
|
1878 * |
18 | 1879 * Revision 1.10 2002/04/12 12:43:36 jcdutton |
1880 * Display DVD disk region setting. | |
1881 * Display possible RCE region protection message. | |
1882 * | |
17 | 1883 * Revision 1.9 2002/04/10 16:45:57 jcdutton |
1884 * Actually fix the const this time! | |
1885 * | |
16 | 1886 * Revision 1.8 2002/04/10 16:40:52 jcdutton |
1887 * Fix a const problem. | |
1888 * | |
14 | 1889 * Revision 1.7 2002/04/10 13:09:40 jcdutton |
1890 * Some improvements to decoder.c | |
1891 * Registers should be updated correctly now, but still needs checking. | |
1892 * | |
10
6f0fb88d1463
Added some debug info, to hopefully help in tracking bugs in libdvdnav.
jcdutton
parents:
9
diff
changeset
|
1893 * Revision 1.6 2002/04/09 15:19:07 jcdutton |
6f0fb88d1463
Added some debug info, to hopefully help in tracking bugs in libdvdnav.
jcdutton
parents:
9
diff
changeset
|
1894 * Added some debug info, to hopefully help in tracking bugs in libdvdnav. |
6f0fb88d1463
Added some debug info, to hopefully help in tracking bugs in libdvdnav.
jcdutton
parents:
9
diff
changeset
|
1895 * |
9 | 1896 * Revision 1.5 2002/04/07 19:35:54 jcdutton |
1897 * Added some comments into the code. | |
1898 * | |
6 | 1899 * Revision 1.4 2002/04/06 18:31:50 jcdutton |
1900 * Some cleaning up. | |
1901 * changed exit(1) to assert(0) so they actually get seen by the user so that it helps developers more. | |
1902 * | |
4
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
3
diff
changeset
|
1903 * Revision 1.3 2002/04/02 18:22:27 richwareham |
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
3
diff
changeset
|
1904 * Added reset patch from Kees Cook <kees@outflux.net> |
99bed5d6db2f
Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents:
3
diff
changeset
|
1905 * |
3
328eadb3f37e
Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents:
0
diff
changeset
|
1906 * Revision 1.2 2002/04/01 18:56:28 richwareham |
328eadb3f37e
Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents:
0
diff
changeset
|
1907 * Added initial example programs directory and make sure all debug/error output goes to stderr. |
328eadb3f37e
Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents:
0
diff
changeset
|
1908 * |
328eadb3f37e
Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents:
0
diff
changeset
|
1909 * Revision 1.1.1.1 2002/03/12 19:45:55 richwareham |
328eadb3f37e
Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents:
0
diff
changeset
|
1910 * Initial import |
0 | 1911 * |
1912 * Revision 1.18 2002/01/22 16:56:49 jcdutton | |
1913 * Fix clut after seeking. | |
6 | 1914 * Add a few virtual machine debug messages, to help diagnose problems with "Deep Purple - Total Abandon" DVD as I don't have the DVD itvm. |
0 | 1915 * Fix a few debug messages, so they do not say FIXME. |
1916 * Move the FIXME debug messages to comments in the code. | |
1917 * | |
1918 * Revision 1.17 2002/01/21 01:16:30 jcdutton | |
1919 * Added some debug messages, to hopefully get info from users. | |
1920 * | |
1921 * Revision 1.16 2002/01/20 21:40:46 jcdutton | |
1922 * Start to fix some assert failures. | |
1923 * | |
1924 * Revision 1.15 2002/01/19 20:24:38 jcdutton | |
1925 * Just some FIXME notes added. | |
1926 * | |
1927 * Revision 1.14 2002/01/13 22:17:57 jcdutton | |
1928 * Change logging. | |
1929 * | |
1930 * | |
1931 */ |