Mercurial > mplayer.hg
comparison stream/vcd_read_nbsd.h @ 23849:2911a78219a8
Cosmetics to reduce diff between Free- and netBSD vcd stuff
author | reimar |
---|---|
date | Thu, 26 Jul 2007 23:15:54 +0000 |
parents | 2ab8edad035d |
children | f900a440b14d |
comparison
equal
deleted
inserted
replaced
23848:2ab8edad035d | 23849:2911a78219a8 |
---|---|
13 int fd; | 13 int fd; |
14 struct ioc_read_toc_entry entry; | 14 struct ioc_read_toc_entry entry; |
15 struct cd_toc_entry entry_data; | 15 struct cd_toc_entry entry_data; |
16 } mp_vcd_priv_t; | 16 } mp_vcd_priv_t; |
17 | 17 |
18 static inline void | 18 static inline void |
19 vcd_set_msf(mp_vcd_priv_t* vcd, unsigned int sect) | 19 vcd_set_msf(mp_vcd_priv_t* vcd, unsigned int sect) |
20 { | 20 { |
21 vcd->entry.data = &vcd->entry_data; | 21 vcd->entry.data = &vcd->entry_data; |
22 TOCADDR(vcd->entry).msf.frame = sect % 75; | 22 TOCADDR(vcd->entry).msf.frame = sect % 75; |
23 sect = sect / 75; | 23 sect = sect / 75; |
39 TOCADDR(vcd->entry).msf.minute++; | 39 TOCADDR(vcd->entry).msf.minute++; |
40 } | 40 } |
41 } | 41 } |
42 } | 42 } |
43 | 43 |
44 static inline unsigned int | 44 static inline unsigned int |
45 vcd_get_msf(mp_vcd_priv_t* vcd) | 45 vcd_get_msf(mp_vcd_priv_t* vcd) |
46 { | 46 { |
47 vcd->entry.data = &vcd->entry_data; | 47 vcd->entry.data = &vcd->entry_data; |
48 return TOCADDR(vcd->entry).msf.frame + | 48 return TOCADDR(vcd->entry).msf.frame + |
49 (TOCADDR(vcd->entry).msf.second + | 49 (TOCADDR(vcd->entry).msf.second + |
50 TOCADDR(vcd->entry).msf.minute * 60) * 75; | 50 TOCADDR(vcd->entry).msf.minute * 60) * 75; |
51 } | 51 } |
52 | 52 |
53 int | 53 int |
54 vcd_seek_to_track(mp_vcd_priv_t* vcd, int track) | 54 vcd_seek_to_track(mp_vcd_priv_t* vcd, int track) |
55 { | 55 { |
56 vcd->entry.address_format = CD_MSF_FORMAT; | 56 vcd->entry.address_format = CD_MSF_FORMAT; |
57 vcd->entry.starting_track = track; | 57 vcd->entry.starting_track = track; |
58 vcd->entry.data_len = sizeof(struct cd_toc_entry); | 58 vcd->entry.data_len = sizeof(struct cd_toc_entry); |
62 return -1; | 62 return -1; |
63 } | 63 } |
64 return VCD_SECTOR_DATA * vcd_get_msf(vcd); | 64 return VCD_SECTOR_DATA * vcd_get_msf(vcd); |
65 } | 65 } |
66 | 66 |
67 int | 67 int |
68 vcd_get_track_end(mp_vcd_priv_t* vcd, int track) | 68 vcd_get_track_end(mp_vcd_priv_t* vcd, int track) |
69 { | 69 { |
70 struct ioc_toc_header tochdr; | 70 struct ioc_toc_header tochdr; |
71 if (ioctl(vcd->fd, CDIOREADTOCHEADER, &tochdr) == -1) { | 71 if (ioctl(vcd->fd, CDIOREADTOCHEADER, &tochdr) == -1) { |
72 mp_msg(MSGT_STREAM,MSGL_ERR,"read CDROM toc header: %s\n",strerror(errno)); | 72 mp_msg(MSGT_STREAM,MSGL_ERR,"read CDROM toc header: %s\n",strerror(errno)); |
106 | 106 |
107 if (ioctl(fd, CDIOREADTOCENTRYS, &tocentry) == -1) { | 107 if (ioctl(fd, CDIOREADTOCENTRYS, &tocentry) == -1) { |
108 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno)); | 108 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno)); |
109 return NULL; | 109 return NULL; |
110 } | 110 } |
111 | |
111 if (i <= tochdr.ending_track) | 112 if (i <= tochdr.ending_track) |
112 mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d\n", | 113 mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d\n", |
113 (int) tocentry.starting_track, | 114 (int)tocentry.starting_track, |
114 (int) tocentry.data->addr_type, | 115 (int)tocentry.data->addr_type, |
115 (int) tocentry.data->control, | 116 (int)tocentry.data->control, |
116 (int) tocentry.address_format, | 117 (int)tocentry.address_format, |
117 (int) TOCADDR(tocentry).msf.minute, | 118 (int)TOCADDR(tocentry).msf.minute, |
118 (int) TOCADDR(tocentry).msf.second, | 119 (int)TOCADDR(tocentry).msf.second, |
119 (int) TOCADDR(tocentry).msf.frame | 120 (int)TOCADDR(tocentry).msf.frame |
120 ); | 121 ); |
121 | 122 |
122 if (mp_msg_test(MSGT_IDENTIFY, MSGL_INFO)) | 123 if (mp_msg_test(MSGT_IDENTIFY, MSGL_INFO)) |
123 { | 124 { |
124 if (i > tochdr.starting_track) | 125 if (i > tochdr.starting_track) |
146 vcd = malloc(sizeof(mp_vcd_priv_t)); | 147 vcd = malloc(sizeof(mp_vcd_priv_t)); |
147 vcd->fd = fd; | 148 vcd->fd = fd; |
148 return vcd; | 149 return vcd; |
149 } | 150 } |
150 | 151 |
151 static int | 152 static int |
152 vcd_read(mp_vcd_priv_t* vcd, char *mem) | 153 vcd_read(mp_vcd_priv_t* vcd, char *mem) |
153 { | 154 { |
154 struct scsireq sc; | 155 struct scsireq sc; |
155 int lba = vcd_get_msf(vcd); | 156 int lba = vcd_get_msf(vcd); |
156 int blocks; | 157 int blocks; |