On 12/3/20 3:55 PM, Derek Lesho wrote:
Serves as a wrapper of videoconvert, and roughly fills the roll of Windows' CColorConverterDMO.
Why can't this be CColorConvertDMO?
Signed-off-by: Derek Lesho dlesho@codeweavers.com
dlls/winegstreamer/Makefile.in | 1 + dlls/winegstreamer/colorconvert.c | 302 +++++++++++++++++++ dlls/winegstreamer/gst_private.h | 1 + dlls/winegstreamer/mfplat.c | 3 + dlls/winegstreamer/winegstreamer_classes.idl | 6 + 5 files changed, 313 insertions(+) create mode 100644 dlls/winegstreamer/colorconvert.c
diff --git a/dlls/winegstreamer/Makefile.in b/dlls/winegstreamer/Makefile.in index 0b3229160b9..5395d6fd501 100644 --- a/dlls/winegstreamer/Makefile.in +++ b/dlls/winegstreamer/Makefile.in @@ -7,6 +7,7 @@ PARENTSRC = ../strmbase
C_SRCS = \ audioconvert.c \
- colorconvert.c \ filter.c \ gst_cbs.c \ gstdemux.c \
diff --git a/dlls/winegstreamer/colorconvert.c b/dlls/winegstreamer/colorconvert.c new file mode 100644 index 00000000000..8d0823fc0dc --- /dev/null +++ b/dlls/winegstreamer/colorconvert.c @@ -0,0 +1,302 @@ +/* GStreamer Color Converter
- Copyright 2020 Derek Lesho
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
+#include "config.h"
+#include "gst_private.h"
+#include "mfapi.h" +#include "mferror.h" +#include "mfidl.h"
+#include "wine/debug.h" +#include "wine/heap.h"
+WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
+struct color_converter +{
- IMFTransform IMFTransform_iface;
- LONG refcount;
+};
+static struct color_converter *impl_color_converter_from_IMFTransform(IMFTransform *iface) +{
- return CONTAINING_RECORD(iface, struct color_converter, IMFTransform_iface);
+}
+static HRESULT WINAPI color_converter_QueryInterface(IMFTransform *iface, REFIID riid, void **obj) +{
- TRACE("%p, %s, %p.\n", iface, debugstr_guid(riid), obj);
- if (IsEqualIID(riid, &IID_IMFTransform) ||
IsEqualIID(riid, &IID_IUnknown))
- {
*obj = iface;
IMFTransform_AddRef(iface);
return S_OK;
- }
- WARN("Unsupported %s.\n", debugstr_guid(riid));
- *obj = NULL;
- return E_NOINTERFACE;
+}
+static ULONG WINAPI color_converter_AddRef(IMFTransform *iface) +{
- struct color_converter *transform = impl_color_converter_from_IMFTransform(iface);
- ULONG refcount = InterlockedIncrement(&transform->refcount);
- TRACE("%p, refcount %u.\n", iface, refcount);
- return refcount;
+}
+static ULONG WINAPI color_converter_Release(IMFTransform *iface) +{
- struct color_converter *transform = impl_color_converter_from_IMFTransform(iface);
- ULONG refcount = InterlockedDecrement(&transform->refcount);
- TRACE("%p, refcount %u.\n", iface, refcount);
- if (!refcount)
- {
heap_free(transform);
- }
- return refcount;
+}
+static HRESULT WINAPI color_converter_GetStreamLimits(IMFTransform *iface, DWORD *input_minimum, DWORD *input_maximum,
DWORD *output_minimum, DWORD *output_maximum)
+{
- TRACE("%p, %p, %p, %p, %p.\n", iface, input_minimum, input_maximum, output_minimum, output_maximum);
- *input_minimum = *input_maximum = *output_minimum = *output_maximum = 1;
- return S_OK;
+}
+static HRESULT WINAPI color_converter_GetStreamCount(IMFTransform *iface, DWORD *inputs, DWORD *outputs) +{
- TRACE("%p, %p, %p.\n", iface, inputs, outputs);
- *inputs = *outputs = 1;
- return S_OK;
+}
+static HRESULT WINAPI color_converter_GetStreamIDs(IMFTransform *iface, DWORD input_size, DWORD *inputs,
DWORD output_size, DWORD *outputs)
+{
- TRACE("%p %u %p %u %p.\n", iface, input_size, inputs, output_size, outputs);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_GetInputStreamInfo(IMFTransform *iface, DWORD id, MFT_INPUT_STREAM_INFO *info) +{
- FIXME("%p %u %p.\n", iface, id, info);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_GetOutputStreamInfo(IMFTransform *iface, DWORD id, MFT_OUTPUT_STREAM_INFO *info) +{
- FIXME("%p %u %p.\n", iface, id, info);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_GetAttributes(IMFTransform *iface, IMFAttributes **attributes) +{
- FIXME("%p, %p.\n", iface, attributes);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_GetInputStreamAttributes(IMFTransform *iface, DWORD id,
IMFAttributes **attributes)
+{
- FIXME("%p, %u, %p.\n", iface, id, attributes);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_GetOutputStreamAttributes(IMFTransform *iface, DWORD id,
IMFAttributes **attributes)
+{
- FIXME("%p, %u, %p.\n", iface, id, attributes);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_DeleteInputStream(IMFTransform *iface, DWORD id) +{
- TRACE("%p, %u.\n", iface, id);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_AddInputStreams(IMFTransform *iface, DWORD streams, DWORD *ids) +{
- TRACE("%p, %u, %p.\n", iface, streams, ids);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_GetInputAvailableType(IMFTransform *iface, DWORD id, DWORD index,
IMFMediaType **type)
+{
- FIXME("%p, %u, %u, %p.\n", iface, id, index, type);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_GetOutputAvailableType(IMFTransform *iface, DWORD id, DWORD index,
IMFMediaType **type)
+{
- FIXME("%p, %u, %u, %p.\n", iface, id, index, type);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_SetInputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) +{
- FIXME("%p, %u, %p, %#x.\n", iface, id, type, flags);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_SetOutputType(IMFTransform *iface, DWORD id, IMFMediaType *type, DWORD flags) +{
- FIXME("%p, %u, %p, %#x.\n", iface, id, type, flags);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_GetInputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) +{
- FIXME("%p, %u, %p.\n", iface, id, type);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_GetOutputCurrentType(IMFTransform *iface, DWORD id, IMFMediaType **type) +{
- FIXME("%p, %u, %p.\n", iface, id, type);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_GetInputStatus(IMFTransform *iface, DWORD id, DWORD *flags) +{
- FIXME("%p, %u, %p.\n", iface, id, flags);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_GetOutputStatus(IMFTransform *iface, DWORD *flags) +{
- FIXME("%p, %p.\n", iface, flags);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_SetOutputBounds(IMFTransform *iface, LONGLONG lower, LONGLONG upper) +{
- FIXME("%p, %s, %s.\n", iface, wine_dbgstr_longlong(lower), wine_dbgstr_longlong(upper));
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_ProcessEvent(IMFTransform *iface, DWORD id, IMFMediaEvent *event) +{
- TRACE("%p, %u, %p.\n", iface, id, event);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_ProcessMessage(IMFTransform *iface, MFT_MESSAGE_TYPE message, ULONG_PTR param) +{
- FIXME("%p, %u %lu.\n", iface, message, param);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_ProcessInput(IMFTransform *iface, DWORD id, IMFSample *sample, DWORD flags) +{
- FIXME("%p, %u, %p, %#x.\n", iface, id, sample, flags);
- return E_NOTIMPL;
+}
+static HRESULT WINAPI color_converter_ProcessOutput(IMFTransform *iface, DWORD flags, DWORD count,
MFT_OUTPUT_DATA_BUFFER *samples, DWORD *status)
+{
- FIXME("%p, %#x, %u, %p, %p.\n", iface, flags, count, samples, status);
- return E_NOTIMPL;
+}
+static const IMFTransformVtbl color_converter_vtbl = +{
- color_converter_QueryInterface,
- color_converter_AddRef,
- color_converter_Release,
- color_converter_GetStreamLimits,
- color_converter_GetStreamCount,
- color_converter_GetStreamIDs,
- color_converter_GetInputStreamInfo,
- color_converter_GetOutputStreamInfo,
- color_converter_GetAttributes,
- color_converter_GetInputStreamAttributes,
- color_converter_GetOutputStreamAttributes,
- color_converter_DeleteInputStream,
- color_converter_AddInputStreams,
- color_converter_GetInputAvailableType,
- color_converter_GetOutputAvailableType,
- color_converter_SetInputType,
- color_converter_SetOutputType,
- color_converter_GetInputCurrentType,
- color_converter_GetOutputCurrentType,
- color_converter_GetInputStatus,
- color_converter_GetOutputStatus,
- color_converter_SetOutputBounds,
- color_converter_ProcessEvent,
- color_converter_ProcessMessage,
- color_converter_ProcessInput,
- color_converter_ProcessOutput,
+};
+HRESULT color_converter_create(REFIID riid, void **ret) +{
- struct color_converter *object;
- TRACE("%s %p\n", debugstr_guid(riid), ret);
- if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
- object->IMFTransform_iface.lpVtbl = &color_converter_vtbl;
- object->refcount = 1;
- *ret = &object->IMFTransform_iface;
- return S_OK;
+} diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 14b6a011ac2..075e0ce1f0f 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -87,5 +87,6 @@ GstBuffer *gst_buffer_from_mf_sample(IMFSample *in) DECLSPEC_HIDDEN; HRESULT winegstreamer_stream_handler_create(REFIID riid, void **obj) DECLSPEC_HIDDEN;
HRESULT audio_converter_create(REFIID riid, void **ret) DECLSPEC_HIDDEN; +HRESULT color_converter_create(REFIID riid, void **ret) DECLSPEC_HIDDEN;
#endif /* __GST_PRIVATE_INCLUDED__ */ diff --git a/dlls/winegstreamer/mfplat.c b/dlls/winegstreamer/mfplat.c index 883084b2d89..288b79997cd 100644 --- a/dlls/winegstreamer/mfplat.c +++ b/dlls/winegstreamer/mfplat.c @@ -407,6 +407,8 @@ static const GUID CLSID_GStreamerByteStreamHandler = {0x317df618, 0x5e5a, 0x468a
static const GUID CLSID_WINEAudioConverter = {0x6a170414,0xaad9,0x4693,{0xb8,0x06,0x3a,0x0c,0x47,0xc5,0x70,0xd6}};
+static GUID CLSID_WINEColorConverter = {0x2be8b27f,0xcd60,0x4b8a,{0x95,0xae,0xd1,0x74,0xcc,0x5c,0xba,0xa7}};
This can be const...
static const struct class_object { const GUID *clsid; @@ -417,6 +419,7 @@ class_objects[] = { &CLSID_VideoProcessorMFT, &video_processor_create }, { &CLSID_GStreamerByteStreamHandler, &winegstreamer_stream_handler_create }, { &CLSID_WINEAudioConverter, &audio_converter_create },
- { &CLSID_WINEColorConverter, &color_converter_create },
};
HRESULT mfplat_get_class_object(REFCLSID rclsid, REFIID riid, void **obj) diff --git a/dlls/winegstreamer/winegstreamer_classes.idl b/dlls/winegstreamer/winegstreamer_classes.idl index cf1fc69f38a..47c10a09cf0 100644 --- a/dlls/winegstreamer/winegstreamer_classes.idl +++ b/dlls/winegstreamer/winegstreamer_classes.idl @@ -67,3 +67,9 @@ coclass GStreamerByteStreamHandler {} uuid(6a170414-aad9-4693-b806-3a0c47c570d6) ] coclass WINEAudioConverter { }
+[
- threading(both),
- uuid(2be8b27f-cd60-4b8a-95ae-d174cc5cbaa7)
+] +coclass WINEColorConverter { }