annotate vm/decoder.h @ 295:2d75ce9fa252 src

when compiling against external dvdread add a compile time macro to identify the case (by means of dvdnav-config --cflags) and include the correct headers in dvdnav.h
author nicodvb
date Sat, 28 Apr 2007 09:27:27 +0000
parents 6c0def2b7e39
children 90ca650854e0
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 Martin Norbäck, Håkan Hjort
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
3 *
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
4 * This file is part of libdvdnav, a DVD navigation library. It is modified
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
5 * from a file originally part of the Ogle DVD player.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
6 *
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
7 * libdvdnav is free software; you can redistribute it and/or modify
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
10 * (at your option) any later version.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
11 *
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
12 * libdvdnav is distributed in the hope that it will be useful,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
15 * GNU General Public License for more details.
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
16 *
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
20 *
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
21 * $Id$
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
22 *
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 #ifndef DECODER_H_INCLUDED
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
26 #define DECODER_H_INCLUDED
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
27
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
28 /* link command types */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
29 typedef enum {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
30 LinkNoLink = 0,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
31
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
32 LinkTopC = 1,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
33 LinkNextC = 2,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
34 LinkPrevC = 3,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
35
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
36 LinkTopPG = 5,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
37 LinkNextPG = 6,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
38 LinkPrevPG = 7,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
39
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
40 LinkTopPGC = 9,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
41 LinkNextPGC = 10,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
42 LinkPrevPGC = 11,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
43 LinkGoUpPGC = 12,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
44 LinkTailPGC = 13,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
45
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
46 LinkRSM = 16,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
47
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
48 LinkPGCN,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
49 LinkPTTN,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
50 LinkPGN,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
51 LinkCN,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
52
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
53 Exit,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
54
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
55 JumpTT, /* 22 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
56 JumpVTS_TT,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
57 JumpVTS_PTT,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
58
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
59 JumpSS_FP,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
60 JumpSS_VMGM_MENU,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
61 JumpSS_VTSM,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
62 JumpSS_VMGM_PGC,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
63
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
64 CallSS_FP, /* 29 */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
65 CallSS_VMGM_MENU,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
66 CallSS_VTSM,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
67 CallSS_VMGM_PGC,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
68
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
69 PlayThis
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
70 } link_cmd_t;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
71
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
72 /* a link's data set */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
73 typedef struct {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
74 link_cmd_t command;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
75 uint16_t data1;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
76 uint16_t data2;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
77 uint16_t data3;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
78 } link_t;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
79
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
80 /* the VM registers */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
81 typedef struct {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
82 uint16_t SPRM[24];
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
83 uint16_t GPRM[16];
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
84 uint8_t GPRM_mode[16]; /* Need to have some thing to indicate normal/counter mode for every GPRM */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
85 struct timeval GPRM_time[16]; /* For counter mode */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
86 } registers_t;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
87
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
88 /* a VM command data set */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
89 typedef struct {
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
90 uint64_t instruction;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
91 uint64_t examined;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
92 registers_t *registers;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
93 } command_t;
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
94
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
95 /* the big VM function, executing the given commands and writing
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
96 * the link where to continue, the return value indicates if a jump
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
97 * has been performed */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
98 int32_t vmEval_CMD(vm_cmd_t commands[], int32_t num_commands,
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
99 registers_t *registers, link_t *return_values);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
100
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
101 /* extracts some bits from the command */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
102 uint32_t vm_getbits(command_t* command, int32_t start, int32_t count);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
103
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
104 #ifdef TRACE
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
105 /* for debugging: prints a link in readable form */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
106 void vm_print_link(link_t value);
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
107
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
108 /* for debugging: dumps VM registers */
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
109 void vm_print_registers( registers_t *registers );
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
110 #endif
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
111
9b1b740e3fc9 big build system changes
mroi
parents:
diff changeset
112 #endif /* DECODER_H_INCLUDED */