Author: akhaldi
Date: Sat May 16 10:10:36 2015
New Revision: 67762
URL:
http://svn.reactos.org/svn/reactos?rev=67762&view=rev
Log:
[MPLAY32] Don't use the timer proc to check if playback should stop. Fixes an issue
where the playback does not stop/repeat with some devices if it has reached its end. By
Ricardo Hanke. CORE-9414
Modified:
trunk/reactos/base/applications/mplay32/mplay32.c
Modified: trunk/reactos/base/applications/mplay32/mplay32.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mplay32/…
==============================================================================
--- trunk/reactos/base/applications/mplay32/mplay32.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mplay32/mplay32.c [iso-8859-1] Sat May 16 10:10:36
2015
@@ -648,7 +648,7 @@
SendMessage(hTrackBar, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)1);
mciGeneric.dwCallback = (DWORD_PTR)hwnd;
- mciError = mciSendCommand(wDeviceId, MCI_STOP, MCI_NOTIFY,
(DWORD_PTR)&mciGeneric);
+ mciError = mciSendCommand(wDeviceId, MCI_STOP, MCI_WAIT,
(DWORD_PTR)&mciGeneric);
if (mciError != 0)
{
ShowMCIError(hwnd, mciError);
@@ -744,7 +744,6 @@
PlayTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
MCI_STATUS_PARMS mciStatus;
- MCI_PLAY_PARMS mciPlay;
DWORD dwPos;
if (wDeviceId == 0) KillTimer(hwnd, IDT_PLAYTIMER);
@@ -753,24 +752,8 @@
mciSendCommand(wDeviceId, MCI_STATUS, MCI_STATUS_ITEM, (DWORD_PTR)&mciStatus);
dwPos = mciStatus.dwReturn;
- if ((UINT)dwPos >= MaxFilePos)
- {
- if (!bRepeat)
- {
- StopPlayback(hwnd);
- }
- else
- {
- mciSendCommand(wDeviceId, MCI_SEEK, MCI_WAIT | MCI_SEEK_TO_START, 0);
- mciPlay.dwCallback = (DWORD_PTR)hwnd;
- mciSendCommand(wDeviceId, MCI_PLAY, MCI_NOTIFY, (DWORD_PTR)&mciPlay);
- }
- }
- else
- {
- SendMessage(hTrackBar, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)dwPos);
- UpdateTimeDisplay(hTimeDisplay);
- }
+ SendMessage(hTrackBar, TBM_SETPOS, (WPARAM)TRUE, (LPARAM)dwPos);
+ UpdateTimeDisplay(hTimeDisplay);
}
static VOID
@@ -829,7 +812,7 @@
case MCI_MODE_PLAY:
{
mciGeneric.dwCallback = (DWORD_PTR)hwnd;
- mciError = mciSendCommand(wDeviceId, MCI_PAUSE, MCI_NOTIFY | MCI_WAIT,
(DWORD_PTR)&mciGeneric);
+ mciError = mciSendCommand(wDeviceId, MCI_PAUSE, MCI_WAIT,
(DWORD_PTR)&mciGeneric);
idBmp = IDB_PLAYICON;
idCmd = IDC_PLAY;
break;
@@ -838,7 +821,7 @@
case MCI_MODE_PAUSE:
{
mciGeneric.dwCallback = (DWORD_PTR)hwnd;
- mciError = mciSendCommand(wDeviceId, MCI_RESUME, MCI_NOTIFY,
(DWORD_PTR)&mciGeneric);
+ mciError = mciSendCommand(wDeviceId, MCI_RESUME, MCI_WAIT,
(DWORD_PTR)&mciGeneric);
idBmp = IDB_PAUSEICON;
idCmd = IDC_PAUSE;
break;
@@ -1234,6 +1217,19 @@
DragQueryFile(drophandle, 0, droppedfile, ARRAYSIZE(droppedfile));
DragFinish(drophandle);
OpenMediaFile(hwnd, droppedfile, NULL);
+ break;
+ }
+
+ case MM_MCINOTIFY:
+ {
+ if (wParam == MCI_NOTIFY_SUCCESSFUL)
+ {
+ StopPlayback(hwnd);
+ if (bRepeat)
+ {
+ StartPlayback(hwnd);
+ }
+ }
break;
}