windowscodecs: Stub IWICMetadataQueryReader.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Andrew Eikum 2016-03-14 13:47:00 -05:00 committed by Alexandre Julliard
parent d2d44610a2
commit 1b8e123465
30 changed files with 223 additions and 42 deletions

View File

@ -22,6 +22,7 @@ C_SRCS = \
jpegformat.c \
main.c \
metadatahandler.c \
metadataquery.c \
palette.c \
pngformat.c \
propertybag.c \

View File

@ -25,7 +25,6 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecs_private.h"

View File

@ -28,7 +28,6 @@
#include "winreg.h"
#include "wingdi.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecs_private.h"

View File

@ -27,7 +27,6 @@
#include "winreg.h"
#include "wingdi.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecs_private.h"

View File

@ -23,7 +23,6 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecs_private.h"

View File

@ -28,8 +28,6 @@
#include "objbase.h"
#include "ocidl.h"
#include "initguid.h"
#include "wincodec.h"
#include "wincodecsdk.h"
#include "wincodecs_private.h"

View File

@ -25,7 +25,6 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecs_private.h"

View File

@ -25,7 +25,6 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecs_private.h"

View File

@ -25,7 +25,6 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecs_private.h"

View File

@ -25,7 +25,6 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecs_private.h"

View File

@ -27,8 +27,6 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecsdk.h"
#include "ungif.h"
@ -816,8 +814,14 @@ static HRESULT WINAPI GifFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface,
static HRESULT WINAPI GifFrameDecode_GetMetadataQueryReader(IWICBitmapFrameDecode *iface,
IWICMetadataQueryReader **ppIMetadataQueryReader)
{
GifFrameDecode *This = impl_from_IWICBitmapFrameDecode(iface);
TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader);
return WINCODEC_ERR_UNSUPPORTEDOPERATION;
if (!ppIMetadataQueryReader)
return E_INVALIDARG;
return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, ppIMetadataQueryReader);
}
static HRESULT WINAPI GifFrameDecode_GetColorContexts(IWICBitmapFrameDecode *iface,

View File

@ -83,7 +83,6 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecs_private.h"

View File

@ -26,7 +26,6 @@
#include "winbase.h"
#include "wingdi.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecs_private.h"

View File

@ -28,8 +28,6 @@
#include "winreg.h"
#include "objbase.h"
#include "shellapi.h"
#include "wincodec.h"
#include "wincodecsdk.h"
#include "wincodecs_private.h"
@ -1098,8 +1096,12 @@ static HRESULT WINAPI ComponentFactory_CreateMetadataWriterFromReader(IWICCompon
static HRESULT WINAPI ComponentFactory_CreateQueryReaderFromBlockReader(IWICComponentFactory *iface,
IWICMetadataBlockReader *block_reader, IWICMetadataQueryReader **query_reader)
{
FIXME("%p,%p,%p: stub\n", iface, block_reader, query_reader);
return E_NOTIMPL;
TRACE("%p,%p,%p\n", iface, block_reader, query_reader);
if (!block_reader || !query_reader)
return E_INVALIDARG;
return MetadataQueryReader_CreateInstance(block_reader, query_reader);
}
static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromBlockWriter(IWICComponentFactory *iface,

View File

@ -27,8 +27,6 @@
#include "winbase.h"
#include "winreg.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecsdk.h"
#include "wincodecs_private.h"

View File

@ -47,7 +47,6 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecs_private.h"

View File

@ -25,7 +25,6 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecs_private.h"

View File

@ -29,8 +29,6 @@
#include "winbase.h"
#include "winternl.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecsdk.h"
#include "wincodecs_private.h"

View File

@ -0,0 +1,150 @@
/*
* Copyright 2016 Andrew Eikum 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
*/
#include "config.h"
#include <stdarg.h>
#define COBJMACROS
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodecs_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
typedef struct {
IWICMetadataQueryReader IWICMetadataQueryReader_iface;
LONG ref;
IWICMetadataBlockReader *block;
} QueryReader;
static inline QueryReader *impl_from_IWICMetadataQueryReader(IWICMetadataQueryReader *iface)
{
return CONTAINING_RECORD(iface, QueryReader, IWICMetadataQueryReader_iface);
}
static HRESULT WINAPI mqr_QueryInterface(IWICMetadataQueryReader *iface, REFIID riid,
void **ppvObject)
{
QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppvObject);
if (IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IWICMetadataQueryReader))
*ppvObject = &This->IWICMetadataQueryReader_iface;
else
*ppvObject = NULL;
if (*ppvObject)
{
IUnknown_AddRef((IUnknown*)*ppvObject);
return S_OK;
}
return E_NOINTERFACE;
}
static ULONG WINAPI mqr_AddRef(IWICMetadataQueryReader *iface)
{
QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) refcount=%u\n", This, ref);
return ref;
}
static ULONG WINAPI mqr_Release(IWICMetadataQueryReader *iface)
{
QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) refcount=%u\n", This, ref);
if (!ref)
{
IWICMetadataBlockReader_Release(This->block);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
static HRESULT WINAPI mqr_GetContainerFormat(IWICMetadataQueryReader *iface,
GUID *pguidContainerFormat)
{
QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
FIXME("(%p,%p)\n", This, pguidContainerFormat);
return E_NOTIMPL;
}
static HRESULT WINAPI mqr_GetLocation(IWICMetadataQueryReader *iface,
UINT cchMaxLength, WCHAR *wzNamespace, UINT *pcchActualLength)
{
QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
FIXME("(%p,%u,%p,%p)\n", This, cchMaxLength, wzNamespace, pcchActualLength);
return E_NOTIMPL;
}
static HRESULT WINAPI mqr_GetMetadataByName(IWICMetadataQueryReader *iface,
LPCWSTR wzName, PROPVARIANT *pvarValue)
{
QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
FIXME("(%p,%s,%p)\n", This, wine_dbgstr_w(wzName), pvarValue);
return E_NOTIMPL;
}
static HRESULT WINAPI mqr_GetEnumerator(IWICMetadataQueryReader *iface,
IEnumString **ppIEnumString)
{
QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
FIXME("(%p,%p)\n", This, ppIEnumString);
return E_NOTIMPL;
}
static IWICMetadataQueryReaderVtbl mqr_vtbl = {
mqr_QueryInterface,
mqr_AddRef,
mqr_Release,
mqr_GetContainerFormat,
mqr_GetLocation,
mqr_GetMetadataByName,
mqr_GetEnumerator
};
HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *mbr, IWICMetadataQueryReader **out)
{
QueryReader *obj;
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj));
if (!obj)
return E_OUTOFMEMORY;
obj->IWICMetadataQueryReader_iface.lpVtbl = &mqr_vtbl;
obj->ref = 1;
IWICMetadataBlockReader_AddRef(mbr);
obj->block = mbr;
*out = &obj->IWICMetadataQueryReader_iface;
return S_OK;
}

