Commit 0be89601 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

wincodecs: Encoder options are optional for CreateNewFrame().

parent 93afd254
...@@ -508,8 +508,11 @@ static HRESULT WINAPI BmpEncoder_CreateNewFrame(IWICBitmapEncoder *iface, ...@@ -508,8 +508,11 @@ static HRESULT WINAPI BmpEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
if (!This->stream) return WINCODEC_ERR_NOTINITIALIZED; if (!This->stream) return WINCODEC_ERR_NOTINITIALIZED;
if (ppIEncoderOptions)
{
hr = CreatePropertyBag2(NULL, 0, ppIEncoderOptions); hr = CreatePropertyBag2(NULL, 0, ppIEncoderOptions);
if (FAILED(hr)) return hr; if (FAILED(hr)) return hr;
}
encode = HeapAlloc(GetProcessHeap(), 0, sizeof(BmpFrameEncode)); encode = HeapAlloc(GetProcessHeap(), 0, sizeof(BmpFrameEncode));
if (!encode) if (!encode)
......
...@@ -617,9 +617,12 @@ static HRESULT WINAPI IcnsEncoder_CreateNewFrame(IWICBitmapEncoder *iface, ...@@ -617,9 +617,12 @@ static HRESULT WINAPI IcnsEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
goto end; goto end;
} }
if (ppIEncoderOptions)
{
hr = CreatePropertyBag2(NULL, 0, ppIEncoderOptions); hr = CreatePropertyBag2(NULL, 0, ppIEncoderOptions);
if (FAILED(hr)) if (FAILED(hr))
goto end; goto end;
}
frameEncode = HeapAlloc(GetProcessHeap(), 0, sizeof(IcnsFrameEncode)); frameEncode = HeapAlloc(GetProcessHeap(), 0, sizeof(IcnsFrameEncode));
if (frameEncode == NULL) if (frameEncode == NULL)
......
...@@ -1466,12 +1466,15 @@ static HRESULT WINAPI JpegEncoder_CreateNewFrame(IWICBitmapEncoder *iface, ...@@ -1466,12 +1466,15 @@ static HRESULT WINAPI JpegEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
return WINCODEC_ERR_NOTINITIALIZED; return WINCODEC_ERR_NOTINITIALIZED;
} }
if (ppIEncoderOptions)
{
hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions); hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
if (FAILED(hr)) if (FAILED(hr))
{ {
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
return hr; return hr;
} }
}
This->frame_count = 1; This->frame_count = 1;
......
...@@ -2055,12 +2055,15 @@ static HRESULT WINAPI PngEncoder_CreateNewFrame(IWICBitmapEncoder *iface, ...@@ -2055,12 +2055,15 @@ static HRESULT WINAPI PngEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
return WINCODEC_ERR_NOTINITIALIZED; return WINCODEC_ERR_NOTINITIALIZED;
} }
if (ppIEncoderOptions)
{
hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions); hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
if (FAILED(hr)) if (FAILED(hr))
{ {
LeaveCriticalSection(&This->lock); LeaveCriticalSection(&This->lock);
return hr; return hr;
} }
}
This->frame_count = 1; This->frame_count = 1;
......
...@@ -804,6 +804,24 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls ...@@ -804,6 +804,24 @@ static void test_multi_encoder(const struct bitmap_data **srcs, const CLSID* cls
int i; int i;
hr = CoCreateInstance(clsid_encoder, NULL, CLSCTX_INPROC_SERVER, hr = CoCreateInstance(clsid_encoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapEncoder, (void **)&encoder);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
hr = CreateStreamOnHGlobal(NULL, TRUE, &stream);
ok(SUCCEEDED(hr), "CreateStreamOnHGlobal failed, hr=%x\n", hr);
hr = IWICBitmapEncoder_Initialize(encoder, stream, WICBitmapEncoderNoCache);
ok(SUCCEEDED(hr), "Initialize failed, hr=%x\n", hr);
/* Encoder options are optional. */
hr = IWICBitmapEncoder_CreateNewFrame(encoder, &frameencode, NULL);
ok(SUCCEEDED(hr), "Failed to create encode frame, hr %#x.\n", hr);
IStream_Release(stream);
IWICBitmapEncoder_Release(encoder);
IWICBitmapFrameEncode_Release(frameencode);
hr = CoCreateInstance(clsid_encoder, NULL, CLSCTX_INPROC_SERVER,
&IID_IWICBitmapEncoder, (void**)&encoder); &IID_IWICBitmapEncoder, (void**)&encoder);
ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr); ok(SUCCEEDED(hr), "CoCreateInstance failed, hr=%x\n", hr);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
......
...@@ -1957,7 +1957,7 @@ static HRESULT WINAPI TiffEncoder_CreateNewFrame(IWICBitmapEncoder *iface, ...@@ -1957,7 +1957,7 @@ static HRESULT WINAPI TiffEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
hr = E_FAIL; hr = E_FAIL;
} }
if (SUCCEEDED(hr)) if (ppIEncoderOptions && SUCCEEDED(hr))
{ {
hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions); hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
......
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