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