annotate stream/vcd_read_os2.h @ 33959:ef089a8affc6

Perform a wsHandleEvents() when playback ends. This fixes a redraw problem with the subwindow (video window) image that could appear twice (on a wrong position).
author ib
date Thu, 01 Sep 2011 19:14:11 +0000
parents 3ab3212fb624
children 3a192d8ecc56
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];
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
42 } mp_vcd_priv_t;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
43
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
44 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
45 {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
46 sect += 150;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
47 vcd->msfCurrent.bFrame = sect % 75;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
48 sect = sect / 75;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
49 vcd->msfCurrent.bSecond = sect % 60;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
50 sect = sect / 60;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
51 vcd->msfCurrent.bMinute = sect;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
52 }
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 static inline unsigned vcd_get_msf(mp_vcd_priv_t *vcd)
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
55 {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
56 return vcd->msfCurrent.bFrame +
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
57 (vcd->msfCurrent.bSecond + vcd->msfCurrent.bMinute * 60) * 75 - 150;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
58 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
59
33349
3ab3212fb624 Make vcd_seek_to_track static, the GUI no longer needs to
reimar
parents: 30981
diff changeset
60 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
61 {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
62 struct {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
63 UCHAR auchSign[4];
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
64 BYTE bTrack;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
65 } __attribute__((packed)) sParam = {{'C', 'D', '0', '1'},};
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
66
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
67 struct {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
68 struct msf msfStart;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
69 BYTE bControlInfo;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
70 } __attribute__((packed)) sData;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
71
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
72 ULONG ulParamLen;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
73 ULONG ulDataLen;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
74 ULONG rc;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
75
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
76 sParam.bTrack = track;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
77 rc = DosDevIOCtl(vcd->hcd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIOTRACK,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
78 &sParam, sizeof(sParam), &ulParamLen,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
79 &sData, sizeof(sData), &ulDataLen);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
80 if (rc) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
81 mp_msg(MSGT_STREAM, MSGL_ERR, "DosDevIOCtl(GETAUDIOTRACK) = 0x%lx\n", rc);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
82 return -1;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
83 }
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 vcd->msfCurrent = sData.msfStart;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
86
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
87 return VCD_SECTOR_DATA * vcd_get_msf(vcd);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
88 }
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 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
91 {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
92 if (track < vcd->iLastTrack)
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
93 return vcd_seek_to_track(vcd, track + 1);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
94
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
95 vcd->msfCurrent = vcd->msfLeadOut;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
96
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
97 return VCD_SECTOR_DATA * vcd_get_msf(vcd);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
98 }
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 static mp_vcd_priv_t *vcd_read_toc(int fd)
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
101 {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
102 mp_vcd_priv_t *vcd;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
103
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
104 UCHAR auchParamDisk[4] = {'C', 'D', '0', '1'};
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
105
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
106 struct {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
107 BYTE bFirstTrack;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
108 BYTE bLastTrack;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
109 struct msf msfLeadOut;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
110 } __attribute__((packed)) sDataDisk;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
111
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
112 struct {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
113 UCHAR auchSign[4];
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
114 BYTE bTrack;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
115 } __attribute__((packed)) sParamTrack = {{'C', 'D', '0', '1'},};
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
116
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
117 struct {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
118 struct msf msfStart;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
119 BYTE bControlInfo;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
120 } __attribute__((packed)) sDataTrack;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
121
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
122 ULONG ulParamLen;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
123 ULONG ulDataLen;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
124 ULONG rc;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
125 int i, iMinute = 0, iSecond = 0, iFrame = 0;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
126
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
127 rc = DosDevIOCtl(fd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIODISK,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
128 auchParamDisk, sizeof(auchParamDisk), &ulParamLen,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
129 &sDataDisk, sizeof(sDataDisk), &ulDataLen);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
130 if (rc) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
131 mp_msg(MSGT_OPEN, MSGL_ERR, "DosDevIOCtl(GETAUDIODISK) = 0x%lx\n", rc);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
132 return NULL;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
133 }
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 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
136 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
137
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
138 for (i = sDataDisk.bFirstTrack; i <= sDataDisk.bLastTrack + 1; i++) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
139 if (i <= sDataDisk.bLastTrack) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
140 sParamTrack.bTrack = i;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
141 rc = DosDevIOCtl(fd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIOTRACK,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
142 &sParamTrack, sizeof(sParamTrack), &ulParamLen,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
143 &sDataTrack, sizeof(sDataTrack), &ulDataLen);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
144 if (rc) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
145 mp_msg(MSGT_OPEN, MSGL_ERR, "DosDevIOCtl(GETAUDIOTRACK) = 0x%lx\n", rc);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
146 return NULL;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
147 }
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 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
150 i,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
151 sDataTrack.bControlInfo & 0x0F,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
152 sDataTrack.bControlInfo >> 4,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
153 sDataTrack.msfStart.bMinute,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
154 sDataTrack.msfStart.bSecond,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
155 sDataTrack.msfStart.bFrame);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
156 } else
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
157 sDataTrack.msfStart = sDataDisk.msfLeadOut;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
158
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
159 if (mp_msg_test(MSGT_IDENTIFY, MSGL_INFO)) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
160 if (i > sDataDisk.bFirstTrack) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
161 iMinute = sDataTrack.msfStart.bMinute - iMinute;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
162 iSecond = sDataTrack.msfStart.bSecond - iSecond;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
163 iFrame = sDataTrack.msfStart.bFrame - iFrame;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
164 if (iFrame < 0) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
165 iFrame += 75;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
166 iSecond--;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
167 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
168 if (iSecond < 0) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
169 iSecond += 60;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
170 iMinute--;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
171 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
172 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
173 i - 1, iMinute, iSecond, iFrame);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
174 }
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 iMinute = sDataTrack.msfStart.bMinute;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
177 iSecond = sDataTrack.msfStart.bSecond;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
178 iFrame = sDataTrack.msfStart.bFrame;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
179 }
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 vcd = calloc(1, sizeof(mp_vcd_priv_t));
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
183 vcd->hcd = fd;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
184 vcd->iFirstTrack = sDataDisk.bFirstTrack;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
185 vcd->iLastTrack = sDataDisk.bLastTrack;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
186 vcd->msfLeadOut = sDataDisk.msfLeadOut;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
187
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
188 return vcd;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
189 }
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
190
30981
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30777
diff changeset
191 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
192 {
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30777
diff changeset
193 return vcd->iLastTrack;
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30777
diff changeset
194 }
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30777
diff changeset
195
30777
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
196 static int vcd_read(mp_vcd_priv_t *vcd, char *mem)
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
197 {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
198 struct {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
199 UCHAR auchSign[4];
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
200 BYTE bAddrMode;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
201 USHORT usSectors;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
202 struct msf msfStart;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
203 BYTE bReserved;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
204 BYTE bInterleavedSize;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
205 } __attribute__((packed)) sParam = {{'C', 'D', '0', '1'}, 1, 1,};
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
206
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
207 ULONG ulParamLen;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
208 ULONG ulDataLen;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
209 ULONG rc;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
210
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
211 /* lead-out ? */
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
212 if (vcd->msfCurrent.bMinute == vcd->msfLeadOut.bMinute &&
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
213 vcd->msfCurrent.bSecond == vcd->msfLeadOut.bSecond &&
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
214 vcd->msfCurrent.bFrame == vcd->msfLeadOut.bFrame)
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
215 return 0;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
216
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
217 sParam.msfStart = vcd->msfCurrent;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
218 rc = DosDevIOCtl(vcd->hcd, IOCTL_CDROMDISK, CDROMDISK_READLONG,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
219 &sParam, sizeof(sParam), &ulParamLen,
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
220 vcd->abVCDSector, sizeof(vcd->abVCDSector), &ulDataLen);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
221 if (rc) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
222 mp_msg(MSGT_STREAM, MSGL_ERR, "DosDevIOCtl(READLONG) = 0x%lx\n", rc);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
223 return 0;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
224 }
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 memcpy(mem, &vcd->abVCDSector[VCD_SECTOR_OFFS], VCD_SECTOR_DATA);
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
227
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
228 vcd->msfCurrent.bFrame++;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
229 if (vcd->msfCurrent.bFrame == 75) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
230 vcd->msfCurrent.bFrame = 0;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
231 vcd->msfCurrent.bSecond++;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
232 if (vcd->msfCurrent.bSecond == 60) {
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
233 vcd->msfCurrent.bSecond = 0;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
234 vcd->msfCurrent.bMinute++;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
235 }
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 return VCD_SECTOR_DATA;
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
239 }
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 #endif /* MPLAYER_VCD_READ_OS2_H */
079be31079d3 Add a VCD support for OS/2
komh
parents:
diff changeset
242