Anton Romanov : wmp: Stub IWMPNetwork get download/buffering progress.

Alexandre Julliard julliard at winehq.org
Fri Apr 20 17:55:42 CDT 2018


Module: wine
Branch: master
Commit: 6e2c61187098bb1cab3b785855074efc39aba59f
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=6e2c61187098bb1cab3b785855074efc39aba59f

Author: Anton Romanov <theli.ua at gmail.com>
Date:   Thu Apr 19 22:45:31 2018 -0700

wmp: Stub IWMPNetwork get download/buffering progress.

Signed-off-by: Anton Romanov <theli.ua at gmail.com>
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wmp/player.c      | 27 +++++++++++++++++++++++----
 dlls/wmp/tests/media.c | 16 ++++++++++++++++
 2 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/dlls/wmp/player.c b/dlls/wmp/player.c
index 0a6d598..df395cb 100644
--- a/dlls/wmp/player.c
+++ b/dlls/wmp/player.c
@@ -1150,8 +1150,17 @@ static HRESULT WINAPI WMPNetwork_get_bufferingCount(IWMPNetwork *iface, LONG *pl
 static HRESULT WINAPI WMPNetwork_get_bufferingProgress(IWMPNetwork *iface, LONG *plBufferingProgress)
 {
     WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
-    FIXME("(%p)->(%p)\n", This, plBufferingProgress);
-    return E_NOTIMPL;
+    TRACE("(%p)->(%p)\n", This, plBufferingProgress);
+    if (!This->filter_graph) {
+        return S_FALSE;
+    }
+    /* Ideally we would use IAMOpenProgress for URL reader but we don't have it in wine (yet)
+     * For file sources FileAsyncReader->Length should work
+     * */
+    FIXME("stub: Returning buffering progress 100\n");
+    *plBufferingProgress = 100;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI WMPNetwork_get_bufferingTime(IWMPNetwork *iface, LONG *plBufferingTime)
@@ -1276,8 +1285,18 @@ static HRESULT WINAPI WMPNetwork_put_maxBandwidth(IWMPNetwork *iface, LONG lMaxB
 static HRESULT WINAPI WMPNetwork_get_downloadProgress(IWMPNetwork *iface, LONG *plDownloadProgress)
 {
     WindowsMediaPlayer *This = impl_from_IWMPNetwork(iface);
-    FIXME("(%p)->(%p)\n", This, plDownloadProgress);
-    return E_NOTIMPL;
+    TRACE("(%p)->(%p)\n", This, plDownloadProgress);
+    if (!This->filter_graph) {
+        return S_FALSE;
+    }
+    /* Ideally we would use IAMOpenProgress for URL reader but we don't have it in wine (yet)
+     * For file sources FileAsyncReader->Length could work or it should just be
+     * 100
+     * */
+    FIXME("stub: Returning download progress 100\n");
+    *plDownloadProgress = 100;
+
+    return S_OK;
 }
 
 static HRESULT WINAPI WMPNetwork_get_encodedFrameRate(IWMPNetwork *iface, LONG *plFrameRate)
diff --git a/dlls/wmp/tests/media.c b/dlls/wmp/tests/media.c
index 2372763..fbbd329 100644
--- a/dlls/wmp/tests/media.c
+++ b/dlls/wmp/tests/media.c
@@ -303,8 +303,10 @@ static BOOL test_wmp(void)
     static DWORD dw = 100;
     IWMPSettings *settings;
     BOOL test_ran = TRUE;
+    IWMPNetwork *network;
     DOUBLE duration;
     VARIANT_BOOL vbool;
+    LONG progress;
     IWMPMedia *media;
     static const WCHAR currentPosition[] = {'c','u','r','r','e','n','t','P','o','s','i','t','i','o','n',0};
     BSTR bstrcurrentPosition = SysAllocString(currentPosition);
@@ -416,6 +418,20 @@ static BOOL test_wmp(void)
     ok(round(duration) == 3, "unexpected value: %f\n", duration);
     IWMPMedia_Release(media);
 
+    network = NULL;
+    hres = IWMPPlayer4_get_network(player4, &network);
+    ok(hres == S_OK, "get_network failed: %08x\n", hres);
+    ok(network != NULL, "network = NULL\n");
+    progress = 0;
+    hres = IWMPNetwork_get_bufferingProgress(network, &progress);
+    ok(hres == S_OK || broken(hres == S_FALSE), "IWMPNetwork_get_bufferingProgress failed: %08x\n", hres);
+    ok(progress == 100, "unexpected value: %d\n", progress);
+    progress = 0;
+    hres = IWMPNetwork_get_downloadProgress(network, &progress);
+    ok(hres == S_OK, "IWMPNetwork_get_downloadProgress failed: %08x\n", hres);
+    ok(progress == 100, "unexpected value: %d\n", progress);
+    IWMPNetwork_Release(network);
+
     SET_EXPECT(PLAYSTATE, wmppsStopped);
     /* The following happens on wine only since we close media on stop */
     SET_EXPECT(OPENSTATE, wmposPlaylistOpenNoMedia);




More information about the wine-cvs mailing list