From d48feb246f814e45477ec181b46d032c301813e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20G=C3=BCnnewig?= Date: Wed, 23 Oct 2002 18:47:20 +0000 Subject: [PATCH] Fixed bug that prevented ICCompressorChoose from working. --- dlls/avifil32/getframe.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/avifil32/getframe.c b/dlls/avifil32/getframe.c index d2bb08606a7..7e5481145e6 100644 --- a/dlls/avifil32/getframe.c +++ b/dlls/avifil32/getframe.c @@ -224,7 +224,7 @@ static LPVOID WINAPI IGetFrame_fnGetFrame(IGetFrame *iface, LONG lPos) LONG lNext = AVIStreamFindSample(This->pStream, lPos, FIND_KEY|FIND_PREV); if (lNext == -1) - lNext = 0; /* first frame is always a keyframe */ + return NULL; if (lNext <= This->lCurrentFrame && This->lCurrentFrame < lPos) lNext++; @@ -338,6 +338,8 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface, /* get input format from stream */ if (This->lpInFormat == NULL) { + HRESULT hr; + This->cbInBuffer = sInfo.dwSuggestedBufferSize; if (This->cbInBuffer == 0) This->cbInBuffer = 1024; @@ -351,7 +353,11 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface, return AVIERR_MEMORY; } - AVIStreamReadFormat(This->pStream, sInfo.dwStart, This->lpInFormat, &This->cbInFormat); + hr = AVIStreamReadFormat(This->pStream, sInfo.dwStart, This->lpInFormat, &This->cbInFormat); + if (FAILED(hr)) { + AVIFILE_CloseCompressor(This); + return hr; + } This->lpInBuffer = ((LPBYTE)This->lpInFormat) + This->cbInFormat; }