annotate vm.h @ 133:d09a81cf65ce src

determine correct PG and PTT numbers when seeking across PG boundaries
author mroi
date Mon, 24 Mar 2003 16:42:59 +0000
parents 66ca475e2a5a
children d9d75a22a061
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 #ifndef VM_H_INCLUDED
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
27 #define VM_H_INCLUDED
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
28
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
29 #include "decoder.h"
97
c1dff1899bda First patch for personalized dvd viewing. I have not tested it yet.
jcdutton
parents: 90
diff changeset
30 #include "remap.h"
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
31 #include <dvd_types.h>
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
32
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
33 /* DOMAIN enum */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
34
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
35 typedef enum {
114
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
36 FP_DOMAIN = 1,
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
37 VTS_DOMAIN = 2,
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
38 VMGM_DOMAIN = 4,
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
39 VTSM_DOMAIN = 8
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
40 } domain_t;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
41
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
42 /**
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
43 * State: SPRM, GPRM, Domain, pgc, pgN, cellN, ?
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
44 */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
45 typedef struct {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
46 registers_t registers;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
47
114
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
48 domain_t domain;
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
49 int vtsN; /* 0 is vmgm? */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
50 pgc_t *pgc; /* either this or 'int pgcN' is enough? */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
51 int pgN; /* is this needed? can allways fid pgN from cellN? */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
52 int cellN;
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
53 int32_t cell_restart; /* get cell to restart */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
54 int blockN;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
55
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
56 /* Resume info */
114
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
57 int rsm_vtsN;
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
58 int rsm_blockN; /* of nav_packet */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
59 uint16_t rsm_regs[5]; /* system registers 4-8 */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
60 int rsm_pgcN;
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
61 int rsm_cellN;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
62 } dvd_state_t;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
63
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
64 typedef struct vm_position_s {
114
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
65 int16_t button; /* Button highlighted */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
66 int32_t vts; /* vts number to use */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
67 int32_t domain; /* domain to use */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
68 int32_t spu_channel; /* spu channel to use */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
69 int32_t angle_channel; /* angle channel to use */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
70 int32_t audio_channel; /* audio channel to use */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
71 int32_t hop_channel; /* channel hopping. E.g menu button pressed */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
72 int32_t title; /* title number */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
73 int32_t chapter; /* chapter number */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
74 int32_t cell; /* cell number */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
75 int32_t cell_restart; /* get cell to restart */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
76 int32_t cell_start; /* sector number of start of current cell in use */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
77 int32_t still; /* is cell still */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
78 int32_t block; /* block number within cell in use */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
79 } vm_position_t;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
80
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
81 typedef struct {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
82 dvd_reader_t *dvd;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
83 ifo_handle_t *vmgi;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
84 ifo_handle_t *vtsi;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
85 dvd_state_t state;
114
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
86 int32_t hop_channel;
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
87 char dvd_name[50];
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
88 remap_t *map;
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
89 int stopped;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
90 } vm_t;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
91
114
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
92 /* magic number for seeking hops */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
93 #define HOP_SEEK 0x1000
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
94
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
95
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
96 /* Audio stream number */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
97 #define AST_REG registers.SPRM[1]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
98 /* Subpicture stream number */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
99 #define SPST_REG registers.SPRM[2]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
100 /* Angle number */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
101 #define AGL_REG registers.SPRM[3]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
102 /* Title Track Number */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
103 #define TTN_REG registers.SPRM[4]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
104 /* VTS Title Track Number */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
105 #define VTS_TTN_REG registers.SPRM[5]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
106 /* PGC Number for this Title Track */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
107 #define TT_PGCN_REG registers.SPRM[6]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
108 /* Current Part of Title (PTT) number for (One_Sequential_PGC_Title) */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
109 #define PTTN_REG registers.SPRM[7]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
110 /* Highlighted Button Number (btn nr 1 == value 1024) */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
111 #define HL_BTNN_REG registers.SPRM[8]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
112 /* Parental Level */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
113 #define PTL_REG registers.SPRM[13]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
114
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
115 /* Initialisation & destruction */
120
66ca475e2a5a - provide the means to make copies of the VM to try certain operations on a copy and
mroi
parents: 114
diff changeset
116 vm_t *vm_new_vm();
114
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
117 void vm_free_vm(vm_t *vm);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
118
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
119 /* IFO access */
6
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
120 ifo_handle_t *vm_get_vmgi(vm_t *vm);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
121 ifo_handle_t *vm_get_vtsi(vm_t *vm);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
122
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
123 /* Reader Access */
6
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
124 dvd_reader_t *vm_get_dvd_reader(vm_t *vm);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
125
114
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
126 /* Basic Handling */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
127 void vm_start(vm_t *vm);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
128 void vm_stop(vm_t *vm);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
129 int vm_reset(vm_t *vm, const char *dvdroot);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
130
120
66ca475e2a5a - provide the means to make copies of the VM to try certain operations on a copy and
mroi
parents: 114
diff changeset
131 /* copying and merging - useful for try-running an operation */
66ca475e2a5a - provide the means to make copies of the VM to try certain operations on a copy and
mroi
parents: 114
diff changeset
132 vm_t *vm_new_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
133 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
134 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
135
114
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
136 /* regular playback */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
137 void vm_position_get(vm_t *vm, vm_position_t *position);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
138 void vm_get_next_cell(vm_t *vm);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
139
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
140 /* Jumping - all these return 1, if a hop has been performed */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
141 int vm_jump_pg(vm_t *vm, int pg);
133
d09a81cf65ce determine correct PG and PTT numbers when seeking across PG boundaries
mroi
parents: 120
diff changeset
142 int vm_jump_cell_block(vm_t *vm, int cell, int block);
90
eeabf5a51b2b Improve chapter selection functions.
jcdutton
parents: 88
diff changeset
143 int vm_jump_title_part(vm_t *vm, int title, int part);
114
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
144 int vm_jump_top_pg(vm_t *vm);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
145 int vm_jump_next_pg(vm_t *vm);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
146 int vm_jump_prev_pg(vm_t *vm);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
147 int vm_jump_up(vm_t *vm);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
148 int vm_jump_menu(vm_t *vm, DVDMenuID_t menuid);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
149 int vm_exec_cmd(vm_t *vm, vm_cmd_t *cmd);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
150
114
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
151 /* getting information */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
152 int vm_get_current_title_part(vm_t *vm, int *title_result, int *part_result);
6
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
153 int vm_get_audio_stream(vm_t *vm, int audioN);
114
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
154 int vm_get_subp_stream(vm_t *vm, int subpN, int mode);
6
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
155 int vm_get_audio_active_stream(vm_t *vm);
55
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 50
diff changeset
156 int vm_get_subp_active_stream(vm_t *vm, int mode);
114
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
157 void vm_get_angle_info(vm_t *vm, int *current, int *num_avail);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
158 #if 0
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
159 /* currently unused */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
160 void vm_get_audio_info(vm_t *vm, int *current, int *num_avail);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
161 void vm_get_subp_info(vm_t *vm, int *current, int *num_avail);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
162 void vm_get_video_res(vm_t *vm, int *width, int *height);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
163 #endif
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
164 int vm_get_video_aspect(vm_t *vm);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
165 int vm_get_video_scale_permission(vm_t *vm);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
166 video_attr_t vm_get_video_attr(vm_t *vm);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
167 audio_attr_t vm_get_audio_attr(vm_t *vm, int streamN);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
168 subp_attr_t vm_get_subp_attr(vm_t *vm, int streamN);
88
929f732a0135 Implement proper prev/next chapter/part.
jcdutton
parents: 55
diff changeset
169
114
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
170 #ifdef TRACE
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
171 /* Debug */
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
172 void vm_position_print(vm_t *vm, vm_position_t *position);
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
173 #endif
b6834e6359cf big libdvdnav cleanup, quoting the ChangeLog:
mroi
parents: 97
diff changeset
174
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
175
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
176 #endif /* VM_HV_INCLUDED */