mciqtz32: Implement MCI_STATUS_LENGTH.

This commit is contained in:
Maarten Lankhorst 2010-05-18 15:08:31 +02:00 committed by Alexandre Julliard
parent f65d4c5a47
commit e331a84fc0
1 changed files with 35 additions and 7 deletions

View File

@ -505,6 +505,7 @@ static DWORD MCIQTZ_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpPar
static DWORD MCIQTZ_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSW lpParms) static DWORD MCIQTZ_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSW lpParms)
{ {
WINE_MCIQTZ* wma; WINE_MCIQTZ* wma;
HRESULT hr;
TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms); TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
@ -521,14 +522,41 @@ static DWORD MCIQTZ_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMS
} }
switch (lpParms->dwItem) { switch (lpParms->dwItem) {
case MCI_STATUS_LENGTH: case MCI_STATUS_LENGTH: {
FIXME("MCI_STATUS_LENGTH not implemented yet\n"); IMediaSeeking *seek;
return MCIERR_UNRECOGNIZED_COMMAND; LONGLONG duration = -1;
case MCI_STATUS_POSITION: GUID format;
{ switch (wma->time_format) {
HRESULT hr; case MCI_FORMAT_MILLISECONDS: format = TIME_FORMAT_MEDIA_TIME; break;
REFTIME curpos; case MCI_FORMAT_FRAMES: format = TIME_FORMAT_FRAME; break;
default: ERR("Unhandled format %x\n", wma->time_format); break;
}
hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IMediaSeeking, (void**)&seek);
if (FAILED(hr)) {
FIXME("Cannot get IMediaPostion interface (hr = %x)\n", hr);
return MCIERR_INTERNAL;
}
hr = IMediaSeeking_SetTimeFormat(seek, &format);
if (FAILED(hr)) {
IMediaSeeking_Release(seek);
FIXME("Cannot set time format (hr = %x)\n", hr);
lpParms->dwReturn = 0;
break;
}
hr = IMediaSeeking_GetDuration(seek, &duration);
IMediaSeeking_Release(seek);
if (FAILED(hr) || duration < 0) {
FIXME("Cannot read duration (hr = %x)\n", hr);
lpParms->dwReturn = 0;
} else if (wma->time_format != MCI_FORMAT_MILLISECONDS)
lpParms->dwReturn = duration;
else
lpParms->dwReturn = duration / 10000;
break;
}
case MCI_STATUS_POSITION: {
IMediaPosition* pmpos; IMediaPosition* pmpos;
REFTIME curpos;
hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IMediaPosition, (LPVOID*)&pmpos); hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IMediaPosition, (LPVOID*)&pmpos);
if (FAILED(hr)) { if (FAILED(hr)) {