annotate vm.c @ 97:c1dff1899bda src

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