annotate stream/vcd_read_darwin.h @ 19283:f3866a8ed333

Change toplevel Makefile to invoke subdirectory Makefiles unconditionally by default. Ensures that dependencies outside the subdirectory (such as header dependencies recorded by "make depend") aren't ignored.
author uau
date Tue, 01 Aug 2006 14:44:07 +0000
parents 64d82a45a05d
children 300e9b7c499f
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
18237
4231482179b6 Get ride of the several if(identify) messy lines and rearangment of some of the output, both patches by Kiriuja mplayer-patches AT en-directo_net, his changes are barely unrelated, nevertheless Im commiting them thogeter just for the sake of my mental healt, I had both patches already applied on my local three
reynaldo
parents: 16547
diff changeset
127 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_START_TRACK=%d\n", hdr.firstTrackNumberInLastSessionLSB);
4231482179b6 Get ride of the several if(identify) messy lines and rearangment of some of the output, both patches by Kiriuja mplayer-patches AT en-directo_net, his changes are barely unrelated, nevertheless Im commiting them thogeter just for the sake of my mental healt, I had both patches already applied on my local three
reynaldo
parents: 16547
diff changeset
128 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_END_TRACK=%d\n", hdr.lastTrackNumberInLastSessionLSB);
16547
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
129 for (i=hdr.firstTrackNumberInLastSessionLSB ; i<=hdr.lastTrackNumberInLastSessionLSB + 1; i++)
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
130 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
131 memset( &tocentry, 0, sizeof(tocentry));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
132 tocentry.addressType = kCDTrackInfoAddressTypeTrackNumber;
16547
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
133 tocentry.address = i<=hdr.lastTrackNumberInLastSessionLSB ? i : CDROM_LEADOUT;
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
134 tocentry.bufferLength = sizeof(entry);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
135 tocentry.buffer = &entry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
136
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
137 if (ioctl(fd,DKIOCCDREADTRACKINFO,&tocentry)==-1)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
138 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
139 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
140 return NULL;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
141 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
142
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
143 trackMSF = CDConvertLBAToMSF(entry.trackStartAddress);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
144
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
145 //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
146 if (i<=hdr.lastTrackNumberInLastSessionLSB)
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
147 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
148 (int)tocentry.address,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
149 //(int)tocentry.entry.addr_type,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
150 //(int)tocentry.entry.control,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
151 (int)tocentry.addressType,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
152 (int)trackMSF.minute,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
153 (int)trackMSF.second,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
154 (int)trackMSF.frame
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
155 );
16547
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
156
18237
4231482179b6 Get ride of the several if(identify) messy lines and rearangment of some of the output, both patches by Kiriuja mplayer-patches AT en-directo_net, his changes are barely unrelated, nevertheless Im commiting them thogeter just for the sake of my mental healt, I had both patches already applied on my local three
reynaldo
parents: 16547
diff changeset
157 if (mp_msg_test(MSGT_IDENTIFY, MSGL_INFO))
16547
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
158 {
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
159 if (i > hdr.firstTrackNumberInLastSessionLSB)
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
160 {
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
161 min = trackMSF.minute - min;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
162 sec = trackMSF.second - sec;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
163 frame = trackMSF.frame - frame;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
164 if ( frame < 0 )
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
165 {
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
166 frame += 75;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
167 sec --;
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 if ( sec < 0 )
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
170 {
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
171 sec += 60;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
172 min --;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
173 }
18237
4231482179b6 Get ride of the several if(identify) messy lines and rearangment of some of the output, both patches by Kiriuja mplayer-patches AT en-directo_net, his changes are barely unrelated, nevertheless Im commiting them thogeter just for the sake of my mental healt, I had both patches already applied on my local three
reynaldo
parents: 16547
diff changeset
174 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_TRACK_%d_MSF=%02d:%02d:%02d\n", i - 1, min, sec, frame);
16547
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
175 }
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
176 min = trackMSF.minute;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
177 sec = trackMSF.second;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
178 frame = trackMSF.frame;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
179 }
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
180 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
181
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
182 vcd = malloc(sizeof(mp_vcd_priv_t));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
183 vcd->fd = fd;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
184 vcd->msf = trackMSF;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
185 return vcd;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
186
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
187 return NULL;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
188 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
189
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
190 static int vcd_read(mp_vcd_priv_t* vcd,char *mem)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
191 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
192 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
193 return 0; // EOF?
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
194
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
195 vcd->msf.frame++;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
196 if (vcd->msf.frame==75)
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=0;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
199 vcd->msf.second++;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
200
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
201 if (vcd->msf.second==60)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
202 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
203 vcd->msf.second=0;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
204 vcd->msf.minute++;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
205 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
206 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
207
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
208 memcpy(mem,vcd->buf.data,VCD_SECTOR_DATA);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
209 return VCD_SECTOR_DATA;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
210 return 0;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
211 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
212