Added new function CDAUDIO_Seek().

This commit is contained in:
Eric Pouech 1999-03-15 15:14:43 +00:00 committed by Alexandre Julliard
parent 3fb2f4289f
commit 52c97d4e99
2 changed files with 28 additions and 2 deletions

View File

@ -56,14 +56,15 @@ int CDAUDIO_Reset(WINE_CDAUDIO* wcda);
int CDAUDIO_Play(WINE_CDAUDIO* wcda, DWORD start, DWORD stop);
int CDAUDIO_Stop(WINE_CDAUDIO* wcda);
int CDAUDIO_Pause(WINE_CDAUDIO* wcda, int pauseOn);
int CDAUDIO_Seek(WINE_CDAUDIO* wcda, DWORD at);
int CDAUDIO_SetDoor(WINE_CDAUDIO* wcda, int open);
UINT16 CDAUDIO_GetNumberOfTracks(WINE_CDAUDIO* wcda);
BOOL CDAUDIO_GetTracksInfo(WINE_CDAUDIO* wcda);
BOOL CDAUDIO_GetCDStatus(WINE_CDAUDIO* wcda);
#define CDFRAMES_PERSEC 75
#define CDFRAMES_PERMIN 4500
#define SECONDS_PERMIN 60
#define CDFRAMES_PERMIN ((CDFRAMES_PERSEC) * (SECONDS_PERMIN))
#ifndef CDROM_DATA_TRACK
#define CDROM_DATA_TRACK 0x04

View File

@ -29,7 +29,7 @@
int CDAUDIO_Open(WINE_CDAUDIO* wcda)
{
#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) {
WARN(cdaudio,"can't open '%s'!. errno=%d\n", CDAUDIO_DEV, errno);
return -1;
@ -423,6 +423,31 @@ int CDAUDIO_Pause(WINE_CDAUDIO* wcda, int pauseOn)
#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]
*/