winecoreaudio: Remove GetAudioSessionWrapper.
[wine.git] / dlls / windowscodecs / main.c
blob4784ad23005a774f38ea070aa4170f5c6a66d475
1 /*
2 * Copyright 2009 Vincent Povirk for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #define COBJMACROS
22 #include <stdarg.h>
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winternl.h"
27 #include "objbase.h"
29 #include "wincodecs_private.h"
31 #include "wine/debug.h"
33 extern BOOL WINAPI WIC_DllMain(HINSTANCE, DWORD, LPVOID);
35 HMODULE windowscodecs_module = 0;
37 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
40 switch (fdwReason)
42 case DLL_PROCESS_ATTACH:
43 DisableThreadLibraryCalls(hinstDLL);
44 windowscodecs_module = hinstDLL;
45 break;
46 case DLL_PROCESS_DETACH:
47 ReleaseComponentInfos();
48 break;
51 return WIC_DllMain(hinstDLL, fdwReason, lpvReserved);
54 HRESULT get_pixelformat_bpp(const GUID *pixelformat, UINT *bpp)
56 HRESULT hr;
57 IWICComponentInfo *info;
58 IWICPixelFormatInfo *formatinfo;
60 hr = CreateComponentInfo(pixelformat, &info);
61 if (SUCCEEDED(hr))
63 hr = IWICComponentInfo_QueryInterface(info, &IID_IWICPixelFormatInfo, (void**)&formatinfo);
65 if (SUCCEEDED(hr))
67 hr = IWICPixelFormatInfo_GetBitsPerPixel(formatinfo, bpp);
69 IWICPixelFormatInfo_Release(formatinfo);
72 IWICComponentInfo_Release(info);
75 return hr;
78 HRESULT TiffDecoder_CreateInstance(REFIID iid, void** ppv)
80 HRESULT hr;
81 struct decoder *decoder;
82 struct decoder_info decoder_info;
84 hr = tiff_decoder_create(&decoder_info, &decoder);
86 if (SUCCEEDED(hr))
87 hr = CommonDecoder_CreateInstance(decoder, &decoder_info, iid, ppv);
89 return hr;
92 HRESULT TiffEncoder_CreateInstance(REFIID iid, void** ppv)
94 HRESULT hr;
95 struct encoder *encoder;
96 struct encoder_info encoder_info;
98 hr = tiff_encoder_create(&encoder_info, &encoder);
100 if (SUCCEEDED(hr))
101 hr = CommonEncoder_CreateInstance(encoder, &encoder_info, iid, ppv);
103 return hr;
106 HRESULT JpegDecoder_CreateInstance(REFIID iid, void** ppv)
108 HRESULT hr;
109 struct decoder *decoder;
110 struct decoder_info decoder_info;
112 hr = jpeg_decoder_create(&decoder_info, &decoder);
114 if (SUCCEEDED(hr))
115 hr = CommonDecoder_CreateInstance(decoder, &decoder_info, iid, ppv);
117 return hr;
120 HRESULT JpegEncoder_CreateInstance(REFIID iid, void** ppv)
122 HRESULT hr;
123 struct encoder *encoder;
124 struct encoder_info encoder_info;
126 hr = jpeg_encoder_create(&encoder_info, &encoder);
128 if (SUCCEEDED(hr))
129 hr = CommonEncoder_CreateInstance(encoder, &encoder_info, iid, ppv);
131 return hr;