[PATCH v2 17/17] winegstreamer: Implement Get(Input/Output)CurrentType functions for color converter transform.

Derek Lesho dlesho at codeweavers.com
Fri Dec 4 10:11:58 CST 2020


Signed-off-by: Derek Lesho <dlesho at codeweavers.com>
---
 dlls/winegstreamer/colorconvert.c | 58 ++++++++++++++++++++++++++++---
 1 file changed, 54 insertions(+), 4 deletions(-)

diff --git a/dlls/winegstreamer/colorconvert.c b/dlls/winegstreamer/colorconvert.c
index 3ae646f1ae2..9c845b270d2 100644
--- a/dlls/winegstreamer/colorconvert.c
+++ b/dlls/winegstreamer/colorconvert.c
@@ -479,16 +479,66 @@ static HRESULT WINAPI color_converter_SetOutputType(IMFTransform *iface, DWORD i
 
 static HRESULT WINAPI color_converter_GetInputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type)
 {
-    FIXME("%p, %u, %p.\n", iface, id, type);
+    IMFMediaType *ret;
+    HRESULT hr;
 
-    return E_NOTIMPL;
+    struct color_converter *converter = impl_color_converter_from_IMFTransform(iface);
+
+    TRACE("%p, %u, %p.\n", converter, id, type);
+
+    if (id != 0)
+        return MF_E_INVALIDSTREAMNUMBER;
+
+    if (FAILED(hr = MFCreateMediaType(&ret)))
+        return hr;
+
+    EnterCriticalSection(&converter->cs);
+
+    if (converter->input_type)
+        hr = IMFMediaType_CopyAllItems(converter->input_type, (IMFAttributes *)ret);
+    else
+        hr = MF_E_TRANSFORM_TYPE_NOT_SET;
+
+    LeaveCriticalSection(&converter->cs);
+
+    if (SUCCEEDED(hr))
+        *type = ret;
+    else
+        IMFMediaType_Release(ret);
+
+    return hr;
 }
 
 static HRESULT WINAPI color_converter_GetOutputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type)
 {
-    FIXME("%p, %u, %p.\n", iface, id, type);
+    IMFMediaType *ret;
+    HRESULT hr;
 
-    return E_NOTIMPL;
+    struct color_converter *converter = impl_color_converter_from_IMFTransform(iface);
+
+    TRACE("%p, %u, %p.\n", converter, id, type);
+
+    if (id != 0)
+        return MF_E_INVALIDSTREAMNUMBER;
+
+    if (FAILED(hr = MFCreateMediaType(&ret)))
+        return hr;
+
+    EnterCriticalSection(&converter->cs);
+
+    if (converter->output_type)
+        hr = IMFMediaType_CopyAllItems(converter->output_type, (IMFAttributes *)ret);
+    else
+        hr = MF_E_TRANSFORM_TYPE_NOT_SET;
+
+    LeaveCriticalSection(&converter->cs);
+
+    if (SUCCEEDED(hr))
+        *type = ret;
+    else
+        IMFMediaType_Release(ret);
+
+    return hr;
 }
 
 static HRESULT WINAPI color_converter_GetInputStatus(IMFTransform *iface, DWORD id, DWORD *flags)
-- 
2.29.2




More information about the wine-devel mailing list