annotate vm.c @ 135:5204d4e4cd3b src

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