Signed-off-by: Rémi Bernon rbernon@codeweavers.com --- dlls/windowscodecs/decoder.c | 46 ++++++-------------------- dlls/windowscodecs/libtiff.c | 4 +-- dlls/windowscodecs/wincodecs_private.h | 4 +-- 3 files changed, 15 insertions(+), 39 deletions(-)
diff --git a/dlls/windowscodecs/decoder.c b/dlls/windowscodecs/decoder.c index 3e43fa91114..0af203febf6 100644 --- a/dlls/windowscodecs/decoder.c +++ b/dlls/windowscodecs/decoder.c @@ -634,48 +634,24 @@ static HRESULT WINAPI CommonDecoderFrame_Block_GetReaderByIndex(IWICMetadataBloc offset, length); }
- if (This->metadata_blocks[nIndex].options & DECODER_BLOCK_READER_CLSID) - { - IWICMetadataReader *reader; - IWICPersistStream *persist; - if (SUCCEEDED(hr)) - { - hr = create_instance(&This->metadata_blocks[nIndex].reader_clsid, - &IID_IWICMetadataReader, (void**)&reader); - } - - if (SUCCEEDED(hr)) - { - hr = IWICMetadataReader_QueryInterface(reader, &IID_IWICPersistStream, (void**)&persist); - - if (SUCCEEDED(hr)) - { - hr = IWICPersistStream_LoadEx(persist, (IStream*)stream, NULL, - This->metadata_blocks[nIndex].options & DECODER_BLOCK_OPTION_MASK); - - IWICPersistStream_Release(persist); - } + if (SUCCEEDED(hr)) + hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER, + &IID_IWICComponentFactory, (void **)&factory);
- if (SUCCEEDED(hr)) - *ppIMetadataReader = reader; - else - IWICMetadataReader_Release(reader); - } - } - else + if (SUCCEEDED(hr)) { - if (SUCCEEDED(hr)) - hr = ImagingFactory_CreateInstance(&IID_IWICComponentFactory, (void**)&factory); - - if (SUCCEEDED(hr)) - { + if (This->metadata_blocks[nIndex].options & DECODER_BLOCK_FORMAT_GUID) + hr = IWICComponentFactory_CreateMetadataReader(factory, + &This->metadata_blocks[nIndex].format_guid, NULL, + This->metadata_blocks[nIndex].options & DECODER_BLOCK_OPTION_MASK, + (IStream*)stream, ppIMetadataReader); + else hr = IWICComponentFactory_CreateMetadataReaderFromContainer(factory, &This->parent->decoder_info.block_format, NULL, This->metadata_blocks[nIndex].options & DECODER_BLOCK_OPTION_MASK, (IStream*)stream, ppIMetadataReader);
- IWICComponentFactory_Release(factory); - } + IWICComponentFactory_Release(factory); }
IWICStream_Release(stream); diff --git a/dlls/windowscodecs/libtiff.c b/dlls/windowscodecs/libtiff.c index 6f5cfc53c62..d318ff80095 100644 --- a/dlls/windowscodecs/libtiff.c +++ b/dlls/windowscodecs/libtiff.c @@ -1129,8 +1129,8 @@ static HRESULT CDECL tiff_decoder_get_metadata_blocks(struct decoder *iface, #else result.options = byte_swapped ? WICPersistOptionBigEndian : WICPersistOptionLittleEndian; #endif - result.options |= WICPersistOptionNoCacheStream|DECODER_BLOCK_FULL_STREAM|DECODER_BLOCK_READER_CLSID; - result.reader_clsid = CLSID_WICIfdMetadataReader; + result.options |= WICPersistOptionNoCacheStream|DECODER_BLOCK_FULL_STREAM|DECODER_BLOCK_FORMAT_GUID; + result.format_guid = GUID_MetadataFormatIfd;
*blocks = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(**blocks)); **blocks = result; diff --git a/dlls/windowscodecs/wincodecs_private.h b/dlls/windowscodecs/wincodecs_private.h index 3b20f7d6c24..5085e4c057c 100644 --- a/dlls/windowscodecs/wincodecs_private.h +++ b/dlls/windowscodecs/wincodecs_private.h @@ -284,13 +284,13 @@ struct decoder_frame
#define DECODER_BLOCK_OPTION_MASK 0x0001000F #define DECODER_BLOCK_FULL_STREAM 0x80000000 -#define DECODER_BLOCK_READER_CLSID 0x40000000 +#define DECODER_BLOCK_FORMAT_GUID 0x40000000 struct decoder_block { ULONGLONG offset; ULONGLONG length; DWORD options; - GUID reader_clsid; + GUID format_guid; };
struct decoder