... apply a CD device stops workaround only for linux for now.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@954 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2014-08-05 17:45:22 +00:00
parent 5058d882e9
commit b5ffff36a3

View file

@ -61,6 +61,9 @@ static void CDAudio_Eject(void)
if (!cd_handle || !enabled)
return;
#ifdef __linux__
SDL_CDStop(cd_handle); /* see CDAudio_Stop() */
#endif
if (SDL_CDEject(cd_handle) == -1)
Con_Printf ("Unable to eject CD-ROM: %s\n", SDL_GetError ());
}
@ -149,8 +152,19 @@ void CDAudio_Stop(void)
if (!playing)
return;
#ifdef __linux__
/* Don't really stop, but just pause: On some devices, the CDROMSTOP
* ioctl causes any followup ioctls to fail for a considerable time.
* observed with a TSSTcorp CDW/DVD SH-M522C drive with TS05 and TS08
* firmware versions running under a 2.6.27.25 kernel, and with a
* Samsung DVD r/w drive running under 2.6.35.6 kernel.
* Therefore, avoid dead stops if playback may be resumed shortly. */
if (SDL_CDPause(cd_handle) == -1)
Con_Printf ("CDAudio_Stop: Unable to stop CD-ROM (%s)\n", SDL_GetError());
#else
if (SDL_CDStop(cd_handle) == -1)
Con_Printf ("CDAudio_Stop: Unable to stop CD-ROM (%s)\n", SDL_GetError());
#endif
wasPlaying = false;
playing = false;
@ -563,6 +577,9 @@ void CDAudio_Shutdown(void)
CDAudio_Stop();
if (hw_vol_works)
CD_SetVolume (NULL); /* no SDL support at present. */
#ifdef __linux__
SDL_CDStop(cd_handle); /* see CDAudio_Stop() */
#endif
SDL_CDClose(cd_handle);
cd_handle = NULL;
cd_dev = -1;