225
|
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
|
|
18 * along with this program; if not, write to the Free Software
|
|
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
|
20 *
|
|
21 * $Id$
|
|
22 *
|
|
23 */
|
|
24
|
|
25 #ifndef DECODER_H_INCLUDED
|
|
26 #define DECODER_H_INCLUDED
|
|
27
|
|
28 #include <inttypes.h>
|
|
29 #include <sys/time.h>
|
|
30
|
|
31 #include "ifo_types.h" /* vm_cmd_t */
|
|
32 #include "dvdnav_internal.h"
|
|
33
|
|
34 /* link command types */
|
|
35 typedef enum {
|
|
36 LinkNoLink = 0,
|
|
37
|
|
38 LinkTopC = 1,
|
|
39 LinkNextC = 2,
|
|
40 LinkPrevC = 3,
|
|
41
|
|
42 LinkTopPG = 5,
|
|
43 LinkNextPG = 6,
|
|
44 LinkPrevPG = 7,
|
|
45
|
|
46 LinkTopPGC = 9,
|
|
47 LinkNextPGC = 10,
|
|
48 LinkPrevPGC = 11,
|
|
49 LinkGoUpPGC = 12,
|
|
50 LinkTailPGC = 13,
|
|
51
|
|
52 LinkRSM = 16,
|
|
53
|
|
54 LinkPGCN,
|
|
55 LinkPTTN,
|
|
56 LinkPGN,
|
|
57 LinkCN,
|
|
58
|
|
59 Exit,
|
|
60
|
|
61 JumpTT, /* 22 */
|
|
62 JumpVTS_TT,
|
|
63 JumpVTS_PTT,
|
|
64
|
|
65 JumpSS_FP,
|
|
66 JumpSS_VMGM_MENU,
|
|
67 JumpSS_VTSM,
|
|
68 JumpSS_VMGM_PGC,
|
|
69
|
|
70 CallSS_FP, /* 29 */
|
|
71 CallSS_VMGM_MENU,
|
|
72 CallSS_VTSM,
|
|
73 CallSS_VMGM_PGC,
|
|
74
|
|
75 PlayThis
|
|
76 } link_cmd_t;
|
|
77
|
|
78 /* a link's data set */
|
|
79 typedef struct {
|
|
80 link_cmd_t command;
|
|
81 uint16_t data1;
|
|
82 uint16_t data2;
|
|
83 uint16_t data3;
|
|
84 } link_t;
|
|
85
|
|
86 /* the VM registers */
|
|
87 typedef struct {
|
|
88 uint16_t SPRM[24];
|
|
89 uint16_t GPRM[16];
|
|
90 uint8_t GPRM_mode[16]; /* Need to have some thing to indicate normal/counter mode for every GPRM */
|
|
91 struct timeval GPRM_time[16]; /* For counter mode */
|
|
92 } registers_t;
|
|
93
|
|
94 /* a VM command data set */
|
|
95 typedef struct {
|
|
96 uint64_t instruction;
|
|
97 uint64_t examined;
|
|
98 registers_t *registers;
|
|
99 } command_t;
|
|
100
|
|
101 /* the big VM function, executing the given commands and writing
|
|
102 * the link where to continue, the return value indicates if a jump
|
|
103 * has been performed */
|
|
104 int32_t vmEval_CMD(vm_cmd_t commands[], int32_t num_commands,
|
|
105 registers_t *registers, link_t *return_values);
|
|
106
|
|
107 /* extracts some bits from the command */
|
|
108 uint32_t vm_getbits(command_t* command, int32_t start, int32_t count);
|
|
109
|
|
110 #ifdef TRACE
|
|
111 /* for debugging: prints a link in readable form */
|
|
112 void vm_print_link(link_t value);
|
|
113
|
|
114 /* for debugging: dumps VM registers */
|
|
115 void vm_print_registers( registers_t *registers );
|
|
116 #endif
|
|
117
|
|
118 #endif /* DECODER_H_INCLUDED */
|