wincodecs: Add a helper for GetDecoderInfo().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Vincent Povirk <vincent@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
074345edd6
commit
aaea92198d
|
@ -1068,20 +1068,9 @@ static HRESULT WINAPI BmpDecoder_GetContainerFormat(IWICBitmapDecoder *iface,
|
||||||
static HRESULT WINAPI BmpDecoder_GetDecoderInfo(IWICBitmapDecoder *iface,
|
static HRESULT WINAPI BmpDecoder_GetDecoderInfo(IWICBitmapDecoder *iface,
|
||||||
IWICBitmapDecoderInfo **ppIDecoderInfo)
|
IWICBitmapDecoderInfo **ppIDecoderInfo)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
|
||||||
IWICComponentInfo *compinfo;
|
|
||||||
|
|
||||||
TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
|
TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
|
||||||
|
|
||||||
hr = CreateComponentInfo(&CLSID_WICBmpDecoder, &compinfo);
|
return get_decoder_info(&CLSID_WICBmpDecoder, ppIDecoderInfo);
|
||||||
if (FAILED(hr)) return hr;
|
|
||||||
|
|
||||||
hr = IWICComponentInfo_QueryInterface(compinfo, &IID_IWICBitmapDecoderInfo,
|
|
||||||
(void**)ppIDecoderInfo);
|
|
||||||
|
|
||||||
IWICComponentInfo_Release(compinfo);
|
|
||||||
|
|
||||||
return hr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI BmpDecoder_CopyPalette(IWICBitmapDecoder *iface,
|
static HRESULT WINAPI BmpDecoder_CopyPalette(IWICBitmapDecoder *iface,
|
||||||
|
|
|
@ -1170,20 +1170,9 @@ static HRESULT WINAPI GifDecoder_GetContainerFormat(IWICBitmapDecoder *iface,
|
||||||
static HRESULT WINAPI GifDecoder_GetDecoderInfo(IWICBitmapDecoder *iface,
|
static HRESULT WINAPI GifDecoder_GetDecoderInfo(IWICBitmapDecoder *iface,
|
||||||
IWICBitmapDecoderInfo **ppIDecoderInfo)
|
IWICBitmapDecoderInfo **ppIDecoderInfo)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
|
||||||
IWICComponentInfo *compinfo;
|
|
||||||
|
|
||||||
TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
|
TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
|
||||||
|
|
||||||
hr = CreateComponentInfo(&CLSID_WICGifDecoder, &compinfo);
|
return get_decoder_info(&CLSID_WICGifDecoder, ppIDecoderInfo);
|
||||||
if (FAILED(hr)) return hr;
|
|
||||||
|
|
||||||
hr = IWICComponentInfo_QueryInterface(compinfo, &IID_IWICBitmapDecoderInfo,
|
|
||||||
(void**)ppIDecoderInfo);
|
|
||||||
|
|
||||||
IWICComponentInfo_Release(compinfo);
|
|
||||||
|
|
||||||
return hr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI GifDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalette *palette)
|
static HRESULT WINAPI GifDecoder_CopyPalette(IWICBitmapDecoder *iface, IWICPalette *palette)
|
||||||
|
|
|
@ -556,20 +556,9 @@ static HRESULT WINAPI IcoDecoder_GetContainerFormat(IWICBitmapDecoder *iface,
|
||||||
static HRESULT WINAPI IcoDecoder_GetDecoderInfo(IWICBitmapDecoder *iface,
|
static HRESULT WINAPI IcoDecoder_GetDecoderInfo(IWICBitmapDecoder *iface,
|
||||||
IWICBitmapDecoderInfo **ppIDecoderInfo)
|
IWICBitmapDecoderInfo **ppIDecoderInfo)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
|
||||||
IWICComponentInfo *compinfo;
|
|
||||||
|
|
||||||
TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
|
TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
|
||||||
|
|
||||||
hr = CreateComponentInfo(&CLSID_WICIcoDecoder, &compinfo);
|
return get_decoder_info(&CLSID_WICIcoDecoder, ppIDecoderInfo);
|
||||||
if (FAILED(hr)) return hr;
|
|
||||||
|
|
||||||
hr = IWICComponentInfo_QueryInterface(compinfo, &IID_IWICBitmapDecoderInfo,
|
|
||||||
(void**)ppIDecoderInfo);
|
|
||||||
|
|
||||||
IWICComponentInfo_Release(compinfo);
|
|
||||||
|
|
||||||
return hr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IcoDecoder_CopyPalette(IWICBitmapDecoder *iface,
|
static HRESULT WINAPI IcoDecoder_CopyPalette(IWICBitmapDecoder *iface,
|
||||||
|
|
|
@ -2029,6 +2029,22 @@ void ReleaseComponentInfos(void)
|
||||||
IWICComponentInfo_Release(&info->IWICComponentInfo_iface);
|
IWICComponentInfo_Release(&info->IWICComponentInfo_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT get_decoder_info(const CLSID *clsid, IWICBitmapDecoderInfo **info)
|
||||||
|
{
|
||||||
|
IWICComponentInfo *compinfo;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = CreateComponentInfo(clsid, &compinfo);
|
||||||
|
if (FAILED(hr)) return hr;
|
||||||
|
|
||||||
|
hr = IWICComponentInfo_QueryInterface(compinfo, &IID_IWICBitmapDecoderInfo,
|
||||||
|
(void **)info);
|
||||||
|
|
||||||
|
IWICComponentInfo_Release(compinfo);
|
||||||
|
|
||||||
|
return hr;
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
IEnumUnknown IEnumUnknown_iface;
|
IEnumUnknown IEnumUnknown_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
|
@ -398,20 +398,9 @@ static HRESULT WINAPI JpegDecoder_GetContainerFormat(IWICBitmapDecoder *iface,
|
||||||
static HRESULT WINAPI JpegDecoder_GetDecoderInfo(IWICBitmapDecoder *iface,
|
static HRESULT WINAPI JpegDecoder_GetDecoderInfo(IWICBitmapDecoder *iface,
|
||||||
IWICBitmapDecoderInfo **ppIDecoderInfo)
|
IWICBitmapDecoderInfo **ppIDecoderInfo)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
|
||||||
IWICComponentInfo *compinfo;
|
|
||||||
|
|
||||||
TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
|
TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
|
||||||
|
|
||||||
hr = CreateComponentInfo(&CLSID_WICJpegDecoder, &compinfo);
|
return get_decoder_info(&CLSID_WICJpegDecoder, ppIDecoderInfo);
|
||||||
if (FAILED(hr)) return hr;
|
|
||||||
|
|
||||||
hr = IWICComponentInfo_QueryInterface(compinfo, &IID_IWICBitmapDecoderInfo,
|
|
||||||
(void**)ppIDecoderInfo);
|
|
||||||
|
|
||||||
IWICComponentInfo_Release(compinfo);
|
|
||||||
|
|
||||||
return hr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI JpegDecoder_CopyPalette(IWICBitmapDecoder *iface,
|
static HRESULT WINAPI JpegDecoder_CopyPalette(IWICBitmapDecoder *iface,
|
||||||
|
|
|
@ -829,20 +829,9 @@ static HRESULT WINAPI PngDecoder_GetContainerFormat(IWICBitmapDecoder *iface,
|
||||||
static HRESULT WINAPI PngDecoder_GetDecoderInfo(IWICBitmapDecoder *iface,
|
static HRESULT WINAPI PngDecoder_GetDecoderInfo(IWICBitmapDecoder *iface,
|
||||||
IWICBitmapDecoderInfo **ppIDecoderInfo)
|
IWICBitmapDecoderInfo **ppIDecoderInfo)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
|
||||||
IWICComponentInfo *compinfo;
|
|
||||||
|
|
||||||
TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
|
TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
|
||||||
|
|
||||||
hr = CreateComponentInfo(&CLSID_WICPngDecoder, &compinfo);
|
return get_decoder_info(&CLSID_WICPngDecoder, ppIDecoderInfo);
|
||||||
if (FAILED(hr)) return hr;
|
|
||||||
|
|
||||||
hr = IWICComponentInfo_QueryInterface(compinfo, &IID_IWICBitmapDecoderInfo,
|
|
||||||
(void**)ppIDecoderInfo);
|
|
||||||
|
|
||||||
IWICComponentInfo_Release(compinfo);
|
|
||||||
|
|
||||||
return hr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI PngDecoder_CopyPalette(IWICBitmapDecoder *iface,
|
static HRESULT WINAPI PngDecoder_CopyPalette(IWICBitmapDecoder *iface,
|
||||||
|
|
|
@ -360,20 +360,9 @@ static HRESULT WINAPI TgaDecoder_GetContainerFormat(IWICBitmapDecoder *iface,
|
||||||
static HRESULT WINAPI TgaDecoder_GetDecoderInfo(IWICBitmapDecoder *iface,
|
static HRESULT WINAPI TgaDecoder_GetDecoderInfo(IWICBitmapDecoder *iface,
|
||||||
IWICBitmapDecoderInfo **ppIDecoderInfo)
|
IWICBitmapDecoderInfo **ppIDecoderInfo)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
|
||||||
IWICComponentInfo *compinfo;
|
|
||||||
|
|
||||||
TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
|
TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
|
||||||
|
|
||||||
hr = CreateComponentInfo(&CLSID_WineTgaDecoder, &compinfo);
|
return get_decoder_info(&CLSID_WineTgaDecoder, ppIDecoderInfo);
|
||||||
if (FAILED(hr)) return hr;
|
|
||||||
|
|
||||||
hr = IWICComponentInfo_QueryInterface(compinfo, &IID_IWICBitmapDecoderInfo,
|
|
||||||
(void**)ppIDecoderInfo);
|
|
||||||
|
|
||||||
IWICComponentInfo_Release(compinfo);
|
|
||||||
|
|
||||||
return hr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI TgaDecoder_CopyPalette(IWICBitmapDecoder *iface,
|
static HRESULT WINAPI TgaDecoder_CopyPalette(IWICBitmapDecoder *iface,
|
||||||
|
|
|
@ -672,20 +672,9 @@ static HRESULT WINAPI TiffDecoder_GetContainerFormat(IWICBitmapDecoder *iface,
|
||||||
static HRESULT WINAPI TiffDecoder_GetDecoderInfo(IWICBitmapDecoder *iface,
|
static HRESULT WINAPI TiffDecoder_GetDecoderInfo(IWICBitmapDecoder *iface,
|
||||||
IWICBitmapDecoderInfo **ppIDecoderInfo)
|
IWICBitmapDecoderInfo **ppIDecoderInfo)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
|
||||||
IWICComponentInfo *compinfo;
|
|
||||||
|
|
||||||
TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
|
TRACE("(%p,%p)\n", iface, ppIDecoderInfo);
|
||||||
|
|
||||||
hr = CreateComponentInfo(&CLSID_WICTiffDecoder, &compinfo);
|
return get_decoder_info(&CLSID_WICTiffDecoder, ppIDecoderInfo);
|
||||||
if (FAILED(hr)) return hr;
|
|
||||||
|
|
||||||
hr = IWICComponentInfo_QueryInterface(compinfo, &IID_IWICBitmapDecoderInfo,
|
|
||||||
(void**)ppIDecoderInfo);
|
|
||||||
|
|
||||||
IWICComponentInfo_Release(compinfo);
|
|
||||||
|
|
||||||
return hr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI TiffDecoder_CopyPalette(IWICBitmapDecoder *iface,
|
static HRESULT WINAPI TiffDecoder_CopyPalette(IWICBitmapDecoder *iface,
|
||||||
|
|
|
@ -126,6 +126,7 @@ extern HRESULT CreatePropertyBag2(const PROPBAG2 *options, UINT count,
|
||||||
extern HRESULT CreateComponentInfo(REFCLSID clsid, IWICComponentInfo **ppIInfo) DECLSPEC_HIDDEN;
|
extern HRESULT CreateComponentInfo(REFCLSID clsid, IWICComponentInfo **ppIInfo) DECLSPEC_HIDDEN;
|
||||||
extern void ReleaseComponentInfos(void) DECLSPEC_HIDDEN;
|
extern void ReleaseComponentInfos(void) DECLSPEC_HIDDEN;
|
||||||
extern HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown) DECLSPEC_HIDDEN;
|
extern HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown) DECLSPEC_HIDDEN;
|
||||||
|
extern HRESULT get_decoder_info(REFCLSID clsid, IWICBitmapDecoderInfo **info) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
typedef struct BmpDecoder BmpDecoder;
|
typedef struct BmpDecoder BmpDecoder;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue