From 5983223b70a232f2865a76433285f8d38bab316e Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Fri, 19 Mar 2004 19:15:03 +0000 Subject: [PATCH] Just update from/to pointers and exit on a subsequent MCI_PLAY command. --- dlls/winmm/mciavi/mciavi.c | 22 ++++++++++++++++++---- dlls/winmm/mciavi/private_mciavi.h | 1 + 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/dlls/winmm/mciavi/mciavi.c b/dlls/winmm/mciavi/mciavi.c index 40729cd1efb..166f364c8ed 100644 --- a/dlls/winmm/mciavi/mciavi.c +++ b/dlls/winmm/mciavi/mciavi.c @@ -427,7 +427,6 @@ static DWORD MCIAVI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms return MCIERR_NO_WINDOW; } - wma->dwStatus = MCI_MODE_PLAY; LeaveCriticalSection(&wma->cs); if (!(dwFlags & MCI_WAIT)) { @@ -435,7 +434,8 @@ static DWORD MCIAVI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms (DWORD_PTR)lpParms, sizeof(MCI_PLAY_PARMS)); } - ShowWindow(wma->hWndPaint, SW_SHOWNA); + if (!(GetWindowLongW(wma->hWndPaint, GWL_STYLE) & WS_VISIBLE)) + ShowWindow(wma->hWndPaint, SW_SHOWNA); EnterCriticalSection(&wma->cs); @@ -454,13 +454,23 @@ static DWORD MCIAVI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms TRACE("Playing from frame=%lu to frame=%lu\n", dwFromFrame, dwToFrame); wma->dwCurrVideoFrame = dwFromFrame; + wma->dwToVideoFrame = dwToFrame; - if (dwToFrame <= wma->dwCurrVideoFrame) + /* if already playing exit */ + if (wma->dwStatus == MCI_MODE_PLAY) + { + LeaveCriticalSection(&wma->cs); + return 0; + } + + if (wma->dwToVideoFrame <= wma->dwCurrVideoFrame) { dwRet = 0; goto mci_play_done; } + wma->dwStatus = MCI_MODE_PLAY; + if (dwFlags & (MCI_DGV_PLAY_REPEAT|MCI_DGV_PLAY_REVERSE|MCI_MCIAVI_PLAY_WINDOW|MCI_MCIAVI_PLAY_FULLSCREEN)) FIXME("Unsupported flag %08lx\n", dwFlags); @@ -610,7 +620,9 @@ static DWORD MCIAVI_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpPa switch (wma->dwStatus) { case MCI_MODE_PLAY: case MCI_MODE_RECORD: + LeaveCriticalSection(&wma->cs); SetEvent(wma->hStopEvent); + EnterCriticalSection(&wma->cs); /* fall through */ case MCI_MODE_PAUSE: /* Since our wave notification callback takes the lock, @@ -648,6 +660,8 @@ static DWORD MCIAVI_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP { WINE_MCIAVI *wma; + TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms); + wma = MCIAVI_mciGetOpenDev(wDevID); if (wma == NULL) return MCIERR_INVALID_DEVICE_ID; @@ -660,7 +674,7 @@ static DWORD MCIAVI_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP LeaveCriticalSection(&wma->cs); return waveOutPause(wma->hWave); } - + LeaveCriticalSection(&wma->cs); return 0; } diff --git a/dlls/winmm/mciavi/private_mciavi.h b/dlls/winmm/mciavi/private_mciavi.h index 5cf83872175..afdcc7fab7d 100644 --- a/dlls/winmm/mciavi/private_mciavi.h +++ b/dlls/winmm/mciavi/private_mciavi.h @@ -76,6 +76,7 @@ typedef struct { HWND hWnd, hWndPaint; DWORD dwCachedFrame; /* buffered frame */ DWORD dwCurrVideoFrame; /* video frame to display and current position */ + DWORD dwToVideoFrame; /* play to */ DWORD dwCurrAudioBlock; /* current audio block being played */ RECT source, dest; /* data for the background mechanism */