Commit 434e7b8e authored by Vincent Povirk's avatar Vincent Povirk Committed by Alexandre Julliard

windowscodecs: Add stub IWICMetadataBlockReader to PNG decoder.

parent 8fdddd87
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "winbase.h" #include "winbase.h"
#include "objbase.h" #include "objbase.h"
#include "wincodec.h" #include "wincodec.h"
#include "wincodecsdk.h"
#include "wincodecs_private.h" #include "wincodecs_private.h"
...@@ -152,6 +153,7 @@ static void user_warning_fn(png_structp png_ptr, png_const_charp warning_message ...@@ -152,6 +153,7 @@ static void user_warning_fn(png_structp png_ptr, png_const_charp warning_message
typedef struct { typedef struct {
IWICBitmapDecoder IWICBitmapDecoder_iface; IWICBitmapDecoder IWICBitmapDecoder_iface;
IWICBitmapFrameDecode IWICBitmapFrameDecode_iface; IWICBitmapFrameDecode IWICBitmapFrameDecode_iface;
IWICMetadataBlockReader IWICMetadataBlockReader_iface;
LONG ref; LONG ref;
png_structp png_ptr; png_structp png_ptr;
png_infop info_ptr; png_infop info_ptr;
...@@ -175,6 +177,11 @@ static inline PngDecoder *impl_from_IWICBitmapFrameDecode(IWICBitmapFrameDecode ...@@ -175,6 +177,11 @@ static inline PngDecoder *impl_from_IWICBitmapFrameDecode(IWICBitmapFrameDecode
return CONTAINING_RECORD(iface, PngDecoder, IWICBitmapFrameDecode_iface); return CONTAINING_RECORD(iface, PngDecoder, IWICBitmapFrameDecode_iface);
} }
static inline PngDecoder *impl_from_IWICMetadataBlockReader(IWICMetadataBlockReader *iface)
{
return CONTAINING_RECORD(iface, PngDecoder, IWICMetadataBlockReader_iface);
}
static const IWICBitmapFrameDecodeVtbl PngDecoder_FrameVtbl; static const IWICBitmapFrameDecodeVtbl PngDecoder_FrameVtbl;
static HRESULT WINAPI PngDecoder_QueryInterface(IWICBitmapDecoder *iface, REFIID iid, static HRESULT WINAPI PngDecoder_QueryInterface(IWICBitmapDecoder *iface, REFIID iid,
...@@ -559,6 +566,7 @@ static const IWICBitmapDecoderVtbl PngDecoder_Vtbl = { ...@@ -559,6 +566,7 @@ static const IWICBitmapDecoderVtbl PngDecoder_Vtbl = {
static HRESULT WINAPI PngDecoder_Frame_QueryInterface(IWICBitmapFrameDecode *iface, REFIID iid, static HRESULT WINAPI PngDecoder_Frame_QueryInterface(IWICBitmapFrameDecode *iface, REFIID iid,
void **ppv) void **ppv)
{ {
PngDecoder *This = impl_from_IWICBitmapFrameDecode(iface);
if (!ppv) return E_INVALIDARG; if (!ppv) return E_INVALIDARG;
if (IsEqualIID(&IID_IUnknown, iid) || if (IsEqualIID(&IID_IUnknown, iid) ||
...@@ -567,6 +575,10 @@ static HRESULT WINAPI PngDecoder_Frame_QueryInterface(IWICBitmapFrameDecode *ifa ...@@ -567,6 +575,10 @@ static HRESULT WINAPI PngDecoder_Frame_QueryInterface(IWICBitmapFrameDecode *ifa
{ {
*ppv = iface; *ppv = iface;
} }
else if (IsEqualIID(&IID_IWICMetadataBlockReader, iid))
{
*ppv = (void**)&This->IWICMetadataBlockReader_iface;
}
else else
{ {
*ppv = NULL; *ppv = NULL;
...@@ -744,6 +756,64 @@ static const IWICBitmapFrameDecodeVtbl PngDecoder_FrameVtbl = { ...@@ -744,6 +756,64 @@ static const IWICBitmapFrameDecodeVtbl PngDecoder_FrameVtbl = {
PngDecoder_Frame_GetThumbnail PngDecoder_Frame_GetThumbnail
}; };
static HRESULT WINAPI PngDecoder_Block_QueryInterface(IWICMetadataBlockReader *iface, REFIID iid,
void **ppv)
{
PngDecoder *This = impl_from_IWICMetadataBlockReader(iface);
return IWICBitmapFrameDecode_QueryInterface(&This->IWICBitmapFrameDecode_iface, iid, ppv);
}
static ULONG WINAPI PngDecoder_Block_AddRef(IWICMetadataBlockReader *iface)
{
PngDecoder *This = impl_from_IWICMetadataBlockReader(iface);
return IUnknown_AddRef((IUnknown*)This);
}
static ULONG WINAPI PngDecoder_Block_Release(IWICMetadataBlockReader *iface)
{
PngDecoder *This = impl_from_IWICMetadataBlockReader(iface);
return IUnknown_Release((IUnknown*)This);
}
static HRESULT WINAPI PngDecoder_Block_GetContainerFormat(IWICMetadataBlockReader *iface,
GUID *pguidContainerFormat)
{
if (!pguidContainerFormat) return E_INVALIDARG;
memcpy(pguidContainerFormat, &GUID_ContainerFormatPng, sizeof(GUID));
return S_OK;
}
static HRESULT WINAPI PngDecoder_Block_GetCount(IWICMetadataBlockReader *iface,
UINT *pcCount)
{
FIXME("%p,%p: stub\n", iface, pcCount);
return E_NOTIMPL;
}
static HRESULT WINAPI PngDecoder_Block_GetReaderByIndex(IWICMetadataBlockReader *iface,
UINT nIndex, IWICMetadataReader **ppIMetadataReader)
{
FIXME("%p,%d,%p\n", iface, nIndex, ppIMetadataReader);
return E_NOTIMPL;
}
static HRESULT WINAPI PngDecoder_Block_GetEnumerator(IWICMetadataBlockReader *iface,
IEnumUnknown **ppIEnumMetadata)
{
FIXME("%p,%p\n", iface, ppIEnumMetadata);
return E_NOTIMPL;
}
static const IWICMetadataBlockReaderVtbl PngDecoder_BlockVtbl = {
PngDecoder_Block_QueryInterface,
PngDecoder_Block_AddRef,
PngDecoder_Block_Release,
PngDecoder_Block_GetContainerFormat,
PngDecoder_Block_GetCount,
PngDecoder_Block_GetReaderByIndex,
PngDecoder_Block_GetEnumerator,
};
HRESULT PngDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) HRESULT PngDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
{ {
PngDecoder *This; PngDecoder *This;
...@@ -766,6 +836,7 @@ HRESULT PngDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) ...@@ -766,6 +836,7 @@ HRESULT PngDecoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv)
This->IWICBitmapDecoder_iface.lpVtbl = &PngDecoder_Vtbl; This->IWICBitmapDecoder_iface.lpVtbl = &PngDecoder_Vtbl;
This->IWICBitmapFrameDecode_iface.lpVtbl = &PngDecoder_FrameVtbl; This->IWICBitmapFrameDecode_iface.lpVtbl = &PngDecoder_FrameVtbl;
This->IWICMetadataBlockReader_iface.lpVtbl = &PngDecoder_BlockVtbl;
This->ref = 1; This->ref = 1;
This->png_ptr = NULL; This->png_ptr = NULL;
This->info_ptr = NULL; This->info_ptr = NULL;
......
...@@ -569,7 +569,7 @@ static void test_metadata_png(void) ...@@ -569,7 +569,7 @@ static void test_metadata_png(void)
ok(hr == S_OK, "GetFrame failed, hr=%x\n", hr); ok(hr == S_OK, "GetFrame failed, hr=%x\n", hr);
hr = IWICBitmapFrameDecode_QueryInterface(frame, &IID_IWICMetadataBlockReader, (void**)&blockreader); hr = IWICBitmapFrameDecode_QueryInterface(frame, &IID_IWICMetadataBlockReader, (void**)&blockreader);
todo_wine ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr); ok(hr == S_OK, "QueryInterface failed, hr=%x\n", hr);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
...@@ -581,11 +581,11 @@ static void test_metadata_png(void) ...@@ -581,11 +581,11 @@ static void test_metadata_png(void)
ok(IsEqualGUID(&containerformat, &GUID_ContainerFormatPng), "unexpected container format\n"); ok(IsEqualGUID(&containerformat, &GUID_ContainerFormatPng), "unexpected container format\n");
hr = IWICMetadataBlockReader_GetCount(blockreader, NULL); hr = IWICMetadataBlockReader_GetCount(blockreader, NULL);
ok(hr == E_INVALIDARG, "GetCount failed, hr=%x\n", hr); todo_wine ok(hr == E_INVALIDARG, "GetCount failed, hr=%x\n", hr);
hr = IWICMetadataBlockReader_GetCount(blockreader, &count); hr = IWICMetadataBlockReader_GetCount(blockreader, &count);
ok(hr == S_OK, "GetCount failed, hr=%x\n", hr); todo_wine ok(hr == S_OK, "GetCount failed, hr=%x\n", hr);
ok(count == 1, "unexpected count %d\n", count); todo_wine ok(count == 1, "unexpected count %d\n", count);
if (0) if (0)
{ {
...@@ -595,7 +595,7 @@ static void test_metadata_png(void) ...@@ -595,7 +595,7 @@ static void test_metadata_png(void)
} }
hr = IWICMetadataBlockReader_GetReaderByIndex(blockreader, 0, &reader); hr = IWICMetadataBlockReader_GetReaderByIndex(blockreader, 0, &reader);
ok(hr == S_OK, "GetReaderByIndex failed, hr=%x\n", hr); todo_wine ok(hr == S_OK, "GetReaderByIndex failed, hr=%x\n", hr);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
...@@ -608,7 +608,7 @@ static void test_metadata_png(void) ...@@ -608,7 +608,7 @@ static void test_metadata_png(void)
} }
hr = IWICMetadataBlockReader_GetReaderByIndex(blockreader, 1, &reader); hr = IWICMetadataBlockReader_GetReaderByIndex(blockreader, 1, &reader);
ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "GetReaderByIndex failed, hr=%x\n", hr); todo_wine ok(hr == WINCODEC_ERR_VALUEOUTOFRANGE, "GetReaderByIndex failed, hr=%x\n", hr);
IWICMetadataBlockReader_Release(blockreader); IWICMetadataBlockReader_Release(blockreader);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment