diff --git a/reactos/dll/win32/mciavi32/info.c b/reactos/dll/win32/mciavi32/info.c index 3e98fcfabea..cc6abdcabb3 100644 --- a/reactos/dll/win32/mciavi32/info.c +++ b/reactos/dll/win32/mciavi32/info.c @@ -187,6 +187,7 @@ DWORD MCIAVI_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSW lpParms) WINE_MCIAVI* wma = MCIAVI_mciGetOpenDev(wDevID); DWORD ret = 0; static const WCHAR wszAviPlayer[] = {'W','i','n','e','\'','s',' ','A','V','I',' ','p','l','a','y','e','r',0}; + static const WCHAR wszVersion[] = {'1','.','1',0}; if (lpParms == NULL || lpParms->lpstrReturn == NULL) return MCIERR_NULL_PARAMETER_BLOCK; @@ -199,6 +200,8 @@ DWORD MCIAVI_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSW lpParms) if (dwFlags & MCI_INFO_PRODUCT) str = wszAviPlayer; + else if (dwFlags & MCI_INFO_VERSION) + str = wszVersion; else if (dwFlags & MCI_INFO_FILE) str = wma->lpFileName; else { diff --git a/reactos/dll/win32/mciavi32/mciavi.c b/reactos/dll/win32/mciavi32/mciavi.c index 5674fe9c85e..e083b4e4c0f 100644 --- a/reactos/dll/win32/mciavi32/mciavi.c +++ b/reactos/dll/win32/mciavi32/mciavi.c @@ -351,6 +351,7 @@ static DWORD MCIAVI_player(WINE_MCIAVI *wma, DWORD dwFlags, LPMCI_PLAY_PARMS lpP DWORD numEvents = 1; HANDLE events[2]; double next_frame_us; + BOOL wait_audio = TRUE; EnterCriticalSection(&wma->cs); @@ -417,19 +418,37 @@ static DWORD MCIAVI_player(WINE_MCIAVI *wma, DWORD dwFlags, LPMCI_PLAY_PARMS lpP else delta = 0; + /* check if the playback was cancelled */ + if ((wma->mci_break.flags & MCI_BREAK_KEY) && + (GetAsyncKeyState(wma->mci_break.parms.nVirtKey) & 0x8000)) + { + if (!(wma->mci_break.flags & MCI_BREAK_HWND) || + GetForegroundWindow() == wma->mci_break.parms.hwndBreak) + { + /* we queue audio blocks ahead so ignore them otherwise the audio + * will keep playing until the buffer is empty */ + wait_audio = FALSE; + + TRACE("playback cancelled using break key\n"); + break; + } + } + LeaveCriticalSection(&wma->cs); ret = WaitForMultipleObjects(numEvents, events, FALSE, delta / 1000); EnterCriticalSection(&wma->cs); if (ret == WAIT_OBJECT_0 || wma->dwStatus != MCI_MODE_PLAY) break; } - if (wma->lpWaveFormat) { - while (wma->dwEventCount != nHdr - 1) - { - LeaveCriticalSection(&wma->cs); - Sleep(100); - EnterCriticalSection(&wma->cs); - } + if (wma->lpWaveFormat) + { + if (wait_audio) + while (wma->dwEventCount != nHdr - 1) + { + LeaveCriticalSection(&wma->cs); + Sleep(100); + EnterCriticalSection(&wma->cs); + } /* just to get rid of some race conditions between play, stop and pause */ LeaveCriticalSection(&wma->cs); @@ -868,6 +887,30 @@ static DWORD MCIAVI_mciCue(UINT wDevID, DWORD dwFlags, LPMCI_DGV_CUE_PARMS lpPar return 0; } +/****************************************************************************** + * MCIAVI_mciBreak [internal] + */ +static DWORD MCIAVI_mciBreak(UINT wDevID, DWORD dwFlags, LPMCI_BREAK_PARMS lpParms) +{ + WINE_MCIAVI *wma; + + TRACE("(%04x, %08x, %p)\n", wDevID, dwFlags, lpParms); + + if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK; + + wma = MCIAVI_mciGetOpenDev(wDevID); + if (wma == NULL) return MCIERR_INVALID_DEVICE_ID; + + EnterCriticalSection(&wma->cs); + + wma->mci_break.flags = dwFlags; + wma->mci_break.parms = *lpParms; + + LeaveCriticalSection(&wma->cs); + + return 0; +} + /****************************************************************************** * MCIAVI_mciSetAudio [internal] */ @@ -986,6 +1029,7 @@ LRESULT CALLBACK MCIAVI_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg, case MCI_WHERE: return MCIAVI_mciWhere (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2); case MCI_STEP: return MCIAVI_mciStep (dwDevID, dwParam1, (LPMCI_DGV_STEP_PARMS) dwParam2); case MCI_CUE: return MCIAVI_mciCue (dwDevID, dwParam1, (LPMCI_DGV_CUE_PARMS) dwParam2); + case MCI_BREAK: return MCIAVI_mciBreak (dwDevID, dwParam1, (LPMCI_BREAK_PARMS) dwParam2); /* Digital Video specific */ case MCI_SETAUDIO: return MCIAVI_mciSetAudio (dwDevID, dwParam1, (LPMCI_DGV_SETAUDIO_PARMSW) dwParam2); case MCI_SIGNAL: return MCIAVI_mciSignal (dwDevID, dwParam1, (LPMCI_DGV_SIGNAL_PARMS) dwParam2); diff --git a/reactos/dll/win32/mciavi32/private_mciavi.h b/reactos/dll/win32/mciavi32/private_mciavi.h index 7e78af273c5..dbaf30f50d0 100644 --- a/reactos/dll/win32/mciavi32/private_mciavi.h +++ b/reactos/dll/win32/mciavi32/private_mciavi.h @@ -81,6 +81,11 @@ typedef struct { DWORD dwToVideoFrame; /* play to */ DWORD dwCurrAudioBlock; /* current audio block being played */ RECT source, dest; + struct + { + DWORD flags; + MCI_BREAK_PARMS parms; + } mci_break; /* data for the background mechanism */ CRITICAL_SECTION cs; HANDLE hStopEvent; diff --git a/reactos/dll/win32/mciavi32/wnd.c b/reactos/dll/win32/mciavi32/wnd.c index 87625d344a2..94b9b6b9a83 100644 --- a/reactos/dll/win32/mciavi32/wnd.c +++ b/reactos/dll/win32/mciavi32/wnd.c @@ -105,7 +105,7 @@ BOOL MCIAVI_RegisterClass(void) return FALSE; } -BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSW lpOpenParms) +BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSW lpParms) { static const WCHAR captionW[] = {'W','i','n','e',' ','M','C','I','-','A','V','I',' ','p','l','a','y','e','r',0}; HWND hParent = 0; @@ -115,8 +115,8 @@ BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARM /* what should be done ? */ if (wma->hWnd) return TRUE; - if (dwFlags & MCI_DGV_OPEN_PARENT) hParent = lpOpenParms->hWndParent; - if (dwFlags & MCI_DGV_OPEN_WS) dwStyle = lpOpenParms->dwStyle; + if (dwFlags & MCI_DGV_OPEN_PARENT) hParent = lpParms->hWndParent; + if (dwFlags & MCI_DGV_OPEN_WS) dwStyle = lpParms->dwStyle; if (wma->hic) SetRect(&rc, 0, 0, wma->outbih->biWidth, wma->outbih->biHeight); @@ -137,6 +137,9 @@ BOOL MCIAVI_CreateWindow(WINE_MCIAVI* wma, DWORD dwFlags, LPMCI_DGV_OPEN_PARM hParent, 0, MCIAVI_hInstance, ULongToPtr(wma->wDevID)); wma->hWndPaint = wma->hWnd; + + TRACE("(%04x, %08X, %p, style %x, parent %p, dimensions %dx%d, hwnd %p)\n", wma->wDevID, + dwFlags, lpParms, dwStyle, hParent, rc.right - rc.left, rc.bottom - rc.top, wma->hWnd); return wma->hWnd != 0; } diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index 671f08c1322..468f7d476ea 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -90,7 +90,7 @@ reactos/dll/win32/jsproxy # Synced to WineStaging-2.2 reactos/dll/win32/loadperf # Synced to WineStaging-2.2 reactos/dll/win32/lz32 # Synced to WineStaging-1.9.11 reactos/dll/win32/mapi32 # Synced to WineStaging-2.2 -reactos/dll/win32/mciavi32 # Synced to WineStaging-1.9.16 +reactos/dll/win32/mciavi32 # Synced to WineStaging-2.9 reactos/dll/win32/mcicda # Synced to WineStaging-1.9.16 reactos/dll/win32/mciqtz32 # Synced to WineStaging-2.2 reactos/dll/win32/mciseq # Synced to WineStaging-1.9.11