Nikolay Sivov : mfreadwrite: Add partial implementation of SetCurrentPosition() for source reader.

Alexandre Julliard julliard at winehq.org
Wed Mar 20 17:09:12 CDT 2019


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Mar 20 08:35:43 2019 +0300

mfreadwrite: Add partial implementation of SetCurrentPosition() for source reader.

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

---

 dlls/mfreadwrite/main.c | 18 +++++++++++++++---
 include/mfidl.idl       | 12 ++++++++++++
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/dlls/mfreadwrite/main.c b/dlls/mfreadwrite/main.c
index ef9e06e..516b592 100644
--- a/dlls/mfreadwrite/main.c
+++ b/dlls/mfreadwrite/main.c
@@ -359,9 +359,21 @@ static HRESULT WINAPI src_reader_SetCurrentMediaType(IMFSourceReader *iface, DWO
 
 static HRESULT WINAPI src_reader_SetCurrentPosition(IMFSourceReader *iface, REFGUID format, REFPROPVARIANT position)
 {
-    srcreader *This = impl_from_IMFSourceReader(iface);
-    FIXME("%p, %s, %p\n", This, debugstr_guid(format), position);
-    return E_NOTIMPL;
+    struct source_reader *reader = impl_from_IMFSourceReader(iface);
+    DWORD flags;
+    HRESULT hr;
+
+    TRACE("%p, %s, %p.\n", iface, debugstr_guid(format), position);
+
+    /* FIXME: fail if we got pending samples. */
+
+    if (FAILED(hr = IMFMediaSource_GetCharacteristics(reader->source, &flags)))
+        return hr;
+
+    if (!(flags & MFMEDIASOURCE_CAN_SEEK))
+        return MF_E_INVALIDREQUEST;
+
+    return IMFMediaSource_Start(reader->source, reader->descriptor, format, position);
 }
 
 static HRESULT WINAPI src_reader_ReadSample(IMFSourceReader *iface, DWORD index,
diff --git a/include/mfidl.idl b/include/mfidl.idl
index 6a958a9..944f8f9 100644
--- a/include/mfidl.idl
+++ b/include/mfidl.idl
@@ -425,6 +425,18 @@ cpp_quote("HRESULT WINAPI MFGetService(IUnknown *object, REFGUID service, REFIID
 cpp_quote("MFTIME  WINAPI MFGetSystemTime(void);")
 cpp_quote("HRESULT WINAPI MFShutdownObject(IUnknown *object);")
 
+typedef enum _MFMEDIASOURCE_CHARACTERISTICS
+{
+    MFMEDIASOURCE_IS_LIVE                    = 0x1,
+    MFMEDIASOURCE_CAN_SEEK                   = 0x2,
+    MFMEDIASOURCE_CAN_PAUSE                  = 0x4,
+    MFMEDIASOURCE_HAS_SLOW_SEEK              = 0x8,
+    MFMEDIASOURCE_HAS_MULTIPLE_PRESENTATIONS = 0x10,
+    MFMEDIASOURCE_CAN_SKIPFORWARD            = 0x20,
+    MFMEDIASOURCE_CAN_SKIPBACKWARD           = 0x40,
+    MFMEDIASOURCE_DOES_NOT_USE_NETWORK       = 0x80,
+} MFMEDIASOURCE_CHARACTERISTICS;
+
 [
     object,
     uuid(279a808d-aec7-40c8-9c6b-a6b492c78a66),




More information about the wine-cvs mailing list