From 1ce8a66e791d31afdbb2a1ffdf98a430ae2fab4f Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Fri, 10 Jun 2011 15:33:09 -0500 Subject: [PATCH] windowscodecs: Implement JpegEncoder_Frame_Initialize. --- dlls/windowscodecs/jpegformat.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c index 50e43678138..2b4b14c72b5 100644 --- a/dlls/windowscodecs/jpegformat.c +++ b/dlls/windowscodecs/jpegformat.c @@ -710,6 +710,7 @@ typedef struct JpegEncoder { struct jpeg_destination_mgr dest_mgr; int initialized; int frame_count; + int frame_initialized; IStream *stream; CRITICAL_SECTION lock; BYTE dest_buffer[1024]; @@ -812,8 +813,22 @@ static ULONG WINAPI JpegEncoder_Frame_Release(IWICBitmapFrameEncode *iface) static HRESULT WINAPI JpegEncoder_Frame_Initialize(IWICBitmapFrameEncode *iface, IPropertyBag2 *pIEncoderOptions) { - FIXME("(%p,%p): stub\n", iface, pIEncoderOptions); - return E_NOTIMPL; + JpegEncoder *This = impl_from_IWICBitmapFrameEncode(iface); + TRACE("(%p,%p)\n", iface, pIEncoderOptions); + + EnterCriticalSection(&This->lock); + + if (This->frame_initialized) + { + LeaveCriticalSection(&This->lock); + return WINCODEC_ERR_WRONGSTATE; + } + + This->frame_initialized = TRUE; + + LeaveCriticalSection(&This->lock); + + return S_OK; } static HRESULT WINAPI JpegEncoder_Frame_SetSize(IWICBitmapFrameEncode *iface, @@ -1138,6 +1153,7 @@ HRESULT JpegEncoder_CreateInstance(IUnknown *pUnkOuter, REFIID iid, void** ppv) This->ref = 1; This->initialized = 0; This->frame_count = 0; + This->frame_initialized = 0; This->stream = NULL; InitializeCriticalSection(&This->lock); This->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": JpegEncoder.lock");