View File

@ -27,7 +27,6 @@
#include "winbase.h"
#include "winreg.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecs_private.h"

View File

@ -31,8 +31,6 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecsdk.h"
#include "wincodecs_private.h"
@ -1020,8 +1018,14 @@ static HRESULT WINAPI PngDecoder_Frame_CopyPixels(IWICBitmapFrameDecode *iface,
static HRESULT WINAPI PngDecoder_Frame_GetMetadataQueryReader(IWICBitmapFrameDecode *iface,
IWICMetadataQueryReader **ppIMetadataQueryReader)
{
FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader);
return E_NOTIMPL;
PngDecoder *This = impl_from_IWICBitmapFrameDecode(iface);
TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader);
if (!ppIMetadataQueryReader)
return E_INVALIDARG;
return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, ppIMetadataQueryReader);
}
static HRESULT WINAPI PngDecoder_Frame_GetColorContexts(IWICBitmapFrameDecode *iface,

View File

@ -26,7 +26,6 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodec.h"
#include "wine/unicode.h"
#include "wincodecs_private.h"

View File

@ -27,8 +27,6 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecsdk.h"
#include "wincodecs_private.h"

View File

@ -29,8 +29,6 @@
#include "objbase.h"
#include "ocidl.h"
#include "wincodec.h"
#include "wincodecsdk.h"
#include "wine/debug.h"
#include "wine/unicode.h"

View File

@ -25,7 +25,6 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecs_private.h"

View File

@ -24,7 +24,6 @@
#include "winreg.h"
#include "objbase.h"
#include "shlwapi.h"
#include "wincodec.h"
#include "wincodecs_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);

View File

@ -964,6 +964,8 @@ static void test_metadata_png(void)
IWICBitmapFrameDecode *frame;
IWICMetadataBlockReader *blockreader;
IWICMetadataReader *reader;
IWICMetadataQueryReader *queryreader;
IWICComponentFactory *factory;
GUID containerformat;
HRESULT hr;
UINT count=0xdeadbeef;
@ -1034,9 +1036,34 @@ static void test_metadata_png(void)
hr = IWICMetadataBlockReader_GetReaderByIndex(blockreader, 1, &reader);
todo_wine ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "GetReaderByIndex failed, hr=%x\n", hr);
hr = CoCreateInstance(&CLSID_WICImagingFactory, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICComponentFactory, (void**)&factory);
ok(hr == S_OK, "CoCreateInstance failed, hr=%x\n", hr);
hr = IWICComponentFactory_CreateQueryReaderFromBlockReader(factory, NULL, &queryreader);
ok(hr == E_INVALIDARG, "CreateQueryReaderFromBlockReader should have failed: %08x\n", hr);
hr = IWICComponentFactory_CreateQueryReaderFromBlockReader(factory, blockreader, NULL);
ok(hr == E_INVALIDARG, "CreateQueryReaderFromBlockReader should have failed: %08x\n", hr);
hr = IWICComponentFactory_CreateQueryReaderFromBlockReader(factory, blockreader, &queryreader);
ok(hr == S_OK, "CreateQueryReaderFromBlockReader failed: %08x\n", hr);
IWICMetadataQueryReader_Release(queryreader);
IWICComponentFactory_Release(factory);
IWICMetadataBlockReader_Release(blockreader);
}
hr = IWICBitmapFrameDecode_GetMetadataQueryReader(frame, &queryreader);
ok(hr == S_OK, "GetMetadataQueryReader failed: %08x\n", hr);
if (SUCCEEDED(hr))
{
IWICMetadataQueryReader_Release(queryreader);
}
IWICBitmapFrameDecode_Release(frame);
IWICBitmapDecoder_Release(decoder);
@ -1126,6 +1153,7 @@ static void test_metadata_gif(void)
IWICBitmapFrameDecode *frame;
IWICMetadataBlockReader *blockreader;
IWICMetadataReader *reader;
IWICMetadataQueryReader *queryreader;
GUID format;
HRESULT hr;
UINT count;
@ -1448,6 +1476,16 @@ static void test_metadata_gif(void)
IWICMetadataBlockReader_Release(blockreader);
}
hr = IWICBitmapFrameDecode_GetMetadataQueryReader(frame, &queryreader);
ok(hr == S_OK ||
broken(hr == WINCODEC_ERR_UNSUPPORTEDOPERATION) /* before Vista */,
"GetMetadataQueryReader failed: %08x\n", hr);
if (SUCCEEDED(hr))
{
IWICMetadataQueryReader_Release(queryreader);
}
IWICBitmapFrameDecode_Release(frame);
IWICBitmapDecoder_Release(decoder);
}

