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;
|
|
|
|
|
2021-10-19 10:55:21 +02:00
|
|
|
hr = tiff_decoder_create(&decoder_info, &decoder);
|
2020-11-20 21:23:27 +01:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2021-10-19 10:55:21 +02:00
|
|
|
hr = tiff_encoder_create(&encoder_info, &encoder);
|
2020-11-20 21:23:27 +01:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2021-10-19 10:51:56 +02:00
|
|
|
hr = jpeg_decoder_create(&decoder_info, &decoder);
|
2020-11-24 22:22:06 +01:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
2021-10-19 10:51:56 +02:00
|
|
|
hr = jpeg_encoder_create(&encoder_info, &encoder);
|
2020-11-24 22:22:06 +01:00
|
|
|
|
|
|
|
if (SUCCEEDED(hr))
|
|
|
|
hr = CommonEncoder_CreateInstance(encoder, &encoder_info, iid, ppv);
|
|
|
|
|
|
|
|
return hr;
|
|
|
|
}
|