Commit 52c97d4e authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

Added new function CDAUDIO_Seek().

parent 3fb2f428
...@@ -56,14 +56,15 @@ int CDAUDIO_Reset(WINE_CDAUDIO* wcda); ...@@ -56,14 +56,15 @@ int CDAUDIO_Reset(WINE_CDAUDIO* wcda);
int CDAUDIO_Play(WINE_CDAUDIO* wcda, DWORD start, DWORD stop); int CDAUDIO_Play(WINE_CDAUDIO* wcda, DWORD start, DWORD stop);
int CDAUDIO_Stop(WINE_CDAUDIO* wcda); int CDAUDIO_Stop(WINE_CDAUDIO* wcda);
int CDAUDIO_Pause(WINE_CDAUDIO* wcda, int pauseOn); int CDAUDIO_Pause(WINE_CDAUDIO* wcda, int pauseOn);
int CDAUDIO_Seek(WINE_CDAUDIO* wcda, DWORD at);
int CDAUDIO_SetDoor(WINE_CDAUDIO* wcda, int open); int CDAUDIO_SetDoor(WINE_CDAUDIO* wcda, int open);
UINT16 CDAUDIO_GetNumberOfTracks(WINE_CDAUDIO* wcda); UINT16 CDAUDIO_GetNumberOfTracks(WINE_CDAUDIO* wcda);
BOOL CDAUDIO_GetTracksInfo(WINE_CDAUDIO* wcda); BOOL CDAUDIO_GetTracksInfo(WINE_CDAUDIO* wcda);
BOOL CDAUDIO_GetCDStatus(WINE_CDAUDIO* wcda); BOOL CDAUDIO_GetCDStatus(WINE_CDAUDIO* wcda);
#define CDFRAMES_PERSEC 75 #define CDFRAMES_PERSEC 75
#define CDFRAMES_PERMIN 4500
#define SECONDS_PERMIN 60 #define SECONDS_PERMIN 60
#define CDFRAMES_PERMIN ((CDFRAMES_PERSEC) * (SECONDS_PERMIN))
#ifndef CDROM_DATA_TRACK #ifndef CDROM_DATA_TRACK
#define CDROM_DATA_TRACK 0x04 #define CDROM_DATA_TRACK 0x04
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
int CDAUDIO_Open(WINE_CDAUDIO* wcda) int CDAUDIO_Open(WINE_CDAUDIO* wcda)
{ {
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__) #if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
wcda->unixdev = open(CDAUDIO_DEV, O_RDONLY, 0); wcda->unixdev = open(CDAUDIO_DEV, O_RDONLY | O_NONBLOCK, 0);
if (wcda->unixdev == -1) { if (wcda->unixdev == -1) {
WARN(cdaudio,"can't open '%s'!. errno=%d\n", CDAUDIO_DEV, errno); WARN(cdaudio,"can't open '%s'!. errno=%d\n", CDAUDIO_DEV, errno);
return -1; return -1;
...@@ -423,6 +423,31 @@ int CDAUDIO_Pause(WINE_CDAUDIO* wcda, int pauseOn) ...@@ -423,6 +423,31 @@ int CDAUDIO_Pause(WINE_CDAUDIO* wcda, int pauseOn)
#endif #endif
} }
int CDAUDIO_Seek(WINE_CDAUDIO* wcda, DWORD at)
{
#if defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__)
int ret = 0;
struct cdrom_msf0 msf;
#ifdef linux
msf.minute = at / CDFRAMES_PERMIN;
msf.second = (at % CDFRAMES_PERMIN) / CDFRAMES_PERSEC;
msf.frame = at % CDFRAMES_PERSEC;
ret = ioctl(wcda->unixdev, CDROMSEEK, &msf);
#else
/* FIXME: the current end for play is lost
* use end of CD ROM instead
*/
FIXME(cdaudio, "Could a BSD expert implement the seek function ?\n");
CDAUDIO_Play(wcda, at, wcda->lpdwTrackPos[wcda->nTracks] + wcda->lpdwTrackLen[wcda->nTracks]);
#endif
return ret;
#else
return -1;
#endif
}
/************************************************************************** /**************************************************************************
* CDAUDIO_SetDoor [internal] * CDAUDIO_SetDoor [internal]
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment