annotate vm.c @ 90:eeabf5a51b2b src

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