1999-02-13 13:38:09 +01:00
|
|
|
/*
|
|
|
|
* Digital video MCI Wine Driver
|
|
|
|
*
|
2001-02-14 22:49:22 +01:00
|
|
|
* Copyright 1999, 2000 Eric POUECH
|
2004-01-01 01:48:01 +01:00
|
|
|
* Copyright 2003 Dmitry Timoshkov
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2001-02-14 22:49:22 +01:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* TODO list :
|
|
|
|
* - handling of palettes
|
|
|
|
* - recording (which input devices ?), a cam recorder ?
|
|
|
|
* - lots of messages still need to be handled (cf FIXME)
|
|
|
|
* - synchronization between audio and video (especially for interleaved
|
|
|
|
* files)
|
|
|
|
* - robustness when reading file can be enhanced
|
2010-11-03 20:04:32 +01:00
|
|
|
* - reimplement the AVI handling part with avifile DLL because
|
|
|
|
* "open @1122334 type avivideo alias a" expects an AVIFile/Stream
|
|
|
|
* and MCI_DGV_SET|STATUS_SPEED maps to Rate/Scale
|
2001-02-14 22:49:22 +01:00
|
|
|
* - some files appear to have more than one audio stream (we only play the
|
|
|
|
* first one)
|
2002-06-01 01:06:46 +02:00
|
|
|
* - some files contain an index of audio/video frame. Better use it,
|
2010-11-03 20:04:32 +01:00
|
|
|
* instead of rebuilding it (AVIFile does that already)
|
2001-02-14 22:49:22 +01:00
|
|
|
* - stopping while playing a file with sound blocks until all buffered
|
|
|
|
* audio is played... still should be stopped ASAP
|
1999-02-13 13:38:09 +01:00
|
|
|
*/
|
|
|
|
|
1999-07-15 16:43:13 +02:00
|
|
|
#include <string.h>
|
2001-02-14 22:49:22 +01:00
|
|
|
#include "private_mciavi.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
2005-02-09 23:26:25 +01:00
|
|
|
#include "wine/unicode.h"
|
1999-02-13 13:38:09 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(mciavi);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
static DWORD MCIAVI_mciStop(UINT, DWORD, LPMCI_GENERIC_PARMS);
|
|
|
|
|
1999-02-13 13:38:09 +01:00
|
|
|
/*======================================================================*
|
2006-08-06 12:28:32 +02:00
|
|
|
* MCI AVI implementation *
|
1999-02-13 13:38:09 +01:00
|
|
|
*======================================================================*/
|
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
HINSTANCE MCIAVI_hInstance = 0;
|
|
|
|
|
2004-02-20 21:19:23 +01:00
|
|
|
/***********************************************************************
|
|
|
|
* DllMain (MCIAVI.0)
|
|
|
|
*/
|
2002-11-05 00:53:41 +01:00
|
|
|
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
2001-02-14 22:49:22 +01:00
|
|
|
{
|
|
|
|
switch (fdwReason) {
|
|
|
|
case DLL_PROCESS_ATTACH:
|
2003-06-30 22:53:48 +02:00
|
|
|
DisableThreadLibraryCalls(hInstDLL);
|
2001-02-14 22:49:22 +01:00
|
|
|
MCIAVI_hInstance = hInstDLL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-05-02 12:21:49 +02:00
|
|
|
/**************************************************************************
|
2002-06-01 01:06:46 +02:00
|
|
|
* MCIAVI_drvOpen [internal]
|
1999-05-02 12:21:49 +02:00
|
|
|
*/
|
2005-02-09 23:26:25 +01:00
|
|
|
static DWORD MCIAVI_drvOpen(LPCWSTR str, LPMCI_OPEN_DRIVER_PARMSW modp)
|
1999-05-02 12:21:49 +02:00
|
|
|
{
|
2002-05-12 01:02:55 +02:00
|
|
|
WINE_MCIAVI* wma;
|
2003-12-31 20:00:03 +01:00
|
|
|
static const WCHAR mciAviWStr[] = {'M','C','I','A','V','I',0};
|
1999-05-02 12:21:49 +02:00
|
|
|
|
2005-02-09 23:26:25 +01:00
|
|
|
TRACE("%s, %p\n", debugstr_w(str), modp);
|
2004-01-01 01:48:01 +01:00
|
|
|
|
|
|
|
/* session instance */
|
2002-05-12 01:02:55 +02:00
|
|
|
if (!modp) return 0xFFFFFFFF;
|
|
|
|
|
2004-01-06 21:39:48 +01:00
|
|
|
if (!MCIAVI_RegisterClass()) return 0;
|
|
|
|
|
2002-05-12 01:02:55 +02:00
|
|
|
wma = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIAVI));
|
1999-07-15 16:43:13 +02:00
|
|
|
if (!wma)
|
|
|
|
return 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
InitializeCriticalSection(&wma->cs);
|
2007-03-10 22:09:08 +01:00
|
|
|
wma->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": WINE_MCIAVI.cs");
|
2005-01-07 16:40:09 +01:00
|
|
|
wma->hStopEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
|
1999-07-15 16:43:13 +02:00
|
|
|
wma->wDevID = modp->wDeviceID;
|
2001-02-14 22:49:22 +01:00
|
|
|
wma->wCommandTable = mciLoadCommandResource(MCIAVI_hInstance, mciAviWStr, 0);
|
2010-03-10 20:32:33 +01:00
|
|
|
wma->dwStatus = MCI_MODE_NOT_READY;
|
2001-02-14 22:49:22 +01:00
|
|
|
modp->wCustomCommandTable = wma->wCommandTable;
|
1999-09-22 18:41:00 +02:00
|
|
|
modp->wType = MCI_DEVTYPE_DIGITAL_VIDEO;
|
2007-05-31 16:00:52 +02:00
|
|
|
mciSetDriverData(wma->wDevID, (DWORD_PTR)wma);
|
2004-01-01 01:48:01 +01:00
|
|
|
|
1999-07-15 16:43:13 +02:00
|
|
|
return modp->wDeviceID;
|
1999-05-02 12:21:49 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2002-06-01 01:06:46 +02:00
|
|
|
* MCIAVI_drvClose [internal]
|
1999-05-02 12:21:49 +02:00
|
|
|
*/
|
2001-02-14 22:49:22 +01:00
|
|
|
static DWORD MCIAVI_drvClose(DWORD dwDevID)
|
1999-05-02 12:21:49 +02:00
|
|
|
{
|
2004-01-01 01:48:01 +01:00
|
|
|
WINE_MCIAVI *wma;
|
|
|
|
|
2006-10-12 21:34:57 +02:00
|
|
|
TRACE("%04x\n", dwDevID);
|
2004-01-01 01:48:01 +01:00
|
|
|
|
|
|
|
/* finish all outstanding things */
|
|
|
|
MCIAVI_mciClose(dwDevID, MCI_WAIT, NULL);
|
|
|
|
|
|
|
|
wma = (WINE_MCIAVI*)mciGetDriverData(dwDevID);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-05-02 12:21:49 +02:00
|
|
|
if (wma) {
|
2004-01-06 21:39:48 +01:00
|
|
|
MCIAVI_UnregisterClass();
|
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
EnterCriticalSection(&wma->cs);
|
|
|
|
|
1999-07-15 16:43:13 +02:00
|
|
|
mciSetDriverData(dwDevID, 0);
|
2001-02-14 22:49:22 +01:00
|
|
|
mciFreeCommandResource(wma->wCommandTable);
|
2004-01-01 01:48:01 +01:00
|
|
|
|
2004-03-02 00:38:25 +01:00
|
|
|
CloseHandle(wma->hStopEvent);
|
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
LeaveCriticalSection(&wma->cs);
|
2007-03-10 22:09:08 +01:00
|
|
|
wma->cs.DebugInfo->Spare[0] = 0;
|
2004-01-01 01:48:01 +01:00
|
|
|
DeleteCriticalSection(&wma->cs);
|
|
|
|
|
2002-06-01 01:06:46 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, wma);
|
2001-02-14 22:49:22 +01:00
|
|
|
return 1;
|
|
|
|
}
|
2002-05-12 01:02:55 +02:00
|
|
|
return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
|
2001-02-14 22:49:22 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2002-06-01 01:06:46 +02:00
|
|
|
* MCIAVI_drvConfigure [internal]
|
2001-02-14 22:49:22 +01:00
|
|
|
*/
|
|
|
|
static DWORD MCIAVI_drvConfigure(DWORD dwDevID)
|
|
|
|
{
|
2004-01-01 01:48:01 +01:00
|
|
|
WINE_MCIAVI *wma;
|
|
|
|
|
2006-10-12 21:34:57 +02:00
|
|
|
TRACE("%04x\n", dwDevID);
|
2004-01-01 01:48:01 +01:00
|
|
|
|
|
|
|
MCIAVI_mciStop(dwDevID, MCI_WAIT, NULL);
|
|
|
|
|
|
|
|
wma = (WINE_MCIAVI*)mciGetDriverData(dwDevID);
|
2001-02-14 22:49:22 +01:00
|
|
|
|
|
|
|
if (wma) {
|
2002-06-01 01:06:46 +02:00
|
|
|
MessageBoxA(0, "Sample AVI Wine Driver !", "MM-Wine Driver", MB_OK);
|
1999-05-02 12:21:49 +02:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1999-02-13 13:38:09 +01:00
|
|
|
/**************************************************************************
|
2002-06-01 01:06:46 +02:00
|
|
|
* MCIAVI_mciGetOpenDev [internal]
|
1999-02-13 13:38:09 +01:00
|
|
|
*/
|
2001-02-14 22:49:22 +01:00
|
|
|
WINE_MCIAVI* MCIAVI_mciGetOpenDev(UINT wDevID)
|
1999-02-13 13:38:09 +01:00
|
|
|
{
|
1999-07-15 16:43:13 +02:00
|
|
|
WINE_MCIAVI* wma = (WINE_MCIAVI*)mciGetDriverData(wDevID);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-05-02 12:21:49 +02:00
|
|
|
if (wma == NULL || wma->nUseCount == 0) {
|
1999-07-15 16:43:13 +02:00
|
|
|
WARN("Invalid wDevID=%u\n", wDevID);
|
1999-02-13 13:38:09 +01:00
|
|
|
return 0;
|
|
|
|
}
|
1999-05-02 12:21:49 +02:00
|
|
|
return wma;
|
1999-02-13 13:38:09 +01:00
|
|
|
}
|
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
static void MCIAVI_CleanUp(WINE_MCIAVI* wma)
|
|
|
|
{
|
|
|
|
/* to prevent handling in WindowProc */
|
|
|
|
wma->dwStatus = MCI_MODE_NOT_READY;
|
|
|
|
if (wma->hFile) {
|
|
|
|
mmioClose(wma->hFile, 0);
|
|
|
|
wma->hFile = 0;
|
2004-01-01 01:48:01 +01:00
|
|
|
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, wma->lpFileName);
|
2004-01-01 01:48:01 +01:00
|
|
|
wma->lpFileName = NULL;
|
|
|
|
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, wma->lpVideoIndex);
|
2001-02-14 22:49:22 +01:00
|
|
|
wma->lpVideoIndex = NULL;
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, wma->lpAudioIndex);
|
2001-02-14 22:49:22 +01:00
|
|
|
wma->lpAudioIndex = NULL;
|
|
|
|
if (wma->hic) ICClose(wma->hic);
|
|
|
|
wma->hic = 0;
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, wma->inbih);
|
2001-02-14 22:49:22 +01:00
|
|
|
wma->inbih = NULL;
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, wma->outbih);
|
2001-02-14 22:49:22 +01:00
|
|
|
wma->outbih = NULL;
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, wma->indata);
|
2001-02-14 22:49:22 +01:00
|
|
|
wma->indata = NULL;
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, wma->outdata);
|
2001-02-14 22:49:22 +01:00
|
|
|
wma->outdata = NULL;
|
|
|
|
if (wma->hbmFrame) DeleteObject(wma->hbmFrame);
|
|
|
|
wma->hbmFrame = 0;
|
|
|
|
if (wma->hWnd) DestroyWindow(wma->hWnd);
|
|
|
|
wma->hWnd = 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-12-23 18:06:43 +01:00
|
|
|
HeapFree(GetProcessHeap(), 0, wma->lpWaveFormat);
|
2001-02-14 22:49:22 +01:00
|
|
|
wma->lpWaveFormat = 0;
|
|
|
|
|
|
|
|
memset(&wma->mah, 0, sizeof(wma->mah));
|
|
|
|
memset(&wma->ash_video, 0, sizeof(wma->ash_video));
|
|
|
|
memset(&wma->ash_audio, 0, sizeof(wma->ash_audio));
|
|
|
|
wma->dwCurrVideoFrame = wma->dwCurrAudioBlock = 0;
|
2004-03-02 00:38:25 +01:00
|
|
|
wma->dwCachedFrame = -1;
|
2001-02-14 22:49:22 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
/***************************************************************************
|
2001-02-14 22:49:22 +01:00
|
|
|
* MCIAVI_mciOpen [internal]
|
1999-03-15 16:40:27 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
static DWORD MCIAVI_mciOpen(UINT wDevID, DWORD dwFlags,
|
2005-02-09 23:26:25 +01:00
|
|
|
LPMCI_DGV_OPEN_PARMSW lpOpenParms)
|
1999-02-13 13:38:09 +01:00
|
|
|
{
|
2004-01-01 01:48:01 +01:00
|
|
|
WINE_MCIAVI *wma;
|
2001-02-14 22:49:22 +01:00
|
|
|
LRESULT dwRet = 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-10-12 21:34:57 +02:00
|
|
|
TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpOpenParms);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
if (lpOpenParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
2004-01-01 01:48:01 +01:00
|
|
|
|
|
|
|
wma = (WINE_MCIAVI *)mciGetDriverData(wDevID);
|
1999-05-02 12:21:49 +02:00
|
|
|
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
EnterCriticalSection(&wma->cs);
|
|
|
|
|
1999-02-13 13:38:09 +01:00
|
|
|
if (wma->nUseCount > 0) {
|
|
|
|
/* The driver is already open on this channel */
|
|
|
|
/* If the driver was opened shareable before and this open specifies */
|
|
|
|
/* shareable then increment the use count */
|
|
|
|
if (wma->fShareable && (dwFlags & MCI_OPEN_SHAREABLE))
|
|
|
|
++wma->nUseCount;
|
|
|
|
else
|
2004-01-01 01:48:01 +01:00
|
|
|
{
|
|
|
|
LeaveCriticalSection(&wma->cs);
|
1999-02-13 13:38:09 +01:00
|
|
|
return MCIERR_MUST_USE_SHAREABLE;
|
2004-01-01 01:48:01 +01:00
|
|
|
}
|
1999-02-13 13:38:09 +01:00
|
|
|
} else {
|
|
|
|
wma->nUseCount = 1;
|
|
|
|
wma->fShareable = dwFlags & MCI_OPEN_SHAREABLE;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
|
|
|
wma->dwStatus = MCI_MODE_NOT_READY;
|
|
|
|
|
1999-02-13 13:38:09 +01:00
|
|
|
if (dwFlags & MCI_OPEN_ELEMENT) {
|
2001-02-14 22:49:22 +01:00
|
|
|
if (dwFlags & MCI_OPEN_ELEMENT_ID) {
|
2002-06-01 01:06:46 +02:00
|
|
|
/* could it be that (DWORD)lpOpenParms->lpstrElementName
|
|
|
|
* contains the hFile value ?
|
2001-02-14 22:49:22 +01:00
|
|
|
*/
|
|
|
|
dwRet = MCIERR_UNRECOGNIZED_COMMAND;
|
2009-11-08 10:24:32 +01:00
|
|
|
} else if (lpOpenParms->lpstrElementName && lpOpenParms->lpstrElementName[0]) {
|
2001-02-14 22:49:22 +01:00
|
|
|
/* FIXME : what should be done id wma->hFile is already != 0, or the driver is playin' */
|
2005-02-09 23:26:25 +01:00
|
|
|
TRACE("MCI_OPEN_ELEMENT %s!\n", debugstr_w(lpOpenParms->lpstrElementName));
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2009-11-08 10:24:32 +01:00
|
|
|
wma->lpFileName = HeapAlloc(GetProcessHeap(), 0, (strlenW(lpOpenParms->lpstrElementName) + 1) * sizeof(WCHAR));
|
|
|
|
strcpyW(wma->lpFileName, lpOpenParms->lpstrElementName);
|
|
|
|
|
2010-11-03 20:04:32 +01:00
|
|
|
if (lpOpenParms->lpstrElementName[0] == '@') {
|
|
|
|
/* The file name @11223344 encodes an AVIFile handle in decimal notation
|
|
|
|
* in Win3.1 and w2k/NT, but this feature is absent in win95 (KB140750).
|
|
|
|
* wma->hFile = LongToHandle(strtolW(lpOpenParms->lpstrElementName+1, NULL, 10)); */
|
|
|
|
FIXME("Using AVIFile/Stream %s NIY\n", debugstr_w(lpOpenParms->lpstrElementName));
|
|
|
|
}
|
2009-11-08 10:24:32 +01:00
|
|
|
wma->hFile = mmioOpenW(lpOpenParms->lpstrElementName, NULL,
|
|
|
|
MMIO_ALLOCBUF | MMIO_DENYWRITE | MMIO_READ);
|
|
|
|
|
|
|
|
if (wma->hFile == 0) {
|
|
|
|
WARN("can't find file=%s!\n", debugstr_w(lpOpenParms->lpstrElementName));
|
|
|
|
dwRet = MCIERR_FILE_NOT_FOUND;
|
|
|
|
} else {
|
|
|
|
if (!MCIAVI_GetInfo(wma))
|
|
|
|
dwRet = MCIERR_INVALID_FILE;
|
|
|
|
else if (!MCIAVI_OpenVideo(wma))
|
|
|
|
dwRet = MCIERR_CANNOT_LOAD_DRIVER;
|
|
|
|
else if (!MCIAVI_CreateWindow(wma, dwFlags, lpOpenParms))
|
|
|
|
dwRet = MCIERR_CREATEWINDOW;
|
2001-02-14 22:49:22 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
FIXME("Don't record yet\n");
|
|
|
|
dwRet = MCIERR_UNSUPPORTED_FUNCTION;
|
|
|
|
}
|
1999-02-13 13:38:09 +01:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
if (dwRet == 0) {
|
2004-01-01 01:48:01 +01:00
|
|
|
TRACE("lpOpenParms->wDeviceID = %04x\n", lpOpenParms->wDeviceID);
|
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
wma->dwStatus = MCI_MODE_STOP;
|
|
|
|
wma->dwMciTimeFormat = MCI_FORMAT_FRAMES;
|
|
|
|
} else {
|
|
|
|
MCIAVI_CleanUp(wma);
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
LeaveCriticalSection(&wma->cs);
|
2010-05-19 05:42:18 +02:00
|
|
|
|
|
|
|
if (!dwRet && (dwFlags & MCI_NOTIFY)) {
|
|
|
|
mciDriverNotify(HWND_32(LOWORD(lpOpenParms->dwCallback)),
|
|
|
|
wDevID, MCI_NOTIFY_SUCCESSFUL);
|
|
|
|
}
|
2004-01-01 01:48:01 +01:00
|
|
|
return dwRet;
|
1999-02-13 13:38:09 +01:00
|
|
|
}
|
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
/***************************************************************************
|
2001-02-14 22:49:22 +01:00
|
|
|
* MCIAVI_mciClose [internal]
|
1999-03-15 16:40:27 +01:00
|
|
|
*/
|
2004-01-01 01:48:01 +01:00
|
|
|
DWORD MCIAVI_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
1999-02-13 13:38:09 +01:00
|
|
|
{
|
2004-01-01 01:48:01 +01:00
|
|
|
WINE_MCIAVI *wma;
|
2001-02-14 22:49:22 +01:00
|
|
|
DWORD dwRet = 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-10-12 21:34:57 +02:00
|
|
|
TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2007-12-20 23:45:34 +01:00
|
|
|
wma = MCIAVI_mciGetOpenDev(wDevID);
|
1999-02-13 13:38:09 +01:00
|
|
|
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2010-03-10 20:32:33 +01:00
|
|
|
MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
|
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
EnterCriticalSection(&wma->cs);
|
|
|
|
|
1999-02-13 13:38:09 +01:00
|
|
|
if (wma->nUseCount == 1) {
|
2001-02-14 22:49:22 +01:00
|
|
|
MCIAVI_CleanUp(wma);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
if ((dwFlags & MCI_NOTIFY) && lpParms) {
|
2002-09-06 21:41:17 +02:00
|
|
|
mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
|
2004-01-01 01:48:01 +01:00
|
|
|
wDevID,
|
2001-02-14 22:49:22 +01:00
|
|
|
MCI_NOTIFY_SUCCESSFUL);
|
|
|
|
}
|
2004-01-01 01:48:01 +01:00
|
|
|
LeaveCriticalSection(&wma->cs);
|
2001-02-14 22:49:22 +01:00
|
|
|
return dwRet;
|
1999-02-13 13:38:09 +01:00
|
|
|
}
|
|
|
|
wma->nUseCount--;
|
2004-01-01 01:48:01 +01:00
|
|
|
|
|
|
|
LeaveCriticalSection(&wma->cs);
|
2001-02-14 22:49:22 +01:00
|
|
|
return dwRet;
|
1999-02-13 13:38:09 +01:00
|
|
|
}
|
|
|
|
|
2012-08-15 20:45:07 +02:00
|
|
|
static double currenttime_us(void)
|
|
|
|
{
|
|
|
|
LARGE_INTEGER lc, lf;
|
|
|
|
QueryPerformanceCounter(&lc);
|
|
|
|
QueryPerformanceFrequency(&lf);
|
|
|
|
return (lc.QuadPart * 1000000) / lf.QuadPart;
|
|
|
|
}
|
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
/***************************************************************************
|
2012-11-06 22:59:55 +01:00
|
|
|
* MCIAVI_player [internal]
|
1999-03-15 16:40:27 +01:00
|
|
|
*/
|
2012-11-06 22:59:55 +01:00
|
|
|
static DWORD MCIAVI_player(WINE_MCIAVI *wma, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
|
1999-02-13 13:38:09 +01:00
|
|
|
{
|
2001-02-14 22:49:22 +01:00
|
|
|
DWORD dwRet;
|
|
|
|
LPWAVEHDR waveHdr = NULL;
|
|
|
|
unsigned i, nHdr = 0;
|
2009-11-22 15:38:26 +01:00
|
|
|
DWORD numEvents = 1;
|
|
|
|
HANDLE events[2];
|
2012-08-15 20:45:07 +02:00
|
|
|
double next_frame_us;
|
2017-03-06 05:24:27 +01:00
|
|
|
BOOL wait_audio = TRUE;
|
1999-02-13 13:38:09 +01:00
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
EnterCriticalSection(&wma->cs);
|
|
|
|
|
2004-03-19 20:15:03 +01:00
|
|
|
if (wma->dwToVideoFrame <= wma->dwCurrVideoFrame)
|
2004-01-01 01:48:01 +01:00
|
|
|
{
|
|
|
|
dwRet = 0;
|
|
|
|
goto mci_play_done;
|
|
|
|
}
|
|
|
|
|
2009-11-22 15:38:26 +01:00
|
|
|
events[0] = wma->hStopEvent;
|
2001-02-14 22:49:22 +01:00
|
|
|
if (wma->lpWaveFormat) {
|
2004-01-01 01:48:01 +01:00
|
|
|
if (MCIAVI_OpenAudio(wma, &nHdr, &waveHdr) != 0)
|
|
|
|
{
|
|
|
|
/* can't play audio */
|
|
|
|
HeapFree(GetProcessHeap(), 0, wma->lpWaveFormat);
|
|
|
|
wma->lpWaveFormat = NULL;
|
|
|
|
}
|
2009-11-22 15:38:26 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
/* fill the queue with as many wave headers as possible */
|
|
|
|
MCIAVI_PlayAudioBlocks(wma, nHdr, waveHdr);
|
|
|
|
events[1] = wma->hEvent;
|
|
|
|
numEvents = 2;
|
|
|
|
}
|
1999-03-15 16:40:27 +01:00
|
|
|
}
|
2001-02-14 22:49:22 +01:00
|
|
|
|
2012-08-15 20:45:07 +02:00
|
|
|
next_frame_us = currenttime_us();
|
2004-01-01 01:48:01 +01:00
|
|
|
while (wma->dwStatus == MCI_MODE_PLAY)
|
|
|
|
{
|
2004-03-02 00:38:25 +01:00
|
|
|
HDC hDC;
|
2012-08-15 20:45:07 +02:00
|
|
|
double tc, delta;
|
2005-12-22 17:15:33 +01:00
|
|
|
DWORD ret;
|
2004-03-02 00:38:25 +01:00
|
|
|
|
2012-08-15 20:45:07 +02:00
|
|
|
tc = currenttime_us();
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-03-02 00:38:25 +01:00
|
|
|
hDC = wma->hWndPaint ? GetDC(wma->hWndPaint) : 0;
|
|
|
|
if (hDC)
|
|
|
|
{
|
2012-11-06 22:59:55 +01:00
|
|
|
while(next_frame_us <= tc && wma->dwCurrVideoFrame < wma->dwToVideoFrame){
|
2012-08-15 20:45:07 +02:00
|
|
|
double dur;
|
|
|
|
dur = MCIAVI_PaintFrame(wma, hDC);
|
2015-09-17 09:58:39 +02:00
|
|
|
++wma->dwCurrVideoFrame;
|
2012-08-15 20:45:07 +02:00
|
|
|
if(!dur)
|
|
|
|
break;
|
|
|
|
next_frame_us += dur;
|
|
|
|
TRACE("next_frame: %f\n", next_frame_us);
|
|
|
|
}
|
2004-03-02 00:38:25 +01:00
|
|
|
ReleaseDC(wma->hWndPaint, hDC);
|
|
|
|
}
|
2015-08-30 19:39:56 +02:00
|
|
|
if (wma->dwCurrVideoFrame >= wma->dwToVideoFrame)
|
|
|
|
{
|
|
|
|
if (!(dwFlags & MCI_DGV_PLAY_REPEAT))
|
|
|
|
break;
|
|
|
|
TRACE("repeat media as requested\n");
|
|
|
|
wma->dwCurrVideoFrame = wma->dwCurrAudioBlock = 0;
|
|
|
|
}
|
2001-02-14 22:49:22 +01:00
|
|
|
|
2009-11-22 15:38:26 +01:00
|
|
|
if (wma->lpWaveFormat)
|
2012-08-15 20:45:07 +02:00
|
|
|
MCIAVI_PlayAudioBlocks(wma, nHdr, waveHdr);
|
2001-02-14 22:49:22 +01:00
|
|
|
|
2012-08-15 20:45:07 +02:00
|
|
|
tc = currenttime_us();
|
2015-08-30 19:39:56 +02:00
|
|
|
if (tc < next_frame_us)
|
2012-08-15 20:45:07 +02:00
|
|
|
delta = next_frame_us - tc;
|
2005-12-22 17:15:33 +01:00
|
|
|
else
|
|
|
|
delta = 0;
|
2004-03-02 00:38:25 +01:00
|
|
|
|
2017-03-06 05:24:27 +01:00
|
|
|
/* 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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-12-22 17:15:33 +01:00
|
|
|
LeaveCriticalSection(&wma->cs);
|
2012-08-15 20:45:07 +02:00
|
|
|
ret = WaitForMultipleObjects(numEvents, events, FALSE, delta / 1000);
|
2005-12-22 17:15:33 +01:00
|
|
|
EnterCriticalSection(&wma->cs);
|
2009-11-22 15:38:26 +01:00
|
|
|
if (ret == WAIT_OBJECT_0 || wma->dwStatus != MCI_MODE_PLAY) break;
|
1999-03-15 16:40:27 +01:00
|
|
|
}
|
2001-02-14 22:49:22 +01:00
|
|
|
|
2017-03-06 05:24:27 +01:00
|
|
|
if (wma->lpWaveFormat)
|
|
|
|
{
|
|
|
|
if (wait_audio)
|
|
|
|
while (wma->dwEventCount != nHdr - 1)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection(&wma->cs);
|
|
|
|
Sleep(100);
|
|
|
|
EnterCriticalSection(&wma->cs);
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
/* just to get rid of some race conditions between play, stop and pause */
|
2004-03-18 02:34:36 +01:00
|
|
|
LeaveCriticalSection(&wma->cs);
|
2001-02-14 22:49:22 +01:00
|
|
|
waveOutReset(wma->hWave);
|
2004-03-18 02:34:36 +01:00
|
|
|
EnterCriticalSection(&wma->cs);
|
2001-02-14 22:49:22 +01:00
|
|
|
|
|
|
|
for (i = 0; i < nHdr; i++)
|
|
|
|
waveOutUnprepareHeader(wma->hWave, &waveHdr[i], sizeof(WAVEHDR));
|
1999-03-15 16:40:27 +01:00
|
|
|
}
|
1999-02-13 13:38:09 +01:00
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
dwRet = 0;
|
2004-01-01 01:48:01 +01:00
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
if (wma->lpWaveFormat) {
|
|
|
|
HeapFree(GetProcessHeap(), 0, waveHdr);
|
1999-07-24 12:45:24 +02:00
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
if (wma->hWave) {
|
2004-03-18 02:34:36 +01:00
|
|
|
LeaveCriticalSection(&wma->cs);
|
2001-02-14 22:49:22 +01:00
|
|
|
waveOutClose(wma->hWave);
|
2004-03-18 02:34:36 +01:00
|
|
|
EnterCriticalSection(&wma->cs);
|
2001-02-14 22:49:22 +01:00
|
|
|
wma->hWave = 0;
|
1999-03-15 16:40:27 +01:00
|
|
|
}
|
2001-02-14 22:49:22 +01:00
|
|
|
CloseHandle(wma->hEvent);
|
1999-03-15 16:40:27 +01:00
|
|
|
}
|
2001-02-14 22:49:22 +01:00
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
mci_play_done:
|
|
|
|
wma->dwStatus = MCI_MODE_STOP;
|
|
|
|
|
2010-05-17 01:12:08 +02:00
|
|
|
if (dwFlags & MCI_NOTIFY) {
|
1999-07-15 16:43:13 +02:00
|
|
|
TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
|
2002-09-06 21:41:17 +02:00
|
|
|
mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
|
2012-11-06 22:59:55 +01:00
|
|
|
wma->wDevID, MCI_NOTIFY_SUCCESSFUL);
|
1999-03-15 16:40:27 +01:00
|
|
|
}
|
2004-01-01 01:48:01 +01:00
|
|
|
LeaveCriticalSection(&wma->cs);
|
2001-02-14 22:49:22 +01:00
|
|
|
return dwRet;
|
1999-02-13 13:38:09 +01:00
|
|
|
}
|
|
|
|
|
2012-11-06 22:59:55 +01:00
|
|
|
struct MCIAVI_play_data
|
|
|
|
{
|
|
|
|
WINE_MCIAVI *wma;
|
|
|
|
DWORD flags;
|
|
|
|
MCI_PLAY_PARMS params; /* FIXME: notify via wma->hCallback like the other MCI drivers */
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MCIAVI_mciPlay_thread
|
|
|
|
*
|
|
|
|
* FIXME: probably should use a common worker thread created at the driver
|
|
|
|
* load time and queue all async commands to it.
|
|
|
|
*/
|
|
|
|
static DWORD WINAPI MCIAVI_mciPlay_thread(LPVOID arg)
|
|
|
|
{
|
|
|
|
struct MCIAVI_play_data *data = (struct MCIAVI_play_data *)arg;
|
|
|
|
DWORD ret;
|
|
|
|
|
|
|
|
TRACE("In thread before async play command (id %u, flags %08x)\n", data->wma->wDevID, data->flags);
|
|
|
|
ret = MCIAVI_player(data->wma, data->flags, &data->params);
|
|
|
|
TRACE("In thread after async play command (id %u, flags %08x)\n", data->wma->wDevID, data->flags);
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, data);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* MCIAVI_mciPlay_async
|
|
|
|
*/
|
|
|
|
static DWORD MCIAVI_mciPlay_async(WINE_MCIAVI *wma, DWORD dwFlags, LPMCI_PLAY_PARMS lpParams)
|
|
|
|
{
|
|
|
|
HANDLE handle;
|
|
|
|
struct MCIAVI_play_data *data = HeapAlloc(GetProcessHeap(), 0, sizeof(struct MCIAVI_play_data));
|
|
|
|
|
|
|
|
if (!data) return MCIERR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
data->wma = wma;
|
|
|
|
data->flags = dwFlags;
|
|
|
|
if (dwFlags & MCI_NOTIFY)
|
|
|
|
data->params.dwCallback = lpParams->dwCallback;
|
|
|
|
|
|
|
|
if (!(handle = CreateThread(NULL, 0, MCIAVI_mciPlay_thread, data, 0, NULL)))
|
|
|
|
{
|
|
|
|
WARN("Couldn't create thread for async play, playing synchronously\n");
|
|
|
|
return MCIAVI_mciPlay_thread(data);
|
|
|
|
}
|
|
|
|
SetThreadPriority(handle, THREAD_PRIORITY_TIME_CRITICAL);
|
|
|
|
CloseHandle(handle);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* MCIAVI_mciPlay [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIAVI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
|
|
|
|
{
|
|
|
|
WINE_MCIAVI *wma;
|
|
|
|
DWORD dwRet;
|
|
|
|
DWORD dwFromFrame, dwToFrame;
|
|
|
|
|
|
|
|
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;
|
|
|
|
if (dwFlags & MCI_DGV_PLAY_REVERSE) return MCIERR_UNSUPPORTED_FUNCTION;
|
|
|
|
if (dwFlags & MCI_TEST) return 0;
|
|
|
|
|
2019-04-17 10:55:52 +02:00
|
|
|
if (dwFlags & (MCI_MCIAVI_PLAY_WINDOW|MCI_MCIAVI_PLAY_FULLBY2))
|
2012-11-06 22:59:55 +01:00
|
|
|
FIXME("Unsupported flag %08x\n", dwFlags);
|
|
|
|
|
|
|
|
EnterCriticalSection(&wma->cs);
|
|
|
|
|
|
|
|
if (!wma->hFile)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection(&wma->cs);
|
|
|
|
return MCIERR_FILE_NOT_FOUND;
|
|
|
|
}
|
|
|
|
if (!wma->hWndPaint)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection(&wma->cs);
|
|
|
|
return MCIERR_NO_WINDOW;
|
|
|
|
}
|
|
|
|
|
|
|
|
dwFromFrame = wma->dwCurrVideoFrame;
|
|
|
|
dwToFrame = wma->dwPlayableVideoFrames - 1;
|
|
|
|
|
|
|
|
if (dwFlags & MCI_FROM) {
|
|
|
|
dwFromFrame = MCIAVI_ConvertTimeFormatToFrame(wma, lpParms->dwFrom);
|
|
|
|
}
|
|
|
|
if (dwFlags & MCI_TO) {
|
|
|
|
dwToFrame = MCIAVI_ConvertTimeFormatToFrame(wma, lpParms->dwTo);
|
|
|
|
}
|
|
|
|
if (dwToFrame >= wma->dwPlayableVideoFrames)
|
|
|
|
dwToFrame = wma->dwPlayableVideoFrames - 1;
|
|
|
|
|
|
|
|
TRACE("Playing from frame=%u to frame=%u\n", dwFromFrame, dwToFrame);
|
|
|
|
|
|
|
|
wma->dwCurrVideoFrame = dwFromFrame;
|
|
|
|
wma->dwToVideoFrame = dwToFrame;
|
|
|
|
|
|
|
|
LeaveCriticalSection(&wma->cs);
|
|
|
|
|
2019-04-17 10:55:52 +02:00
|
|
|
if (dwFlags & MCI_MCIAVI_PLAY_FULLSCREEN)
|
|
|
|
{
|
|
|
|
HMONITOR mon = MonitorFromWindow(wma->hWndPaint, MONITOR_DEFAULTTONEAREST);
|
|
|
|
MONITORINFO mi;
|
|
|
|
mi.cbSize = sizeof(mi);
|
|
|
|
GetMonitorInfoA(mon, &mi);
|
|
|
|
wma->hWndPaint = CreateWindowA("STATIC", NULL, WS_POPUP | WS_VISIBLE, mi.rcMonitor.left,
|
|
|
|
mi.rcMonitor.top, mi.rcMonitor.right - mi.rcMonitor.left, mi.rcMonitor.bottom - mi.rcMonitor.top,
|
|
|
|
NULL, NULL, NULL, 0);
|
|
|
|
}
|
|
|
|
/* if not fullscreen ensure the window is visible */
|
|
|
|
else if (!(GetWindowLongW(wma->hWndPaint, GWL_STYLE) & WS_VISIBLE))
|
2012-11-06 22:59:55 +01:00
|
|
|
ShowWindow(wma->hWndPaint, SW_SHOWNA);
|
|
|
|
|
|
|
|
EnterCriticalSection(&wma->cs);
|
|
|
|
|
|
|
|
/* if already playing exit */
|
|
|
|
if (wma->dwStatus == MCI_MODE_PLAY)
|
|
|
|
{
|
|
|
|
LeaveCriticalSection(&wma->cs);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
wma->dwStatus = MCI_MODE_PLAY;
|
|
|
|
|
|
|
|
LeaveCriticalSection(&wma->cs);
|
|
|
|
|
|
|
|
if (dwFlags & MCI_WAIT)
|
|
|
|
return MCIAVI_player(wma, dwFlags, lpParms);
|
|
|
|
|
|
|
|
dwRet = MCIAVI_mciPlay_async(wma, dwFlags, lpParms);
|
|
|
|
|
|
|
|
if (dwRet) {
|
|
|
|
EnterCriticalSection(&wma->cs);
|
|
|
|
wma->dwStatus = MCI_MODE_STOP;
|
|
|
|
LeaveCriticalSection(&wma->cs);
|
|
|
|
}
|
|
|
|
return dwRet;
|
|
|
|
}
|
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
/***************************************************************************
|
2001-02-14 22:49:22 +01:00
|
|
|
* MCIAVI_mciStop [internal]
|
1999-03-15 16:40:27 +01:00
|
|
|
*/
|
2001-02-14 22:49:22 +01:00
|
|
|
static DWORD MCIAVI_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
1999-02-13 13:38:09 +01:00
|
|
|
{
|
2004-01-01 01:48:01 +01:00
|
|
|
WINE_MCIAVI *wma;
|
2001-02-14 22:49:22 +01:00
|
|
|
DWORD dwRet = 0;
|
1999-09-27 15:38:57 +02:00
|
|
|
|
2006-10-12 21:34:57 +02:00
|
|
|
TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
wma = MCIAVI_mciGetOpenDev(wDevID);
|
2001-02-14 22:49:22 +01:00
|
|
|
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
2009-11-28 15:50:41 +01:00
|
|
|
if (dwFlags & MCI_TEST) return 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
EnterCriticalSection(&wma->cs);
|
|
|
|
|
2006-10-12 21:34:57 +02:00
|
|
|
TRACE("current status %04x\n", wma->dwStatus);
|
2005-12-22 17:15:33 +01:00
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
switch (wma->dwStatus) {
|
|
|
|
case MCI_MODE_PLAY:
|
|
|
|
case MCI_MODE_RECORD:
|
2004-03-19 20:15:03 +01:00
|
|
|
LeaveCriticalSection(&wma->cs);
|
2004-03-02 00:38:25 +01:00
|
|
|
SetEvent(wma->hStopEvent);
|
2004-03-19 20:15:03 +01:00
|
|
|
EnterCriticalSection(&wma->cs);
|
2004-03-02 00:38:25 +01:00
|
|
|
/* fall through */
|
|
|
|
case MCI_MODE_PAUSE:
|
2004-03-16 02:13:52 +01:00
|
|
|
/* Since our wave notification callback takes the lock,
|
|
|
|
* we must release it before resetting the device */
|
|
|
|
LeaveCriticalSection(&wma->cs);
|
2004-03-02 00:38:25 +01:00
|
|
|
dwRet = waveOutReset(wma->hWave);
|
2004-03-16 02:13:52 +01:00
|
|
|
EnterCriticalSection(&wma->cs);
|
2004-03-02 00:38:25 +01:00
|
|
|
/* fall through */
|
1999-07-24 12:45:24 +02:00
|
|
|
default:
|
2004-01-01 01:48:01 +01:00
|
|
|
do /* one more chance for an async thread to finish */
|
|
|
|
{
|
|
|
|
LeaveCriticalSection(&wma->cs);
|
2004-03-02 00:38:25 +01:00
|
|
|
Sleep(10);
|
2004-01-01 01:48:01 +01:00
|
|
|
EnterCriticalSection(&wma->cs);
|
|
|
|
} while (wma->dwStatus != MCI_MODE_STOP);
|
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
break;
|
2004-01-01 01:48:01 +01:00
|
|
|
|
|
|
|
case MCI_MODE_NOT_READY:
|
|
|
|
break;
|
1999-02-13 13:38:09 +01:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
if ((dwFlags & MCI_NOTIFY) && lpParms) {
|
2002-09-06 21:41:17 +02:00
|
|
|
mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
|
2004-01-01 01:48:01 +01:00
|
|
|
wDevID, MCI_NOTIFY_SUCCESSFUL);
|
1999-09-27 15:38:57 +02:00
|
|
|
}
|
2004-01-01 01:48:01 +01:00
|
|
|
LeaveCriticalSection(&wma->cs);
|
2001-02-14 22:49:22 +01:00
|
|
|
return dwRet;
|
1999-02-13 13:38:09 +01:00
|
|
|
}
|
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
/***************************************************************************
|
2001-02-14 22:49:22 +01:00
|
|
|
* MCIAVI_mciPause [internal]
|
1999-03-15 16:40:27 +01:00
|
|
|
*/
|
2001-02-14 22:49:22 +01:00
|
|
|
static DWORD MCIAVI_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
1999-02-13 13:38:09 +01:00
|
|
|
{
|
2004-01-01 01:48:01 +01:00
|
|
|
WINE_MCIAVI *wma;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-10-12 21:34:57 +02:00
|
|
|
TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
|
2004-03-19 20:15:03 +01:00
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
wma = MCIAVI_mciGetOpenDev(wDevID);
|
1999-03-15 16:40:27 +01:00
|
|
|
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
2009-11-28 15:50:41 +01:00
|
|
|
if (dwFlags & MCI_TEST) return 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
EnterCriticalSection(&wma->cs);
|
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
if (wma->dwStatus == MCI_MODE_PLAY)
|
|
|
|
wma->dwStatus = MCI_MODE_PAUSE;
|
|
|
|
|
2004-03-18 02:34:36 +01:00
|
|
|
if (wma->lpWaveFormat) {
|
|
|
|
LeaveCriticalSection(&wma->cs);
|
|
|
|
return waveOutPause(wma->hWave);
|
|
|
|
}
|
2004-03-19 20:15:03 +01:00
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
LeaveCriticalSection(&wma->cs);
|
2004-03-18 02:34:36 +01:00
|
|
|
return 0;
|
1999-03-15 16:40:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/***************************************************************************
|
2001-02-14 22:49:22 +01:00
|
|
|
* MCIAVI_mciResume [internal]
|
1999-03-15 16:40:27 +01:00
|
|
|
*/
|
2001-02-14 22:49:22 +01:00
|
|
|
static DWORD MCIAVI_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
1999-03-15 16:40:27 +01:00
|
|
|
{
|
2004-01-01 01:48:01 +01:00
|
|
|
WINE_MCIAVI *wma;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-10-12 21:34:57 +02:00
|
|
|
TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
wma = MCIAVI_mciGetOpenDev(wDevID);
|
1999-03-15 16:40:27 +01:00
|
|
|
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
2009-11-28 15:50:41 +01:00
|
|
|
if (dwFlags & MCI_TEST) return 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
EnterCriticalSection(&wma->cs);
|
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
if (wma->dwStatus == MCI_MODE_PAUSE)
|
|
|
|
wma->dwStatus = MCI_MODE_PLAY;
|
|
|
|
|
2004-03-18 02:34:36 +01:00
|
|
|
if (wma->lpWaveFormat) {
|
|
|
|
LeaveCriticalSection(&wma->cs);
|
|
|
|
return waveOutRestart(wma->hWave);
|
|
|
|
}
|
2004-01-01 01:48:01 +01:00
|
|
|
|
|
|
|
LeaveCriticalSection(&wma->cs);
|
2004-03-18 02:34:36 +01:00
|
|
|
return 0;
|
1999-03-15 16:40:27 +01:00
|
|
|
}
|
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
/***************************************************************************
|
|
|
|
* MCIAVI_mciSeek [internal]
|
1999-03-15 16:40:27 +01:00
|
|
|
*/
|
2001-02-14 22:49:22 +01:00
|
|
|
static DWORD MCIAVI_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
|
1999-03-15 16:40:27 +01:00
|
|
|
{
|
2004-01-01 01:48:01 +01:00
|
|
|
WINE_MCIAVI *wma;
|
2009-11-28 08:26:36 +01:00
|
|
|
DWORD position;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-10-12 21:34:57 +02:00
|
|
|
TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
2004-01-01 01:48:01 +01:00
|
|
|
|
|
|
|
wma = MCIAVI_mciGetOpenDev(wDevID);
|
1999-03-15 16:40:27 +01:00
|
|
|
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
2009-11-28 08:26:36 +01:00
|
|
|
|
|
|
|
position = dwFlags & (MCI_SEEK_TO_START|MCI_SEEK_TO_END|MCI_TO);
|
|
|
|
if (!position) return MCIERR_MISSING_PARAMETER;
|
|
|
|
if (position&(position-1)) return MCIERR_FLAGS_NOT_COMPATIBLE;
|
|
|
|
|
|
|
|
if (dwFlags & MCI_TO) {
|
|
|
|
position = MCIAVI_ConvertTimeFormatToFrame(wma, lpParms->dwTo);
|
|
|
|
if (position >= wma->dwPlayableVideoFrames)
|
|
|
|
return MCIERR_OUTOFRANGE;
|
|
|
|
} else if (dwFlags & MCI_SEEK_TO_START) {
|
|
|
|
position = 0;
|
|
|
|
} else {
|
|
|
|
position = wma->dwPlayableVideoFrames - 1;
|
|
|
|
}
|
2009-11-28 15:50:41 +01:00
|
|
|
if (dwFlags & MCI_TEST) return 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2009-11-26 08:46:55 +01:00
|
|
|
MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
|
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
EnterCriticalSection(&wma->cs);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2009-11-28 08:26:36 +01:00
|
|
|
wma->dwCurrVideoFrame = position;
|
|
|
|
TRACE("Seeking to frame=%u\n", wma->dwCurrVideoFrame);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
if (dwFlags & MCI_NOTIFY) {
|
2002-09-06 21:41:17 +02:00
|
|
|
mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
|
2004-01-01 01:48:01 +01:00
|
|
|
wDevID, MCI_NOTIFY_SUCCESSFUL);
|
2001-02-14 22:49:22 +01:00
|
|
|
}
|
|
|
|
LeaveCriticalSection(&wma->cs);
|
1999-03-15 16:40:27 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2001-02-14 22:49:22 +01:00
|
|
|
/*****************************************************************************
|
|
|
|
* MCIAVI_mciLoad [internal]
|
1999-03-15 16:40:27 +01:00
|
|
|
*/
|
2005-02-09 23:26:25 +01:00
|
|
|
static DWORD MCIAVI_mciLoad(UINT wDevID, DWORD dwFlags, LPMCI_DGV_LOAD_PARMSW lpParms)
|
1999-03-15 16:40:27 +01:00
|
|
|
{
|
2004-01-01 01:48:01 +01:00
|
|
|
WINE_MCIAVI *wma;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-10-12 21:34:57 +02:00
|
|
|
FIXME("(%04x, %08x, %p) : stub\n", wDevID, dwFlags, lpParms);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
2004-01-01 01:48:01 +01:00
|
|
|
|
|
|
|
wma = MCIAVI_mciGetOpenDev(wDevID);
|
1999-03-15 16:40:27 +01:00
|
|
|
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2009-11-28 15:38:47 +01:00
|
|
|
return MCIERR_UNSUPPORTED_FUNCTION; /* like w2k */
|
1999-03-15 16:40:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-14 22:49:22 +01:00
|
|
|
* MCIAVI_mciRealize [internal]
|
1999-03-15 16:40:27 +01:00
|
|
|
*/
|
2001-02-14 22:49:22 +01:00
|
|
|
static DWORD MCIAVI_mciRealize(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
1999-03-15 16:40:27 +01:00
|
|
|
{
|
2004-01-01 01:48:01 +01:00
|
|
|
WINE_MCIAVI *wma;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-10-12 21:34:57 +02:00
|
|
|
FIXME("(%04x, %08x, %p) : stub\n", wDevID, dwFlags, lpParms);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
2004-01-01 01:48:01 +01:00
|
|
|
|
|
|
|
wma = MCIAVI_mciGetOpenDev(wDevID);
|
1999-03-15 16:40:27 +01:00
|
|
|
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
2009-11-28 15:50:41 +01:00
|
|
|
if (dwFlags & MCI_TEST) return 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-14 22:49:22 +01:00
|
|
|
* MCIAVI_mciUpdate [internal]
|
1999-03-15 16:40:27 +01:00
|
|
|
*/
|
2001-02-14 22:49:22 +01:00
|
|
|
static DWORD MCIAVI_mciUpdate(UINT wDevID, DWORD dwFlags, LPMCI_DGV_UPDATE_PARMS lpParms)
|
1999-03-15 16:40:27 +01:00
|
|
|
{
|
2004-01-01 01:48:01 +01:00
|
|
|
WINE_MCIAVI *wma;
|
2001-02-14 22:49:22 +01:00
|
|
|
|
2006-10-12 21:34:57 +02:00
|
|
|
TRACE("%04x, %08x, %p\n", wDevID, dwFlags, lpParms);
|
2004-01-01 01:48:01 +01:00
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
2004-01-01 01:48:01 +01:00
|
|
|
|
|
|
|
wma = MCIAVI_mciGetOpenDev(wDevID);
|
1999-03-15 16:40:27 +01:00
|
|
|
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
2009-11-28 15:50:41 +01:00
|
|
|
/* Ignore MCI_TEST flag. */
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-03-02 00:38:25 +01:00
|
|
|
EnterCriticalSection(&wma->cs);
|
|
|
|
|
|
|
|
if (dwFlags & MCI_DGV_UPDATE_HDC)
|
|
|
|
MCIAVI_PaintFrame(wma, lpParms->hDC);
|
|
|
|
|
|
|
|
LeaveCriticalSection(&wma->cs);
|
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-14 22:49:22 +01:00
|
|
|
* MCIAVI_mciStep [internal]
|
1999-03-15 16:40:27 +01:00
|
|
|
*/
|
2001-02-14 22:49:22 +01:00
|
|
|
static DWORD MCIAVI_mciStep(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STEP_PARMS lpParms)
|
1999-03-15 16:40:27 +01:00
|
|
|
{
|
2004-01-01 01:48:01 +01:00
|
|
|
WINE_MCIAVI *wma;
|
2009-11-28 08:26:36 +01:00
|
|
|
DWORD position;
|
|
|
|
int delta = 1;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2009-11-28 08:26:36 +01:00
|
|
|
TRACE("(%04x, %08x, %p)\n", wDevID, dwFlags, lpParms);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
2004-01-01 01:48:01 +01:00
|
|
|
|
|
|
|
wma = MCIAVI_mciGetOpenDev(wDevID);
|
1999-03-15 16:40:27 +01:00
|
|
|
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
2009-11-28 08:26:36 +01:00
|
|
|
|
|
|
|
if (dwFlags & MCI_DGV_STEP_FRAMES) delta = lpParms->dwFrames;
|
|
|
|
if (dwFlags & MCI_DGV_STEP_REVERSE) delta = -delta;
|
|
|
|
position = wma->dwCurrVideoFrame + delta;
|
|
|
|
if (position >= wma->dwPlayableVideoFrames) return MCIERR_OUTOFRANGE;
|
2009-11-28 15:50:41 +01:00
|
|
|
if (dwFlags & MCI_TEST) return 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2009-11-26 08:46:55 +01:00
|
|
|
MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
|
|
|
|
|
2009-11-28 08:26:36 +01:00
|
|
|
EnterCriticalSection(&wma->cs);
|
|
|
|
|
|
|
|
wma->dwCurrVideoFrame = position;
|
|
|
|
TRACE("Stepping to frame=%u\n", wma->dwCurrVideoFrame);
|
|
|
|
|
|
|
|
if (dwFlags & MCI_NOTIFY) {
|
|
|
|
mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
|
|
|
|
wDevID, MCI_NOTIFY_SUCCESSFUL);
|
|
|
|
}
|
|
|
|
LeaveCriticalSection(&wma->cs);
|
1999-03-15 16:40:27 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-14 22:49:22 +01:00
|
|
|
* MCIAVI_mciCue [internal]
|
1999-03-15 16:40:27 +01:00
|
|
|
*/
|
2001-02-14 22:49:22 +01:00
|
|
|
static DWORD MCIAVI_mciCue(UINT wDevID, DWORD dwFlags, LPMCI_DGV_CUE_PARMS lpParms)
|
1999-03-15 16:40:27 +01:00
|
|
|
{
|
2004-01-01 01:48:01 +01:00
|
|
|
WINE_MCIAVI *wma;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-10-12 21:34:57 +02:00
|
|
|
FIXME("(%04x, %08x, %p) : stub\n", wDevID, dwFlags, lpParms);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
2004-01-01 01:48:01 +01:00
|
|
|
|
|
|
|
wma = MCIAVI_mciGetOpenDev(wDevID);
|
1999-03-15 16:40:27 +01:00
|
|
|
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
2009-11-28 15:38:47 +01:00
|
|
|
if (dwFlags & MCI_DGV_CUE_INPUT) return MCIERR_UNSUPPORTED_FUNCTION;
|
2009-11-28 15:50:41 +01:00
|
|
|
if (dwFlags & MCI_TEST) return 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-03-06 05:24:27 +01:00
|
|
|
/******************************************************************************
|
|
|
|
* 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;
|
|
|
|
}
|
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
/******************************************************************************
|
2001-02-14 22:49:22 +01:00
|
|
|
* MCIAVI_mciSetAudio [internal]
|
1999-03-15 16:40:27 +01:00
|
|
|
*/
|
2005-02-09 23:26:25 +01:00
|
|
|
static DWORD MCIAVI_mciSetAudio(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SETAUDIO_PARMSW lpParms)
|
1999-03-15 16:40:27 +01:00
|
|
|
{
|
2004-01-01 01:48:01 +01:00
|
|
|
WINE_MCIAVI *wma;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
2004-01-01 01:48:01 +01:00
|
|
|
|
2010-03-15 08:11:04 +01:00
|
|
|
FIXME("(%04x, %08x, %p) Item %04x: stub\n", wDevID, dwFlags, lpParms, dwFlags & MCI_DGV_SETAUDIO_ITEM ? lpParms->dwItem : 0);
|
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
wma = MCIAVI_mciGetOpenDev(wDevID);
|
1999-03-15 16:40:27 +01:00
|
|
|
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2010-03-15 08:11:04 +01:00
|
|
|
return 0;
|
1999-03-15 16:40:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-14 22:49:22 +01:00
|
|
|
* MCIAVI_mciSignal [internal]
|
1999-03-15 16:40:27 +01:00
|
|
|
*/
|
2001-02-14 22:49:22 +01:00
|
|
|
static DWORD MCIAVI_mciSignal(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SIGNAL_PARMS lpParms)
|
1999-03-15 16:40:27 +01:00
|
|
|
{
|
2004-01-01 01:48:01 +01:00
|
|
|
WINE_MCIAVI *wma;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-10-12 21:34:57 +02:00
|
|
|
FIXME("(%04x, %08x, %p) : stub\n", wDevID, dwFlags, lpParms);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
2004-01-01 01:48:01 +01:00
|
|
|
|
|
|
|
wma = MCIAVI_mciGetOpenDev(wDevID);
|
1999-03-15 16:40:27 +01:00
|
|
|
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-14 22:49:22 +01:00
|
|
|
* MCIAVI_mciSetVideo [internal]
|
1999-03-15 16:40:27 +01:00
|
|
|
*/
|
2005-02-09 23:26:25 +01:00
|
|
|
static DWORD MCIAVI_mciSetVideo(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SETVIDEO_PARMSW lpParms)
|
1999-03-15 16:40:27 +01:00
|
|
|
{
|
2004-01-01 01:48:01 +01:00
|
|
|
WINE_MCIAVI *wma;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
2004-01-01 01:48:01 +01:00
|
|
|
|
2010-03-15 08:11:04 +01:00
|
|
|
FIXME("(%04x, %08x, %p) Item %04x: stub\n", wDevID, dwFlags, lpParms, dwFlags & MCI_DGV_SETVIDEO_ITEM ? lpParms->dwItem : 0);
|
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
wma = MCIAVI_mciGetOpenDev(wDevID);
|
1999-03-15 16:40:27 +01:00
|
|
|
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2010-03-15 08:11:04 +01:00
|
|
|
return 0;
|
1999-03-15 16:40:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-02-14 22:49:22 +01:00
|
|
|
* MCIAVI_mciConfigure [internal]
|
1999-03-15 16:40:27 +01:00
|
|
|
*/
|
2001-02-14 22:49:22 +01:00
|
|
|
static DWORD MCIAVI_mciConfigure(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
1999-03-15 16:40:27 +01:00
|
|
|
{
|
2004-01-01 01:48:01 +01:00
|
|
|
WINE_MCIAVI *wma;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2006-10-12 21:34:57 +02:00
|
|
|
FIXME("(%04x, %08x, %p) : stub\n", wDevID, dwFlags, lpParms);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
|
2004-01-01 01:48:01 +01:00
|
|
|
|
|
|
|
wma = MCIAVI_mciGetOpenDev(wDevID);
|
1999-03-15 16:40:27 +01:00
|
|
|
if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
|
2009-11-28 15:50:41 +01:00
|
|
|
if (dwFlags & MCI_TEST) return 0;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-15 16:40:27 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1999-02-13 13:38:09 +01:00
|
|
|
/*======================================================================*
|
|
|
|
* MCI AVI entry points *
|
|
|
|
*======================================================================*/
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-07-11 20:56:41 +02:00
|
|
|
* DriverProc (MCIAVI.@)
|
1999-02-13 13:38:09 +01:00
|
|
|
*/
|
2005-11-28 20:53:22 +01:00
|
|
|
LRESULT CALLBACK MCIAVI_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
|
|
|
|
LPARAM dwParam1, LPARAM dwParam2)
|
1999-02-13 13:38:09 +01:00
|
|
|
{
|
2005-11-28 20:53:22 +01:00
|
|
|
TRACE("(%08lX, %p, %08X, %08lX, %08lX)\n",
|
2001-02-14 22:49:22 +01:00
|
|
|
dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-02-13 13:38:09 +01:00
|
|
|
switch (wMsg) {
|
|
|
|
case DRV_LOAD: return 1;
|
|
|
|
case DRV_FREE: return 1;
|
2005-02-09 23:26:25 +01:00
|
|
|
case DRV_OPEN: return MCIAVI_drvOpen((LPCWSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSW)dwParam2);
|
2001-02-14 22:49:22 +01:00
|
|
|
case DRV_CLOSE: return MCIAVI_drvClose(dwDevID);
|
1999-02-13 13:38:09 +01:00
|
|
|
case DRV_ENABLE: return 1;
|
|
|
|
case DRV_DISABLE: return 1;
|
|
|
|
case DRV_QUERYCONFIGURE: return 1;
|
2001-02-14 22:49:22 +01:00
|
|
|
case DRV_CONFIGURE: return MCIAVI_drvConfigure(dwDevID);
|
1999-02-13 13:38:09 +01:00
|
|
|
case DRV_INSTALL: return DRVCNF_RESTART;
|
|
|
|
case DRV_REMOVE: return DRVCNF_RESTART;
|
2002-05-12 01:02:55 +02:00
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2004-01-01 01:48:01 +01:00
|
|
|
/* session instance */
|
|
|
|
if (dwDevID == 0xFFFFFFFF) return 1;
|
2002-05-12 01:02:55 +02:00
|
|
|
|
|
|
|
switch (wMsg) {
|
2005-02-09 23:26:25 +01:00
|
|
|
case MCI_OPEN_DRIVER: return MCIAVI_mciOpen (dwDevID, dwParam1, (LPMCI_DGV_OPEN_PARMSW) dwParam2);
|
2001-02-14 22:49:22 +01:00
|
|
|
case MCI_CLOSE_DRIVER: return MCIAVI_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
|
|
|
case MCI_PLAY: return MCIAVI_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);
|
|
|
|
case MCI_STOP: return MCIAVI_mciStop (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
|
|
|
case MCI_SET: return MCIAVI_mciSet (dwDevID, dwParam1, (LPMCI_DGV_SET_PARMS) dwParam2);
|
|
|
|
case MCI_PAUSE: return MCIAVI_mciPause (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
|
|
|
case MCI_RESUME: return MCIAVI_mciResume (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
2005-02-09 23:26:25 +01:00
|
|
|
case MCI_STATUS: return MCIAVI_mciStatus (dwDevID, dwParam1, (LPMCI_DGV_STATUS_PARMSW) dwParam2);
|
2001-02-14 22:49:22 +01:00
|
|
|
case MCI_GETDEVCAPS: return MCIAVI_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS) dwParam2);
|
2005-02-09 23:26:25 +01:00
|
|
|
case MCI_INFO: return MCIAVI_mciInfo (dwDevID, dwParam1, (LPMCI_DGV_INFO_PARMSW) dwParam2);
|
2001-02-14 22:49:22 +01:00
|
|
|
case MCI_SEEK: return MCIAVI_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2);
|
2002-06-01 01:06:46 +02:00
|
|
|
case MCI_PUT: return MCIAVI_mciPut (dwDevID, dwParam1, (LPMCI_DGV_PUT_PARMS) dwParam2);
|
2005-02-09 23:26:25 +01:00
|
|
|
case MCI_WINDOW: return MCIAVI_mciWindow (dwDevID, dwParam1, (LPMCI_DGV_WINDOW_PARMSW) dwParam2);
|
|
|
|
case MCI_LOAD: return MCIAVI_mciLoad (dwDevID, dwParam1, (LPMCI_DGV_LOAD_PARMSW) dwParam2);
|
2001-02-14 22:49:22 +01:00
|
|
|
case MCI_REALIZE: return MCIAVI_mciRealize (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
|
|
|
case MCI_UPDATE: return MCIAVI_mciUpdate (dwDevID, dwParam1, (LPMCI_DGV_UPDATE_PARMS) dwParam2);
|
|
|
|
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);
|
2017-03-06 05:24:27 +01:00
|
|
|
case MCI_BREAK: return MCIAVI_mciBreak (dwDevID, dwParam1, (LPMCI_BREAK_PARMS) dwParam2);
|
2002-06-01 01:06:46 +02:00
|
|
|
/* Digital Video specific */
|
2005-02-09 23:26:25 +01:00
|
|
|
case MCI_SETAUDIO: return MCIAVI_mciSetAudio (dwDevID, dwParam1, (LPMCI_DGV_SETAUDIO_PARMSW) dwParam2);
|
2001-02-14 22:49:22 +01:00
|
|
|
case MCI_SIGNAL: return MCIAVI_mciSignal (dwDevID, dwParam1, (LPMCI_DGV_SIGNAL_PARMS) dwParam2);
|
2005-02-09 23:26:25 +01:00
|
|
|
case MCI_SETVIDEO: return MCIAVI_mciSetVideo (dwDevID, dwParam1, (LPMCI_DGV_SETVIDEO_PARMSW) dwParam2);
|
2001-02-14 22:49:22 +01:00
|
|
|
case MCI_CONFIGURE: return MCIAVI_mciConfigure (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2009-11-26 16:59:51 +01:00
|
|
|
/* no editing, recording, saving, locking without inputs */
|
|
|
|
case MCI_CAPTURE:
|
|
|
|
case MCI_COPY:
|
|
|
|
case MCI_CUT:
|
|
|
|
case MCI_DELETE:
|
|
|
|
case MCI_FREEZE:
|
|
|
|
case MCI_LIST:
|
|
|
|
case MCI_MONITOR:
|
|
|
|
case MCI_PASTE:
|
|
|
|
case MCI_QUALITY:
|
|
|
|
case MCI_RECORD:
|
|
|
|
case MCI_RESERVE:
|
|
|
|
case MCI_RESTORE:
|
|
|
|
case MCI_SAVE:
|
|
|
|
case MCI_UNDO:
|
|
|
|
case MCI_UNFREEZE:
|
|
|
|
TRACE("Unsupported function [0x%x] flags=%08x\n", wMsg, (DWORD)dwParam1);
|
|
|
|
return MCIERR_UNSUPPORTED_FUNCTION;
|
1999-03-15 16:40:27 +01:00
|
|
|
case MCI_SPIN:
|
2002-06-01 01:06:46 +02:00
|
|
|
case MCI_ESCAPE:
|
2009-11-26 16:59:51 +01:00
|
|
|
WARN("Unsupported command [0x%x] %08x\n", wMsg, (DWORD)dwParam1);
|
1999-02-13 13:38:09 +01:00
|
|
|
break;
|
|
|
|
case MCI_OPEN:
|
|
|
|
case MCI_CLOSE:
|
1999-07-15 16:43:13 +02:00
|
|
|
FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
|
1999-02-13 13:38:09 +01:00
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
default:
|
2005-11-28 20:53:22 +01:00
|
|
|
TRACE("Sending msg [%u] to default driver proc\n", wMsg);
|
1999-02-26 12:11:13 +01:00
|
|
|
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
1999-02-13 13:38:09 +01:00
|
|
|
}
|
|
|
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
|
|
|
}
|