2009-06-01 20:32:41 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2009 Vincent Povirk for CodeWeavers
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef WINCODECS_PRIVATE_H
|
|
|
|
#define WINCODECS_PRIVATE_H
|
|
|
|
|
2016-03-14 19:47:00 +01:00
|
|
|
#include "wincodec.h"
|
|
|
|
#include "wincodecsdk.h"
|
2018-11-09 12:26:45 +01:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
2016-03-14 19:47:00 +01:00
|
|
|
|
2010-06-07 21:36:35 +02:00
|
|
|
DEFINE_GUID(CLSID_WineTgaDecoder, 0xb11fc79a,0x67cc,0x43e6,0xa9,0xce,0xe3,0xd5,0x49,0x45,0xd3,0x04);
|
|
|
|
|
2010-08-24 09:43:54 +02:00
|
|
|
DEFINE_GUID(CLSID_WICIcnsEncoder, 0x312fb6f1,0xb767,0x409d,0x8a,0x6d,0x0f,0xc1,0x54,0xd4,0xf0,0x5c);
|
|
|
|
|
2010-06-07 21:36:35 +02:00
|
|
|
DEFINE_GUID(GUID_WineContainerFormatTga, 0x0c44fda1,0xa5c5,0x4298,0x96,0x85,0x47,0x3f,0xc1,0x7c,0xd3,0x22);
|
|
|
|
|
2020-11-29 23:13:15 +01:00
|
|
|
DEFINE_GUID(GUID_WineContainerFormatIcns, 0xe4cd3e69,0x4436,0x4363,0x98,0x1d,0xcc,0xf0,0x5a,0x87,0x4c,0x73);
|
|
|
|
|
2010-09-06 04:24:53 +02:00
|
|
|
DEFINE_GUID(GUID_VendorWine, 0xddf46da1,0x7dc1,0x404e,0x98,0xf2,0xef,0xa4,0x8d,0xfc,0x95,0x0a);
|
|
|
|
|
2020-04-21 19:02:57 +02:00
|
|
|
extern IID IID_IMILBitmap;
|
|
|
|
extern IID IID_IMILBitmapSource;
|
|
|
|
extern IID IID_IMILBitmapLock;
|
|
|
|
extern IID IID_IMILBitmapScaler;
|
|
|
|
extern IID IID_IMILFormatConverter;
|
|
|
|
extern IID IID_IMILPalette;
|
2019-05-15 05:36:20 +02:00
|
|
|
|
2013-10-14 05:07:06 +02:00
|
|
|
#define INTERFACE IMILBitmapSource
|
|
|
|
DECLARE_INTERFACE_(IMILBitmapSource,IUnknown)
|
|
|
|
{
|
|
|
|
/*** IUnknown methods ***/
|
|
|
|
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE;
|
|
|
|
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
|
|
|
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
2019-05-15 05:36:20 +02:00
|
|
|
/*** IWICBitmapSource methods ***/
|
|
|
|
STDMETHOD_(HRESULT,GetSize)(THIS_ UINT *,UINT *) PURE;
|
|
|
|
STDMETHOD_(HRESULT,GetPixelFormat)(THIS_ int *) PURE;
|
|
|
|
STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *) PURE;
|
|
|
|
STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *) PURE;
|
|
|
|
STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *) PURE;
|
|
|
|
};
|
|
|
|
#undef INTERFACE
|
|
|
|
|
|
|
|
#define INTERFACE IMILBitmap
|
|
|
|
DECLARE_INTERFACE_(IMILBitmap,IMILBitmapSource)
|
|
|
|
{
|
|
|
|
/*** IUnknown methods ***/
|
|
|
|
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE;
|
|
|
|
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
|
|
|
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
|
|
|
/*** IWICBitmapSource methods ***/
|
|
|
|
STDMETHOD_(HRESULT,GetSize)(THIS_ UINT *,UINT *) PURE;
|
|
|
|
STDMETHOD_(HRESULT,GetPixelFormat)(THIS_ int *) PURE;
|
|
|
|
STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *) PURE;
|
|
|
|
STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *) PURE;
|
|
|
|
STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *) PURE;
|
|
|
|
/*** IMILBitmap methods ***/
|
|
|
|
STDMETHOD_(HRESULT,unknown1)(THIS_ void **) PURE;
|
|
|
|
STDMETHOD_(HRESULT,Lock)(THIS_ const WICRect *,DWORD,IWICBitmapLock **) PURE;
|
|
|
|
STDMETHOD_(HRESULT,Unlock)(THIS_ IWICBitmapLock *) PURE;
|
|
|
|
STDMETHOD_(HRESULT,SetPalette)(THIS_ IWICPalette *) PURE;
|
|
|
|
STDMETHOD_(HRESULT,SetResolution)(THIS_ double,double) PURE;
|
|
|
|
STDMETHOD_(HRESULT,AddDirtyRect)(THIS_ const WICRect *) PURE;
|
2013-10-14 05:07:06 +02:00
|
|
|
};
|
|
|
|
#undef INTERFACE
|
|
|
|
|
2019-05-15 05:36:46 +02:00
|
|
|
#define INTERFACE IMILBitmapScaler
|
|
|
|
DECLARE_INTERFACE_(IMILBitmapScaler,IMILBitmapSource)
|
|
|
|
{
|
|
|
|
/*** IUnknown methods ***/
|
|
|
|
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE;
|
|
|
|
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
|
|
|
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
|
|
|
/*** IWICBitmapSource methods ***/
|
|
|
|
STDMETHOD_(HRESULT,GetSize)(THIS_ UINT *,UINT *) PURE;
|
|
|
|
STDMETHOD_(HRESULT,GetPixelFormat)(THIS_ int *) PURE;
|
|
|
|
STDMETHOD_(HRESULT,GetResolution)(THIS_ double *,double *) PURE;
|
|
|
|
STDMETHOD_(HRESULT,CopyPalette)(THIS_ IWICPalette *) PURE;
|
|
|
|
STDMETHOD_(HRESULT,CopyPixels)(THIS_ const WICRect *,UINT,UINT,BYTE *) PURE;
|
|
|
|
/*** IMILBitmapScaler methods ***/
|
|
|
|
STDMETHOD_(HRESULT,unknown1)(THIS_ void **) PURE;
|
|
|
|
STDMETHOD_(HRESULT,Initialize)(THIS_ IMILBitmapSource *,UINT,UINT,WICBitmapInterpolationMode) PURE;
|
|
|
|
};
|
|
|
|
#undef INTERFACE
|
|
|
|
|
2019-05-16 13:53:33 +02:00
|
|
|
#define THISCALLMETHOD_(type,method) type (__thiscall *method)
|
|
|
|
|
2013-10-14 05:07:06 +02:00
|
|
|
#define INTERFACE IMILUnknown1
|
|
|
|
DECLARE_INTERFACE_(IMILUnknown1,IUnknown)
|
|
|
|
{
|
|
|
|
/*** IUnknown methods ***/
|
|
|
|
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE;
|
|
|
|
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
|
|
|
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
2019-05-16 13:53:33 +02:00
|
|
|
THISCALLMETHOD_(void,unknown1)(THIS_ void*) PURE;
|
2019-05-15 05:36:20 +02:00
|
|
|
STDMETHOD_(HRESULT,unknown2)(THIS_ void*, void*) PURE;
|
2019-05-16 13:53:33 +02:00
|
|
|
THISCALLMETHOD_(HRESULT,unknown3)(THIS_ void*) PURE;
|
2019-05-15 05:36:20 +02:00
|
|
|
STDMETHOD_(HRESULT,unknown4)(THIS_ void*) PURE;
|
|
|
|
STDMETHOD_(HRESULT,unknown5)(THIS_ void*) PURE;
|
|
|
|
STDMETHOD_(HRESULT,unknown6)(THIS_ DWORD64) PURE;
|
|
|
|
STDMETHOD_(HRESULT,unknown7)(THIS_ void*) PURE;
|
2019-05-16 13:53:33 +02:00
|
|
|
THISCALLMETHOD_(HRESULT,unknown8)(THIS) PURE;
|
2013-10-14 05:07:06 +02:00
|
|
|
};
|
|
|
|
#undef INTERFACE
|
|
|
|
|
|
|
|
#define INTERFACE IMILUnknown2
|
|
|
|
DECLARE_INTERFACE_(IMILUnknown2,IUnknown)
|
|
|
|
{
|
|
|
|
/*** IUnknown methods ***/
|
|
|
|
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID,void **) PURE;
|
|
|
|
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
|
|
|
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
|
|
|
/*** unknown methods ***/
|
2019-05-15 05:36:20 +02:00
|
|
|
STDMETHOD_(HRESULT,unknown1)(THIS_ void *,void **) PURE;
|
|
|
|
STDMETHOD_(HRESULT,unknown2)(THIS_ void *,void *) PURE;
|
|
|
|
STDMETHOD_(HRESULT,unknown3)(THIS_ void *) PURE;
|
2013-10-14 05:07:06 +02:00
|
|
|
};
|
|
|
|
#undef INTERFACE
|
|
|
|
|
2021-01-20 10:30:05 +01:00
|
|
|
HRESULT create_instance(const CLSID *clsid, const IID *iid, void **ppv) DECLSPEC_HIDDEN;
|
2015-03-06 11:20:16 +01:00
|
|
|
|
2015-03-05 12:13:00 +01:00
|
|
|
typedef HRESULT(*class_constructor)(REFIID,void**);
|
2014-01-14 12:18:11 +01:00
|
|
|
extern HRESULT FormatConverter_CreateInstance(REFIID riid, void** ppv) DECLSPEC_HIDDEN;
|
2018-09-30 13:05:56 +02:00
|
|
|
extern HRESULT ImagingFactory_CreateInstance(REFIID riid, void** ppv) DECLSPEC_HIDDEN;
|
2014-01-14 12:18:11 +01:00
|
|
|
extern HRESULT BmpDecoder_CreateInstance(REFIID riid, void** ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT PngDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT PngEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT BmpEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT DibDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT GifDecoder_CreateInstance(REFIID riid, void** ppv) DECLSPEC_HIDDEN;
|
2020-04-27 04:32:36 +02:00
|
|
|
extern HRESULT GifEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
2014-01-14 12:18:11 +01:00
|
|
|
extern HRESULT IcoDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT JpegDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT JpegEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT TiffDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT TiffEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT IcnsEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT TgaDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
2020-04-15 12:42:07 +02:00
|
|
|
extern HRESULT DdsDecoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
2021-03-15 03:59:17 +01:00
|
|
|
extern HRESULT DdsEncoder_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
2010-09-16 20:40:55 +02:00
|
|
|
|
2012-08-14 20:39:15 +02:00
|
|
|
extern HRESULT BitmapImpl_Create(UINT uiWidth, UINT uiHeight,
|
2018-03-21 10:28:27 +01:00
|
|
|
UINT stride, UINT datasize, void *view, UINT offset,
|
2012-08-14 20:39:15 +02:00
|
|
|
REFWICPixelFormatGUID pixelFormat, WICBitmapCreateCacheOption option,
|
|
|
|
IWICBitmap **ppIBitmap) DECLSPEC_HIDDEN;
|
2012-02-28 20:45:32 +01:00
|
|
|
extern HRESULT BitmapScaler_Create(IWICBitmapScaler **scaler) DECLSPEC_HIDDEN;
|
2011-04-29 10:11:52 +02:00
|
|
|
extern HRESULT FlipRotator_Create(IWICBitmapFlipRotator **fliprotator) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT PaletteImpl_Create(IWICPalette **palette) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT StreamImpl_Create(IWICStream **stream) DECLSPEC_HIDDEN;
|
2012-11-15 14:06:25 +01:00
|
|
|
extern HRESULT ColorContext_Create(IWICColorContext **context) DECLSPEC_HIDDEN;
|
2013-02-06 13:52:09 +01:00
|
|
|
extern HRESULT ColorTransform_Create(IWICColorTransform **transform) DECLSPEC_HIDDEN;
|
2013-07-18 15:30:54 +02:00
|
|
|
extern HRESULT BitmapClipper_Create(IWICBitmapClipper **clipper) DECLSPEC_HIDDEN;
|
2009-07-03 00:09:47 +02:00
|
|
|
|
2009-07-01 22:48:56 +02:00
|
|
|
extern HRESULT copy_pixels(UINT bpp, const BYTE *srcbuffer,
|
|
|
|
UINT srcwidth, UINT srcheight, INT srcstride,
|
2011-04-29 10:11:52 +02:00
|
|
|
const WICRect *rc, UINT dststride, UINT dstbuffersize, BYTE *dstbuffer) DECLSPEC_HIDDEN;
|
2009-07-01 22:48:56 +02:00
|
|
|
|
2014-06-13 21:02:23 +02:00
|
|
|
extern HRESULT configure_write_source(IWICBitmapFrameEncode *iface,
|
|
|
|
IWICBitmapSource *source, const WICRect *prc,
|
|
|
|
const WICPixelFormatGUID *format,
|
|
|
|
INT width, INT height, double xres, double yres) DECLSPEC_HIDDEN;
|
|
|
|
|
|
|
|
extern HRESULT write_source(IWICBitmapFrameEncode *iface,
|
|
|
|
IWICBitmapSource *source, const WICRect *prc,
|
2020-03-05 20:19:52 +01:00
|
|
|
const WICPixelFormatGUID *format, UINT bpp, BOOL need_palette,
|
2014-06-13 21:02:23 +02:00
|
|
|
INT width, INT height) DECLSPEC_HIDDEN;
|
|
|
|
|
2011-04-29 10:11:52 +02:00
|
|
|
extern void reverse_bgr8(UINT bytesperpixel, LPBYTE bits, UINT width, UINT height, INT stride) DECLSPEC_HIDDEN;
|
2011-01-10 22:23:17 +01:00
|
|
|
|
2012-06-13 19:56:10 +02:00
|
|
|
extern HRESULT get_pixelformat_bpp(const GUID *pixelformat, UINT *bpp) DECLSPEC_HIDDEN;
|
|
|
|
|
2018-02-05 17:59:32 +01:00
|
|
|
extern HRESULT CreatePropertyBag2(const PROPBAG2 *options, UINT count,
|
2013-01-29 19:50:36 +01:00
|
|
|
IPropertyBag2 **property) DECLSPEC_HIDDEN;
|
2009-08-11 23:10:12 +02:00
|
|
|
|
2011-04-29 10:11:52 +02:00
|
|
|
extern HRESULT CreateComponentInfo(REFCLSID clsid, IWICComponentInfo **ppIInfo) DECLSPEC_HIDDEN;
|
2018-03-29 20:50:35 +02:00
|
|
|
extern void ReleaseComponentInfos(void) DECLSPEC_HIDDEN;
|
2011-04-29 10:11:52 +02:00
|
|
|
extern HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnknown **ppIEnumUnknown) DECLSPEC_HIDDEN;
|
2018-04-01 10:49:12 +02:00
|
|
|
extern HRESULT get_decoder_info(REFCLSID clsid, IWICBitmapDecoderInfo **info) DECLSPEC_HIDDEN;
|
2009-07-15 00:50:28 +02:00
|
|
|
|
2011-01-10 22:36:14 +01:00
|
|
|
typedef struct BmpDecoder BmpDecoder;
|
|
|
|
|
2011-04-29 10:11:52 +02:00
|
|
|
extern HRESULT IcoDibDecoder_CreateInstance(BmpDecoder **ppDecoder) DECLSPEC_HIDDEN;
|
|
|
|
extern void BmpDecoder_GetWICDecoder(BmpDecoder *This, IWICBitmapDecoder **ppDecoder) DECLSPEC_HIDDEN;
|
|
|
|
extern void BmpDecoder_FindIconMask(BmpDecoder *This, ULONG *mask_offset, int *topdown) DECLSPEC_HIDDEN;
|
2010-09-16 20:40:55 +02:00
|
|
|
|
2012-01-11 23:03:24 +01:00
|
|
|
typedef struct _MetadataItem
|
|
|
|
{
|
|
|
|
PROPVARIANT schema;
|
|
|
|
PROPVARIANT id;
|
|
|
|
PROPVARIANT value;
|
|
|
|
} MetadataItem;
|
|
|
|
|
|
|
|
typedef struct _MetadataHandlerVtbl
|
|
|
|
{
|
|
|
|
int is_writer;
|
|
|
|
const CLSID *clsid;
|
|
|
|
HRESULT (*fnLoad)(IStream *stream, const GUID *preferred_vendor,
|
|
|
|
DWORD persist_options, MetadataItem **items, DWORD *item_count);
|
|
|
|
HRESULT (*fnSave)(IStream *stream, DWORD persist_options,
|
|
|
|
const MetadataItem *items, DWORD item_count);
|
|
|
|
HRESULT (*fnGetSizeMax)(const MetadataItem *items, DWORD item_count,
|
|
|
|
ULARGE_INTEGER *size);
|
|
|
|
} MetadataHandlerVtbl;
|
|
|
|
|
2014-01-14 12:18:11 +01:00
|
|
|
extern HRESULT MetadataReader_Create(const MetadataHandlerVtbl *vtable, REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
2012-09-11 00:01:15 +02:00
|
|
|
|
2014-01-14 12:18:11 +01:00
|
|
|
extern HRESULT UnknownMetadataReader_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT IfdMetadataReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN;
|
2016-06-15 19:43:40 +02:00
|
|
|
extern HRESULT PngChrmReader_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
2015-04-01 21:57:45 +02:00
|
|
|
extern HRESULT PngGamaReader_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
2014-01-14 12:18:11 +01:00
|
|
|
extern HRESULT PngTextReader_CreateInstance(REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT LSDReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT IMDReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT GCEReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT APEReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN;
|
|
|
|
extern HRESULT GifCommentReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN;
|
2017-06-22 05:38:56 +02:00
|
|
|
extern HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *, const WCHAR *, IWICMetadataQueryReader **) DECLSPEC_HIDDEN;
|
2021-01-27 18:33:49 +01:00
|
|
|
extern HRESULT MetadataQueryWriter_CreateInstance(IWICMetadataBlockWriter *, const WCHAR *, IWICMetadataQueryWriter **) DECLSPEC_HIDDEN;
|
2013-02-06 13:53:21 +01:00
|
|
|
extern HRESULT stream_initialize_from_filehandle(IWICStream *iface, HANDLE hfile) DECLSPEC_HIDDEN;
|
|
|
|
|
2017-06-22 05:38:56 +02:00
|
|
|
static inline WCHAR *heap_strdupW(const WCHAR *src)
|
|
|
|
{
|
|
|
|
WCHAR *dst;
|
|
|
|
SIZE_T len;
|
|
|
|
if (!src) return NULL;
|
2020-11-30 21:02:21 +01:00
|
|
|
len = (lstrlenW(src) + 1) * sizeof(WCHAR);
|
2017-06-22 05:38:56 +02:00
|
|
|
if ((dst = HeapAlloc(GetProcessHeap(), 0, len))) memcpy(dst, src, len);
|
|
|
|
return dst;
|
|
|
|
}
|
|
|
|
|
2018-11-09 12:26:45 +01:00
|
|
|
static inline const char *debug_wic_rect(const WICRect *rect)
|
|
|
|
{
|
|
|
|
if (!rect) return "(null)";
|
|
|
|
return wine_dbg_sprintf("(%u,%u)-(%u,%u)", rect->X, rect->Y, rect->Width, rect->Height);
|
|
|
|
}
|
|
|
|
|
2020-10-09 21:56:16 +02:00
|
|
|
extern HMODULE windowscodecs_module;
|
|
|
|
|
2020-10-09 21:56:20 +02:00
|
|
|
HRESULT read_png_chunk(IStream *stream, BYTE *type, BYTE **data, ULONG *data_size);
|
|
|
|
|
2020-10-09 21:56:16 +02:00
|
|
|
/* unixlib iface */
|
|
|
|
struct decoder_funcs;
|
|
|
|
|
|
|
|
struct decoder_info
|
|
|
|
{
|
|
|
|
GUID container_format;
|
|
|
|
GUID block_format;
|
|
|
|
CLSID clsid;
|
|
|
|
};
|
|
|
|
|
2020-10-09 21:56:17 +02:00
|
|
|
#define DECODER_FLAGS_CAPABILITY_MASK 0x1f
|
2020-11-08 18:10:02 +01:00
|
|
|
#define DECODER_FLAGS_UNSUPPORTED_COLOR_CONTEXT 0x80000000
|
2020-10-09 21:56:17 +02:00
|
|
|
|
|
|
|
struct decoder_stat
|
|
|
|
{
|
|
|
|
DWORD flags;
|
|
|
|
DWORD frame_count;
|
|
|
|
};
|
|
|
|
|
2020-10-09 21:56:18 +02:00
|
|
|
struct decoder_frame
|
|
|
|
{
|
|
|
|
CLSID pixel_format;
|
|
|
|
UINT width, height;
|
|
|
|
UINT bpp;
|
2020-11-30 21:02:21 +01:00
|
|
|
DOUBLE dpix, dpiy;
|
2020-10-09 21:56:21 +02:00
|
|
|
DWORD num_color_contexts;
|
2020-10-09 21:56:18 +02:00
|
|
|
DWORD num_colors;
|
|
|
|
WICColor palette[256];
|
|
|
|
};
|
|
|
|
|
2020-10-27 18:54:42 +01:00
|
|
|
#define DECODER_BLOCK_OPTION_MASK 0x0001000F
|
|
|
|
#define DECODER_BLOCK_FULL_STREAM 0x80000000
|
|
|
|
#define DECODER_BLOCK_READER_CLSID 0x40000000
|
2020-10-09 21:56:20 +02:00
|
|
|
struct decoder_block
|
|
|
|
{
|
|
|
|
ULONGLONG offset;
|
|
|
|
ULONGLONG length;
|
|
|
|
DWORD options;
|
2020-10-27 18:54:42 +01:00
|
|
|
GUID reader_clsid;
|
2020-10-09 21:56:20 +02:00
|
|
|
};
|
|
|
|
|
2020-10-09 21:56:16 +02:00
|
|
|
struct decoder
|
|
|
|
{
|
|
|
|
const struct decoder_funcs *vtable;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct decoder_funcs
|
|
|
|
{
|
2020-10-09 21:56:17 +02:00
|
|
|
HRESULT (CDECL *initialize)(struct decoder* This, IStream *stream, struct decoder_stat *st);
|
2020-10-09 21:56:18 +02:00
|
|
|
HRESULT (CDECL *get_frame_info)(struct decoder* This, UINT frame, struct decoder_frame *info);
|
2020-10-09 21:56:19 +02:00
|
|
|
HRESULT (CDECL *copy_pixels)(struct decoder* This, UINT frame, const WICRect *prc,
|
|
|
|
UINT stride, UINT buffersize, BYTE *buffer);
|
2020-10-09 21:56:20 +02:00
|
|
|
HRESULT (CDECL *get_metadata_blocks)(struct decoder* This, UINT frame, UINT *count,
|
|
|
|
struct decoder_block **blocks);
|
2020-10-09 21:56:21 +02:00
|
|
|
HRESULT (CDECL *get_color_context)(struct decoder* This, UINT frame, UINT num,
|
|
|
|
BYTE **data, DWORD *datasize);
|
2020-10-09 21:56:16 +02:00
|
|
|
void (CDECL *destroy)(struct decoder* This);
|
|
|
|
};
|
|
|
|
|
2020-10-27 18:54:42 +01:00
|
|
|
HRESULT CDECL stream_getsize(IStream *stream, ULONGLONG *size);
|
2020-10-09 21:56:17 +02:00
|
|
|
HRESULT CDECL stream_read(IStream *stream, void *buffer, ULONG read, ULONG *bytes_read);
|
|
|
|
HRESULT CDECL stream_seek(IStream *stream, LONGLONG ofs, DWORD origin, ULONGLONG *new_position);
|
2020-11-15 21:12:25 +01:00
|
|
|
HRESULT CDECL stream_write(IStream *stream, const void *buffer, ULONG write, ULONG *bytes_written);
|
2020-10-09 21:56:17 +02:00
|
|
|
|
|
|
|
struct win32_funcs
|
|
|
|
{
|
2020-10-27 18:54:42 +01:00
|
|
|
HRESULT (CDECL *stream_getsize)(IStream *stream, ULONGLONG *size);
|
2020-10-09 21:56:17 +02:00
|
|
|
HRESULT (CDECL *stream_read)(IStream *stream, void *buffer, ULONG read, ULONG *bytes_read);
|
|
|
|
HRESULT (CDECL *stream_seek)(IStream *stream, LONGLONG ofs, DWORD origin, ULONGLONG *new_position);
|
2020-11-15 21:12:25 +01:00
|
|
|
HRESULT (CDECL *stream_write)(IStream *stream, const void *buffer, ULONG write, ULONG *bytes_written);
|
2020-10-09 21:56:17 +02:00
|
|
|
};
|
|
|
|
|
2020-10-09 21:56:16 +02:00
|
|
|
HRESULT CDECL decoder_create(const CLSID *decoder_clsid, struct decoder_info *info, struct decoder **result);
|
2020-10-09 21:56:17 +02:00
|
|
|
HRESULT CDECL decoder_initialize(struct decoder *This, IStream *stream, struct decoder_stat *st);
|
2020-10-09 21:56:18 +02:00
|
|
|
HRESULT CDECL decoder_get_frame_info(struct decoder* This, UINT frame, struct decoder_frame *info);
|
2020-10-09 21:56:19 +02:00
|
|
|
HRESULT CDECL decoder_copy_pixels(struct decoder* This, UINT frame, const WICRect *prc,
|
|
|
|
UINT stride, UINT buffersize, BYTE *buffer);
|
2020-10-09 21:56:20 +02:00
|
|
|
HRESULT CDECL decoder_get_metadata_blocks(struct decoder* This, UINT frame, UINT *count,
|
|
|
|
struct decoder_block **blocks);
|
2020-10-09 21:56:21 +02:00
|
|
|
HRESULT CDECL decoder_get_color_context(struct decoder* This, UINT frame, UINT num,
|
|
|
|
BYTE **data, DWORD *datasize);
|
2020-10-09 21:56:16 +02:00
|
|
|
void CDECL decoder_destroy(struct decoder *This);
|
|
|
|
|
2020-11-15 21:12:24 +01:00
|
|
|
struct encoder_funcs;
|
|
|
|
|
|
|
|
/* sync with encoder_option_properties */
|
|
|
|
enum encoder_option
|
|
|
|
{
|
|
|
|
ENCODER_OPTION_INTERLACE,
|
|
|
|
ENCODER_OPTION_FILTER,
|
2020-11-20 21:23:27 +01:00
|
|
|
ENCODER_OPTION_COMPRESSION_METHOD,
|
|
|
|
ENCODER_OPTION_COMPRESSION_QUALITY,
|
2020-11-24 22:22:06 +01:00
|
|
|
ENCODER_OPTION_IMAGE_QUALITY,
|
|
|
|
ENCODER_OPTION_BITMAP_TRANSFORM,
|
|
|
|
ENCODER_OPTION_LUMINANCE,
|
|
|
|
ENCODER_OPTION_CHROMINANCE,
|
|
|
|
ENCODER_OPTION_YCRCB_SUBSAMPLING,
|
|
|
|
ENCODER_OPTION_SUPPRESS_APP0,
|
2020-11-15 21:12:24 +01:00
|
|
|
ENCODER_OPTION_END
|
|
|
|
};
|
|
|
|
|
2020-11-15 21:12:25 +01:00
|
|
|
#define ENCODER_FLAGS_MULTI_FRAME 0x1
|
2020-11-29 23:13:15 +01:00
|
|
|
#define ENCODER_FLAGS_ICNS_SIZE 0x2
|
2021-01-27 18:33:46 +01:00
|
|
|
#define ENCODER_FLAGS_SUPPORTS_METADATA 0x4
|
2020-11-15 21:12:25 +01:00
|
|
|
|
2020-11-15 21:12:24 +01:00
|
|
|
struct encoder_info
|
|
|
|
{
|
2020-11-15 21:12:25 +01:00
|
|
|
DWORD flags;
|
2020-11-15 21:12:24 +01:00
|
|
|
GUID container_format;
|
|
|
|
CLSID clsid;
|
|
|
|
DWORD encoder_options[7];
|
|
|
|
};
|
|
|
|
|
2020-11-15 21:12:25 +01:00
|
|
|
struct encoder_frame
|
|
|
|
{
|
|
|
|
GUID pixel_format;
|
|
|
|
UINT width, height;
|
|
|
|
UINT bpp;
|
|
|
|
BOOL indexed;
|
2020-11-30 21:02:21 +01:00
|
|
|
DOUBLE dpix, dpiy;
|
2020-11-15 21:12:25 +01:00
|
|
|
DWORD num_colors;
|
|
|
|
WICColor palette[256];
|
|
|
|
/* encoder options */
|
|
|
|
BOOL interlace;
|
|
|
|
DWORD filter;
|
|
|
|
};
|
|
|
|
|
2020-11-15 21:12:24 +01:00
|
|
|
struct encoder
|
|
|
|
{
|
|
|
|
const struct encoder_funcs *vtable;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct encoder_funcs
|
|
|
|
{
|
2020-11-15 21:12:25 +01:00
|
|
|
HRESULT (CDECL *initialize)(struct encoder* This, IStream *stream);
|
|
|
|
HRESULT (CDECL *get_supported_format)(struct encoder* This, GUID *pixel_format, DWORD *bpp, BOOL *indexed);
|
|
|
|
HRESULT (CDECL *create_frame)(struct encoder* This, const struct encoder_frame *frame);
|
|
|
|
HRESULT (CDECL *write_lines)(struct encoder* This, BYTE *data, DWORD line_count, DWORD stride);
|
|
|
|
HRESULT (CDECL *commit_frame)(struct encoder* This);
|
|
|
|
HRESULT (CDECL *commit_file)(struct encoder* This);
|
2020-11-15 21:12:24 +01:00
|
|
|
void (CDECL *destroy)(struct encoder* This);
|
|
|
|
};
|
|
|
|
|
2020-11-15 21:12:25 +01:00
|
|
|
HRESULT CDECL encoder_initialize(struct encoder* This, IStream *stream);
|
|
|
|
HRESULT CDECL encoder_get_supported_format(struct encoder* This, GUID *pixel_format, DWORD *bpp, BOOL *indexed);
|
|
|
|
HRESULT CDECL encoder_create_frame(struct encoder* This, const struct encoder_frame *frame);
|
|
|
|
HRESULT CDECL encoder_write_lines(struct encoder* This, BYTE *data, DWORD line_count, DWORD stride);
|
|
|
|
HRESULT CDECL encoder_commit_frame(struct encoder* This);
|
|
|
|
HRESULT CDECL encoder_commit_file(struct encoder* This);
|
2020-11-15 21:12:24 +01:00
|
|
|
void CDECL encoder_destroy(struct encoder* This);
|
|
|
|
|
2020-10-09 21:56:16 +02:00
|
|
|
HRESULT CDECL png_decoder_create(struct decoder_info *info, struct decoder **result);
|
2020-10-27 18:54:42 +01:00
|
|
|
HRESULT CDECL tiff_decoder_create(struct decoder_info *info, struct decoder **result);
|
2020-11-08 18:10:02 +01:00
|
|
|
HRESULT CDECL jpeg_decoder_create(struct decoder_info *info, struct decoder **result);
|
2020-10-09 21:56:16 +02:00
|
|
|
|
2020-11-15 21:12:24 +01:00
|
|
|
HRESULT CDECL png_encoder_create(struct encoder_info *info, struct encoder **result);
|
2020-11-20 21:23:27 +01:00
|
|
|
HRESULT CDECL tiff_encoder_create(struct encoder_info *info, struct encoder **result);
|
2020-11-24 22:22:06 +01:00
|
|
|
HRESULT CDECL jpeg_encoder_create(struct encoder_info *info, struct encoder **result);
|
2020-11-29 23:13:15 +01:00
|
|
|
HRESULT CDECL icns_encoder_create(struct encoder_info *info, struct encoder **result);
|
2020-11-15 21:12:24 +01:00
|
|
|
|
2020-10-09 21:56:16 +02:00
|
|
|
struct unix_funcs
|
|
|
|
{
|
|
|
|
HRESULT (CDECL *decoder_create)(const CLSID *decoder_clsid, struct decoder_info *info, struct decoder **result);
|
2020-10-09 21:56:17 +02:00
|
|
|
HRESULT (CDECL *decoder_initialize)(struct decoder *This, IStream *stream, struct decoder_stat *st);
|
2020-10-09 21:56:18 +02:00
|
|
|
HRESULT (CDECL *decoder_get_frame_info)(struct decoder* This, UINT frame, struct decoder_frame *info);
|
2020-10-09 21:56:19 +02:00
|
|
|
HRESULT (CDECL *decoder_copy_pixels)(struct decoder* This, UINT frame, const WICRect *prc,
|
|
|
|
UINT stride, UINT buffersize, BYTE *buffer);
|
2020-10-09 21:56:20 +02:00
|
|
|
HRESULT (CDECL *decoder_get_metadata_blocks)(struct decoder* This, UINT frame, UINT *count,
|
|
|
|
struct decoder_block **blocks);
|
2020-10-09 21:56:21 +02:00
|
|
|
HRESULT (CDECL *decoder_get_color_context)(struct decoder* This, UINT frame, UINT num,
|
|
|
|
BYTE **data, DWORD *datasize);
|
2020-10-09 21:56:16 +02:00
|
|
|
void (CDECL *decoder_destroy)(struct decoder* This);
|
2020-11-15 21:12:24 +01:00
|
|
|
HRESULT (CDECL *encoder_create)(const CLSID *encoder_clsid, struct encoder_info *info, struct encoder **result);
|
2020-11-15 21:12:25 +01:00
|
|
|
HRESULT (CDECL *encoder_initialize)(struct encoder* This, IStream *stream);
|
|
|
|
HRESULT (CDECL *encoder_get_supported_format)(struct encoder* This, GUID *pixel_format, DWORD *bpp, BOOL *indexed);
|
|
|
|
HRESULT (CDECL *encoder_create_frame)(struct encoder* This, const struct encoder_frame *frame);
|
|
|
|
HRESULT (CDECL *encoder_write_lines)(struct encoder* This, BYTE *data, DWORD line_count, DWORD stride);
|
|
|
|
HRESULT (CDECL *encoder_commit_frame)(struct encoder* This);
|
|
|
|
HRESULT (CDECL *encoder_commit_file)(struct encoder* This);
|
2020-11-15 21:12:24 +01:00
|
|
|
void (CDECL *encoder_destroy)(struct encoder* This);
|
2020-10-09 21:56:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
HRESULT get_unix_decoder(const CLSID *decoder_clsid, struct decoder_info *info, struct decoder **result);
|
2020-11-15 21:12:24 +01:00
|
|
|
HRESULT get_unix_encoder(const CLSID *encoder_clsid, struct encoder_info *info, struct encoder **result);
|
2020-10-09 21:56:16 +02:00
|
|
|
|
2020-10-09 21:56:23 +02:00
|
|
|
extern HRESULT CommonDecoder_CreateInstance(struct decoder *decoder,
|
|
|
|
const struct decoder_info *decoder_info, REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
|
|
|
|
2020-11-15 21:12:25 +01:00
|
|
|
extern HRESULT CommonEncoder_CreateInstance(struct encoder *encoder,
|
|
|
|
const struct encoder_info *encoder_info, REFIID iid, void** ppv) DECLSPEC_HIDDEN;
|
|
|
|
|
2009-06-01 20:32:41 +02:00
|
|
|
#endif /* WINCODECS_PRIVATE_H */
|