Commit 77422c4a authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

windowscodecs: Add IWICMetadataBlockWriter stub interface.

parent 24b9203d
...@@ -58,6 +58,7 @@ typedef struct CommonEncoder { ...@@ -58,6 +58,7 @@ typedef struct CommonEncoder {
typedef struct CommonEncoderFrame { typedef struct CommonEncoderFrame {
IWICBitmapFrameEncode IWICBitmapFrameEncode_iface; IWICBitmapFrameEncode IWICBitmapFrameEncode_iface;
IWICMetadataBlockWriter IWICMetadataBlockWriter_iface;
LONG ref; LONG ref;
CommonEncoder *parent; CommonEncoder *parent;
struct encoder_frame encoder_frame; struct encoder_frame encoder_frame;
...@@ -77,10 +78,15 @@ static inline CommonEncoderFrame *impl_from_IWICBitmapFrameEncode(IWICBitmapFram ...@@ -77,10 +78,15 @@ static inline CommonEncoderFrame *impl_from_IWICBitmapFrameEncode(IWICBitmapFram
return CONTAINING_RECORD(iface, CommonEncoderFrame, IWICBitmapFrameEncode_iface); return CONTAINING_RECORD(iface, CommonEncoderFrame, IWICBitmapFrameEncode_iface);
} }
static inline CommonEncoderFrame *impl_from_IWICMetadataBlockWriter(IWICMetadataBlockWriter *iface)
{
return CONTAINING_RECORD(iface, CommonEncoderFrame, IWICMetadataBlockWriter_iface);
}
static HRESULT WINAPI CommonEncoderFrame_QueryInterface(IWICBitmapFrameEncode *iface, REFIID iid, static HRESULT WINAPI CommonEncoderFrame_QueryInterface(IWICBitmapFrameEncode *iface, REFIID iid,
void **ppv) void **ppv)
{ {
CommonEncoderFrame *This = impl_from_IWICBitmapFrameEncode(iface); CommonEncoderFrame *object = impl_from_IWICBitmapFrameEncode(iface);
TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv); TRACE("(%p,%s,%p)\n", iface, debugstr_guid(iid), ppv);
if (!ppv) return E_INVALIDARG; if (!ppv) return E_INVALIDARG;
...@@ -88,7 +94,12 @@ static HRESULT WINAPI CommonEncoderFrame_QueryInterface(IWICBitmapFrameEncode *i ...@@ -88,7 +94,12 @@ static HRESULT WINAPI CommonEncoderFrame_QueryInterface(IWICBitmapFrameEncode *i
if (IsEqualIID(&IID_IUnknown, iid) || if (IsEqualIID(&IID_IUnknown, iid) ||
IsEqualIID(&IID_IWICBitmapFrameEncode, iid)) IsEqualIID(&IID_IWICBitmapFrameEncode, iid))
{ {
*ppv = &This->IWICBitmapFrameEncode_iface; *ppv = &object->IWICBitmapFrameEncode_iface;
}
else if (object->parent->encoder_info.flags & ENCODER_FLAGS_SUPPORTS_METADATA
&& IsEqualIID(&IID_IWICMetadataBlockWriter, iid))
{
*ppv = &object->IWICMetadataBlockWriter_iface;
} }
else else
{ {
...@@ -628,6 +639,110 @@ static HRESULT WINAPI CommonEncoder_SetPreview(IWICBitmapEncoder *iface, IWICBit ...@@ -628,6 +639,110 @@ static HRESULT WINAPI CommonEncoder_SetPreview(IWICBitmapEncoder *iface, IWICBit
return WINCODEC_ERR_UNSUPPORTEDOPERATION; return WINCODEC_ERR_UNSUPPORTEDOPERATION;
} }
static HRESULT WINAPI CommonEncoderFrame_Block_QueryInterface(IWICMetadataBlockWriter *iface, REFIID iid, void **ppv)
{
CommonEncoderFrame *encoder = impl_from_IWICMetadataBlockWriter(iface);
return IWICBitmapFrameEncode_QueryInterface(&encoder->IWICBitmapFrameEncode_iface, iid, ppv);
}
static ULONG WINAPI CommonEncoderFrame_Block_AddRef(IWICMetadataBlockWriter *iface)
{
CommonEncoderFrame *encoder = impl_from_IWICMetadataBlockWriter(iface);
return IWICBitmapFrameEncode_AddRef(&encoder->IWICBitmapFrameEncode_iface);
}
static ULONG WINAPI CommonEncoderFrame_Block_Release(IWICMetadataBlockWriter *iface)
{
CommonEncoderFrame *encoder = impl_from_IWICMetadataBlockWriter(iface);
return IWICBitmapFrameEncode_Release(&encoder->IWICBitmapFrameEncode_iface);
}
static HRESULT WINAPI CommonEncoderFrame_Block_GetContainerFormat(IWICMetadataBlockWriter *iface, GUID *container_format)
{
FIXME("iface %p, container_format %p stub.\n", iface, container_format);
return E_NOTIMPL;
}
static HRESULT WINAPI CommonEncoderFrame_Block_GetCount(IWICMetadataBlockWriter *iface, UINT *count)
{
FIXME("iface %p, count %p stub.\n", iface, count);
return E_NOTIMPL;
}
static HRESULT WINAPI CommonEncoderFrame_Block_GetReaderByIndex(IWICMetadataBlockWriter *iface,
UINT index, IWICMetadataReader **metadata_reader)
{
FIXME("iface %p, index %d, metadata_reader %p stub.\n", iface, index, metadata_reader);
return E_NOTIMPL;
}
static HRESULT WINAPI CommonEncoderFrame_Block_GetEnumerator(IWICMetadataBlockWriter *iface, IEnumUnknown **enum_metadata)
{
FIXME("iface %p, ppIEnumMetadata %p stub.\n", iface, enum_metadata);
return E_NOTIMPL;
}
static HRESULT WINAPI CommonEncoderFrame_Block_InitializeFromBlockReader(IWICMetadataBlockWriter *iface,
IWICMetadataBlockReader *metadata_block_reader)
{
FIXME("iface %p, metadata_block_reader %p stub.\n", iface, metadata_block_reader);
return E_NOTIMPL;
}
static HRESULT WINAPI CommonEncoderFrame_Block_GetWriterByIndex(IWICMetadataBlockWriter *iface, UINT index,
IWICMetadataWriter **metadata_writer)
{
FIXME("iface %p, index %u, metadata_writer %p stub.\n", iface, index, metadata_writer);
return E_NOTIMPL;
}
static HRESULT WINAPI CommonEncoderFrame_Block_AddWriter(IWICMetadataBlockWriter *iface, IWICMetadataWriter *metadata_writer)
{
FIXME("iface %p, metadata_writer %p.\n", iface, metadata_writer);
return E_NOTIMPL;
}
static HRESULT WINAPI CommonEncoderFrame_Block_SetWriterByIndex(IWICMetadataBlockWriter *iface, UINT index,
IWICMetadataWriter *metadata_writer)
{
FIXME("iface %p, index %u, metadata_writer %p stub.\n", iface, index, metadata_writer);
return E_NOTIMPL;
}
static HRESULT WINAPI CommonEncoderFrame_Block_RemoveWriterByIndex(IWICMetadataBlockWriter *iface, UINT index)
{
FIXME("iface %p, index %u.\n", iface, index);
return E_NOTIMPL;
}
static const IWICMetadataBlockWriterVtbl CommonEncoderFrame_BlockVtbl =
{
CommonEncoderFrame_Block_QueryInterface,
CommonEncoderFrame_Block_AddRef,
CommonEncoderFrame_Block_Release,
CommonEncoderFrame_Block_GetContainerFormat,
CommonEncoderFrame_Block_GetCount,
CommonEncoderFrame_Block_GetReaderByIndex,
CommonEncoderFrame_Block_GetEnumerator,
CommonEncoderFrame_Block_InitializeFromBlockReader,
CommonEncoderFrame_Block_GetWriterByIndex,
CommonEncoderFrame_Block_AddWriter,
CommonEncoderFrame_Block_SetWriterByIndex,
CommonEncoderFrame_Block_RemoveWriterByIndex,
};
static HRESULT WINAPI CommonEncoder_CreateNewFrame(IWICBitmapEncoder *iface, static HRESULT WINAPI CommonEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
IWICBitmapFrameEncode **ppIFrameEncode, IPropertyBag2 **ppIEncoderOptions) IWICBitmapFrameEncode **ppIFrameEncode, IPropertyBag2 **ppIEncoderOptions)
{ {
...@@ -661,6 +776,7 @@ static HRESULT WINAPI CommonEncoder_CreateNewFrame(IWICBitmapEncoder *iface, ...@@ -661,6 +776,7 @@ static HRESULT WINAPI CommonEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
} }
result->IWICBitmapFrameEncode_iface.lpVtbl = &CommonEncoderFrame_Vtbl; result->IWICBitmapFrameEncode_iface.lpVtbl = &CommonEncoderFrame_Vtbl;
result->IWICMetadataBlockWriter_iface.lpVtbl = &CommonEncoderFrame_BlockVtbl;
result->ref = 1; result->ref = 1;
result->parent = This; result->parent = This;
......
...@@ -746,7 +746,7 @@ HRESULT CDECL jpeg_encoder_create(struct encoder_info *info, struct encoder **re ...@@ -746,7 +746,7 @@ HRESULT CDECL jpeg_encoder_create(struct encoder_info *info, struct encoder **re
This->cinfo_initialized = FALSE; This->cinfo_initialized = FALSE;
*result = &This->encoder; *result = &This->encoder;
info->flags = 0; info->flags = ENCODER_FLAGS_SUPPORTS_METADATA;
info->container_format = GUID_ContainerFormatJpeg; info->container_format = GUID_ContainerFormatJpeg;
info->clsid = CLSID_WICJpegEncoder; info->clsid = CLSID_WICJpegEncoder;
info->encoder_options[0] = ENCODER_OPTION_IMAGE_QUALITY; info->encoder_options[0] = ENCODER_OPTION_IMAGE_QUALITY;
......
...@@ -997,7 +997,7 @@ HRESULT CDECL png_encoder_create(struct encoder_info *info, struct encoder **res ...@@ -997,7 +997,7 @@ HRESULT CDECL png_encoder_create(struct encoder_info *info, struct encoder **res
This->data = NULL; This->data = NULL;
*result = &This->encoder; *result = &This->encoder;
info->flags = 0; info->flags = ENCODER_FLAGS_SUPPORTS_METADATA;
info->container_format = GUID_ContainerFormatPng; info->container_format = GUID_ContainerFormatPng;
info->clsid = CLSID_WICPngEncoder; info->clsid = CLSID_WICPngEncoder;
info->encoder_options[0] = ENCODER_OPTION_INTERLACE; info->encoder_options[0] = ENCODER_OPTION_INTERLACE;
......
...@@ -1414,7 +1414,7 @@ HRESULT CDECL tiff_encoder_create(struct encoder_info *info, struct encoder **re ...@@ -1414,7 +1414,7 @@ HRESULT CDECL tiff_encoder_create(struct encoder_info *info, struct encoder **re
This->tiff = NULL; This->tiff = NULL;
This->num_frames = 0; This->num_frames = 0;
info->flags = ENCODER_FLAGS_MULTI_FRAME; info->flags = ENCODER_FLAGS_MULTI_FRAME | ENCODER_FLAGS_SUPPORTS_METADATA;
info->container_format = GUID_ContainerFormatTiff; info->container_format = GUID_ContainerFormatTiff;
info->clsid = CLSID_WICTiffEncoder; info->clsid = CLSID_WICTiffEncoder;
info->encoder_options[0] = ENCODER_OPTION_COMPRESSION_METHOD; info->encoder_options[0] = ENCODER_OPTION_COMPRESSION_METHOD;
......
...@@ -355,6 +355,7 @@ enum encoder_option ...@@ -355,6 +355,7 @@ enum encoder_option
#define ENCODER_FLAGS_MULTI_FRAME 0x1 #define ENCODER_FLAGS_MULTI_FRAME 0x1
#define ENCODER_FLAGS_ICNS_SIZE 0x2 #define ENCODER_FLAGS_ICNS_SIZE 0x2
#define ENCODER_FLAGS_SUPPORTS_METADATA 0x4
struct encoder_info struct encoder_info
{ {
......
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