mfplat: Read queue subscriber within the critical section.
[wine/zf.git] / dlls / windowscodecs / unix_lib.c
blob268a1cd9d16e940bc35275d4cf1bb023f6eb9b61
1 /*
2 * unix_lib.c - This is the Unix side of the Unix interface.
4 * Copyright 2020 Esme Povirk
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #if 0
22 #pragma makedep unix
23 #endif
25 #include "config.h"
26 #include "wine/port.h"
28 #include <stdarg.h>
30 #define NONAMELESSUNION
32 #include "ntstatus.h"
33 #define WIN32_NO_STATUS
34 #include "windef.h"
35 #include "winternl.h"
36 #include "winbase.h"
37 #include "objbase.h"
39 #include "initguid.h"
40 #include "wincodecs_private.h"
42 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
46 #include "wincodecs_common.h"
48 static const struct win32_funcs *win32_funcs;
50 HRESULT CDECL stream_getsize(IStream *stream, ULONGLONG *size)
52 return win32_funcs->stream_getsize(stream, size);
55 HRESULT CDECL stream_read(IStream *stream, void *buffer, ULONG read, ULONG *bytes_read)
57 return win32_funcs->stream_read(stream, buffer, read, bytes_read);
60 HRESULT CDECL stream_seek(IStream *stream, LONGLONG ofs, DWORD origin, ULONGLONG *new_position)
62 return win32_funcs->stream_seek(stream, ofs, origin, new_position);
65 HRESULT CDECL stream_write(IStream *stream, const void *buffer, ULONG write, ULONG *bytes_written)
67 return win32_funcs->stream_write(stream, buffer, write, bytes_written);
70 HRESULT CDECL decoder_create(const CLSID *decoder_clsid, struct decoder_info *info, struct decoder **result)
72 if (IsEqualGUID(decoder_clsid, &CLSID_WICPngDecoder))
73 return png_decoder_create(info, result);
75 if (IsEqualGUID(decoder_clsid, &CLSID_WICTiffDecoder))
76 return tiff_decoder_create(info, result);
78 if (IsEqualGUID(decoder_clsid, &CLSID_WICJpegDecoder))
79 return jpeg_decoder_create(info, result);
81 return E_NOTIMPL;
84 HRESULT CDECL encoder_create(const CLSID *encoder_clsid, struct encoder_info *info, struct encoder **result)
86 if (IsEqualGUID(encoder_clsid, &CLSID_WICPngEncoder))
87 return png_encoder_create(info, result);
89 if (IsEqualGUID(encoder_clsid, &CLSID_WICTiffEncoder))
90 return tiff_encoder_create(info, result);
92 if (IsEqualGUID(encoder_clsid, &CLSID_WICJpegEncoder))
93 return jpeg_encoder_create(info, result);
95 if (IsEqualGUID(encoder_clsid, &CLSID_WICIcnsEncoder))
96 return icns_encoder_create(info, result);
98 return E_NOTIMPL;
101 static const struct unix_funcs unix_funcs = {
102 decoder_create,
103 decoder_initialize,
104 decoder_get_frame_info,
105 decoder_copy_pixels,
106 decoder_get_metadata_blocks,
107 decoder_get_color_context,
108 decoder_destroy,
109 encoder_create,
110 encoder_initialize,
111 encoder_get_supported_format,
112 encoder_create_frame,
113 encoder_write_lines,
114 encoder_commit_frame,
115 encoder_commit_file,
116 encoder_destroy
119 NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out )
121 if (reason != DLL_PROCESS_ATTACH) return STATUS_SUCCESS;
123 win32_funcs = ptr_in;
125 *(const struct unix_funcs **)ptr_out = &unix_funcs;
126 return STATUS_SUCCESS;