Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
d4926497
Commit
d4926497
authored
Feb 02, 1999
by
Eric Pouech
Committed by
Alexandre Julliard
Feb 02, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed tracks indexing in mcicda.c
Make use of new Wine internal CD ROM interface.
parent
a3e27393
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
159 additions
and
551 deletions
+159
-551
mcicda.c
multimedia/mcicda.c
+159
-551
No files found.
multimedia/mcicda.c
View file @
d4926497
...
@@ -3,47 +3,16 @@
...
@@ -3,47 +3,16 @@
* Sample MCI CDAUDIO Wine Driver for Linux
* Sample MCI CDAUDIO Wine Driver for Linux
*
*
* Copyright 1994 Martin Ayotte
* Copyright 1994 Martin Ayotte
* Copyright 1998-99 Eric Pouech
*/
*/
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include "windows.h"
#include "windows.h"
#include "wine/winuser16.h"
#include "user.h"
#include "user.h"
#include "driver.h"
#include "driver.h"
#include "multimedia.h"
#include "multimedia.h"
#include "debug.h"
#include "debug.h"
#include "cdrom.h"
#ifdef HAVE_LINUX_CDROM_H
# include <linux/cdrom.h>
#endif
#ifdef HAVE_LINUX_UCDROM_H
# include <linux/ucdrom.h>
#endif
#ifdef HAVE_SYS_CDIO_H
# include <sys/cdio.h>
#endif
#if defined(__NetBSD__)
# define CDAUDIO_DEV "/dev/rcd0d"
#elif defined(__FreeBSD__)
# define CDAUDIO_DEV "/dev/rcd0c"
#else
# define CDAUDIO_DEV "/dev/cdrom"
#endif
#define MAX_CDAUDIODRV (1)
#define MAX_CDAUDIO_TRACKS 256
#define CDFRAMES_PERSEC 75
#define CDFRAMES_PERMIN 4500
#define SECONDS_PERMIN 60
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
typedef
struct
{
typedef
struct
{
int
nUseCount
;
/* Incremented for each shared open */
int
nUseCount
;
/* Incremented for each shared open */
BOOL16
fShareable
;
/* TRUE if first open was shareable */
BOOL16
fShareable
;
/* TRUE if first open was shareable */
...
@@ -51,199 +20,77 @@ typedef struct {
...
@@ -51,199 +20,77 @@ typedef struct {
HANDLE16
hCallback
;
/* Callback handle for pending notification */
HANDLE16
hCallback
;
/* Callback handle for pending notification */
MCI_OPEN_PARMS16
openParms
;
MCI_OPEN_PARMS16
openParms
;
DWORD
dwTimeFormat
;
DWORD
dwTimeFormat
;
int
unixdev
;
WINE_CDAUDIO
wcda
;
#ifdef linux
struct
cdrom_subchnl
sc
;
#else
struct
cd_sub_channel_info
sc
;
#endif
int
cdMode
;
int
mciMode
;
int
mciMode
;
UINT16
nCurTrack
;
}
WINE_MCICDAUDIO
;
DWORD
dwCurFrame
;
UINT16
nTracks
;
#define MAX_CDAUDIODRV (1)
DWORD
dwTotalLen
;
static
WINE_MCICDAUDIO
CDADev
[
MAX_CDAUDIODRV
];
LPDWORD
lpdwTrackLen
;
LPDWORD
lpdwTrackPos
;
LPBYTE
lpbTrackFlags
;
DWORD
dwFirstOffset
;
}
WINE_CDAUDIO
;
static
WINE_CDAUDIO
CDADev
[
MAX_CDAUDIODRV
];
#endif
#ifndef CDROM_DATA_TRACK
#define CDROM_DATA_TRACK 0x04
#endif
/*-----------------------------------------------------------------------*/
/*-----------------------------------------------------------------------*/
/**************************************************************************
/**************************************************************************
* CDAUDIO_mciGetOpenDrv [internal]
* CDAUDIO_mciGetOpenDrv [internal]
*/
*/
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
static
WINE_MCICDAUDIO
*
CDAUDIO_mciGetOpenDrv
(
UINT16
wDevID
)
static
WINE_CDAUDIO
*
CDAUDIO_mciGetOpenDrv
(
UINT16
wDevID
)
{
{
if
(
wDevID
>=
MAX_CDAUDIODRV
||
CDADev
[
wDevID
].
nUseCount
==
0
||
if
(
wDevID
>=
MAX_CDAUDIODRV
||
CDADev
[
wDevID
].
nUseCount
==
0
||
CDADev
[
wDevID
].
unixdev
=
=
0
)
{
CDADev
[
wDevID
].
wcda
.
unixdev
<
=
0
)
{
WARN
(
cdaudio
,
"Invalid wDevID=%u
\n
"
,
wDevID
);
WARN
(
cdaudio
,
"Invalid wDevID=%u
\n
"
,
wDevID
);
return
0
;
return
0
;
}
}
return
&
CDADev
[
wDevID
];
return
&
CDADev
[
wDevID
];
}
}
#endif
/**************************************************************************
/**************************************************************************
* CDAUDIO_
GetNumberOfTracks
[internal]
* CDAUDIO_
mciMode
[internal]
*/
*/
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
static
int
CDAUDIO_mciMode
(
int
wcdaMode
)
static
UINT16
CDAUDIO_GetNumberOfTracks
(
WINE_CDAUDIO
*
wcda
)
{
{
#ifdef linux
switch
(
wcdaMode
)
{
struct
cdrom_tochdr
hdr
;
case
WINE_CDA_DONTKNOW
:
return
MCI_MODE_STOP
;
#else
case
WINE_CDA_NOTREADY
:
return
MCI_MODE_STOP
;
struct
ioc_toc_header
hdr
;
case
WINE_CDA_OPEN
:
return
MCI_MODE_OPEN
;
#endif
case
WINE_CDA_PLAY
:
return
MCI_MODE_PLAY
;
case
WINE_CDA_STOP
:
return
MCI_MODE_STOP
;
if
(
wcda
->
nTracks
==
0
)
{
case
WINE_CDA_PAUSE
:
return
MCI_MODE_PAUSE
;
#ifdef linux
default:
if
(
ioctl
(
wcda
->
unixdev
,
CDROMREADTOCHDR
,
&
hdr
))
{
FIXME
(
cdaudio
,
"Unknown mode %04x
\n
"
,
wcdaMode
);
#else
if
(
ioctl
(
wcda
->
unixdev
,
CDIOREADTOCHEADER
,
&
hdr
))
{
#endif
WARN
(
cdaudio
,
"(%p) -- Error occured (%d)!
\n
"
,
wcda
,
errno
);
return
(
WORD
)
-
1
;
}
#ifdef linux
wcda
->
nTracks
=
hdr
.
cdth_trk1
;
#else
wcda
->
nTracks
=
hdr
.
ending_track
-
hdr
.
starting_track
+
1
;
#endif
}
}
return
wcda
->
nTracks
;
return
MCI_MODE_STOP
;
}
}
#endif
/**************************************************************************
/**************************************************************************
* CDAUDIO_
GetTracksInfo
[internal]
* CDAUDIO_
mciGetError
[internal]
*/
*/
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
static
int
CDAUDIO_mciGetError
(
WINE_MCICDAUDIO
*
wmcda
)
static
BOOL32
CDAUDIO_GetTracksInfo
(
WINE_CDAUDIO
*
wcda
)
{
{
int
i
,
length
;
switch
(
wmcda
->
wcda
.
cdaMode
)
{
int
start
,
last_start
=
0
;
case
WINE_CDA_DONTKNOW
:
int
total_length
=
0
;
case
WINE_CDA_NOTREADY
:
return
MCIERR_DEVICE_NOT_READY
;
#ifdef linux
case
WINE_CDA_OPEN
:
return
MCIERR_DEVICE_OPEN
;
struct
cdrom_tocentry
entry
;
case
WINE_CDA_PLAY
:
#else
case
WINE_CDA_STOP
:
struct
ioc_read_toc_entry
entry
;
case
WINE_CDA_PAUSE
:
break
;
struct
cd_toc_entry
toc_buffer
;
default:
#endif
FIXME
(
cdaudio
,
"Unknown mode %04x
\n
"
,
wmcda
->
wcda
.
cdaMode
);
if
(
wcda
->
nTracks
==
0
)
{
if
(
CDAUDIO_GetNumberOfTracks
(
wcda
)
==
(
WORD
)
-
1
)
return
FALSE
;
}
TRACE
(
cdaudio
,
"nTracks=%u
\n
"
,
wcda
->
nTracks
);
if
(
wcda
->
lpdwTrackLen
!=
NULL
)
free
(
wcda
->
lpdwTrackLen
);
wcda
->
lpdwTrackLen
=
(
LPDWORD
)
malloc
((
wcda
->
nTracks
+
1
)
*
sizeof
(
DWORD
));
if
(
wcda
->
lpdwTrackPos
!=
NULL
)
free
(
wcda
->
lpdwTrackPos
);
wcda
->
lpdwTrackPos
=
(
LPDWORD
)
malloc
((
wcda
->
nTracks
+
1
)
*
sizeof
(
DWORD
));
if
(
wcda
->
lpbTrackFlags
!=
NULL
)
free
(
wcda
->
lpbTrackFlags
);
wcda
->
lpbTrackFlags
=
(
LPBYTE
)
malloc
((
wcda
->
nTracks
+
1
)
*
sizeof
(
BYTE
));
if
(
wcda
->
lpdwTrackLen
==
NULL
||
wcda
->
lpdwTrackPos
==
NULL
||
wcda
->
lpbTrackFlags
==
NULL
)
{
WARN
(
cdaudio
,
"error allocating track table !
\n
"
);
return
FALSE
;
}
memset
(
wcda
->
lpdwTrackLen
,
0
,
(
wcda
->
nTracks
+
1
)
*
sizeof
(
DWORD
));
memset
(
wcda
->
lpdwTrackPos
,
0
,
(
wcda
->
nTracks
+
1
)
*
sizeof
(
DWORD
));
memset
(
wcda
->
lpbTrackFlags
,
0
,
(
wcda
->
nTracks
+
1
)
*
sizeof
(
BYTE
));
for
(
i
=
0
;
i
<=
wcda
->
nTracks
;
i
++
)
{
if
(
i
==
wcda
->
nTracks
)
#ifdef linux
entry
.
cdte_track
=
CDROM_LEADOUT
;
#else
#define LEADOUT 0xaa
entry
.
starting_track
=
LEADOUT
;
/* XXX */
#endif
else
#ifdef linux
entry
.
cdte_track
=
i
+
1
;
#else
entry
.
starting_track
=
i
+
1
;
#endif
#ifdef linux
entry
.
cdte_format
=
CDROM_MSF
;
#else
bzero
((
char
*
)
&
toc_buffer
,
sizeof
(
toc_buffer
));
entry
.
address_format
=
CD_MSF_FORMAT
;
entry
.
data_len
=
sizeof
(
toc_buffer
);
entry
.
data
=
&
toc_buffer
;
#endif
#ifdef linux
if
(
ioctl
(
wcda
->
unixdev
,
CDROMREADTOCENTRY
,
&
entry
))
{
#else
if
(
ioctl
(
wcda
->
unixdev
,
CDIOREADTOCENTRYS
,
&
entry
))
{
#endif
WARN
(
cdaudio
,
"error read entry (%d)
\n
"
,
errno
);
return
FALSE
;
}
#ifdef linux
start
=
CDFRAMES_PERSEC
*
(
SECONDS_PERMIN
*
entry
.
cdte_addr
.
msf
.
minute
+
entry
.
cdte_addr
.
msf
.
second
)
+
entry
.
cdte_addr
.
msf
.
frame
;
#else
start
=
CDFRAMES_PERSEC
*
(
SECONDS_PERMIN
*
toc_buffer
.
addr
.
msf
.
minute
+
toc_buffer
.
addr
.
msf
.
second
)
+
toc_buffer
.
addr
.
msf
.
frame
;
#endif
if
(
i
==
0
)
{
last_start
=
start
;
wcda
->
dwFirstOffset
=
start
;
TRACE
(
cdaudio
,
"dwFirstOffset=%u
\n
"
,
start
);
}
else
{
length
=
start
-
last_start
;
last_start
=
start
;
start
=
last_start
-
length
;
total_length
+=
length
;
wcda
->
lpdwTrackLen
[
i
-
1
]
=
length
;
wcda
->
lpdwTrackPos
[
i
-
1
]
=
start
;
TRACE
(
cdaudio
,
"track #%u start=%u len=%u
\n
"
,
i
,
start
,
length
);
}
#ifdef linux
wcda
->
lpbTrackFlags
[
i
]
=
(
entry
.
cdte_adr
<<
4
)
|
(
entry
.
cdte_ctrl
&
0x0f
);
#else
wcda
->
lpbTrackFlags
[
i
]
=
(
toc_buffer
.
addr_type
<<
4
)
|
(
toc_buffer
.
control
&
0x0f
);
#endif
TRACE
(
cdaudio
,
"track #%u flags=%02x
\n
"
,
i
+
1
,
wcda
->
lpbTrackFlags
[
i
]);
}
}
wcda
->
dwTotalLen
=
total_length
;
return
MCIERR_DRIVER_INTERNAL
;
TRACE
(
cdaudio
,
"total_len=%u
\n
"
,
total_length
);
return
TRUE
;
}
}
#endif
/**************************************************************************
/**************************************************************************
>>>>>>> 1.9
* CDAUDIO_CalcFrame [internal]
* CDAUDIO_CalcFrame [internal]
*/
*/
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
static
DWORD
CDAUDIO_CalcFrame
(
WINE_MCICDAUDIO
*
wmcda
,
DWORD
dwTime
)
static
DWORD
CDAUDIO_CalcFrame
(
WINE_CDAUDIO
*
wcda
,
DWORD
dwTime
)
{
{
DWORD
dwFrame
=
0
;
DWORD
dwFrame
=
0
;
UINT16
wTrack
;
UINT16
wTrack
;
TRACE
(
cdaudio
,
"(%p, %08lX, %lu);
\n
"
,
w
cda
,
w
cda
->
dwTimeFormat
,
dwTime
);
TRACE
(
cdaudio
,
"(%p, %08lX, %lu);
\n
"
,
w
mcda
,
wm
cda
->
dwTimeFormat
,
dwTime
);
switch
(
wcda
->
dwTimeFormat
)
{
switch
(
w
m
cda
->
dwTimeFormat
)
{
case
MCI_FORMAT_MILLISECONDS
:
case
MCI_FORMAT_MILLISECONDS
:
dwFrame
=
dwTime
*
CDFRAMES_PERSEC
/
1000
;
dwFrame
=
(
dwTime
*
CDFRAMES_PERSEC
)
/
1000
;
TRACE
(
cdaudio
,
"MILLISECONDS %lu
\n
"
,
dwFrame
);
TRACE
(
cdaudio
,
"MILLISECONDS %lu
\n
"
,
dwFrame
);
break
;
break
;
case
MCI_FORMAT_MSF
:
case
MCI_FORMAT_MSF
:
...
@@ -261,8 +108,8 @@ static DWORD CDAUDIO_CalcFrame(WINE_CDAUDIO* wcda, DWORD dwTime)
...
@@ -261,8 +108,8 @@ static DWORD CDAUDIO_CalcFrame(WINE_CDAUDIO* wcda, DWORD dwTime)
MCI_TMSF_TRACK
(
dwTime
),
MCI_TMSF_MINUTE
(
dwTime
),
MCI_TMSF_TRACK
(
dwTime
),
MCI_TMSF_MINUTE
(
dwTime
),
MCI_TMSF_SECOND
(
dwTime
),
MCI_TMSF_FRAME
(
dwTime
));
MCI_TMSF_SECOND
(
dwTime
),
MCI_TMSF_FRAME
(
dwTime
));
TRACE
(
cdaudio
,
"TMSF trackpos[%u]=%lu
\n
"
,
TRACE
(
cdaudio
,
"TMSF trackpos[%u]=%lu
\n
"
,
wTrack
,
w
cda
->
lpdwTrackPos
[
wTrack
-
1
]);
wTrack
,
w
mcda
->
wcda
.
lpdwTrackPos
[
wTrack
-
1
]);
dwFrame
=
w
cda
->
lpdwTrackPos
[
wTrack
-
1
];
dwFrame
=
w
mcda
->
wcda
.
lpdwTrackPos
[
wTrack
-
1
];
dwFrame
+=
CDFRAMES_PERMIN
*
MCI_TMSF_MINUTE
(
dwTime
);
dwFrame
+=
CDFRAMES_PERMIN
*
MCI_TMSF_MINUTE
(
dwTime
);
dwFrame
+=
CDFRAMES_PERSEC
*
MCI_TMSF_SECOND
(
dwTime
);
dwFrame
+=
CDFRAMES_PERSEC
*
MCI_TMSF_SECOND
(
dwTime
);
dwFrame
+=
MCI_TMSF_FRAME
(
dwTime
);
dwFrame
+=
MCI_TMSF_FRAME
(
dwTime
);
...
@@ -270,125 +117,11 @@ static DWORD CDAUDIO_CalcFrame(WINE_CDAUDIO* wcda, DWORD dwTime)
...
@@ -270,125 +117,11 @@ static DWORD CDAUDIO_CalcFrame(WINE_CDAUDIO* wcda, DWORD dwTime)
}
}
return
dwFrame
;
return
dwFrame
;
}
}
#endif
/**************************************************************************
* CDAUDIO_GetCDStatus [internal]
*/
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
static
BOOL32
CDAUDIO_GetCDStatus
(
WINE_CDAUDIO
*
wcda
)
{
int
oldmode
=
wcda
->
cdMode
;
#ifdef linux
wcda
->
sc
.
cdsc_format
=
CDROM_MSF
;
#else
struct
ioc_read_subchannel
read_sc
;
read_sc
.
address_format
=
CD_MSF_FORMAT
;
read_sc
.
data_format
=
CD_CURRENT_POSITION
;
read_sc
.
track
=
0
;
read_sc
.
data_len
=
sizeof
(
wcda
->
sc
);
read_sc
.
data
=
(
struct
cd_sub_channel_info
*
)
&
wcda
->
sc
;
#endif
#ifdef linux
if
(
ioctl
(
wcda
->
unixdev
,
CDROMSUBCHNL
,
&
wcda
->
sc
))
{
#else
if
(
ioctl
(
wcda
->
unixdev
,
CDIOCREADSUBCHANNEL
,
&
read_sc
))
{
#endif
TRACE
(
cdaudio
,
"opened or no_media (%d)!
\n
"
,
errno
);
wcda
->
cdMode
=
MCI_MODE_OPEN
;
/* was NOT_READY */
return
TRUE
;
}
switch
(
#ifdef linux
wcda
->
sc
.
cdsc_audiostatus
#else
wcda
->
sc
.
header
.
audio_status
#endif
)
{
#ifdef linux
case
CDROM_AUDIO_INVALID
:
#else
case
CD_AS_AUDIO_INVALID
:
#endif
WARN
(
cdaudio
,
"device doesn't support status, using MCI status.
\n
"
);
wcda
->
cdMode
=
0
;
break
;
#ifdef linux
case
CDROM_AUDIO_NO_STATUS
:
#else
case
CD_AS_NO_STATUS
:
#endif
wcda
->
cdMode
=
MCI_MODE_STOP
;
TRACE
(
cdaudio
,
"MCI_MODE_STOP !
\n
"
);
break
;
#ifdef linux
case
CDROM_AUDIO_PLAY
:
#else
case
CD_AS_PLAY_IN_PROGRESS
:
#endif
wcda
->
cdMode
=
MCI_MODE_PLAY
;
TRACE
(
cdaudio
,
"MCI_MODE_PLAY !
\n
"
);
break
;
#ifdef linux
case
CDROM_AUDIO_PAUSED
:
#else
case
CD_AS_PLAY_PAUSED
:
#endif
wcda
->
cdMode
=
MCI_MODE_PAUSE
;
TRACE
(
cdaudio
,
"MCI_MODE_PAUSE !
\n
"
);
break
;
default:
#ifdef linux
TRACE
(
cdaudio
,
"status=%02X !
\n
"
,
wcda
->
sc
.
cdsc_audiostatus
);
#else
TRACE
(
cdaudio
,
"status=%02X !
\n
"
,
wcda
->
sc
.
header
.
audio_status
);
#endif
}
#ifdef linux
wcda
->
nCurTrack
=
wcda
->
sc
.
cdsc_trk
;
wcda
->
dwCurFrame
=
CDFRAMES_PERMIN
*
wcda
->
sc
.
cdsc_absaddr
.
msf
.
minute
+
CDFRAMES_PERSEC
*
wcda
->
sc
.
cdsc_absaddr
.
msf
.
second
+
wcda
->
sc
.
cdsc_absaddr
.
msf
.
frame
;
#else
wcda
->
nCurTrack
=
wcda
->
sc
.
what
.
position
.
track_number
;
wcda
->
dwCurFrame
=
CDFRAMES_PERMIN
*
wcda
->
sc
.
what
.
position
.
absaddr
.
msf
.
minute
+
CDFRAMES_PERSEC
*
wcda
->
sc
.
what
.
position
.
absaddr
.
msf
.
second
+
wcda
->
sc
.
what
.
position
.
absaddr
.
msf
.
frame
;
#endif
#ifdef linux
TRACE
(
cdaudio
,
"%02u-%02u:%02u:%02u
\n
"
,
wcda
->
sc
.
cdsc_trk
,
wcda
->
sc
.
cdsc_absaddr
.
msf
.
minute
,
wcda
->
sc
.
cdsc_absaddr
.
msf
.
second
,
wcda
->
sc
.
cdsc_absaddr
.
msf
.
frame
);
#else
TRACE
(
cdaudio
,
"%02u-%02u:%02u:%02u
\n
"
,
wcda
->
sc
.
what
.
position
.
track_number
,
wcda
->
sc
.
what
.
position
.
absaddr
.
msf
.
minute
,
wcda
->
sc
.
what
.
position
.
absaddr
.
msf
.
second
,
wcda
->
sc
.
what
.
position
.
absaddr
.
msf
.
frame
);
#endif
if
(
oldmode
!=
wcda
->
cdMode
&&
oldmode
==
MCI_MODE_OPEN
)
{
if
(
!
CDAUDIO_GetTracksInfo
(
wcda
))
{
WARN
(
cdaudio
,
"error updating TracksInfo !
\n
"
);
return
FALSE
;
}
}
return
TRUE
;
}
#endif
/**************************************************************************
/**************************************************************************
* CDAUDIO_CalcTime [internal]
* CDAUDIO_CalcTime [internal]
*/
*/
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
static
DWORD
CDAUDIO_CalcTime
(
WINE_MCICDAUDIO
*
wmcda
,
DWORD
dwFrame
)
static
DWORD
CDAUDIO_CalcTime
(
WINE_CDAUDIO
*
wcda
,
DWORD
dwFrame
)
{
{
DWORD
dwTime
=
0
;
DWORD
dwTime
=
0
;
UINT16
wTrack
;
UINT16
wTrack
;
...
@@ -396,11 +129,11 @@ static DWORD CDAUDIO_CalcTime(WINE_CDAUDIO* wcda, DWORD dwFrame)
...
@@ -396,11 +129,11 @@ static DWORD CDAUDIO_CalcTime(WINE_CDAUDIO* wcda, DWORD dwFrame)
UINT16
wSeconds
;
UINT16
wSeconds
;
UINT16
wFrames
;
UINT16
wFrames
;
TRACE
(
cdaudio
,
"(%p, %08lX, %lu);
\n
"
,
w
cda
,
w
cda
->
dwTimeFormat
,
dwFrame
);
TRACE
(
cdaudio
,
"(%p, %08lX, %lu);
\n
"
,
w
mcda
,
wm
cda
->
dwTimeFormat
,
dwFrame
);
switch
(
wcda
->
dwTimeFormat
)
{
switch
(
w
m
cda
->
dwTimeFormat
)
{
case
MCI_FORMAT_MILLISECONDS
:
case
MCI_FORMAT_MILLISECONDS
:
dwTime
=
dwFrame
/
CDFRAMES_PERSEC
*
1000
;
dwTime
=
(
dwFrame
*
1000
)
/
CDFRAMES_PERSEC
;
TRACE
(
cdaudio
,
"MILLISECONDS %lu
\n
"
,
dwTime
);
TRACE
(
cdaudio
,
"MILLISECONDS %lu
\n
"
,
dwTime
);
break
;
break
;
case
MCI_FORMAT_MSF
:
case
MCI_FORMAT_MSF
:
...
@@ -413,11 +146,11 @@ static DWORD CDAUDIO_CalcTime(WINE_CDAUDIO* wcda, DWORD dwFrame)
...
@@ -413,11 +146,11 @@ static DWORD CDAUDIO_CalcTime(WINE_CDAUDIO* wcda, DWORD dwFrame)
case
MCI_FORMAT_TMSF
:
case
MCI_FORMAT_TMSF
:
default:
default:
/* unknown format ! force TMSF ! ... */
/* unknown format ! force TMSF ! ... */
for
(
wTrack
=
0
;
wTrack
<
w
cda
->
nTracks
;
wTrack
++
)
{
for
(
wTrack
=
0
;
wTrack
<
w
mcda
->
wcda
.
nTracks
;
wTrack
++
)
{
/* dwTime += wcda->lpdwTrackLen[wTrack - 1];
/* dwTime += w
m
cda->lpdwTrackLen[wTrack - 1];
TRACE(cdaudio, "Adding trk#%u curpos=%u \n", dwTime);
TRACE(cdaudio, "Adding trk#%u curpos=%u \n", dwTime);
if (dwTime >= dwFrame) break; */
if (dwTime >= dwFrame) break; */
if
(
w
cda
->
lpdwTrackPos
[
wTrack
-
1
]
>=
dwFrame
)
break
;
if
(
w
mcda
->
wcda
.
lpdwTrackPos
[
wTrack
-
1
]
>=
dwFrame
)
break
;
}
}
wMinutes
=
dwFrame
/
CDFRAMES_PERMIN
;
wMinutes
=
dwFrame
/
CDFRAMES_PERMIN
;
wSeconds
=
(
dwFrame
-
CDFRAMES_PERMIN
*
wMinutes
)
/
CDFRAMES_PERSEC
;
wSeconds
=
(
dwFrame
-
CDFRAMES_PERMIN
*
wMinutes
)
/
CDFRAMES_PERSEC
;
...
@@ -428,7 +161,6 @@ static DWORD CDAUDIO_CalcTime(WINE_CDAUDIO* wcda, DWORD dwFrame)
...
@@ -428,7 +161,6 @@ static DWORD CDAUDIO_CalcTime(WINE_CDAUDIO* wcda, DWORD dwFrame)
}
}
return
dwTime
;
return
dwTime
;
}
}
#endif
static
DWORD
CDAUDIO_mciSeek
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_SEEK_PARMS
lpParms
);
static
DWORD
CDAUDIO_mciSeek
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_SEEK_PARMS
lpParms
);
static
DWORD
CDAUDIO_mciStop
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
);
static
DWORD
CDAUDIO_mciStop
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
);
...
@@ -438,9 +170,8 @@ static DWORD CDAUDIO_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS l
...
@@ -438,9 +170,8 @@ static DWORD CDAUDIO_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS l
*/
*/
static
DWORD
CDAUDIO_mciOpen
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_OPEN_PARMS32A
lpOpenParms
)
static
DWORD
CDAUDIO_mciOpen
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_OPEN_PARMS32A
lpOpenParms
)
{
{
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
DWORD
dwDeviceID
;
DWORD
dwDeviceID
;
WINE_
CDAUDIO
*
w
cda
;
WINE_
MCICDAUDIO
*
wm
cda
;
MCI_SEEK_PARMS
seekParms
;
MCI_SEEK_PARMS
seekParms
;
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpOpenParms
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpOpenParms
);
...
@@ -450,50 +181,40 @@ static DWORD CDAUDIO_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMS32A l
...
@@ -450,50 +181,40 @@ static DWORD CDAUDIO_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMS32A l
dwDeviceID
=
lpOpenParms
->
wDeviceID
;
dwDeviceID
=
lpOpenParms
->
wDeviceID
;
wcda
=
&
CDADev
[
wDevID
];
w
m
cda
=
&
CDADev
[
wDevID
];
if
(
wcda
->
nUseCount
>
0
)
{
if
(
w
m
cda
->
nUseCount
>
0
)
{
/* The driver already open on this channel */
/* The driver
is
already open on this channel */
/* If the driver was opened shareable before and this open specifies */
/* If the driver was opened shareable before and this open specifies */
/* shareable then increment the use count */
/* shareable then increment the use count */
if
(
wcda
->
fShareable
&&
(
dwFlags
&
MCI_OPEN_SHAREABLE
))
if
(
w
m
cda
->
fShareable
&&
(
dwFlags
&
MCI_OPEN_SHAREABLE
))
++
wcda
->
nUseCount
;
++
w
m
cda
->
nUseCount
;
else
else
return
MCIERR_MUST_USE_SHAREABLE
;
return
MCIERR_MUST_USE_SHAREABLE
;
}
else
{
}
else
{
wcda
->
nUseCount
=
1
;
w
m
cda
->
nUseCount
=
1
;
wcda
->
fShareable
=
dwFlags
&
MCI_OPEN_SHAREABLE
;
w
m
cda
->
fShareable
=
dwFlags
&
MCI_OPEN_SHAREABLE
;
}
}
if
(
dwFlags
&
MCI_OPEN_ELEMENT
)
{
if
(
dwFlags
&
MCI_OPEN_ELEMENT
)
{
TRACE
(
cdaudio
,
"MCI_OPEN_ELEMENT !
\n
"
);
TRACE
(
cdaudio
,
"MCI_OPEN_ELEMENT !
\n
"
);
/* return MCIERR_NO_ELEMENT_ALLOWED; */
/* return MCIERR_NO_ELEMENT_ALLOWED; */
}
}
wcda
->
openParms
.
dwCallback
=
lpOpenParms
->
dwCallback
;
wmcda
->
openParms
.
dwCallback
=
lpOpenParms
->
dwCallback
;
wcda
->
openParms
.
wDeviceID
=
(
WORD
)
lpOpenParms
->
wDeviceID
;
wmcda
->
openParms
.
wDeviceID
=
(
WORD
)
lpOpenParms
->
wDeviceID
;
wcda
->
openParms
.
wReserved0
=
0
;
/*????*/
wmcda
->
openParms
.
wReserved0
=
0
;
/*????*/
wcda
->
openParms
.
lpstrDeviceType
=
lpOpenParms
->
lpstrDeviceType
;
wmcda
->
openParms
.
lpstrDeviceType
=
lpOpenParms
->
lpstrDeviceType
;
wcda
->
openParms
.
lpstrElementName
=
lpOpenParms
->
lpstrElementName
;
wmcda
->
openParms
.
lpstrElementName
=
lpOpenParms
->
lpstrElementName
;
wcda
->
openParms
.
lpstrAlias
=
lpOpenParms
->
lpstrAlias
;
wmcda
->
openParms
.
lpstrAlias
=
lpOpenParms
->
lpstrAlias
;
wcda
->
wNotifyDeviceID
=
dwDeviceID
;
wmcda
->
wNotifyDeviceID
=
dwDeviceID
;
wcda
->
unixdev
=
open
(
CDAUDIO_DEV
,
O_RDONLY
,
0
);
if
(
CDAUDIO_Open
(
&
wmcda
->
wcda
)
==
-
1
)
{
if
(
wcda
->
unixdev
==
-
1
)
{
--
wmcda
->
nUseCount
;
WARN
(
cdaudio
,
"can't open '%s'!. errno=%d
\n
"
,
CDAUDIO_DEV
,
errno
);
perror
(
"can't open
\n
"
);
return
MCIERR_HARDWARE
;
return
MCIERR_HARDWARE
;
}
}
wcda
->
cdMode
=
0
;
wmcda
->
mciMode
=
MCI_MODE_STOP
;
wcda
->
mciMode
=
MCI_MODE_STOP
;
wmcda
->
dwTimeFormat
=
MCI_FORMAT_TMSF
;
wcda
->
dwTimeFormat
=
MCI_FORMAT_TMSF
;
if
(
!
CDAUDIO_GetTracksInfo
(
&
wmcda
->
wcda
))
{
wcda
->
nCurTrack
=
0
;
wcda
->
nTracks
=
0
;
wcda
->
dwTotalLen
=
0
;
wcda
->
dwFirstOffset
=
0
;
wcda
->
lpdwTrackLen
=
NULL
;
wcda
->
lpdwTrackPos
=
NULL
;
wcda
->
lpbTrackFlags
=
NULL
;
if
(
!
CDAUDIO_GetTracksInfo
(
&
CDADev
[
wDevID
]))
{
WARN
(
cdaudio
,
"error reading TracksInfo !
\n
"
);
WARN
(
cdaudio
,
"error reading TracksInfo !
\n
"
);
/* return MCIERR_INTERNAL; */
/* return MCIERR_INTERNAL; */
}
}
...
@@ -501,9 +222,6 @@ static DWORD CDAUDIO_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMS32A l
...
@@ -501,9 +222,6 @@ static DWORD CDAUDIO_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMS32A l
CDAUDIO_mciSeek
(
wDevID
,
MCI_SEEK_TO_START
,
&
seekParms
);
CDAUDIO_mciSeek
(
wDevID
,
MCI_SEEK_TO_START
,
&
seekParms
);
return
0
;
return
0
;
#else
return
MCIERR_HARDWARE
;
#endif
}
}
/**************************************************************************
/**************************************************************************
...
@@ -511,23 +229,17 @@ static DWORD CDAUDIO_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMS32A l
...
@@ -511,23 +229,17 @@ static DWORD CDAUDIO_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMS32A l
*/
*/
static
DWORD
CDAUDIO_mciClose
(
UINT16
wDevID
,
DWORD
dwParam
,
LPMCI_GENERIC_PARMS
lpParms
)
static
DWORD
CDAUDIO_mciClose
(
UINT16
wDevID
,
DWORD
dwParam
,
LPMCI_GENERIC_PARMS
lpParms
)
{
{
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
WINE_MCICDAUDIO
*
wmcda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
WINE_CDAUDIO
*
wcda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwParam
,
lpParms
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwParam
,
lpParms
);
if
(
wcda
==
NULL
)
return
MCIERR_INVALID_DEVICE_ID
;
if
(
w
m
cda
==
NULL
)
return
MCIERR_INVALID_DEVICE_ID
;
if
(
wcda
->
nUseCount
==
1
)
{
if
(
w
m
cda
->
nUseCount
==
1
)
{
CDAUDIO_mciStop
(
wDevID
,
0
,
NULL
);
CDAUDIO_mciStop
(
wDevID
,
0
,
NULL
);
CDAUDIO_Close
(
&
wmcda
->
wcda
);
if
(
wcda
->
lpdwTrackLen
!=
NULL
)
free
(
wcda
->
lpdwTrackLen
);
if
(
wcda
->
lpdwTrackPos
!=
NULL
)
free
(
wcda
->
lpdwTrackPos
);
if
(
wcda
->
lpbTrackFlags
!=
NULL
)
free
(
wcda
->
lpbTrackFlags
);
close
(
wcda
->
unixdev
);
}
}
wcda
->
nUseCount
--
;
wmcda
->
nUseCount
--
;
#endif
return
0
;
return
0
;
}
}
...
@@ -537,7 +249,6 @@ static DWORD CDAUDIO_mciClose(UINT16 wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS
...
@@ -537,7 +249,6 @@ static DWORD CDAUDIO_mciClose(UINT16 wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS
static
DWORD
CDAUDIO_mciGetDevCaps
(
UINT16
wDevID
,
DWORD
dwFlags
,
static
DWORD
CDAUDIO_mciGetDevCaps
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_GETDEVCAPS_PARMS
lpParms
)
LPMCI_GETDEVCAPS_PARMS
lpParms
)
{
{
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
if
(
lpParms
==
NULL
)
return
MCIERR_NULL_PARAMETER_BLOCK
;
if
(
lpParms
==
NULL
)
return
MCIERR_NULL_PARAMETER_BLOCK
;
...
@@ -579,9 +290,6 @@ static DWORD CDAUDIO_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
...
@@ -579,9 +290,6 @@ static DWORD CDAUDIO_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
}
}
TRACE
(
cdaudio
,
"lpParms->dwReturn=%08lX;
\n
"
,
lpParms
->
dwReturn
);
TRACE
(
cdaudio
,
"lpParms->dwReturn=%08lX;
\n
"
,
lpParms
->
dwReturn
);
return
0
;
return
0
;
#else
return
MCIERR_HARDWARE
;
#endif
}
}
/**************************************************************************
/**************************************************************************
...
@@ -589,16 +297,15 @@ static DWORD CDAUDIO_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
...
@@ -589,16 +297,15 @@ static DWORD CDAUDIO_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
*/
*/
static
DWORD
CDAUDIO_mciInfo
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_INFO_PARMS16
lpParms
)
static
DWORD
CDAUDIO_mciInfo
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_INFO_PARMS16
lpParms
)
{
{
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
DWORD
ret
=
0
;
DWORD
ret
=
0
;
LPSTR
str
=
0
;
LPSTR
str
=
0
;
WINE_
CDAUDIO
*
w
cda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
WINE_
MCICDAUDIO
*
wm
cda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
if
(
lpParms
==
NULL
||
lpParms
->
lpstrReturn
==
NULL
)
{
if
(
lpParms
==
NULL
||
lpParms
->
lpstrReturn
==
NULL
)
{
ret
=
MCIERR_NULL_PARAMETER_BLOCK
;
ret
=
MCIERR_NULL_PARAMETER_BLOCK
;
}
else
if
(
wcda
==
NULL
)
{
}
else
if
(
w
m
cda
==
NULL
)
{
ret
=
MCIERR_INVALID_DEVICE_ID
;
ret
=
MCIERR_INVALID_DEVICE_ID
;
}
else
{
}
else
{
TRACE
(
cdaudio
,
"buf=%p, len=%lu
\n
"
,
lpParms
->
lpstrReturn
,
lpParms
->
dwRetSize
);
TRACE
(
cdaudio
,
"buf=%p, len=%lu
\n
"
,
lpParms
->
lpstrReturn
,
lpParms
->
dwRetSize
);
...
@@ -619,9 +326,6 @@ static DWORD CDAUDIO_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lp
...
@@ -619,9 +326,6 @@ static DWORD CDAUDIO_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lp
}
}
return
ret
;
return
ret
;
#else
return
MCIERR_HARDWARE
;
#endif
}
}
/**************************************************************************
/**************************************************************************
...
@@ -629,92 +333,99 @@ static DWORD CDAUDIO_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lp
...
@@ -629,92 +333,99 @@ static DWORD CDAUDIO_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lp
*/
*/
static
DWORD
CDAUDIO_mciStatus
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_STATUS_PARMS
lpParms
)
static
DWORD
CDAUDIO_mciStatus
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_STATUS_PARMS
lpParms
)
{
{
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
WINE_MCICDAUDIO
*
wmcda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
WINE_CDAUDIO
*
wcda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
DWORD
ret
=
0
;
DWORD
ret
=
0
;
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
if
(
lpParms
==
NULL
)
{
if
(
lpParms
==
NULL
)
{
ret
=
MCIERR_NULL_PARAMETER_BLOCK
;
ret
=
MCIERR_NULL_PARAMETER_BLOCK
;
}
else
if
(
wcda
==
NULL
)
{
}
else
if
(
w
m
cda
==
NULL
)
{
ret
=
MCIERR_INVALID_DEVICE_ID
;
ret
=
MCIERR_INVALID_DEVICE_ID
;
}
else
{
}
else
{
if
(
dwFlags
&
MCI_NOTIFY
)
{
if
(
dwFlags
&
MCI_NOTIFY
)
{
TRACE
(
cdaudio
,
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
TRACE
(
cdaudio
,
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
mciDriverNotify16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wcda
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
w
m
cda
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
}
if
(
dwFlags
&
MCI_STATUS_ITEM
)
{
if
(
dwFlags
&
MCI_STATUS_ITEM
)
{
switch
(
lpParms
->
dwItem
)
{
switch
(
lpParms
->
dwItem
)
{
case
MCI_STATUS_CURRENT_TRACK
:
case
MCI_STATUS_CURRENT_TRACK
:
if
(
!
CDAUDIO_GetCDStatus
(
wcda
))
return
MCIERR_DRIVER_INTERNAL
;
if
(
!
CDAUDIO_GetCDStatus
(
&
wmcda
->
wcda
))
{
lpParms
->
dwReturn
=
wcda
->
nCurTrack
;
return
CDAUDIO_mciGetError
(
wmcda
);
}
lpParms
->
dwReturn
=
wmcda
->
wcda
.
nCurTrack
;
TRACE
(
cdaudio
,
"CURRENT_TRACK=%lu!
\n
"
,
lpParms
->
dwReturn
);
TRACE
(
cdaudio
,
"CURRENT_TRACK=%lu!
\n
"
,
lpParms
->
dwReturn
);
return
0
;
return
0
;
case
MCI_STATUS_LENGTH
:
case
MCI_STATUS_LENGTH
:
if
(
w
cda
->
nTracks
==
0
)
{
if
(
w
mcda
->
wcda
.
nTracks
==
0
)
{
if
(
!
CDAUDIO_GetTracksInfo
(
wcda
))
{
if
(
!
CDAUDIO_GetTracksInfo
(
&
wmcda
->
wcda
))
{
WARN
(
cdaudio
,
"error reading TracksInfo !
\n
"
);
WARN
(
cdaudio
,
"error reading TracksInfo !
\n
"
);
return
MCIERR_DRIVER_INTERNAL
;
return
CDAUDIO_mciGetError
(
wmcda
)
;
}
}
}
}
if
(
dwFlags
&
MCI_TRACK
)
{
if
(
dwFlags
&
MCI_TRACK
)
{
TRACE
(
cdaudio
,
"MCI_TRACK #%lu LENGTH=??? !
\n
"
,
lpParms
->
dwTrack
);
TRACE
(
cdaudio
,
"MCI_TRACK #%lu LENGTH=??? !
\n
"
,
lpParms
->
dwTrack
);
if
(
lpParms
->
dwTrack
>
w
cda
->
nTracks
)
if
(
lpParms
->
dwTrack
>
w
mcda
->
wcda
.
nTracks
||
lpParms
->
dwTrack
==
0
)
return
MCIERR_OUTOFRANGE
;
return
MCIERR_OUTOFRANGE
;
lpParms
->
dwReturn
=
w
cda
->
lpdwTrackLen
[
lpParms
->
dwTrack
-
1
];
lpParms
->
dwReturn
=
w
mcda
->
wcda
.
lpdwTrackLen
[
lpParms
->
dwTrack
-
1
];
}
else
{
}
else
{
lpParms
->
dwReturn
=
w
cda
->
dwTotalLen
;
lpParms
->
dwReturn
=
w
mcda
->
wcda
.
dwTotalLen
;
}
}
lpParms
->
dwReturn
=
CDAUDIO_CalcTime
(
wcda
,
lpParms
->
dwReturn
);
lpParms
->
dwReturn
=
CDAUDIO_CalcTime
(
w
m
cda
,
lpParms
->
dwReturn
);
TRACE
(
cdaudio
,
"LENGTH=%lu !
\n
"
,
lpParms
->
dwReturn
);
TRACE
(
cdaudio
,
"LENGTH=%lu !
\n
"
,
lpParms
->
dwReturn
);
return
0
;
return
0
;
case
MCI_STATUS_MODE
:
case
MCI_STATUS_MODE
:
if
(
!
CDAUDIO_GetCDStatus
(
wcda
))
return
MCIERR_DRIVER_INTERNAL
;
if
(
!
CDAUDIO_GetCDStatus
(
&
wmcda
->
wcda
))
lpParms
->
dwReturn
=
wcda
->
cdMode
;
return
CDAUDIO_mciGetError
(
wmcda
);
if
(
!
lpParms
->
dwReturn
)
lpParms
->
dwReturn
=
wcda
->
mciMode
;
lpParms
->
dwReturn
=
CDAUDIO_mciMode
(
wmcda
->
wcda
.
cdaMode
);
if
(
!
lpParms
->
dwReturn
)
lpParms
->
dwReturn
=
wmcda
->
mciMode
;
TRACE
(
cdaudio
,
"MCI_STATUS_MODE=%08lX !
\n
"
,
lpParms
->
dwReturn
);
TRACE
(
cdaudio
,
"MCI_STATUS_MODE=%08lX !
\n
"
,
lpParms
->
dwReturn
);
return
0
;
return
0
;
case
MCI_STATUS_MEDIA_PRESENT
:
case
MCI_STATUS_MEDIA_PRESENT
:
if
(
!
CDAUDIO_GetCDStatus
(
wcda
))
return
MCIERR_DRIVER_INTERNAL
;
if
(
!
CDAUDIO_GetCDStatus
(
&
wmcda
->
wcda
))
lpParms
->
dwReturn
=
(
wcda
->
nTracks
>
0
)
?
TRUE
:
FALSE
;
return
CDAUDIO_mciGetError
(
wmcda
);
lpParms
->
dwReturn
=
(
wmcda
->
wcda
.
nTracks
>
0
)
?
TRUE
:
FALSE
;
TRACE
(
cdaudio
,
"MCI_STATUS_MEDIA_PRESENT =%s!
\n
"
,
lpParms
->
dwReturn
?
"Y"
:
"N"
);
TRACE
(
cdaudio
,
"MCI_STATUS_MEDIA_PRESENT =%s!
\n
"
,
lpParms
->
dwReturn
?
"Y"
:
"N"
);
return
0
;
return
0
;
case
MCI_STATUS_NUMBER_OF_TRACKS
:
case
MCI_STATUS_NUMBER_OF_TRACKS
:
lpParms
->
dwReturn
=
CDAUDIO_GetNumberOfTracks
(
wcda
);
lpParms
->
dwReturn
=
CDAUDIO_GetNumberOfTracks
(
&
wmcda
->
wcda
);
TRACE
(
cdaudio
,
"MCI_STATUS_NUMBER_OF_TRACKS = %lu !
\n
"
,
lpParms
->
dwReturn
);
TRACE
(
cdaudio
,
"MCI_STATUS_NUMBER_OF_TRACKS = %lu !
\n
"
,
lpParms
->
dwReturn
);
if
(
lpParms
->
dwReturn
==
(
WORD
)
-
1
)
return
MCIERR_DRIVER_INTERNAL
;
if
(
lpParms
->
dwReturn
==
(
WORD
)
-
1
)
return
CDAUDIO_mciGetError
(
wmcda
);
return
0
;
return
0
;
case
MCI_STATUS_POSITION
:
case
MCI_STATUS_POSITION
:
if
(
!
CDAUDIO_GetCDStatus
(
wcda
))
return
MCIERR_DRIVER_INTERNAL
;
if
(
!
CDAUDIO_GetCDStatus
(
&
wmcda
->
wcda
))
lpParms
->
dwReturn
=
wcda
->
dwCurFrame
;
return
CDAUDIO_mciGetError
(
wmcda
);
lpParms
->
dwReturn
=
wmcda
->
wcda
.
dwCurFrame
;
if
(
dwFlags
&
MCI_STATUS_START
)
{
if
(
dwFlags
&
MCI_STATUS_START
)
{
lpParms
->
dwReturn
=
w
cda
->
dwFirstOffset
;
lpParms
->
dwReturn
=
w
mcda
->
wcda
.
dwFirstOffset
;
TRACE
(
cdaudio
,
"get MCI_STATUS_START !
\n
"
);
TRACE
(
cdaudio
,
"get MCI_STATUS_START !
\n
"
);
}
}
if
(
dwFlags
&
MCI_TRACK
)
{
if
(
dwFlags
&
MCI_TRACK
)
{
if
(
lpParms
->
dwTrack
>
w
cda
->
nTracks
)
if
(
lpParms
->
dwTrack
>
w
mcda
->
wcda
.
nTracks
||
lpParms
->
dwTrack
==
0
)
return
MCIERR_OUTOFRANGE
;
return
MCIERR_OUTOFRANGE
;
lpParms
->
dwReturn
=
w
cda
->
lpdwTrackPos
[
lpParms
->
dwTrack
-
1
];
lpParms
->
dwReturn
=
w
mcda
->
wcda
.
lpdwTrackPos
[
lpParms
->
dwTrack
-
1
];
TRACE
(
cdaudio
,
"get MCI_TRACK #%lu !
\n
"
,
lpParms
->
dwTrack
);
TRACE
(
cdaudio
,
"get MCI_TRACK #%lu !
\n
"
,
lpParms
->
dwTrack
);
}
}
lpParms
->
dwReturn
=
CDAUDIO_CalcTime
(
wcda
,
lpParms
->
dwReturn
);
lpParms
->
dwReturn
=
CDAUDIO_CalcTime
(
w
m
cda
,
lpParms
->
dwReturn
);
TRACE
(
cdaudio
,
"MCI_STATUS_POSITION=%08lX !
\n
"
,
lpParms
->
dwReturn
);
TRACE
(
cdaudio
,
"MCI_STATUS_POSITION=%08lX !
\n
"
,
lpParms
->
dwReturn
);
return
0
;
return
0
;
case
MCI_STATUS_READY
:
case
MCI_STATUS_READY
:
TRACE
(
cdaudio
,
"MCI_STATUS_READY !
\n
"
);
TRACE
(
cdaudio
,
"MCI_STATUS_READY !
\n
"
);
lpParms
->
dwReturn
=
TRUE
;
lpParms
->
dwReturn
=
(
wmcda
->
wcda
.
cdaMode
!=
WINE_CDA_DONTKNOW
&&
wmcda
->
wcda
.
cdaMode
!=
WINE_CDA_NOTREADY
);
TRACE
(
cdaudio
,
"MCI_STATUS_READY=%ld!
\n
"
,
lpParms
->
dwReturn
);
return
0
;
return
0
;
case
MCI_STATUS_TIME_FORMAT
:
case
MCI_STATUS_TIME_FORMAT
:
lpParms
->
dwReturn
=
wcda
->
dwTimeFormat
;
lpParms
->
dwReturn
=
w
m
cda
->
dwTimeFormat
;
TRACE
(
cdaudio
,
"MCI_STATUS_TIME_FORMAT =%08lx!
\n
"
,
lpParms
->
dwReturn
);
TRACE
(
cdaudio
,
"MCI_STATUS_TIME_FORMAT =%08lx!
\n
"
,
lpParms
->
dwReturn
);
return
0
;
return
0
;
/* FIXME: the constant used here are not defined in mmsystem.h */
/* MCI_CDA_STATUS_TYPE_TRACK is very likely to be 0x00004001 */
case
MCI_CDA_STATUS_TYPE_TRACK
:
case
MCI_CDA_STATUS_TYPE_TRACK
:
if
(
!
(
dwFlags
&
MCI_TRACK
))
return
MCIERR_MISSING_PARAMETER
;
if
(
!
(
dwFlags
&
MCI_TRACK
))
lpParms
->
dwReturn
=
(
wcda
->
lpbTrackFlags
[
lpParms
->
dwTrack
-
1
]
&
return
MCIERR_MISSING_PARAMETER
;
if
(
lpParms
->
dwTrack
>
wmcda
->
wcda
.
nTracks
||
lpParms
->
dwTrack
==
0
)
return
MCIERR_OUTOFRANGE
;
lpParms
->
dwReturn
=
(
wmcda
->
wcda
.
lpbTrackFlags
[
lpParms
->
dwTrack
-
1
]
&
CDROM_DATA_TRACK
)
?
MCI_CDA_TRACK_OTHER
:
MCI_CDA_TRACK_AUDIO
;
CDROM_DATA_TRACK
)
?
MCI_CDA_TRACK_OTHER
:
MCI_CDA_TRACK_AUDIO
;
TRACE
(
cdaudio
,
"MCI_CDA_STATUS_TYPE_TRACK[%ld]=%08lx
\n
"
,
lpParms
->
dwTrack
,
lpParms
->
dwReturn
);
TRACE
(
cdaudio
,
"MCI_CDA_STATUS_TYPE_TRACK[%ld]=%08lx
\n
"
,
lpParms
->
dwTrack
,
lpParms
->
dwReturn
);
return
0
;
return
0
;
...
@@ -726,9 +437,6 @@ static DWORD CDAUDIO_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS
...
@@ -726,9 +437,6 @@ static DWORD CDAUDIO_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS
}
}
WARN
(
cdaudio
,
"not MCI_STATUS_ITEM !
\n
"
);
WARN
(
cdaudio
,
"not MCI_STATUS_ITEM !
\n
"
);
return
0
;
return
0
;
#else
return
MCIERR_HARDWARE
;
#endif
}
}
/**************************************************************************
/**************************************************************************
...
@@ -736,97 +444,50 @@ static DWORD CDAUDIO_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS
...
@@ -736,97 +444,50 @@ static DWORD CDAUDIO_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS
*/
*/
static
DWORD
CDAUDIO_mciPlay
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_PLAY_PARMS
lpParms
)
static
DWORD
CDAUDIO_mciPlay
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_PLAY_PARMS
lpParms
)
{
{
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
int
start
,
end
;
int
start
,
end
;
WINE_
CDAUDIO
*
w
cda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
WINE_
MCICDAUDIO
*
wm
cda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
DWORD
ret
=
0
;
DWORD
ret
=
0
;
#ifdef linux
struct
cdrom_msf
msf
;
#else
struct
ioc_play_msf
msf
;
#endif
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
if
(
lpParms
==
NULL
)
{
if
(
lpParms
==
NULL
)
{
ret
=
MCIERR_NULL_PARAMETER_BLOCK
;
ret
=
MCIERR_NULL_PARAMETER_BLOCK
;
}
else
if
(
wcda
==
NULL
)
{
}
else
if
(
w
m
cda
==
NULL
)
{
ret
=
MCIERR_INVALID_DEVICE_ID
;
ret
=
MCIERR_INVALID_DEVICE_ID
;
}
else
{
}
else
{
if
(
w
cda
->
nTracks
==
0
)
{
if
(
w
mcda
->
wcda
.
nTracks
==
0
)
{
if
(
!
CDAUDIO_GetTracksInfo
(
wcda
))
{
if
(
!
CDAUDIO_GetTracksInfo
(
&
wmcda
->
wcda
))
{
WARN
(
cdaudio
,
"error reading TracksInfo !
\n
"
);
WARN
(
cdaudio
,
"error reading TracksInfo !
\n
"
);
return
MCIERR_DRIVER_INTERNAL
;
return
MCIERR_DRIVER_INTERNAL
;
}
}
}
}
end
=
w
cda
->
dwTotalLen
;
end
=
w
mcda
->
wcda
.
dwTotalLen
;
w
cda
->
nCurTrack
=
1
;
w
mcda
->
wcda
.
nCurTrack
=
1
;
if
(
dwFlags
&
MCI_FROM
)
{
if
(
dwFlags
&
MCI_FROM
)
{
start
=
CDAUDIO_CalcFrame
(
wcda
,
lpParms
->
dwFrom
);
start
=
CDAUDIO_CalcFrame
(
w
m
cda
,
lpParms
->
dwFrom
);
TRACE
(
cdaudio
,
"MCI_FROM=%08lX -> %u
\n
"
,
lpParms
->
dwFrom
,
start
);
TRACE
(
cdaudio
,
"MCI_FROM=%08lX -> %u
\n
"
,
lpParms
->
dwFrom
,
start
);
}
else
{
}
else
{
if
(
!
CDAUDIO_GetCDStatus
(
wcda
))
return
MCIERR_DRIVER_INTERNAL
;
if
(
!
CDAUDIO_GetCDStatus
(
&
wmcda
->
wcda
))
return
MCIERR_DRIVER_INTERNAL
;
start
=
w
cda
->
dwCurFrame
;
start
=
w
mcda
->
wcda
.
dwCurFrame
;
}
}
if
(
dwFlags
&
MCI_TO
)
{
if
(
dwFlags
&
MCI_TO
)
{
end
=
CDAUDIO_CalcFrame
(
wcda
,
lpParms
->
dwTo
);
end
=
CDAUDIO_CalcFrame
(
w
m
cda
,
lpParms
->
dwTo
);
TRACE
(
cdaudio
,
"MCI_TO=%08lX -> %u
\n
"
,
lpParms
->
dwTo
,
end
);
TRACE
(
cdaudio
,
"MCI_TO=%08lX -> %u
\n
"
,
lpParms
->
dwTo
,
end
);
}
}
end
+=
wcda
->
dwFirstOffset
;
end
+=
wmcda
->
wcda
.
dwFirstOffset
;
#ifdef linux
msf
.
cdmsf_min0
=
start
/
CDFRAMES_PERMIN
;
if
(
CDAUDIO_Play
(
&
wmcda
->
wcda
,
start
,
end
)
==
-
1
)
msf
.
cdmsf_sec0
=
(
start
%
CDFRAMES_PERMIN
)
/
CDFRAMES_PERSEC
;
msf
.
cdmsf_frame0
=
start
%
CDFRAMES_PERSEC
;
msf
.
cdmsf_min1
=
end
/
CDFRAMES_PERMIN
;
msf
.
cdmsf_sec1
=
(
end
%
CDFRAMES_PERMIN
)
/
CDFRAMES_PERSEC
;
msf
.
cdmsf_frame1
=
end
%
CDFRAMES_PERSEC
;
#else
msf
.
start_m
=
start
/
CDFRAMES_PERMIN
;
msf
.
start_s
=
(
start
%
CDFRAMES_PERMIN
)
/
CDFRAMES_PERSEC
;
msf
.
start_f
=
start
%
CDFRAMES_PERSEC
;
msf
.
end_m
=
end
/
CDFRAMES_PERMIN
;
msf
.
end_s
=
(
end
%
CDFRAMES_PERMIN
)
/
CDFRAMES_PERSEC
;
msf
.
end_f
=
end
%
CDFRAMES_PERSEC
;
#endif
#ifdef linux
if
(
ioctl
(
wcda
->
unixdev
,
CDROMSTART
))
{
#else
if
(
ioctl
(
wcda
->
unixdev
,
CDIOCSTART
,
NULL
))
{
#endif
WARN
(
cdaudio
,
"motor doesn't start !
\n
"
);
return
MCIERR_HARDWARE
;
}
#ifdef linux
if
(
ioctl
(
wcda
->
unixdev
,
CDROMPLAYMSF
,
&
msf
))
{
#else
if
(
ioctl
(
wcda
->
unixdev
,
CDIOCPLAYMSF
,
&
msf
))
{
#endif
WARN
(
cdaudio
,
"device doesn't play !
\n
"
);
return
MCIERR_HARDWARE
;
return
MCIERR_HARDWARE
;
}
wmcda
->
mciMode
=
MCI_MODE_PLAY
;
#ifdef linux
TRACE
(
cdaudio
,
"msf = %d:%d:%d %d:%d:%d
\n
"
,
msf
.
cdmsf_min0
,
msf
.
cdmsf_sec0
,
msf
.
cdmsf_frame0
,
msf
.
cdmsf_min1
,
msf
.
cdmsf_sec1
,
msf
.
cdmsf_frame1
);
#else
TRACE
(
cdaudio
,
"msf = %d:%d:%d %d:%d:%d
\n
"
,
msf
.
start_m
,
msf
.
start_s
,
msf
.
start_f
,
msf
.
end_m
,
msf
.
end_s
,
msf
.
end_f
);
#endif
wcda
->
mciMode
=
MCI_MODE_PLAY
;
if
(
dwFlags
&
MCI_NOTIFY
)
{
if
(
dwFlags
&
MCI_NOTIFY
)
{
TRACE
(
cdaudio
,
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
TRACE
(
cdaudio
,
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
/*
/*
mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback),
mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback),
wcda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
w
m
cda->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
*/
*/
}
}
}
}
return
ret
;
return
ret
;
#else
return
MCIERR_HARDWARE
;
#endif
}
}
/**************************************************************************
/**************************************************************************
...
@@ -834,29 +495,21 @@ static DWORD CDAUDIO_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpPa
...
@@ -834,29 +495,21 @@ static DWORD CDAUDIO_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpPa
*/
*/
static
DWORD
CDAUDIO_mciStop
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
static
DWORD
CDAUDIO_mciStop
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
{
{
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
WINE_MCICDAUDIO
*
wmcda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
WINE_CDAUDIO
*
wcda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
if
(
wcda
==
NULL
)
return
MCIERR_INVALID_DEVICE_ID
;
if
(
w
m
cda
==
NULL
)
return
MCIERR_INVALID_DEVICE_ID
;
#ifdef linux
if
(
CDAUDIO_Stop
(
&
wmcda
->
wcda
)
==
-
1
)
if
(
ioctl
(
wcda
->
unixdev
,
CDROMSTOP
))
#else
if
(
ioctl
(
wcda
->
unixdev
,
CDIOCSTOP
,
NULL
))
#endif
return
MCIERR_HARDWARE
;
return
MCIERR_HARDWARE
;
wcda
->
mciMode
=
MCI_MODE_STOP
;
w
m
cda
->
mciMode
=
MCI_MODE_STOP
;
if
(
lpParms
&&
(
dwFlags
&
MCI_NOTIFY
))
{
if
(
lpParms
&&
(
dwFlags
&
MCI_NOTIFY
))
{
TRACE
(
cdaudio
,
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
TRACE
(
cdaudio
,
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
mciDriverNotify16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wcda
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
w
m
cda
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
}
return
0
;
return
0
;
#else
return
MCIERR_HARDWARE
;
#endif
}
}
/**************************************************************************
/**************************************************************************
...
@@ -864,29 +517,21 @@ static DWORD CDAUDIO_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS l
...
@@ -864,29 +517,21 @@ static DWORD CDAUDIO_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS l
*/
*/
static
DWORD
CDAUDIO_mciPause
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
static
DWORD
CDAUDIO_mciPause
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
{
{
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
WINE_MCICDAUDIO
*
wmcda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
WINE_CDAUDIO
*
wcda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
if
(
wcda
==
NULL
)
return
MCIERR_INVALID_DEVICE_ID
;
if
(
w
m
cda
==
NULL
)
return
MCIERR_INVALID_DEVICE_ID
;
#ifdef linux
if
(
CDAUDIO_Pause
(
&
wmcda
->
wcda
,
1
)
==
-
1
)
if
(
ioctl
(
wcda
->
unixdev
,
CDROMPAUSE
))
#else
if
(
ioctl
(
wcda
->
unixdev
,
CDIOCPAUSE
,
NULL
))
#endif
return
MCIERR_HARDWARE
;
return
MCIERR_HARDWARE
;
wcda
->
mciMode
=
MCI_MODE_PAUSE
;
w
m
cda
->
mciMode
=
MCI_MODE_PAUSE
;
if
(
lpParms
&&
(
dwFlags
&
MCI_NOTIFY
))
{
if
(
lpParms
&&
(
dwFlags
&
MCI_NOTIFY
))
{
TRACE
(
cdaudio
,
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
TRACE
(
cdaudio
,
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
mciDriverNotify16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wcda
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
w
m
cda
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
}
return
0
;
return
0
;
#else
return
MCIERR_HARDWARE
;
#endif
}
}
/**************************************************************************
/**************************************************************************
...
@@ -894,48 +539,39 @@ static DWORD CDAUDIO_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS
...
@@ -894,48 +539,39 @@ static DWORD CDAUDIO_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS
*/
*/
static
DWORD
CDAUDIO_mciResume
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
static
DWORD
CDAUDIO_mciResume
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_GENERIC_PARMS
lpParms
)
{
{
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
WINE_MCICDAUDIO
*
wmcda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
WINE_CDAUDIO
*
wcda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
if
(
wcda
==
NULL
)
return
MCIERR_INVALID_DEVICE_ID
;
if
(
w
m
cda
==
NULL
)
return
MCIERR_INVALID_DEVICE_ID
;
#ifdef linux
if
(
CDAUDIO_Pause
(
&
wmcda
->
wcda
,
0
)
==
-
1
)
if
(
ioctl
(
wcda
->
unixdev
,
CDROMRESUME
))
#else
if
(
ioctl
(
wcda
->
unixdev
,
CDIOCRESUME
,
NULL
))
#endif
return
MCIERR_HARDWARE
;
return
MCIERR_HARDWARE
;
wcda
->
mciMode
=
MCI_MODE_STOP
;
w
m
cda
->
mciMode
=
MCI_MODE_STOP
;
if
(
lpParms
&&
(
dwFlags
&
MCI_NOTIFY
))
{
if
(
lpParms
&&
(
dwFlags
&
MCI_NOTIFY
))
{
TRACE
(
cdaudio
,
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
TRACE
(
cdaudio
,
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
mciDriverNotify16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wcda
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
w
m
cda
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
}
return
0
;
return
0
;
#else
return
MCIERR_HARDWARE
;
#endif
}
}
/**************************************************************************
/**************************************************************************
* CDAUDIO_mciSeek [internal]
* CDAUDIO_mciSeek [internal]
*/
*/
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
static
DWORD
CDAUDIO_mciSeek
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_SEEK_PARMS
lpParms
)
static
DWORD
CDAUDIO_mciSeek
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_SEEK_PARMS
lpParms
)
{
{
DWORD
dwRet
;
DWORD
dwRet
;
MCI_PLAY_PARMS
playParms
;
MCI_PLAY_PARMS
playParms
;
WINE_
CDAUDIO
*
w
cda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
WINE_
MCICDAUDIO
*
wm
cda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
if
(
wcda
==
NULL
)
return
MCIERR_INVALID_DEVICE_ID
;
if
(
w
m
cda
==
NULL
)
return
MCIERR_INVALID_DEVICE_ID
;
if
(
lpParms
==
NULL
)
return
MCIERR_NULL_PARAMETER_BLOCK
;
if
(
lpParms
==
NULL
)
return
MCIERR_NULL_PARAMETER_BLOCK
;
wcda
->
mciMode
=
MCI_MODE_SEEK
;
w
m
cda
->
mciMode
=
MCI_MODE_SEEK
;
switch
(
dwFlags
&
~
(
MCI_NOTIFY
|
MCI_WAIT
))
{
switch
(
dwFlags
&
~
(
MCI_NOTIFY
|
MCI_WAIT
))
{
case
MCI_SEEK_TO_START
:
case
MCI_SEEK_TO_START
:
TRACE
(
cdaudio
,
"Seeking to start
\n
"
);
TRACE
(
cdaudio
,
"Seeking to start
\n
"
);
...
@@ -943,7 +579,7 @@ static DWORD CDAUDIO_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpPa
...
@@ -943,7 +579,7 @@ static DWORD CDAUDIO_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpPa
break
;
break
;
case
MCI_SEEK_TO_END
:
case
MCI_SEEK_TO_END
:
TRACE
(
cdaudio
,
"Seeking to end
\n
"
);
TRACE
(
cdaudio
,
"Seeking to end
\n
"
);
playParms
.
dwFrom
=
w
cda
->
dwTotalLen
;
playParms
.
dwFrom
=
w
mcda
->
wcda
.
dwTotalLen
;
break
;
break
;
case
MCI_TO
:
case
MCI_TO
:
TRACE
(
cdaudio
,
"Seeking to %lu
\n
"
,
lpParms
->
dwTo
);
TRACE
(
cdaudio
,
"Seeking to %lu
\n
"
,
lpParms
->
dwTo
);
...
@@ -959,59 +595,38 @@ static DWORD CDAUDIO_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpPa
...
@@ -959,59 +595,38 @@ static DWORD CDAUDIO_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpPa
if
(
dwFlags
&
MCI_NOTIFY
)
{
if
(
dwFlags
&
MCI_NOTIFY
)
{
TRACE
(
cdaudio
,
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
TRACE
(
cdaudio
,
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
mciDriverNotify16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
mciDriverNotify16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wcda
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
w
m
cda
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
}
return
dwRet
;
return
dwRet
;
}
}
#endif
/**************************************************************************
/**************************************************************************
* CDAUDIO_mciSetDoor [internal]
* CDAUDIO_mciSetDoor [internal]
*/
*/
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
static
DWORD
CDAUDIO_mciSetDoor
(
UINT16
wDevID
,
int
open
)
static
DWORD
CDAUDIO_mciSetDoor
(
UINT16
wDevID
,
int
open
)
{
{
WINE_
CDAUDIO
*
w
cda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
WINE_
MCICDAUDIO
*
wm
cda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
TRACE
(
cdaudio
,
"(%04x, %s) !
\n
"
,
wDevID
,
(
open
)
?
"OPEN"
:
"CLOSE"
);
TRACE
(
cdaudio
,
"(%04x, %s) !
\n
"
,
wDevID
,
(
open
)
?
"OPEN"
:
"CLOSE"
);
if
(
wcda
==
NULL
)
return
MCIERR_INVALID_DEVICE_ID
;
if
(
w
m
cda
==
NULL
)
return
MCIERR_INVALID_DEVICE_ID
;
#ifdef linux
if
(
CDAUDIO_SetDoor
(
&
wmcda
->
wcda
,
open
)
==
-
1
)
if
(
open
)
{
return
MCIERR_HARDWARE
;
if
(
ioctl
(
wcda
->
unixdev
,
CDROMEJECT
))
return
MCIERR_HARDWARE
;
wmcda
->
mciMode
=
(
open
)
?
MCI_MODE_OPEN
:
MCI_MODE_STOP
;
wcda
->
mciMode
=
MCI_MODE_OPEN
;
}
else
{
if
(
ioctl
(
wcda
->
unixdev
,
CDROMEJECT
,
1
))
return
MCIERR_HARDWARE
;
wcda
->
mciMode
=
MCI_MODE_STOP
;
}
#else
if
(
ioctl
(
wcda
->
unixdev
,
CDIOCALLOW
,
NULL
))
return
MCIERR_HARDWARE
;
if
(
open
)
{
if
(
ioctl
(
wcda
->
unixdev
,
CDIOCEJECT
,
NULL
))
return
MCIERR_HARDWARE
;
wcda
->
mciMode
=
MCI_MODE_OPEN
;
}
else
{
if
(
ioctl
(
wcda
->
unixdev
,
CDIOCCLOSE
,
NULL
))
return
MCIERR_HARDWARE
;
wcda
->
mciMode
=
MCI_MODE_STOP
;
}
if
(
ioctl
(
wcda
->
unixdev
,
CDIOCPREVENT
,
NULL
))
return
MCIERR_HARDWARE
;
#endif
wcda
->
nTracks
=
0
;
return
0
;
return
0
;
}
}
#endif
/**************************************************************************
/**************************************************************************
* CDAUDIO_mciSet [internal]
* CDAUDIO_mciSet [internal]
*/
*/
static
DWORD
CDAUDIO_mciSet
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_SET_PARMS
lpParms
)
static
DWORD
CDAUDIO_mciSet
(
UINT16
wDevID
,
DWORD
dwFlags
,
LPMCI_SET_PARMS
lpParms
)
{
{
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
WINE_MCICDAUDIO
*
wmcda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
WINE_CDAUDIO
*
wcda
=
CDAUDIO_mciGetOpenDrv
(
wDevID
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
TRACE
(
cdaudio
,
"(%04X, %08lX, %p);
\n
"
,
wDevID
,
dwFlags
,
lpParms
);
if
(
wcda
==
NULL
)
return
MCIERR_INVALID_DEVICE_ID
;
if
(
w
m
cda
==
NULL
)
return
MCIERR_INVALID_DEVICE_ID
;
if
(
lpParms
==
NULL
)
return
MCIERR_NULL_PARAMETER_BLOCK
;;
if
(
lpParms
==
NULL
)
return
MCIERR_NULL_PARAMETER_BLOCK
;;
/*
/*
TRACE(cdaudio,"dwTimeFormat=%08lX\n", lpParms->dwTimeFormat);
TRACE(cdaudio,"dwTimeFormat=%08lX\n", lpParms->dwTimeFormat);
...
@@ -1032,7 +647,7 @@ static DWORD CDAUDIO_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParm
...
@@ -1032,7 +647,7 @@ static DWORD CDAUDIO_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParm
WARN
(
cdaudio
,
"bad time format !
\n
"
);
WARN
(
cdaudio
,
"bad time format !
\n
"
);
return
MCIERR_BAD_TIME_FORMAT
;
return
MCIERR_BAD_TIME_FORMAT
;
}
}
wcda
->
dwTimeFormat
=
lpParms
->
dwTimeFormat
;
w
m
cda
->
dwTimeFormat
=
lpParms
->
dwTimeFormat
;
}
}
if
(
dwFlags
&
MCI_SET_DOOR_OPEN
)
{
if
(
dwFlags
&
MCI_SET_DOOR_OPEN
)
{
CDAUDIO_mciSetDoor
(
wDevID
,
TRUE
);
CDAUDIO_mciSetDoor
(
wDevID
,
TRUE
);
...
@@ -1047,12 +662,9 @@ static DWORD CDAUDIO_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParm
...
@@ -1047,12 +662,9 @@ static DWORD CDAUDIO_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParm
TRACE
(
cdaudio
,
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
TRACE
(
cdaudio
,
"MCI_NOTIFY_SUCCESSFUL %08lX !
\n
"
,
lpParms
->
dwCallback
);
lpParms
->
dwCallback
);
mciDriverNotify16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
mciDriverNotify16
((
HWND16
)
LOWORD
(
lpParms
->
dwCallback
),
wcda
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
w
m
cda
->
wNotifyDeviceID
,
MCI_NOTIFY_SUCCESSFUL
);
}
}
return
0
;
return
0
;
#else
return
MCIERR_HARDWARE
;
#endif
}
}
/**************************************************************************
/**************************************************************************
...
@@ -1061,7 +673,6 @@ static DWORD CDAUDIO_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParm
...
@@ -1061,7 +673,6 @@ static DWORD CDAUDIO_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParm
LONG
MCICDAUDIO_DriverProc32
(
DWORD
dwDevID
,
HDRVR16
hDriv
,
DWORD
wMsg
,
LONG
MCICDAUDIO_DriverProc32
(
DWORD
dwDevID
,
HDRVR16
hDriv
,
DWORD
wMsg
,
DWORD
dwParam1
,
DWORD
dwParam2
)
DWORD
dwParam1
,
DWORD
dwParam2
)
{
{
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
switch
(
wMsg
)
{
switch
(
wMsg
)
{
case
DRV_LOAD
:
return
1
;
case
DRV_LOAD
:
return
1
;
case
DRV_FREE
:
return
1
;
case
DRV_FREE
:
return
1
;
...
@@ -1070,7 +681,7 @@ LONG MCICDAUDIO_DriverProc32(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg,
...
@@ -1070,7 +681,7 @@ LONG MCICDAUDIO_DriverProc32(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg,
case
DRV_ENABLE
:
return
1
;
case
DRV_ENABLE
:
return
1
;
case
DRV_DISABLE
:
return
1
;
case
DRV_DISABLE
:
return
1
;
case
DRV_QUERYCONFIGURE
:
return
1
;
case
DRV_QUERYCONFIGURE
:
return
1
;
case
DRV_CONFIGURE
:
MessageBox
16
(
0
,
"Sample MultiM
edia Linux Driver !"
,
"MMLinux Driver"
,
MB_OK
);
return
1
;
case
DRV_CONFIGURE
:
MessageBox
32A
(
0
,
"Sample Multim
edia Linux Driver !"
,
"MMLinux Driver"
,
MB_OK
);
return
1
;
case
DRV_INSTALL
:
return
DRVCNF_RESTART
;
case
DRV_INSTALL
:
return
DRVCNF_RESTART
;
case
DRV_REMOVE
:
return
DRVCNF_RESTART
;
case
DRV_REMOVE
:
return
DRVCNF_RESTART
;
...
@@ -1115,9 +726,6 @@ LONG MCICDAUDIO_DriverProc32(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg,
...
@@ -1115,9 +726,6 @@ LONG MCICDAUDIO_DriverProc32(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg,
return
DefDriverProc32
(
dwDevID
,
hDriv
,
wMsg
,
dwParam1
,
dwParam2
);
return
DefDriverProc32
(
dwDevID
,
hDriv
,
wMsg
,
dwParam1
,
dwParam2
);
}
}
return
MCIERR_UNRECOGNIZED_COMMAND
;
return
MCIERR_UNRECOGNIZED_COMMAND
;
#else
return
MCIERR_UNRECOGNIZED_COMMAND
;
#endif
}
}
/*-----------------------------------------------------------------------*/
/*-----------------------------------------------------------------------*/
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment