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)
|
if (!ppIMetadataQueryReader)
|
||||||
return E_INVALIDARG;
|
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,
|
static HRESULT WINAPI GifFrameDecode_GetColorContexts(IWICBitmapFrameDecode *iface,
|
||||||
|
|
|
@ -1101,7 +1101,7 @@ static HRESULT WINAPI ComponentFactory_CreateQueryReaderFromBlockReader(IWICComp
|
||||||
if (!block_reader || !query_reader)
|
if (!block_reader || !query_reader)
|
||||||
return E_INVALIDARG;
|
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,
|
static HRESULT WINAPI ComponentFactory_CreateQueryWriterFromBlockWriter(IWICComponentFactory *iface,
|
||||||
|
|
|
@ -695,7 +695,7 @@ static HRESULT WINAPI JpegDecoder_Frame_GetMetadataQueryReader(IWICBitmapFrameDe
|
||||||
if (!ppIMetadataQueryReader)
|
if (!ppIMetadataQueryReader)
|
||||||
return E_INVALIDARG;
|
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,
|
static HRESULT WINAPI JpegDecoder_Frame_GetColorContexts(IWICBitmapFrameDecode *iface,
|
||||||
|
|
|
@ -35,10 +35,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(wincodecs);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
IWICMetadataQueryReader IWICMetadataQueryReader_iface;
|
IWICMetadataQueryReader IWICMetadataQueryReader_iface;
|
||||||
|
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
IWICMetadataBlockReader *block;
|
IWICMetadataBlockReader *block;
|
||||||
|
WCHAR *root;
|
||||||
} QueryReader;
|
} QueryReader;
|
||||||
|
|
||||||
static inline QueryReader *impl_from_IWICMetadataQueryReader(IWICMetadataQueryReader *iface)
|
static inline QueryReader *impl_from_IWICMetadataQueryReader(IWICMetadataQueryReader *iface)
|
||||||
|
@ -84,6 +83,7 @@ static ULONG WINAPI mqr_Release(IWICMetadataQueryReader *iface)
|
||||||
if (!ref)
|
if (!ref)
|
||||||
{
|
{
|
||||||
IWICMetadataBlockReader_Release(This->block);
|
IWICMetadataBlockReader_Release(This->block);
|
||||||
|
HeapFree(GetProcessHeap(), 0, This->root);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
}
|
}
|
||||||
return ref;
|
return ref;
|
||||||
|
@ -98,12 +98,31 @@ static HRESULT WINAPI mqr_GetContainerFormat(IWICMetadataQueryReader *iface, GUI
|
||||||
return IWICMetadataBlockReader_GetContainerFormat(This->block, format);
|
return IWICMetadataBlockReader_GetContainerFormat(This->block, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI mqr_GetLocation(IWICMetadataQueryReader *iface,
|
static HRESULT WINAPI mqr_GetLocation(IWICMetadataQueryReader *iface, UINT len, WCHAR *location, UINT *ret_len)
|
||||||
UINT cchMaxLength, WCHAR *wzNamespace, UINT *pcchActualLength)
|
|
||||||
{
|
{
|
||||||
|
static const WCHAR rootW[] = { '/',0 };
|
||||||
QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
|
QueryReader *This = impl_from_IWICMetadataQueryReader(iface);
|
||||||
FIXME("(%p,%u,%p,%p)\n", This, cchMaxLength, wzNamespace, pcchActualLength);
|
const WCHAR *root;
|
||||||
return E_NOTIMPL;
|
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,
|
static HRESULT WINAPI mqr_GetMetadataByName(IWICMetadataQueryReader *iface,
|
||||||
|
@ -132,7 +151,7 @@ static IWICMetadataQueryReaderVtbl mqr_vtbl = {
|
||||||
mqr_GetEnumerator
|
mqr_GetEnumerator
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *mbr, IWICMetadataQueryReader **out)
|
HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *mbr, const WCHAR *root, IWICMetadataQueryReader **out)
|
||||||
{
|
{
|
||||||
QueryReader *obj;
|
QueryReader *obj;
|
||||||
|
|
||||||
|
@ -146,6 +165,8 @@ HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *mbr, IWICMet
|
||||||
IWICMetadataBlockReader_AddRef(mbr);
|
IWICMetadataBlockReader_AddRef(mbr);
|
||||||
obj->block = mbr;
|
obj->block = mbr;
|
||||||
|
|
||||||
|
obj->root = root ? heap_strdupW(root) : NULL;
|
||||||
|
|
||||||
*out = &obj->IWICMetadataQueryReader_iface;
|
*out = &obj->IWICMetadataQueryReader_iface;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -1105,7 +1105,7 @@ static HRESULT WINAPI PngDecoder_Frame_GetMetadataQueryReader(IWICBitmapFrameDec
|
||||||
if (!ppIMetadataQueryReader)
|
if (!ppIMetadataQueryReader)
|
||||||
return E_INVALIDARG;
|
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,
|
static HRESULT WINAPI PngDecoder_Frame_GetColorContexts(IWICBitmapFrameDecode *iface,
|
||||||
|
|
|
@ -1172,7 +1172,7 @@ static HRESULT WINAPI TiffFrameDecode_GetMetadataQueryReader(IWICBitmapFrameDeco
|
||||||
if (!ppIMetadataQueryReader)
|
if (!ppIMetadataQueryReader)
|
||||||
return E_INVALIDARG;
|
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,
|
static HRESULT WINAPI TiffFrameDecode_GetColorContexts(IWICBitmapFrameDecode *iface,
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
#include "wincodec.h"
|
#include "wincodec.h"
|
||||||
#include "wincodecsdk.h"
|
#include "wincodecsdk.h"
|
||||||
|
#include "wine/unicode.h"
|
||||||
|
|
||||||
DEFINE_GUID(CLSID_WineTgaDecoder, 0xb11fc79a,0x67cc,0x43e6,0xa9,0xce,0xe3,0xd5,0x49,0x45,0xd3,0x04);
|
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 GCEReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN;
|
||||||
extern HRESULT APEReader_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 GifCommentReader_CreateInstance(REFIID iid, void **ppv) DECLSPEC_HIDDEN;
|
||||||
|
extern HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *, const WCHAR *, IWICMetadataQueryReader **) DECLSPEC_HIDDEN;
|
||||||
extern HRESULT MetadataQueryReader_CreateInstance(IWICMetadataBlockReader *mbr, IWICMetadataQueryReader **out) DECLSPEC_HIDDEN;
|
|
||||||
|
|
||||||
extern HRESULT stream_initialize_from_filehandle(IWICStream *iface, HANDLE hfile) 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 */
|
#endif /* WINCODECS_PRIVATE_H */
|
||||||
|
|
Loading…
Reference in New Issue