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