Nikolay Sivov : winegstreamer: Maintain playback rate value for the media source.

Alexandre Julliard julliard at winehq.org
Wed Feb 16 15:30:25 CST 2022


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Feb 16 11:53:32 2022 +0300

winegstreamer: Maintain playback rate value for the media source.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winegstreamer/media_source.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c
index 9a77cf72c07..bccbf888a4a 100644
--- a/dlls/winegstreamer/media_source.c
+++ b/dlls/winegstreamer/media_source.c
@@ -105,6 +105,7 @@ struct media_source
         SOURCE_RUNNING,
         SOURCE_SHUTDOWN,
     } state;
+    float rate;
 
     HANDLE read_thread;
     bool read_thread_shutdown;
@@ -1110,6 +1111,7 @@ static ULONG WINAPI media_source_rate_control_Release(IMFRateControl *iface)
 static HRESULT WINAPI media_source_rate_control_SetRate(IMFRateControl *iface, BOOL thin, float rate)
 {
     struct media_source *source = impl_from_IMFRateControl(iface);
+    HRESULT hr;
 
     FIXME("%p, %d, %f.\n", iface, thin, rate);
 
@@ -1119,20 +1121,24 @@ static HRESULT WINAPI media_source_rate_control_SetRate(IMFRateControl *iface, B
     if (thin)
         return MF_E_THINNING_UNSUPPORTED;
 
-    if (rate != 1.0f)
-        return MF_E_UNSUPPORTED_RATE;
+    if (FAILED(hr = IMFRateSupport_IsRateSupported(&source->IMFRateSupport_iface, thin, rate, NULL)))
+        return hr;
+
+    source->rate = rate;
 
     return IMFMediaEventQueue_QueueEventParamVar(source->event_queue, MESourceRateChanged, &GUID_NULL, S_OK, NULL);
 }
 
 static HRESULT WINAPI media_source_rate_control_GetRate(IMFRateControl *iface, BOOL *thin, float *rate)
 {
+    struct media_source *source = impl_from_IMFRateControl(iface);
+
     TRACE("%p, %p, %p.\n", iface, thin, rate);
 
     if (thin)
         *thin = FALSE;
 
-    *rate = 1.0f;
+    *rate = source->rate;
 
     return S_OK;
 }
@@ -1427,6 +1433,7 @@ static HRESULT media_source_constructor(IMFByteStream *bytestream, struct media_
     object->ref = 1;
     object->byte_stream = bytestream;
     IMFByteStream_AddRef(bytestream);
+    object->rate = 1.0f;
 
     if (FAILED(hr = MFCreateEventQueue(&object->event_queue)))
         goto fail;




More information about the wine-cvs mailing list