2009-05-28 20:36:54 +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
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2012-06-13 19:56:10 +02:00
|
|
|
#define COBJMACROS
|
2009-05-28 20:36:54 +02:00
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2020-10-09 21:56:20 +02:00
|
|
|
#include "winternl.h"
|
2009-07-01 22:48:56 +02:00
|
|
|
#include "objbase.h"
|
|
|
|
|
|
|
|
#include "wincodecs_private.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
2010-10-22 15:14:40 +02:00
|
|
|
extern BOOL WINAPI WIC_DllMain(HINSTANCE, DWORD, LPVOID) DECLSPEC_HIDDEN;
|
|
|
|
|
2020-10-09 21:56:16 +02:00
|
|
|
HMODULE windowscodecs_module = 0;
|
|
|
|
|
2009-05-28 20:36:54 +02:00
|
|
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
|
|
|
{
|
|
|
|
|
|
|
|
switch (fdwReason)
|
|
|
|
{
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
DisableThreadLibraryCalls(hinstDLL);
|
2020-10-09 21:56:16 +02:00
|
|
|
windowscodecs_module = hinstDLL;
|
2009-05-28 20:36:54 +02:00
|
|
|
break;
|
2018-03-29 20:50:35 +02:00
|
|
|
case DLL_PROCESS_DETACH:
|
|
|
|
ReleaseComponentInfos();
|
|
|
|
break;
|
2009-05-28 20:36:54 +02:00
|
|
|
}
|
|
|
|
|
2010-10-22 15:14:40 +02:00
|
|
|
return WIC_DllMain(hinstDLL, fdwReason, lpvReserved);
|
2009-05-28 20:36:54 +02:00
|
|
|
}
|
2009-07-01 22:48:56 +02:00
|
|
|
|
2012-06-13 19:56:10 +02:00
|
|
|
HRESULT get_pixelformat_bpp(const GUID *pixelformat, UINT *bpp)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
IWICComponentInfo *info;
|
|
|
|
IWICPixelFormatInfo *formatinfo;
|
|
|
|
|
|
|
|
hr = CreateComponentInfo(pixelformat, &info);
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo, (void**)&formatinfo);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
{
|
|
|
|
hr = IWICPixelFormatInfo_GetBitsPerPixel(formatinfo, bpp);
|
|
|
|
|
|
|
|
IWICPixelFormatInfo_Release(formatinfo);
|
|
|
|
}
|
|
|
|
|
|
|
|
IWICComponentInfo_Release(info);
|
|
|
|
}
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
2020-11-20 21:23:27 +01:00
|
|
|
|
|
|
|
HRESULT TiffDecoder_CreateInstance(REFIID iid, void** ppv)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
struct decoder *decoder;
|
|
|
|
struct decoder_info decoder_info;
|
|
|
|
|
|
|
|
hr = get_unix_decoder(&CLSID_WICTiffDecoder, &decoder_info, &decoder);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = CommonDecoder_CreateInstance(decoder, &decoder_info, iid, ppv);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT TiffEncoder_CreateInstance(REFIID iid, void** ppv)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
struct encoder *encoder;
|
|
|
|
struct encoder_info encoder_info;
|
|
|
|
|
|
|
|
hr = get_unix_encoder(&CLSID_WICTiffEncoder, &encoder_info, &encoder);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = CommonEncoder_CreateInstance(encoder, &encoder_info, iid, ppv);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
2020-11-24 22:22:06 +01:00
|
|
|
|
|
|
|
HRESULT JpegDecoder_CreateInstance(REFIID iid, void** ppv)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
struct decoder *decoder;
|
|
|
|
struct decoder_info decoder_info;
|
|
|
|
|
|
|
|
hr = get_unix_decoder(&CLSID_WICJpegDecoder, &decoder_info, &decoder);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = CommonDecoder_CreateInstance(decoder, &decoder_info, iid, ppv);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
|
|
|
|
|
|
|
HRESULT JpegEncoder_CreateInstance(REFIID iid, void** ppv)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
struct encoder *encoder;
|
|
|
|
struct encoder_info encoder_info;
|
|
|
|
|
|
|
|
hr = get_unix_encoder(&CLSID_WICJpegEncoder, &encoder_info, &encoder);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = CommonEncoder_CreateInstance(encoder, &encoder_info, iid, ppv);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|
2020-11-29 23:13:15 +01:00
|
|
|
|
|
|
|
HRESULT IcnsEncoder_CreateInstance(REFIID iid, void** ppv)
|
|
|
|
{
|
|
|
|
HRESULT hr;
|
|
|
|
struct encoder *encoder;
|
|
|
|
struct encoder_info encoder_info;
|
|
|
|
|
|
|
|
hr = get_unix_encoder(&CLSID_WICIcnsEncoder, &encoder_info, &encoder);
|
|
|
|
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = CommonEncoder_CreateInstance(encoder, &encoder_info, iid, ppv);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|