annotate vm/vm.h @ 249:5d643668f1e3 src

I added this code myself a long time ago, but now I am quite convinced that it is wrong: Why would we filter out SPU stream change events that switch SPUs off? This breaks watching the trailer on the RC2 of "Girl, interrupted", because you always get unwanted subtitles. When I added this code, it fixed a problem with the RC2 of "Terminator", but I cannot reproduce this problem any more. Back then, the menu highlights would not show up, but they do now. I assume the problem really got fixed with proper support for forced subtitles in xine, so this crappy workaround here can go away. After all, this way it is more symmetric to audio stream change events, because these are not filtered.
author mroi
date Sun, 12 Sep 2004 15:12:43 +0000
parents 9b1b740e3fc9
children 6299ccea8a38
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
225
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
1 /*
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
2 * Copyright (C) 2000, 2001 Håkan Hjort
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
3 * Copyright (C) 2001 Rich Wareham <richwareham@users.sourceforge.net>
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
4 *
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
5 * This file is part of libdvdnav, a DVD navigation library. It is modified
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
6 * from a file originally part of the Ogle DVD player.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
7 *
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
8 * libdvdnav is free software; you can redistribute it and/or modify
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
11 * (at your option) any later version.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
12 *
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
13 * libdvdnav is distributed in the hope that it will be useful,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
16 * GNU General Public License for more details.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
17 *
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
21 *
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
22 * $Id$
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
23 *
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
24 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
25
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
26 #ifndef VM_H_INCLUDED
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
27 #define VM_H_INCLUDED
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
28
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
29 #include "remap.h"
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
30 #include "dvdnav_internal.h"
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
31
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
32 /* DOMAIN enum */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
33
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
34 typedef enum {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
35 FP_DOMAIN = 1,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
36 VTS_DOMAIN = 2,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
37 VMGM_DOMAIN = 4,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
38 VTSM_DOMAIN = 8
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
39 } domain_t;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
40
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
41 /**
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
42 * State: SPRM, GPRM, Domain, pgc, pgN, cellN, ?
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
43 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
44 typedef struct {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
45 registers_t registers;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
46
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
47 domain_t domain;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
48 int vtsN; /* 0 is vmgm? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
49 pgc_t *pgc; /* either this or 'int pgcN' is enough? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
50 int pgcN; /* but provide pgcN for quick lookup */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
51 int pgN; /* is this needed? can allways fid pgN from cellN? */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
52 int cellN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
53 int32_t cell_restart; /* get cell to restart */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
54 int blockN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
55
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
56 /* Resume info */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
57 int rsm_vtsN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
58 int rsm_blockN; /* of nav_packet */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
59 uint16_t rsm_regs[5]; /* system registers 4-8 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
60 int rsm_pgcN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
61 int rsm_cellN;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
62 } dvd_state_t;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
63
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
64 typedef struct vm_position_s {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
65 int16_t button; /* Button highlighted */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
66 int32_t vts; /* vts number to use */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
67 domain_t domain; /* domain to use */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
68 int32_t spu_channel; /* spu channel to use */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
69 int32_t angle_channel; /* angle channel to use */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
70 int32_t audio_channel; /* audio channel to use */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
71 int32_t hop_channel; /* channel hopping. E.g menu button pressed */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
72 #if 0
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
73 /* currently unused */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
74 int32_t title; /* title number */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
75 int32_t chapter; /* chapter number */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
76 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
77 int32_t cell; /* cell number */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
78 int32_t cell_restart; /* get cell to restart */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
79 int32_t cell_start; /* sector number of start of current cell in use */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
80 int32_t still; /* is cell still */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
81 int32_t block; /* block number within cell in use */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
82 } vm_position_t;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
83
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
84 typedef struct {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
85 dvd_reader_t *dvd;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
86 ifo_handle_t *vmgi;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
87 ifo_handle_t *vtsi;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
88 dvd_state_t state;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
89 int32_t hop_channel;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
90 char dvd_name[50];
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
91 remap_t *map;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
92 int stopped;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
93 } vm_t;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
94
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
95 /* magic number for seeking hops */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
96 #define HOP_SEEK 0x1000
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
97
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
98
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
99 /* Audio stream number */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
100 #define AST_REG registers.SPRM[1]
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
101 /* Subpicture stream number */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
102 #define SPST_REG registers.SPRM[2]
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
103 /* Angle number */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
104 #define AGL_REG registers.SPRM[3]
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
105 /* Title Track Number */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
106 #define TTN_REG registers.SPRM[4]
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
107 /* VTS Title Track Number */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
108 #define VTS_TTN_REG registers.SPRM[5]
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
109 /* PGC Number for this Title Track */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
110 #define TT_PGCN_REG registers.SPRM[6]
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
111 /* Current Part of Title (PTT) number for (One_Sequential_PGC_Title) */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
112 #define PTTN_REG registers.SPRM[7]
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
113 /* Highlighted Button Number (btn nr 1 == value 1024) */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
114 #define HL_BTNN_REG registers.SPRM[8]
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
115 /* Parental Level */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
116 #define PTL_REG registers.SPRM[13]
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
117
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
118 /* Initialisation & destruction */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
119 vm_t *vm_new_vm(void);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
120 void vm_free_vm(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
121
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
122 /* IFO access */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
123 ifo_handle_t *vm_get_vmgi(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
124 ifo_handle_t *vm_get_vtsi(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
125
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
126 /* Reader Access */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
127 dvd_reader_t *vm_get_dvd_reader(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
128
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
129 /* Basic Handling */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
130 void vm_start(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
131 void vm_stop(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
132 int vm_reset(vm_t *vm, const char *dvdroot);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
133
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
134 /* copying and merging - useful for try-running an operation */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
135 vm_t *vm_new_copy(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
136 void vm_merge(vm_t *target, vm_t *source);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
137 void vm_free_copy(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
138
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
139 /* regular playback */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
140 void vm_position_get(vm_t *vm, vm_position_t *position);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
141 void vm_get_next_cell(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
142
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
143 /* Jumping - all these return 1, if a hop has been performed */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
144 int vm_jump_pg(vm_t *vm, int pg);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
145 int vm_jump_cell_block(vm_t *vm, int cell, int block);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
146 int vm_jump_title_part(vm_t *vm, int title, int part);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
147 int vm_jump_top_pg(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
148 int vm_jump_next_pg(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
149 int vm_jump_prev_pg(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
150 int vm_jump_up(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
151 int vm_jump_menu(vm_t *vm, DVDMenuID_t menuid);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
152 int vm_jump_resume(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
153 int vm_exec_cmd(vm_t *vm, vm_cmd_t *cmd);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
154
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
155 /* getting information */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
156 int vm_get_current_menu(vm_t *vm, int *menuid);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
157 int vm_get_current_title_part(vm_t *vm, int *title_result, int *part_result);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
158 int vm_get_audio_stream(vm_t *vm, int audioN);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
159 int vm_get_subp_stream(vm_t *vm, int subpN, int mode);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
160 int vm_get_audio_active_stream(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
161 int vm_get_subp_active_stream(vm_t *vm, int mode);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
162 void vm_get_angle_info(vm_t *vm, int *current, int *num_avail);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
163 #if 0
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
164 /* currently unused */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
165 void vm_get_audio_info(vm_t *vm, int *current, int *num_avail);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
166 void vm_get_subp_info(vm_t *vm, int *current, int *num_avail);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
167 void vm_get_video_res(vm_t *vm, int *width, int *height);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
168 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
169 int vm_get_video_aspect(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
170 int vm_get_video_scale_permission(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
171 video_attr_t vm_get_video_attr(vm_t *vm);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
172 audio_attr_t vm_get_audio_attr(vm_t *vm, int streamN);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
173 subp_attr_t vm_get_subp_attr(vm_t *vm, int streamN);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
174
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
175 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
176 /* Debug */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
177 void vm_position_print(vm_t *vm, vm_position_t *position);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
178 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
179
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
180
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
181 #endif /* VM_HV_INCLUDED */