View File

@ -26,7 +26,6 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecs_private.h"

View File

@ -32,8 +32,6 @@
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "wincodec.h"
#include "wincodecsdk.h"
#include "wincodecs_private.h"
@ -1167,8 +1165,14 @@ static HRESULT WINAPI TiffFrameDecode_CopyPixels(IWICBitmapFrameDecode *iface,
static HRESULT WINAPI TiffFrameDecode_GetMetadataQueryReader(IWICBitmapFrameDecode *iface,
IWICMetadataQueryReader **ppIMetadataQueryReader)
{
FIXME("(%p,%p): stub\n", iface, ppIMetadataQueryReader);
return E_NOTIMPL;
TiffFrameDecode *This = impl_from_IWICBitmapFrameDecode(iface);
TRACE("(%p,%p)\n", iface, ppIMetadataQueryReader);
if (!ppIMetadataQueryReader)
return E_INVALIDARG;
return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, ppIMetadataQueryReader);
}
static HRESULT WINAPI TiffFrameDecode_GetColorContexts(IWICBitmapFrameDecode *iface,

View File

@ -19,6 +19,9 @@
#ifndef WINCODECS_PRIVATE_H
#define WINCODECS_PRIVATE_H
#include "wincodec.h"
#include "wincodecsdk.h"
DEFINE_GUID(CLSID_WineTgaDecoder, 0xb11fc79a,0x67cc,0x43e6,0xa9,0xce,0xe3,0xd5,0x49,0x45,0xd3,0x04);
DEFINE_GUID(CLSID_WICIcnsEncoder, 0x312fb6f1,0xb767,0x409d,0x8a,0x6d,0x0f,0xc1,0x54,0xd4,0xf0,0x5c);
@ -159,6 +162,8 @@ extern HRESULT GCEReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN;
extern HRESULT APEReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN;
extern HRESULT GifCommentReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN;
extern HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *mbr, IWICMetadataQueryReader **out) DECLSPEC_HIDDEN;
extern HRESULT stream_initialize_from_filehandle(IWICStream *iface, HANDLE hfile) DECLSPEC_HIDDEN;
#endif /* WINCODECS_PRIVATE_H */