From a839018d01382ce43931e4f52b41ef4a1488247b Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 13 Aug 2009 10:34:05 -0500 Subject: [PATCH] windowscodecs: add stub implementation of IWICFormatConverterInfo --- dlls/windowscodecs/info.c | 166 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 166 insertions(+), 0 deletions(-) diff --git a/dlls/windowscodecs/info.c b/dlls/windowscodecs/info.c index e8a70c3..d4be4e4 100644 --- a/dlls/windowscodecs/info.c +++ b/dlls/windowscodecs/info.c @@ -464,6 +464,171 @@ static HRESULT BitmapDecoderInfo_Constructor(HKEY classkey, REFCLSID clsid, IWIC return S_OK; } +typedef struct { + const IWICFormatConverterInfoVtbl *lpIWICFormatConverterInfoVtbl; + LONG ref; + HKEY classkey; + CLSID clsid; +} FormatConverterInfo; + +static HRESULT WINAPI FormatConverterInfo_QueryInterface(IWICFormatConverterInfo *iface, REFIID iid, + void **ppv) +{ + FormatConverterInfo *This = (FormatConverterInfo*)iface; + TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); + + if (!ppv) return E_INVALIDARG; + + if (IsEqualIID(&IID_IUnknown, iid) || + IsEqualIID(&IID_IWICComponentInfo, iid) || + IsEqualIID(&IID_IWICFormatConverterInfo ,iid)) + { + *ppv = This; + } + else + { + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI FormatConverterInfo_AddRef(IWICFormatConverterInfo *iface) +{ + FormatConverterInfo *This = (FormatConverterInfo*)iface; + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + return ref; +} + +static ULONG WINAPI FormatConverterInfo_Release(IWICFormatConverterInfo *iface) +{ + FormatConverterInfo *This = (FormatConverterInfo*)iface; + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p) refcount=%u\n", iface, ref); + + if (ref == 0) + { + RegCloseKey(This->classkey); + HeapFree(GetProcessHeap(), 0, This); + } + + return ref; +} + +static HRESULT WINAPI FormatConverterInfo_GetComponentType(IWICFormatConverterInfo *iface, + WICComponentType *pType) +{ + TRACE("(%p,%p)\n", iface, pType); + *pType = WICPixelFormatConverter; + return S_OK; +} + +static HRESULT WINAPI FormatConverterInfo_GetCLSID(IWICFormatConverterInfo *iface, CLSID *pclsid) +{ + FIXME("(%p,%p): stub\n", iface, pclsid); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverterInfo_GetSigningStatus(IWICFormatConverterInfo *iface, DWORD *pStatus) +{ + FIXME("(%p,%p): stub\n", iface, pStatus); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverterInfo_GetAuthor(IWICFormatConverterInfo *iface, UINT cchAuthor, + WCHAR *wzAuthor, UINT *pcchActual) +{ + FIXME("(%p,%u,%p,%p): stub\n", iface, cchAuthor, wzAuthor, pcchActual); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverterInfo_GetVendorGUID(IWICFormatConverterInfo *iface, GUID *pguidVendor) +{ + FIXME("(%p,%p): stub\n", iface, pguidVendor); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverterInfo_GetVersion(IWICFormatConverterInfo *iface, UINT cchVersion, + WCHAR *wzVersion, UINT *pcchActual) +{ + FIXME("(%p,%u,%p,%p): stub\n", iface, cchVersion, wzVersion, pcchActual); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverterInfo_GetSpecVersion(IWICFormatConverterInfo *iface, UINT cchSpecVersion, + WCHAR *wzSpecVersion, UINT *pcchActual) +{ + FIXME("(%p,%u,%p,%p): stub\n", iface, cchSpecVersion, wzSpecVersion, pcchActual); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverterInfo_GetFriendlyName(IWICFormatConverterInfo *iface, UINT cchFriendlyName, + WCHAR *wzFriendlyName, UINT *pcchActual) +{ + FIXME("(%p,%u,%p,%p): stub\n", iface, cchFriendlyName, wzFriendlyName, pcchActual); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverterInfo_GetPixelFormats(IWICFormatConverterInfo *iface, + UINT cFormats, GUID *pguidPixelFormats, UINT *pcActual) +{ + FIXME("(%p,%u,%p,%p): stub\n", iface, cFormats, pguidPixelFormats, pcActual); + return E_NOTIMPL; +} + +static HRESULT WINAPI FormatConverterInfo_CreateInstance(IWICFormatConverterInfo *iface, + IWICFormatConverter **ppIFormatConverter) +{ + FormatConverterInfo *This = (FormatConverterInfo*)iface; + + TRACE("(%p,%p)\n", iface, ppIFormatConverter); + + return CoCreateInstance(&This->clsid, NULL, CLSCTX_INPROC_SERVER, + &IID_IWICFormatConverter, (void**)ppIFormatConverter); +} + +static const IWICFormatConverterInfoVtbl FormatConverterInfo_Vtbl = { + FormatConverterInfo_QueryInterface, + FormatConverterInfo_AddRef, + FormatConverterInfo_Release, + FormatConverterInfo_GetComponentType, + FormatConverterInfo_GetCLSID, + FormatConverterInfo_GetSigningStatus, + FormatConverterInfo_GetAuthor, + FormatConverterInfo_GetVendorGUID, + FormatConverterInfo_GetVersion, + FormatConverterInfo_GetSpecVersion, + FormatConverterInfo_GetFriendlyName, + FormatConverterInfo_GetPixelFormats, + FormatConverterInfo_CreateInstance +}; + +static HRESULT FormatConverterInfo_Constructor(HKEY classkey, REFCLSID clsid, IWICComponentInfo **ppIInfo) +{ + FormatConverterInfo *This; + + This = HeapAlloc(GetProcessHeap(), 0, sizeof(FormatConverterInfo)); + if (!This) + { + RegCloseKey(classkey); + return E_OUTOFMEMORY; + } + + This->lpIWICFormatConverterInfoVtbl = &FormatConverterInfo_Vtbl; + This->ref = 1; + This->classkey = classkey; + memcpy(&This->clsid, clsid, sizeof(CLSID)); + + *ppIInfo = (IWICComponentInfo*)This; + return S_OK; +} + static WCHAR const clsid_keyname[] = {'C','L','S','I','D',0}; static WCHAR const instance_keyname[] = {'I','n','s','t','a','n','c','e',0}; @@ -475,6 +640,7 @@ struct category { static const struct category categories[] = { {WICDecoder, &CATID_WICBitmapDecoders, BitmapDecoderInfo_Constructor}, + {WICPixelFormatConverter, &CATID_WICFormatConverters, FormatConverterInfo_Constructor}, {0} }; -- 1.5.4.3