mciwave: Fix precondition to avoid having 2 simultaneous players.

This commit is contained in:
Jörg Höhle 2011-03-05 16:32:23 +01:00 committed by Alexandre Julliard
parent 2a02649341
commit fc1e8e79c2
1 changed files with 10 additions and 5 deletions

View File

@ -756,8 +756,8 @@ static DWORD WAVE_mciPlay(MCIDEVICEID wDevID, DWORD_PTR dwFlags, DWORD_PTR pmt,
return MCIERR_FILE_NOT_FOUND; return MCIERR_FILE_NOT_FOUND;
} }
if (wmw->dwStatus == MCI_MODE_PAUSE && !wmw->fInput) { if (wmw->dwStatus == MCI_MODE_PAUSE && !wmw->fInput && !(dwFlags & (MCI_FROM | MCI_TO))) {
/* FIXME: parameters (start/end) in lpParams may not be used */ /* FIXME: notification is different with Resume than Play */
return WAVE_mciResume(wDevID, dwFlags, (LPMCI_GENERIC_PARMS)lpParms); return WAVE_mciResume(wDevID, dwFlags, (LPMCI_GENERIC_PARMS)lpParms);
} }
@ -765,8 +765,12 @@ static DWORD WAVE_mciPlay(MCIDEVICEID wDevID, DWORD_PTR dwFlags, DWORD_PTR pmt,
* We have to set MCI_MODE_PLAY before we do this so that the app can spin * We have to set MCI_MODE_PLAY before we do this so that the app can spin
* on MCI_STATUS, so we have to allow it here if we're not going to start this thread. * on MCI_STATUS, so we have to allow it here if we're not going to start this thread.
*/ */
if ((wmw->dwStatus != MCI_MODE_STOP) && ((wmw->dwStatus != MCI_MODE_PLAY) && (dwFlags & MCI_WAIT))) { if ( !(wmw->dwStatus == MCI_MODE_STOP) &&
return MCIERR_INTERNAL; !((wmw->dwStatus == MCI_MODE_PLAY) && (dwFlags & MCI_WAIT) && !wmw->hWave)) {
/* FIXME: Check FROM/TO parameters first. */
/* FIXME: Play; Play [notify|wait] must hook into the running player. */
dwRet = WAVE_mciStop(wDevID, MCI_WAIT, NULL);
if (dwRet) return dwRet;
} }
if (wmw->lpWaveFormat->wFormatTag == WAVE_FORMAT_PCM) { if (wmw->lpWaveFormat->wFormatTag == WAVE_FORMAT_PCM) {
@ -1011,7 +1015,8 @@ static DWORD WAVE_mciRecord(MCIDEVICEID wDevID, DWORD_PTR dwFlags, DWORD_PTR pmt
* We have to set MCI_MODE_RECORD before we do this so that the app can spin * We have to set MCI_MODE_RECORD before we do this so that the app can spin
* on MCI_STATUS, so we have to allow it here if we're not going to start this thread. * on MCI_STATUS, so we have to allow it here if we're not going to start this thread.
*/ */
if ((wmw->dwStatus != MCI_MODE_STOP) && ((wmw->dwStatus != MCI_MODE_RECORD) && (dwFlags & MCI_WAIT))) { if ( !(wmw->dwStatus == MCI_MODE_STOP) &&
!((wmw->dwStatus == MCI_MODE_RECORD) && (dwFlags & MCI_WAIT) && !wmw->hWave)) {
return MCIERR_INTERNAL; return MCIERR_INTERNAL;
} }