windowscodecs: Implement GetContainerFormat() for encoders.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8d75d949a6
commit
938d00cd76
|
@ -472,6 +472,11 @@ static HRESULT WINAPI BmpEncoder_Initialize(IWICBitmapEncoder *iface,
|
|||
static HRESULT WINAPI BmpEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
|
||||
GUID *pguidContainerFormat)
|
||||
{
|
||||
TRACE("(%p,%p)\n", iface, pguidContainerFormat);
|
||||
|
||||
if (!pguidContainerFormat)
|
||||
return E_INVALIDARG;
|
||||
|
||||
memcpy(pguidContainerFormat, &GUID_ContainerFormatBmp, sizeof(GUID));
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -1381,11 +1381,15 @@ static HRESULT WINAPI JpegEncoder_Initialize(IWICBitmapEncoder *iface,
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI JpegEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
|
||||
GUID *pguidContainerFormat)
|
||||
static HRESULT WINAPI JpegEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *format)
|
||||
{
|
||||
FIXME("(%p,%s): stub\n", iface, debugstr_guid(pguidContainerFormat));
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p,%p)\n", iface, format);
|
||||
|
||||
if (!format)
|
||||
return E_INVALIDARG;
|
||||
|
||||
memcpy(format, &GUID_ContainerFormatJpeg, sizeof(*format));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI JpegEncoder_GetEncoderInfo(IWICBitmapEncoder *iface,
|
||||
|
|
|
@ -1968,11 +1968,15 @@ static HRESULT WINAPI PngEncoder_Initialize(IWICBitmapEncoder *iface,
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PngEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
|
||||
GUID *pguidContainerFormat)
|
||||
static HRESULT WINAPI PngEncoder_GetContainerFormat(IWICBitmapEncoder *iface, GUID *format)
|
||||
{
|
||||
FIXME("(%p,%s): stub\n", iface, debugstr_guid(pguidContainerFormat));
|
||||
return E_NOTIMPL;
|
||||
TRACE("(%p,%p)\n", iface, format);
|
||||
|
||||
if (!format)
|
||||
return E_INVALIDARG;
|
||||
|
||||
memcpy(format, &GUID_ContainerFormatPng, sizeof(*format));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PngEncoder_GetEncoderInfo(IWICBitmapEncoder *iface,
|
||||
|
|
|
@ -849,6 +849,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
|
|||
const struct bitmap_data **dsts, const CLSID *clsid_decoder, WICRect *rc,
|
||||
const struct setting *settings, const char *name, IWICPalette *palette)
|
||||
{
|
||||
const GUID *container_format = NULL;
|
||||
HRESULT hr;
|
||||
IWICBitmapEncoder *encoder;
|
||||
BitmapTestSrc *src_obj;
|
||||
|
@ -859,6 +860,7 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
|
|||
IWICBitmapDecoder *decoder;
|
||||
IWICBitmapFrameDecode *framedecode;
|
||||
WICPixelFormatGUID pixelformat;
|
||||
GUID guid;
|
||||
int i;
|
||||
|
||||
hr = CoCreateInstance(clsid_encoder, NULL, CLSCTX_INPROC_SERVER,
|
||||
|
@ -868,6 +870,28 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
|
|||
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
|
||||
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
|
||||
|
||||
hr = IWICBitmapEncoder_GetContainerFormat(encoder, NULL);
|
||||
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
if (IsEqualGUID(clsid_encoder, &CLSID_WICPngEncoder))
|
||||
container_format = &GUID_ContainerFormatPng;
|
||||
else if (IsEqualGUID(clsid_encoder, &CLSID_WICBmpEncoder))
|
||||
container_format = &GUID_ContainerFormatBmp;
|
||||
else if (IsEqualGUID(clsid_encoder, &CLSID_WICTiffEncoder))
|
||||
container_format = &GUID_ContainerFormatTiff;
|
||||
else if (IsEqualGUID(clsid_encoder, &CLSID_WICJpegEncoder))
|
||||
container_format = &GUID_ContainerFormatJpeg;
|
||||
else
|
||||
ok(0, "Unknown encoder %s.\n", wine_dbgstr_guid(clsid_encoder));
|
||||
|
||||
if (container_format)
|
||||
{
|
||||
memset(&guid, 0, sizeof(guid));
|
||||
hr = IWICBitmapEncoder_GetContainerFormat(encoder, &guid);
|
||||
ok(SUCCEEDED(hr), "Failed to get container format, hr %#x.\n", hr);
|
||||
ok(IsEqualGUID(container_format, &guid), "Unexpected container format %s.\n", wine_dbgstr_guid(&guid));
|
||||
}
|
||||
|
||||
hr = IWICBitmapEncoder_Initialize(encoder, stream, WICBitmapEncoderNoCache);
|
||||
ok(SUCCEEDED(hr), "Initialize failed, hr=%x\n", hr);
|
||||
|
||||
|
|
|
@ -1884,6 +1884,11 @@ exit:
|
|||
static HRESULT WINAPI TiffEncoder_GetContainerFormat(IWICBitmapEncoder *iface,
|
||||
GUID *pguidContainerFormat)
|
||||
{
|
||||
TRACE("(%p,%p)\n", iface, pguidContainerFormat);
|
||||
|
||||
if (!pguidContainerFormat)
|
||||
return E_INVALIDARG;
|
||||
|
||||
memcpy(pguidContainerFormat, &GUID_ContainerFormatTiff, sizeof(GUID));
|
||||
return S_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue