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