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