Maarten Lankhorst : mciqtz32: Implement MCI_STATUS_LENGTH.

Alexandre Julliard julliard at winehq.org
Tue May 18 12:33:00 CDT 2010


Module: wine
Branch: master
Commit: e331a84fc0daddf2e38de84f0d0b4d5f047f6841
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e331a84fc0daddf2e38de84f0d0b4d5f047f6841

Author: Maarten Lankhorst <m.b.lankhorst at gmail.com>
Date:   Tue May 18 15:08:31 2010 +0200

mciqtz32: Implement MCI_STATUS_LENGTH.

---

 dlls/mciqtz32/mciqtz.c |   42 +++++++++++++++++++++++++++++++++++-------
 1 files changed, 35 insertions(+), 7 deletions(-)

diff --git a/dlls/mciqtz32/mciqtz.c b/dlls/mciqtz32/mciqtz.c
index 37af196..36a7fcb 100644
--- a/dlls/mciqtz32/mciqtz.c
+++ b/dlls/mciqtz32/mciqtz.c
@@ -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)
 {
     WINE_MCIQTZ* wma;
+    HRESULT hr;
 
     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) {
-        case MCI_STATUS_LENGTH:
-            FIXME("MCI_STATUS_LENGTH not implemented yet\n");
-            return MCIERR_UNRECOGNIZED_COMMAND;
-        case MCI_STATUS_POSITION:
-        {
-            HRESULT hr;
-            REFTIME curpos;
+        case MCI_STATUS_LENGTH: {
+            IMediaSeeking *seek;
+            LONGLONG duration = -1;
+            GUID format;
+            switch (wma->time_format) {
+                case MCI_FORMAT_MILLISECONDS: format = TIME_FORMAT_MEDIA_TIME; break;
+                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;
+            REFTIME curpos;
 
             hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IMediaPosition, (LPVOID*)&pmpos);
             if (FAILED(hr)) {




More information about the wine-cvs mailing list