Mercurial > mplayer.hg
comparison stream/vcd_read_nbsd.h @ 23853:565d08e0ee51
Simplify NetBSD vcd_read code
author | reimar |
---|---|
date | Fri, 27 Jul 2007 16:59:41 +0000 |
parents | f900a440b14d |
children | 3522fdbd3d2a |
comparison
equal
deleted
inserted
replaced
23852:5982ecb1dcdf | 23853:565d08e0ee51 |
---|---|
1 | 1 |
2 #include <sys/types.h> | 2 #include <sys/types.h> |
3 #ifdef __NetBSD__ | 3 #ifdef __NetBSD__ |
4 #include <sys/inttypes.h> | 4 #include <sys/inttypes.h> |
5 #endif | 5 #endif |
6 #include "libavutil/intreadwrite.h" | |
6 #include <sys/cdio.h> | 7 #include <sys/cdio.h> |
7 #include <sys/scsiio.h> | 8 #include <sys/scsiio.h> |
8 | 9 |
9 #define CDROM_LEADOUT 0xAA | 10 #define CDROM_LEADOUT 0xAA |
10 #define TOCADDR(te) ((te).data->addr) | 11 #define TOCADDR(te) ((te).data->addr) |
153 vcd_read(mp_vcd_priv_t* vcd, char *mem) | 154 vcd_read(mp_vcd_priv_t* vcd, char *mem) |
154 { | 155 { |
155 struct scsireq sc; | 156 struct scsireq sc; |
156 int lba = vcd_get_msf(vcd); | 157 int lba = vcd_get_msf(vcd); |
157 int blocks; | 158 int blocks; |
158 int sector_type; | |
159 int sync, header_code, user_data, edc_ecc, error_field; | |
160 int sub_channel; | |
161 int rc; | 159 int rc; |
162 | 160 |
163 blocks = 1; | 161 blocks = 1; |
164 sector_type = 5; /* mode2/form2 */ | |
165 sync = 0; | |
166 header_code = 0; | |
167 user_data = 1; | |
168 edc_ecc = 0; | |
169 error_field = 0; | |
170 sub_channel = 0; | |
171 | 162 |
172 memset(&sc, 0, sizeof(sc)); | 163 memset(&sc, 0, sizeof(sc)); |
173 sc.cmd[0] = 0xBE; | 164 sc.cmd[0] = 0xBE; |
174 sc.cmd[1] = (sector_type) << 2; | 165 sc.cmd[1] = 5 << 2; // mode2/form2 |
175 sc.cmd[2] = (lba >> 24) & 0xff; | 166 AV_WB32(&sc.cmd[2], lba); |
176 sc.cmd[3] = (lba >> 16) & 0xff; | 167 AV_WB24(&sc.cmd[6], blocks); |
177 sc.cmd[4] = (lba >> 8) & 0xff; | 168 sc.cmd[9] = 1 << 4; // user data only |
178 sc.cmd[5] = lba & 0xff; | 169 sc.cmd[10] = 0; // no subchannel |
179 sc.cmd[6] = (blocks >> 16) & 0xff; | |
180 sc.cmd[7] = (blocks >> 8) & 0xff; | |
181 sc.cmd[8] = blocks & 0xff; | |
182 sc.cmd[9] = (sync << 7) | (header_code << 5) | (user_data << 4) | | |
183 (edc_ecc << 3) | (error_field << 1); | |
184 sc.cmd[10] = sub_channel; | |
185 sc.cmdlen = 12; | 170 sc.cmdlen = 12; |
186 sc.databuf = (caddr_t) mem; | 171 sc.databuf = (caddr_t) mem; |
187 sc.datalen = 2328; | 172 sc.datalen = 2328; |
188 sc.senselen = sizeof(sc.sense); | 173 sc.senselen = sizeof(sc.sense); |
189 sc.flags = SCCMD_READ; | 174 sc.flags = SCCMD_READ; |