- Sync mciavi32 and mciqtz32 with Wine 1.1.20

svn path=/trunk/; revision=40813
This commit is contained in:
Dmitry Chapyshev 2009-05-06 08:46:19 +00:00
parent 63c10be4be
commit 6c47ffb60d
3 changed files with 74 additions and 71 deletions

View file

@ -225,72 +225,73 @@ DWORD MCIAVI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms)
}
if (dwFlags & MCI_SET_ON) {
char buffer[256];
strcpy(buffer, "MCI_SET_ON:");
const char *szVideo="";
const char *szAudio="";
const char *szSeek="";
if (dwFlags & MCI_SET_VIDEO) {
strncat(buffer, " video", sizeof(buffer)-sizeof("MCI_SET_ON:"));
szVideo = " video";
wma->dwSet |= 4;
}
if (dwFlags & MCI_SET_AUDIO) {
strncat(buffer, " audio", sizeof(buffer)-sizeof("MCI_SET_ON:"));
switch (lpParms->dwAudio) {
case MCI_SET_AUDIO_ALL:
strncat(buffer, " all", sizeof(buffer)-sizeof("MCI_SET_ON:"));
szAudio = " audio all";
wma->dwSet |= 3;
break;
case MCI_SET_AUDIO_LEFT:
strncat(buffer, " left", sizeof(buffer)-sizeof("MCI_SET_ON:"));
szAudio = " audio left";
wma->dwSet |= 1;
break;
case MCI_SET_AUDIO_RIGHT:
strncat(buffer, " right", sizeof(buffer)-sizeof("MCI_SET_ON:"));
szAudio = " audio right";
wma->dwSet |= 2;
break;
default:
szAudio = " audio unknown";
WARN("Unknown audio channel %u\n", lpParms->dwAudio);
break;
}
}
if (dwFlags & MCI_DGV_SET_SEEK_EXACTLY) {
strncat(buffer, " seek_exactly", sizeof(buffer));
szSeek = " seek_exactly";
}
FIXME("%s\n", buffer);
FIXME("MCI_SET_ON:%s%s%s\n", szVideo, szAudio, szSeek);
}
if (dwFlags & MCI_SET_OFF) {
char buffer[256];
const char *szVideo="";
const char *szAudio="";
const char *szSeek="";
strcpy(buffer, "MCI_SET_OFF:");
if (dwFlags & MCI_SET_VIDEO) {
strncat(buffer, " video", sizeof(buffer)-sizeof("MCI_SET_OFF:"));
szVideo = " video";
wma->dwSet &= ~4;
}
if (dwFlags & MCI_SET_AUDIO) {
strncat(buffer, " audio", sizeof(buffer)-sizeof("MCI_SET_OFF:"));
switch (lpParms->dwAudio) {
case MCI_SET_AUDIO_ALL:
strncat(buffer, " all", sizeof(buffer)-sizeof("MCI_SET_OFF:"));
szAudio = " audio all";
wma->dwSet &= ~3;
break;
case MCI_SET_AUDIO_LEFT:
strncat(buffer, " left", sizeof(buffer)-sizeof("MCI_SET_OFF:"));
szAudio = " audio left";
wma->dwSet &= ~2;
break;
case MCI_SET_AUDIO_RIGHT:
strncat(buffer, " right", sizeof(buffer)-sizeof("MCI_SET_OFF:"));
szAudio = " audio right";
wma->dwSet &= ~2;
break;
default:
szAudio = " audio unknown";
WARN("Unknown audio channel %u\n", lpParms->dwAudio);
break;
}
}
if (dwFlags & MCI_DGV_SET_SEEK_EXACTLY) {
strncat(buffer, " seek_exactly", sizeof(buffer)-strlen(buffer)-1);
szSeek = " seek_exactly";
}
FIXME("%s\n", buffer);
FIXME("MCI_SET_OFF:%s%s%s\n", szVideo, szAudio, szSeek);
}
if (dwFlags & MCI_DGV_SET_FILEFORMAT) {
LPCSTR str = "save";

View file

@ -34,25 +34,39 @@ static DWORD MCIQTZ_mciClose(UINT, DWORD, LPMCI_GENERIC_PARMS);
static DWORD MCIQTZ_mciStop(UINT, DWORD, LPMCI_GENERIC_PARMS);
/*======================================================================*
* MCI QTZ implementation *
* MCI QTZ implementation *
*======================================================================*/
HINSTANCE MCIQTZ_hInstance = 0;
/***********************************************************************
* DllMain (MCIQTZ.0)
* DllMain (MCIQTZ.0)
*/
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID fImpLoad)
{
switch (fdwReason) {
case DLL_PROCESS_ATTACH:
DisableThreadLibraryCalls(hInstDLL);
MCIQTZ_hInstance = hInstDLL;
break;
MCIQTZ_hInstance = hInstDLL;
break;
}
return TRUE;
}
/**************************************************************************
* MCIQTZ_mciGetOpenDev [internal]
*/
static WINE_MCIQTZ* MCIQTZ_mciGetOpenDev(UINT wDevID)
{
WINE_MCIQTZ* wma = (WINE_MCIQTZ*)mciGetDriverData(wDevID);
if (!wma) {
WARN("Invalid wDevID=%u\n", wDevID);
return NULL;
}
return wma;
}
/**************************************************************************
* MCIQTZ_drvOpen [internal]
*/
@ -60,7 +74,7 @@ static DWORD MCIQTZ_drvOpen(LPCWSTR str, LPMCI_OPEN_DRIVER_PARMSW modp)
{
WINE_MCIQTZ* wma;
TRACE("%s, %p\n", debugstr_w(str), modp);
TRACE("(%s, %p)\n", debugstr_w(str), modp);
/* session instance */
if (!modp)
@ -83,14 +97,14 @@ static DWORD MCIQTZ_drvClose(DWORD dwDevID)
{
WINE_MCIQTZ* wma;
TRACE("%04x\n", dwDevID);
TRACE("(%04x)\n", dwDevID);
/* finish all outstanding things */
MCIQTZ_mciClose(dwDevID, MCI_WAIT, NULL);
wma = (WINE_MCIQTZ*)mciGetDriverData(dwDevID);
wma = MCIQTZ_mciGetOpenDev(dwDevID);
if (wma) {
/* finish all outstanding things */
MCIQTZ_mciClose(dwDevID, MCI_WAIT, NULL);
HeapFree(GetProcessHeap(), 0, wma);
return 1;
}
@ -105,32 +119,17 @@ static DWORD MCIQTZ_drvConfigure(DWORD dwDevID)
{
WINE_MCIQTZ* wma;
TRACE("%04x\n", dwDevID);
TRACE("(%04x)\n", dwDevID);
wma = MCIQTZ_mciGetOpenDev(dwDevID);
if (!wma)
return 0;
MCIQTZ_mciStop(dwDevID, MCI_WAIT, NULL);
wma = (WINE_MCIQTZ*)mciGetDriverData(dwDevID);
MessageBoxA(0, "Sample QTZ Wine Driver !", "MM-Wine Driver", MB_OK);
if (wma) {
MessageBoxA(0, "Sample QTZ Wine Driver !", "MM-Wine Driver", MB_OK);
return 1;
}
return 0;
}
/**************************************************************************
* MCIQTZ_mciGetOpenDev [internal]
*/
static WINE_MCIQTZ* MCIQTZ_mciGetOpenDev(UINT wDevID)
{
WINE_MCIQTZ* wma = (WINE_MCIQTZ*)mciGetDriverData(wDevID);
if (!wma) {
WARN("Invalid wDevID=%u\n", wDevID);
return 0;
}
return wma;
return 1;
}
/***************************************************************************
@ -144,15 +143,15 @@ static DWORD MCIQTZ_mciOpen(UINT wDevID, DWORD dwFlags,
TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpOpenParms);
MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
if (!lpOpenParms)
return MCIERR_NULL_PARAMETER_BLOCK;
wma = (WINE_MCIQTZ*)mciGetDriverData(wDevID);
wma = MCIQTZ_mciGetOpenDev(wDevID);
if (!wma)
return MCIERR_INVALID_DEVICE_ID;
MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
CoInitializeEx(NULL, COINIT_MULTITHREADED);
hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IGraphBuilder, (LPVOID*)&wma->pgraph);
@ -185,6 +184,8 @@ static DWORD MCIQTZ_mciOpen(UINT wDevID, DWORD dwFlags,
goto err;
}
wma->opened = TRUE;
return 0;
err:
@ -209,20 +210,18 @@ static DWORD MCIQTZ_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
wma = MCIQTZ_mciGetOpenDev(wDevID);
if (!wma)
return MCIERR_INVALID_DEVICE_ID;
if (wma->pgraph)
IGraphBuilder_Release(wma->pgraph);
wma->pgraph = NULL;
if (wma->pmctrl)
IMediaControl_Release(wma->pmctrl);
wma->pmctrl = NULL;
MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
CoUninitialize();
if (wma->opened) {
IGraphBuilder_Release(wma->pgraph);
IMediaControl_Release(wma->pmctrl);
CoUninitialize();
wma->opened = FALSE;
}
return 0;
}
@ -241,6 +240,8 @@ static DWORD MCIQTZ_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms
return MCIERR_NULL_PARAMETER_BLOCK;
wma = MCIQTZ_mciGetOpenDev(wDevID);
if (!wma)
return MCIERR_INVALID_DEVICE_ID;
hr = IMediaControl_Run(wma->pmctrl);
if (FAILED(hr)) {
@ -265,8 +266,6 @@ static DWORD MCIQTZ_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms
TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
if (!lpParms)
return MCIERR_NULL_PARAMETER_BLOCK;
@ -274,6 +273,8 @@ static DWORD MCIQTZ_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms
if (!wma)
return MCIERR_INVALID_DEVICE_ID;
MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
if (dwFlags & MCI_SEEK_TO_START) {
newpos = 0;
} else if (dwFlags & MCI_SEEK_TO_END) {
@ -415,11 +416,11 @@ static DWORD MCIQTZ_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMS
}
/*======================================================================*
* MCI QTZ entry points *
* MCI QTZ entry points *
*======================================================================*/
/**************************************************************************
* DriverProc (MCIQTZ.@)
* DriverProc (MCIQTZ.@)
*/
LRESULT CALLBACK MCIQTZ_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
LPARAM dwParam1, LPARAM dwParam2)
@ -449,9 +450,9 @@ LRESULT CALLBACK MCIQTZ_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
case MCI_CLOSE_DRIVER: return MCIQTZ_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_PLAY: return MCIQTZ_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);
case MCI_SEEK: return MCIQTZ_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2);
case MCI_STOP: return MCIQTZ_mciStop (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
case MCI_STATUS: return MCIQTZ_mciStatus (dwDevID, dwParam1, (LPMCI_DGV_STATUS_PARMSW) dwParam2);
case MCI_RECORD:
case MCI_STOP:
case MCI_SET:
case MCI_PAUSE:
case MCI_RESUME:
@ -484,18 +485,18 @@ LRESULT CALLBACK MCIQTZ_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
case MCI_UNDO:
case MCI_CONFIGURE:
case MCI_RESTORE:
FIXME("Unimplemented command [%u]\n", wMsg);
FIXME("Unimplemented command [%08X]\n", wMsg);
break;
case MCI_SPIN:
case MCI_ESCAPE:
WARN("Unsupported command [%u]\n", wMsg);
WARN("Unsupported command [%08X]\n", wMsg);
break;
case MCI_OPEN:
case MCI_CLOSE:
FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
break;
default:
TRACE("Sending msg [%u] to default driver proc\n", wMsg);
TRACE("Sending msg [%08X] to default driver proc\n", wMsg);
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
}

View file

@ -27,6 +27,7 @@
typedef struct {
MCIDEVICEID wDevID;
BOOL opened;
IGraphBuilder* pgraph;
IMediaControl* pmctrl;
BOOL started;