annotate libmpdemux/vcd_read_darwin.h @ 17774:30fa0638b78d

We start with 0, so ch (channel number) == AF_NCH is invalid, too (not just >)
author reimar
date Wed, 08 Mar 2006 13:00:51 +0000
parents aa15d627a00b
children 4231482179b6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13842
78e5886bc211 fix build on darwin ppc
nplourde
parents: 13682
diff changeset
1 #include <sys/types.h>
78e5886bc211 fix build on darwin ppc
nplourde
parents: 13682
diff changeset
2 #include <CoreFoundation/CFBase.h>
78e5886bc211 fix build on darwin ppc
nplourde
parents: 13682
diff changeset
3 #include <IOKit/IOKitLib.h>
78e5886bc211 fix build on darwin ppc
nplourde
parents: 13682
diff changeset
4 #include <IOKit/storage/IOCDTypes.h>
78e5886bc211 fix build on darwin ppc
nplourde
parents: 13682
diff changeset
5 #include <IOKit/storage/IOCDMedia.h>
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
6 #include <IOKit/storage/IOCDMediaBSDClient.h>
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
7
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
8 //=================== VideoCD ==========================
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
9 #define CDROM_LEADOUT 0xAA
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
10
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
11 typedef struct
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
12 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
13 uint8_t sync [12];
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
14 uint8_t header [4];
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
15 uint8_t subheader [8];
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
16 uint8_t data [2324];
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
17 uint8_t spare [4];
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
18 } cdsector_t;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
19
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
20 typedef struct mp_vcd_priv_st
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
21 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
22 int fd;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
23 dk_cd_read_track_info_t entry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
24 CDMSF msf;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
25 cdsector_t buf;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
26 } mp_vcd_priv_t;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
27
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
28 static inline void vcd_set_msf(mp_vcd_priv_t* vcd, unsigned int sect)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
29 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
30 vcd->msf.frame=sect%75;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
31 sect=sect/75;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
32 vcd->msf.second=sect%60;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
33 sect=sect/60;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
34 vcd->msf.minute=sect;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
35 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
36
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
37 static inline unsigned int vcd_get_msf(mp_vcd_priv_t* vcd)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
38 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
39 return vcd->msf.frame +
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
40 (vcd->msf.second+
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
41 vcd->msf.minute*60)*75;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
42
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
43 return 0;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
44 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
45
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
46 int vcd_seek_to_track(mp_vcd_priv_t* vcd, int track)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
47 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
48 dk_cd_read_track_info_t tocentry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
49 struct CDTrackInfo entry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
50
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
51 memset( &vcd->entry, 0, sizeof(vcd->entry));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
52 vcd->entry.addressType = kCDTrackInfoAddressTypeTrackNumber;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
53 vcd->entry.address = track;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
54 vcd->entry.bufferLength = sizeof(entry);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
55 vcd->entry.buffer = &entry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
56
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
57 if (ioctl(vcd->fd, DKIOCCDREADTRACKINFO, &vcd->entry))
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
58 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
59 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif1: %s\n",strerror(errno));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
60 return -1;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
61 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
62 return VCD_SECTOR_DATA*vcd_get_msf(vcd);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
63
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
64 return -1;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
65 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
66
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
67 int vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
68 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
69 dk_cd_read_disc_info_t tochdr;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
70 struct CDDiscInfo hdr;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
71
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
72 dk_cd_read_track_info_t tocentry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
73 struct CDTrackInfo entry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
74
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
75 //read toc header
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
76 memset(&tochdr, 0, sizeof(tochdr));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
77 tochdr.buffer = &hdr;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
78 tochdr.bufferLength = sizeof(hdr);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
79
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
80 if (ioctl(vcd->fd, DKIOCCDREADDISCINFO, &tochdr) < 0)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
81 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
82 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc header: %s\n",strerror(errno));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
83 return NULL;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
84 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
85
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
86 //read track info
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
87 memset( &vcd->entry, 0, sizeof(vcd->entry));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
88 vcd->entry.addressType = kCDTrackInfoAddressTypeTrackNumber;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
89 vcd->entry.address = track<(hdr.lastTrackNumberInLastSessionLSB+1)?(track):CDROM_LEADOUT;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
90 vcd->entry.bufferLength = sizeof(entry);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
91 vcd->entry.buffer = &entry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
92
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
93 if (ioctl(vcd->fd, DKIOCCDREADTRACKINFO, &vcd->entry))
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
94 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
95 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif2: %s\n",strerror(errno));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
96 return -1;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
97 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
98 return VCD_SECTOR_DATA*vcd_get_msf(vcd);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
99
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
100 return -1;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
101 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
102
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
103 mp_vcd_priv_t* vcd_read_toc(int fd)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
104 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
105 dk_cd_read_disc_info_t tochdr;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
106 struct CDDiscInfo hdr;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
107
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
108 dk_cd_read_track_info_t tocentry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
109 struct CDTrackInfo entry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
110 CDMSF trackMSF;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
111
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
112 mp_vcd_priv_t* vcd;
16547
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
113 int i, min = 0, sec = 0, frame = 0;
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
114
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
115 //read toc header
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
116 memset(&tochdr, 0, sizeof(tochdr));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
117 tochdr.buffer = &hdr;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
118 tochdr.bufferLength = sizeof(hdr);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
119
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
120 if (ioctl(fd, DKIOCCDREADDISCINFO, &tochdr) < 0)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
121 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
122 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc header: %s\n",strerror(errno));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
123 return NULL;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
124 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
125
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
126 //print all track info
16547
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
127 if (identify)
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
128 {
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
129 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_START_TRACK=%d\n", hdr.firstTrackNumberInLastSessionLSB);
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
130 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_END_TRACK=%d\n", hdr.lastTrackNumberInLastSessionLSB);
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
131 }
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
132 for (i=hdr.firstTrackNumberInLastSessionLSB ; i<=hdr.lastTrackNumberInLastSessionLSB + 1; i++)
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
133 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
134 memset( &tocentry, 0, sizeof(tocentry));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
135 tocentry.addressType = kCDTrackInfoAddressTypeTrackNumber;
16547
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
136 tocentry.address = i<=hdr.lastTrackNumberInLastSessionLSB ? i : CDROM_LEADOUT;
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
137 tocentry.bufferLength = sizeof(entry);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
138 tocentry.buffer = &entry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
139
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
140 if (ioctl(fd,DKIOCCDREADTRACKINFO,&tocentry)==-1)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
141 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
142 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
143 return NULL;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
144 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
145
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
146 trackMSF = CDConvertLBAToMSF(entry.trackStartAddress);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
147
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
148 //mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d\n",
16547
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
149 if (i<=hdr.lastTrackNumberInLastSessionLSB)
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
150 mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d: format=%d %02d:%02d:%02d\n",
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
151 (int)tocentry.address,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
152 //(int)tocentry.entry.addr_type,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
153 //(int)tocentry.entry.control,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
154 (int)tocentry.addressType,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
155 (int)trackMSF.minute,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
156 (int)trackMSF.second,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
157 (int)trackMSF.frame
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
158 );
16547
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
159
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
160 if (identify)
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
161 {
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
162 if (i > hdr.firstTrackNumberInLastSessionLSB)
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
163 {
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
164 min = trackMSF.minute - min;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
165 sec = trackMSF.second - sec;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
166 frame = trackMSF.frame - frame;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
167 if ( frame < 0 )
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
168 {
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
169 frame += 75;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
170 sec --;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
171 }
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
172 if ( sec < 0 )
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
173 {
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
174 sec += 60;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
175 min --;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
176 }
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
177 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_TRACK_%d_MSF=%02d:%02d:%02d\n", i - 1, min, sec, frame);
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
178 }
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
179 min = trackMSF.minute;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
180 sec = trackMSF.second;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
181 frame = trackMSF.frame;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
182 }
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
183 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
184
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
185 vcd = malloc(sizeof(mp_vcd_priv_t));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
186 vcd->fd = fd;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
187 vcd->msf = trackMSF;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
188 return vcd;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
189
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
190 return NULL;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
191 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
192
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
193 static int vcd_read(mp_vcd_priv_t* vcd,char *mem)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
194 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
195 if (pread(vcd->fd,&vcd->buf,VCD_SECTOR_SIZE,vcd_get_msf(vcd)*VCD_SECTOR_SIZE) != VCD_SECTOR_SIZE)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
196 return 0; // EOF?
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
197
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
198 vcd->msf.frame++;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
199 if (vcd->msf.frame==75)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
200 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
201 vcd->msf.frame=0;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
202 vcd->msf.second++;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
203
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
204 if (vcd->msf.second==60)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
205 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
206 vcd->msf.second=0;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
207 vcd->msf.minute++;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
208 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
209 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
210
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
211 memcpy(mem,vcd->buf.data,VCD_SECTOR_DATA);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
212 return VCD_SECTOR_DATA;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
213 return 0;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
214 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
215