windowscodecs: Implement IWICMetadataQueryReader::GetLocation.
Signed-off-by: Dmitry Timoshkov <dmitry@baikal.ru> Signed-off-by: Vincent Povirk <vincent@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3059668de3
commit
c94bf3cf27
|
@ -821,7 +821,7 @@ static HRESULT WINAPI GifFrameDecode_GetMetadataQueryReader(IWICBitmapFrameDecod
|
|||
if (!ppIMetadataQueryReader)
|
||||
return E_INVALIDARG;
|
||||
|
||||
return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, ppIMetadataQueryReader);
|
||||
return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, NULL, ppIMetadataQueryReader);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI GifFrameDecode_GetColorContexts(IWICBitmapFrameDecode *iface,
|
||||
|
|
|
@ -1101,7 +1101,7 @@ static HRESULT WINAPI ComponentFactory_CreateQueryReaderFromBlockReader(IWICComp
|
|||
if (!block_reader || !query_reader)
|
||||
return E_INVALIDARG;
|
||||
|
||||
return MetadataQueryReader_CreateInstance(block_reader, query_reader);
|
||||
return MetadataQueryReader_CreateInstance(block_reader, NULL, query_reader);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromBlockWriter(IWICComponentFactory *iface,
|
||||
|
|
|
@ -695,7 +695,7 @@ static HRESULT WINAPI JpegDecoder_Frame_GetMetadataQueryReader(IWICBitmapFrameDe
|
|||
if (!ppIMetadataQueryReader)
|
||||
return E_INVALIDARG;
|
||||
|
||||
return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, ppIMetadataQueryReader);
|
||||
return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, NULL, ppIMetadataQueryReader);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI JpegDecoder_Frame_GetColorContexts(IWICBitmapFrameDecode *iface,
|
||||
|
|
|
@ -35,10 +35,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
|
|||
|
||||
typedef struct {
|
||||
IWICMetadataQueryReader IWICMetadataQueryReader_iface;
|
||||
|
||||
LONG ref;
|
||||
|
||||
IWICMetadataBlockReader *block;
|
||||
WCHAR *root;
|
||||
} QueryReader;
|
||||
|
||||
static inline QueryReader *impl_from_IWICMetadataQueryReader(IWICMetadataQueryReader *iface)
|
||||
|
@ -84,6 +83,7 @@ static ULONG WINAPI mqr_Release(IWICMetadataQueryReader *iface)
|
|||
if (!ref)
|
||||
{
|
||||
IWICMetadataBlockReader_Release(This->block);
|
||||
HeapFree(GetProcessHeap(), 0, This->root);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
return ref;
|
||||
|
@ -98,12 +98,31 @@ static HRESULT WINAPI mqr_GetContainerFormat(IWICMetadataQueryReader *iface, GUI
|
|||
return IWICMetadataBlockReader_GetContainerFormat(This->block, format);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI mqr_GetLocation(IWICMetadataQueryReader *iface,
|
||||
UINT cchMaxLength, WCHAR *wzNamespace, UINT *pcchActualLength)
|
||||
static HRESULT WINAPI mqr_GetLocation(IWICMetadataQueryReader *iface, UINT len, WCHAR *location, UINT *ret_len)
|
||||
{
|
||||
static const WCHAR rootW[] = { '/',0 };
|
||||
QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
|
||||
FIXME("(%p,%u,%p,%p)\n", This, cchMaxLength, wzNamespace, pcchActualLength);
|
||||
return E_NOTIMPL;
|
||||
const WCHAR *root;
|
||||
UINT actual_len;
|
||||
|
||||
TRACE("(%p,%u,%p,%p)\n", This, len, location, ret_len);
|
||||
|
||||
if (!ret_len) return E_INVALIDARG;
|
||||
|
||||
root = This->root ? This->root : rootW;
|
||||
actual_len = lstrlenW(root) + 1;
|
||||
|
||||
if (location)
|
||||
{
|
||||
if (len < actual_len)
|
||||
return WINCODEC_ERR_INSUFFICIENTBUFFER;
|
||||
|
||||
memcpy(location, root, actual_len * sizeof(WCHAR));
|
||||
}
|
||||
|
||||
*ret_len = actual_len;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI mqr_GetMetadataByName(IWICMetadataQueryReader *iface,
|
||||
|
@ -132,7 +151,7 @@ static IWICMetadataQueryReaderVtbl mqr_vtbl = {
|
|||
mqr_GetEnumerator
|
||||
};
|
||||
|
||||
HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *mbr, IWICMetadataQueryReader **out)
|
||||
HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *mbr, const WCHAR *root, IWICMetadataQueryReader **out)
|
||||
{
|
||||
QueryReader *obj;
|
||||
|
||||
|
@ -146,6 +165,8 @@ HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *mbr, IWICMet
|
|||
IWICMetadataBlockReader_AddRef(mbr);
|
||||
obj->block = mbr;
|
||||
|
||||
obj->root = root ? heap_strdupW(root) : NULL;
|
||||
|
||||
*out = &obj->IWICMetadataQueryReader_iface;
|
||||
|
||||
return S_OK;
|
||||
|
|
|
@ -1105,7 +1105,7 @@ static HRESULT WINAPI PngDecoder_Frame_GetMetadataQueryReader(IWICBitmapFrameDec
|
|||
if (!ppIMetadataQueryReader)
|
||||
return E_INVALIDARG;
|
||||
|
||||
return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, ppIMetadataQueryReader);
|
||||
return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, NULL, ppIMetadataQueryReader);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PngDecoder_Frame_GetColorContexts(IWICBitmapFrameDecode *iface,
|
||||
|
|
|
@ -1172,7 +1172,7 @@ static HRESULT WINAPI TiffFrameDecode_GetMetadataQueryReader(IWICBitmapFrameDeco
|
|||
if (!ppIMetadataQueryReader)
|
||||
return E_INVALIDARG;
|
||||
|
||||
return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, ppIMetadataQueryReader);
|
||||
return MetadataQueryReader_CreateInstance(&This->IWICMetadataBlockReader_iface, NULL, ppIMetadataQueryReader);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI TiffFrameDecode_GetColorContexts(IWICBitmapFrameDecode *iface,
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "wincodec.h"
|
||||
#include "wincodecsdk.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
DEFINE_GUID(CLSID_WineTgaDecoder, 0xb11fc79a,0x67cc,0x43e6,0xa9,0xce,0xe3,0xd5,0x49,0x45,0xd3,0x04);
|
||||
|
||||
|
@ -162,9 +163,17 @@ extern HRESULT IMDReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN;
|
|||
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 MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *, const WCHAR *, IWICMetadataQueryReader **) DECLSPEC_HIDDEN;
|
||||
extern HRESULT stream_initialize_from_filehandle(IWICStream *iface, HANDLE hfile) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline WCHAR *heap_strdupW(const WCHAR *src)
|
||||
{
|
||||
WCHAR *dst;
|
||||
SIZE_T len;
|
||||
if (!src) return NULL;
|
||||
len = (strlenW(src) + 1) * sizeof(WCHAR);
|
||||
if ((dst = HeapAlloc(GetProcessHeap(), 0, len))) memcpy(dst, src, len);
|
||||
return dst;
|
||||
}
|
||||
|
||||
#endif /* WINCODECS_PRIVATE_H */
|
||||
|
|
Loading…
Reference in New Issue