Mercurial > mplayer.hg
annotate libmpdvdkit2/nav_read.c @ 15368:f2109e48a3c1
Add border masking support for lavc
author | gpoirier |
---|---|
date | Sun, 08 May 2005 20:51:38 +0000 |
parents | 25df9508f9a8 |
children | 483e955893b8 |
rev | line source |
---|---|
7029 | 1 /* |
2 * Copyright (C) 2000, 2001, 2002 Håkan Hjort <d95hjort@dtek.chalmers.se> | |
3 * | |
14938
25df9508f9a8
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
8257
diff
changeset
|
4 * Modified for use with MPlayer, changes contained in libdvdread_changes.diff. |
25df9508f9a8
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
8257
diff
changeset
|
5 * detailed CVS changelog at http://www.mplayerhq.hu/cgi-bin/cvsweb.cgi/main/ |
25df9508f9a8
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
8257
diff
changeset
|
6 * $Id$ |
25df9508f9a8
Mark modified files as such to comply more closely with GPL ¡ø2a.
diego
parents:
8257
diff
changeset
|
7 * |
7029 | 8 * This program is free software; you can redistribute it and/or modify |
9 * it under the terms of the GNU General Public License as published by | |
10 * the Free Software Foundation; either version 2 of the License, or | |
11 * (at your option) any later version. | |
12 * | |
13 * This program is distributed in the hope that it will be useful, | |
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 * GNU General Public License for more details. | |
17 * | |
18 * You should have received a copy of the GNU General Public License | |
19 * along with this program; if not, write to the Free Software | |
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 */ | |
22 | |
23 #include <stdio.h> | |
24 #include <string.h> | |
25 #include <inttypes.h> | |
7033 | 26 //#include <assert.h> |
7029 | 27 |
28 #include "config.h" // Needed for WORDS_BIGENDIAN | |
29 #include "bswap.h" | |
30 #include "nav_types.h" | |
31 #include "nav_read.h" | |
32 | |
33 void navRead_PCI(pci_t *pci, unsigned char *buffer) { | |
34 int i, j, k; | |
35 | |
36 assert(sizeof(pci_t) == PCI_BYTES - 1); // -1 for substream id | |
37 | |
38 memcpy(pci, buffer, sizeof(pci_t)); | |
39 | |
40 /* Endian conversions */ | |
41 | |
42 /* pci pci_gi */ | |
43 B2N_32(pci->pci_gi.nv_pck_lbn); | |
44 B2N_16(pci->pci_gi.vobu_cat); | |
45 B2N_32(pci->pci_gi.vobu_s_ptm); | |
46 B2N_32(pci->pci_gi.vobu_e_ptm); | |
47 B2N_32(pci->pci_gi.vobu_se_e_ptm); | |
48 | |
49 /* pci nsml_agli */ | |
50 for(i = 0; i < 9; i++) | |
51 B2N_32(pci->nsml_agli.nsml_agl_dsta[i]); | |
52 | |
53 /* pci hli hli_gi */ | |
54 B2N_16(pci->hli.hl_gi.hli_ss); | |
55 B2N_32(pci->hli.hl_gi.hli_s_ptm); | |
56 B2N_32(pci->hli.hl_gi.hli_e_ptm); | |
57 B2N_32(pci->hli.hl_gi.btn_se_e_ptm); | |
58 | |
59 /* pci hli btn_colit */ | |
60 for(i = 0; i < 3; i++) | |
61 for(j = 0; j < 2; j++) | |
62 B2N_32(pci->hli.btn_colit.btn_coli[i][j]); | |
63 | |
64 #if !defined(WORDS_BIGENDIAN) | |
65 /* pci hli btni */ | |
66 for(i = 0; i < 36; i++) { | |
67 char tmp[6], swap; | |
68 memcpy(tmp, &(pci->hli.btnit[i]), 6); | |
69 /* This is a B2N_24() */ | |
70 swap = tmp[0]; tmp[0] = tmp[2]; tmp[2] = swap; | |
71 /* This is a B2N_24() */ | |
72 swap = tmp[3]; tmp[3] = tmp[5]; tmp[5] = swap; | |
73 memcpy(&(pci->hli.btnit[i]), tmp, 6); | |
74 } | |
75 #endif | |
76 | |
77 | |
78 /* Asserts */ | |
79 | |
80 /* pci pci gi */ | |
81 assert(pci->pci_gi.zero1 == 0); | |
82 | |
83 /* pci hli hli_gi */ | |
84 assert(pci->hli.hl_gi.zero1 == 0); | |
85 assert(pci->hli.hl_gi.zero2 == 0); | |
86 assert(pci->hli.hl_gi.zero3 == 0); | |
87 assert(pci->hli.hl_gi.zero4 == 0); | |
88 assert(pci->hli.hl_gi.zero5 == 0); | |
89 | |
90 /* Are there buttons defined here? */ | |
91 if((pci->hli.hl_gi.hli_ss & 0x03) != 0) { | |
92 assert(pci->hli.hl_gi.btn_ns != 0); | |
93 assert(pci->hli.hl_gi.btngr_ns != 0); | |
94 } else { | |
95 assert((pci->hli.hl_gi.btn_ns != 0 && pci->hli.hl_gi.btngr_ns != 0) | |
96 || (pci->hli.hl_gi.btn_ns == 0 && pci->hli.hl_gi.btngr_ns == 0)); | |
97 } | |
98 | |
99 /* pci hli btnit */ | |
100 for(i = 0; i < pci->hli.hl_gi.btngr_ns; i++) { | |
101 for(j = 0; j < (36 / pci->hli.hl_gi.btngr_ns); j++) { | |
8257
635df9d22d38
100l patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
8254
diff
changeset
|
102 #ifdef HAVE_ASSERT_H |
635df9d22d38
100l patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
8254
diff
changeset
|
103 int n = (36 / pci->hli.hl_gi.btngr_ns) * i + j; |
635df9d22d38
100l patch by (Dominik Mierzejewski <dominik at rangers dot eu dot org>)
michael
parents:
8254
diff
changeset
|
104 #endif |
7029 | 105 assert(pci->hli.btnit[n].zero1 == 0); |
106 assert(pci->hli.btnit[n].zero2 == 0); | |
107 assert(pci->hli.btnit[n].zero3 == 0); | |
108 assert(pci->hli.btnit[n].zero4 == 0); | |
109 assert(pci->hli.btnit[n].zero5 == 0); | |
110 assert(pci->hli.btnit[n].zero6 == 0); | |
111 | |
112 if (j < pci->hli.hl_gi.btn_ns) { | |
113 assert(pci->hli.btnit[n].x_start <= pci->hli.btnit[n].x_end); | |
114 assert(pci->hli.btnit[n].y_start <= pci->hli.btnit[n].y_end); | |
115 assert(pci->hli.btnit[n].up <= pci->hli.hl_gi.btn_ns); | |
116 assert(pci->hli.btnit[n].down <= pci->hli.hl_gi.btn_ns); | |
117 assert(pci->hli.btnit[n].left <= pci->hli.hl_gi.btn_ns); | |
118 assert(pci->hli.btnit[n].right <= pci->hli.hl_gi.btn_ns); | |
119 //vmcmd_verify(pci->hli.btnit[n].cmd); | |
120 } else { | |
121 assert(pci->hli.btnit[n].btn_coln == 0); | |
122 assert(pci->hli.btnit[n].auto_action_mode == 0); | |
123 assert(pci->hli.btnit[n].x_start == 0); | |
124 assert(pci->hli.btnit[n].y_start == 0); | |
125 assert(pci->hli.btnit[n].x_end == 0); | |
126 assert(pci->hli.btnit[n].y_end == 0); | |
127 assert(pci->hli.btnit[n].up == 0); | |
128 assert(pci->hli.btnit[n].down == 0); | |
129 assert(pci->hli.btnit[n].left == 0); | |
130 assert(pci->hli.btnit[n].right == 0); | |
131 for (k = 0; k < 8; k++) | |
132 assert(pci->hli.btnit[n].cmd.bytes[k] == 0); //CHECK_ZERO? | |
133 } | |
134 } | |
135 } | |
136 } | |
137 | |
138 void navRead_DSI(dsi_t *dsi, unsigned char *buffer) { | |
139 int i; | |
140 | |
141 assert(sizeof(dsi_t) == DSI_BYTES - 1); // -1 for substream id | |
142 | |
143 memcpy(dsi, buffer, sizeof(dsi_t)); | |
144 | |
145 /* Endian conversions */ | |
146 | |
147 /* dsi dsi gi */ | |
148 B2N_32(dsi->dsi_gi.nv_pck_scr); | |
149 B2N_32(dsi->dsi_gi.nv_pck_lbn); | |
150 B2N_32(dsi->dsi_gi.vobu_ea); | |
151 B2N_32(dsi->dsi_gi.vobu_1stref_ea); | |
152 B2N_32(dsi->dsi_gi.vobu_2ndref_ea); | |
153 B2N_32(dsi->dsi_gi.vobu_3rdref_ea); | |
154 B2N_16(dsi->dsi_gi.vobu_vob_idn); | |
155 | |
156 /* dsi sml pbi */ | |
157 B2N_16(dsi->sml_pbi.category); | |
158 B2N_32(dsi->sml_pbi.ilvu_ea); | |
159 B2N_32(dsi->sml_pbi.ilvu_sa); | |
160 B2N_16(dsi->sml_pbi.size); | |
161 B2N_32(dsi->sml_pbi.vob_v_s_s_ptm); | |
162 B2N_32(dsi->sml_pbi.vob_v_e_e_ptm); | |
163 | |
164 /* dsi sml agli */ | |
165 for(i = 0; i < 9; i++) { | |
166 B2N_32(dsi->sml_agli.data[ i ].address); | |
167 B2N_16(dsi->sml_agli.data[ i ].size); | |
168 } | |
169 | |
170 /* dsi vobu sri */ | |
171 B2N_32(dsi->vobu_sri.next_video); | |
172 for(i = 0; i < 19; i++) | |
173 B2N_32(dsi->vobu_sri.fwda[i]); | |
174 B2N_32(dsi->vobu_sri.next_vobu); | |
175 B2N_32(dsi->vobu_sri.prev_vobu); | |
176 for(i = 0; i < 19; i++) | |
177 B2N_32(dsi->vobu_sri.bwda[i]); | |
178 B2N_32(dsi->vobu_sri.prev_video); | |
179 | |
180 /* dsi synci */ | |
181 for(i = 0; i < 8; i++) | |
182 B2N_16(dsi->synci.a_synca[i]); | |
183 for(i = 0; i < 32; i++) | |
184 B2N_32(dsi->synci.sp_synca[i]); | |
185 | |
186 | |
187 /* Asserts */ | |
188 | |
189 /* dsi dsi gi */ | |
190 assert(dsi->dsi_gi.zero1 == 0); | |
191 } | |
192 |