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