annotate vm.h @ 50:578ce1d41479 src

Rename some of the functions in vm.c to help readability. Hopefully fix __FUNCTION__ problem. Use __func_ as recommended in C99. Fix bug where libdvdnav would not immeadiately replay the same cell due to menu buttons.
author jcdutton
date Tue, 02 Jul 2002 22:57:10 +0000
parents df024077cbc1
children 5674fbd44f26
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"
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
30 #include <dvd_types.h>
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
31
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
32 /* DOMAIN enum */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
33
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
34 typedef enum {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
35 FP_DOMAIN = 1,
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
36 VTS_DOMAIN = 2,
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
37 VMGM_DOMAIN = 4,
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
38 VTSM_DOMAIN = 8
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
39 } domain_t;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
40
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
41 /**
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
42 * State: SPRM, GPRM, Domain, pgc, pgN, cellN, ?
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
43 */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
44 typedef struct {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
45 registers_t registers;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
46
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
47 pgc_t *pgc; /* either this or *pgc is enough? */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
48
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
49 domain_t domain;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
50 int vtsN; /* 0 is vmgm? */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
51 /* int pgcN; // either this or *pgc is enough. Which to use? */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
52 int pgN; /* is this needed? can allways fid pgN from cellN? */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
53 int cellN;
50
578ce1d41479 Rename some of the functions in vm.c to help readability.
jcdutton
parents: 25
diff changeset
54 int32_t cell_restart; /* get cell to restart */
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
55 int blockN;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
56
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
57 /* Resume info */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
58 int rsm_vtsN;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
59 int rsm_blockN; /* of nav_packet */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
60 uint16_t rsm_regs[5]; /* system registers 4-8 */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
61 int rsm_pgcN;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
62 int rsm_cellN;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
63 } dvd_state_t;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
64
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
65 typedef struct vm_position_s {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
66 int16_t button; /* Button highlighted */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
67 uint32_t clut; /* CLUT to use, not needed in this struct */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
68 int32_t vts; /* vts number to use */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
69 int32_t domain; /* domain to use */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
70 int32_t spu_channel; /* spu channel to use */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
71 int32_t angle_channel; /* angle channel to use */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
72 int32_t audio_channel; /* audio channel to use */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
73 int32_t hop_channel; /* channel hopping. E.g menu button pressed */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
74 int32_t title; /* title number */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
75 int32_t chapter; /* chapter number */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
76 int32_t cell; /* cell number */
50
578ce1d41479 Rename some of the functions in vm.c to help readability.
jcdutton
parents: 25
diff changeset
77 int32_t cell_restart; /* get cell to restart */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
78 int32_t still; /* is cell still */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
79 int32_t vobu_start; /* block number of start of current VOBU in use */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
80 int32_t vobu_next; /* block number within VOBU in use */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
81 } vm_position_t;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
82
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
83 typedef struct {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
84 dvd_reader_t *dvd;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
85 ifo_handle_t *vmgi;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
86 ifo_handle_t *vtsi;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
87 dvd_state_t state;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
88 int badness_counter;
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
89 int32_t hop_channel;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
90 } vm_t;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
91
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
92
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
93 /* Audio stream number */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
94 #define AST_REG registers.SPRM[1]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
95 /* Subpicture stream number */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
96 #define SPST_REG registers.SPRM[2]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
97 /* Angle number */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
98 #define AGL_REG registers.SPRM[3]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
99 /* Title Track Number */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
100 #define TTN_REG registers.SPRM[4]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
101 /* VTS Title Track Number */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
102 #define VTS_TTN_REG registers.SPRM[5]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
103 /* PGC Number for this Title Track */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
104 #define TT_PGCN_REG registers.SPRM[6]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
105 /* Current Part of Title (PTT) number for (One_Sequential_PGC_Title) */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
106 #define PTTN_REG registers.SPRM[7]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
107 /* Highlighted Button Number (btn nr 1 == value 1024) */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
108 #define HL_BTNN_REG registers.SPRM[8]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
109 /* Parental Level */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
110 #define PTL_REG registers.SPRM[13]
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
111
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
112 /* Initialisation & destruction */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
113 vm_t* vm_new_vm();
6
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
114 void vm_free_vm(vm_t *vm);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
115
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
116 /* IFO access */
6
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
117 ifo_handle_t *vm_get_vmgi(vm_t *vm);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
118 ifo_handle_t *vm_get_vtsi(vm_t *vm);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
119
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
120 /* Reader Access */
6
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
121 dvd_reader_t *vm_get_dvd_reader(vm_t *vm);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
122
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
123 /* Jumping */
6
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
124 int vm_start_title(vm_t *vm, int tt);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
125 int vm_jump_prog(vm_t *vm, int pr);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
126
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
127 /* Other calls */
17
a68c6da98b73 Actually fix the const this time!
jcdutton
parents: 16
diff changeset
128 int vm_reset(vm_t *vm, char *dvdroot); /* , register_t regs); */
6
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
129 int vm_start(vm_t *vm);
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
130 int vm_position_get(vm_t *vm, vm_position_t *position);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 17
diff changeset
131 int vm_position_print(vm_t *vm, vm_position_t *position);
6
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
132 int vm_eval_cmd(vm_t *vm, vm_cmd_t *cmd);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
133 int vm_get_next_cell(vm_t *vm);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
134 int vm_menu_call(vm_t *vm, DVDMenuID_t menuid, int block);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
135 int vm_resume(vm_t *vm);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
136 int vm_go_up(vm_t *vm);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
137 int vm_top_pg(vm_t *vm);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
138 int vm_next_pg(vm_t *vm);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
139 int vm_prev_pg(vm_t *vm);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
140 int vm_get_audio_stream(vm_t *vm, int audioN);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
141 int vm_get_audio_active_stream(vm_t *vm);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
142 int vm_get_subp_stream(vm_t *vm, int subpN);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
143 int vm_get_subp_active_stream(vm_t *vm);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
144 void vm_get_angle_info(vm_t *vm, int *num_avail, int *current);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
145 void vm_get_audio_info(vm_t *vm, int *num_avail, int *current);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
146 void vm_get_subp_info(vm_t *vm, int *num_avail, int *current);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
147 subp_attr_t vm_get_subp_attr(vm_t *vm, int streamN);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
148 audio_attr_t vm_get_audio_attr(vm_t *vm, int streamN);
5f319e02e333 Some cleaning up.
jcdutton
parents: 0
diff changeset
149 void vm_get_video_res(vm_t *vm, int *width, int *height);
25
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 22
diff changeset
150 int vm_get_video_aspect(vm_t *vm);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
151
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
152 #endif /* VM_HV_INCLUDED */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
153