annotate stream/vcd_read_os2.h @ 36721:e9044aed2250

Fix issue with testing of the help message header files. In order for all definitions to be checked properly, we cannot rely on config.h, but must assure that all conditional symbolic constants are defined.
author ib
date Sun, 09 Feb 2014 09:22:09 +0000
parents 3a192d8ecc56
children 1471cf0a74f7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30777
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
1 /*
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
2 * implementation of VCD IO for OS/2
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
3 *
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
4 * Copyright (c) 2009 KO Myung-Hun (komh@chollian.net)
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
5 *
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
6 * This file is part of MPlayer.
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
7 *
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
8 * MPlayer is free software; you can redistribute it and/or modify
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
11 * (at your option) any later version.
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
12 *
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
13 * MPlayer is distributed in the hope that it will be useful,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
16 * GNU General Public License for more details.
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
17 *
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License along
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
19 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
21 */
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
22
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
23 #ifndef MPLAYER_VCD_READ_OS2_H
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
24 #define MPLAYER_VCD_READ_OS2_H
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
25
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
26 #include "mp_msg.h"
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
27
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
28 struct __attribute__((packed)) msf {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
29 BYTE bFrame;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
30 BYTE bSecond;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
31 BYTE bMinute;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
32 BYTE bReserved;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
33 };
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
34
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
35 typedef struct {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
36 HFILE hcd;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
37 struct msf msfCurrent;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
38 int iFirstTrack;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
39 int iLastTrack;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
40 struct msf msfLeadOut;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
41 BYTE abVCDSector[VCD_SECTOR_SIZE];
36433
3a192d8ecc56 Revise and fix stream control for VCD.
ib
parents: 33349
diff changeset
42 unsigned int track;
30777
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
43 } mp_vcd_priv_t;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
44
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
45 static inline void vcd_set_msf(mp_vcd_priv_t *vcd, unsigned sect)
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
46 {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
47 sect += 150;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
48 vcd->msfCurrent.bFrame = sect % 75;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
49 sect = sect / 75;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
50 vcd->msfCurrent.bSecond = sect % 60;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
51 sect = sect / 60;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
52 vcd->msfCurrent.bMinute = sect;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
53 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
54
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
55 static inline unsigned vcd_get_msf(mp_vcd_priv_t *vcd)
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
56 {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
57 return vcd->msfCurrent.bFrame +
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
58 (vcd->msfCurrent.bSecond + vcd->msfCurrent.bMinute * 60) * 75 - 150;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
59 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
60
33349
3ab3212fb624 Make vcd_seek_to_track static, the GUI no longer needs to
reimar
parents: 30981
diff changeset
61 static int vcd_seek_to_track(mp_vcd_priv_t *vcd, int track)
30777
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
62 {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
63 struct {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
64 UCHAR auchSign[4];
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
65 BYTE bTrack;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
66 } __attribute__((packed)) sParam = {{'C', 'D', '0', '1'},};
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
67
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
68 struct {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
69 struct msf msfStart;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
70 BYTE bControlInfo;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
71 } __attribute__((packed)) sData;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
72
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
73 ULONG ulParamLen;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
74 ULONG ulDataLen;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
75 ULONG rc;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
76
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
77 sParam.bTrack = track;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
78 rc = DosDevIOCtl(vcd->hcd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIOTRACK,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
79 &sParam, sizeof(sParam), &ulParamLen,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
80 &sData, sizeof(sData), &ulDataLen);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
81 if (rc) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
82 mp_msg(MSGT_STREAM, MSGL_ERR, "DosDevIOCtl(GETAUDIOTRACK) = 0x%lx\n", rc);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
83 return -1;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
84 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
85
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
86 vcd->msfCurrent = sData.msfStart;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
87
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
88 return VCD_SECTOR_DATA * vcd_get_msf(vcd);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
89 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
90
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
91 static int vcd_get_track_end(mp_vcd_priv_t *vcd, int track)
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
92 {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
93 if (track < vcd->iLastTrack)
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
94 return vcd_seek_to_track(vcd, track + 1);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
95
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
96 vcd->msfCurrent = vcd->msfLeadOut;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
97
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
98 return VCD_SECTOR_DATA * vcd_get_msf(vcd);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
99 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
100
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
101 static mp_vcd_priv_t *vcd_read_toc(int fd)
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
102 {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
103 mp_vcd_priv_t *vcd;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
104
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
105 UCHAR auchParamDisk[4] = {'C', 'D', '0', '1'};
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
106
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
107 struct {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
108 BYTE bFirstTrack;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
109 BYTE bLastTrack;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
110 struct msf msfLeadOut;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
111 } __attribute__((packed)) sDataDisk;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
112
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
113 struct {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
114 UCHAR auchSign[4];
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
115 BYTE bTrack;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
116 } __attribute__((packed)) sParamTrack = {{'C', 'D', '0', '1'},};
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
117
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
118 struct {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
119 struct msf msfStart;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
120 BYTE bControlInfo;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
121 } __attribute__((packed)) sDataTrack;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
122
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
123 ULONG ulParamLen;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
124 ULONG ulDataLen;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
125 ULONG rc;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
126 int i, iMinute = 0, iSecond = 0, iFrame = 0;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
127
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
128 rc = DosDevIOCtl(fd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIODISK,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
129 auchParamDisk, sizeof(auchParamDisk), &ulParamLen,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
130 &sDataDisk, sizeof(sDataDisk), &ulDataLen);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
131 if (rc) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
132 mp_msg(MSGT_OPEN, MSGL_ERR, "DosDevIOCtl(GETAUDIODISK) = 0x%lx\n", rc);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
133 return NULL;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
134 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
135
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
136 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_START_TRACK=%d\n", sDataDisk.bFirstTrack);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
137 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_END_TRACK=%d\n", sDataDisk.bLastTrack);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
138
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
139 for (i = sDataDisk.bFirstTrack; i <= sDataDisk.bLastTrack + 1; i++) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
140 if (i <= sDataDisk.bLastTrack) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
141 sParamTrack.bTrack = i;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
142 rc = DosDevIOCtl(fd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIOTRACK,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
143 &sParamTrack, sizeof(sParamTrack), &ulParamLen,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
144 &sDataTrack, sizeof(sDataTrack), &ulDataLen);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
145 if (rc) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
146 mp_msg(MSGT_OPEN, MSGL_ERR, "DosDevIOCtl(GETAUDIOTRACK) = 0x%lx\n", rc);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
147 return NULL;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
148 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
149
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
150 mp_msg(MSGT_OPEN, MSGL_INFO, "track %02d: adr=%d ctrl=%d %02d:%02d:%02d\n",
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
151 i,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
152 sDataTrack.bControlInfo & 0x0F,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
153 sDataTrack.bControlInfo >> 4,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
154 sDataTrack.msfStart.bMinute,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
155 sDataTrack.msfStart.bSecond,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
156 sDataTrack.msfStart.bFrame);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
157 } else
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
158 sDataTrack.msfStart = sDataDisk.msfLeadOut;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
159
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
160 if (mp_msg_test(MSGT_IDENTIFY, MSGL_INFO)) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
161 if (i > sDataDisk.bFirstTrack) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
162 iMinute = sDataTrack.msfStart.bMinute - iMinute;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
163 iSecond = sDataTrack.msfStart.bSecond - iSecond;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
164 iFrame = sDataTrack.msfStart.bFrame - iFrame;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
165 if (iFrame < 0) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
166 iFrame += 75;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
167 iSecond--;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
168 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
169 if (iSecond < 0) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
170 iSecond += 60;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
171 iMinute--;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
172 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
173 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_TRACK_%d_MSF=%02d:%02d:%02d\n",
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
174 i - 1, iMinute, iSecond, iFrame);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
175 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
176
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
177 iMinute = sDataTrack.msfStart.bMinute;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
178 iSecond = sDataTrack.msfStart.bSecond;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
179 iFrame = sDataTrack.msfStart.bFrame;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
180 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
181 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
182
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
183 vcd = calloc(1, sizeof(mp_vcd_priv_t));
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
184 vcd->hcd = fd;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
185 vcd->iFirstTrack = sDataDisk.bFirstTrack;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
186 vcd->iLastTrack = sDataDisk.bLastTrack;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
187 vcd->msfLeadOut = sDataDisk.msfLeadOut;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
188
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
189 return vcd;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
190 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
191
30981
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30777
diff changeset
192 static int vcd_end_track(mp_vcd_priv_t* vcd)
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30777
diff changeset
193 {
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30777
diff changeset
194 return vcd->iLastTrack;
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30777
diff changeset
195 }
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30777
diff changeset
196
30777
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
197 static int vcd_read(mp_vcd_priv_t *vcd, char *mem)
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
198 {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
199 struct {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
200 UCHAR auchSign[4];
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
201 BYTE bAddrMode;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
202 USHORT usSectors;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
203 struct msf msfStart;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
204 BYTE bReserved;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
205 BYTE bInterleavedSize;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
206 } __attribute__((packed)) sParam = {{'C', 'D', '0', '1'}, 1, 1,};
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
207
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
208 ULONG ulParamLen;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
209 ULONG ulDataLen;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
210 ULONG rc;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
211
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
212 /* lead-out ? */
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
213 if (vcd->msfCurrent.bMinute == vcd->msfLeadOut.bMinute &&
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
214 vcd->msfCurrent.bSecond == vcd->msfLeadOut.bSecond &&
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
215 vcd->msfCurrent.bFrame == vcd->msfLeadOut.bFrame)
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
216 return 0;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
217
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
218 sParam.msfStart = vcd->msfCurrent;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
219 rc = DosDevIOCtl(vcd->hcd, IOCTL_CDROMDISK, CDROMDISK_READLONG,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
220 &sParam, sizeof(sParam), &ulParamLen,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
221 vcd->abVCDSector, sizeof(vcd->abVCDSector), &ulDataLen);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
222 if (rc) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
223 mp_msg(MSGT_STREAM, MSGL_ERR, "DosDevIOCtl(READLONG) = 0x%lx\n", rc);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
224 return 0;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
225 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
226
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
227 memcpy(mem, &vcd->abVCDSector[VCD_SECTOR_OFFS], VCD_SECTOR_DATA);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
228
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
229 vcd->msfCurrent.bFrame++;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
230 if (vcd->msfCurrent.bFrame == 75) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
231 vcd->msfCurrent.bFrame = 0;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
232 vcd->msfCurrent.bSecond++;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
233 if (vcd->msfCurrent.bSecond == 60) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
234 vcd->msfCurrent.bSecond = 0;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
235 vcd->msfCurrent.bMinute++;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
236 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
237 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
238
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
239 return VCD_SECTOR_DATA;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
240 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
241
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
242 #endif /* MPLAYER_VCD_READ_OS2_H */
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
243