Debian Codegraph @

src/vm/decoder.h

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