msvfw32: Ask the codec to fill the lpbiOutput info when it is not available.

Signed-off-by: Bruno Jesus <00cpxxx@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Bruno Jesus 2015-10-20 14:56:56 +08:00 committed by Alexandre Julliard
parent 4a9d238c14
commit cc9e70a80a
1 changed files with 33 additions and 0 deletions

View File

@ -1408,6 +1408,12 @@ static void clear_compvars(PCOMPVARS pc)
HeapFree(GetProcessHeap(), 0, pc->lpBitsOut);
HeapFree(GetProcessHeap(), 0, pc->lpState);
pc->lpbiIn = pc->lpBitsPrev = pc->lpBitsOut = pc->lpState = NULL;
if (pc->dwFlags & 0x80000000)
{
HeapFree(GetProcessHeap(), 0, pc->lpBitsOut);
pc->lpBitsOut = NULL;
pc->dwFlags &= ~0x80000000;
}
}
/***********************************************************************
@ -1445,6 +1451,33 @@ BOOL VFWAPI ICSeqCompressFrameStart(PCOMPVARS pc, LPBITMAPINFO lpbiIn)
pc->cbState = sizeof(ICCOMPRESS);
if (!pc->lpbiOut)
{
pc->lpbiOut = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(BITMAPINFO));
if (!pc->lpbiOut)
goto error;
ret = ICSendMessage(pc->hic, ICM_COMPRESS_GET_FORMAT,
(DWORD_PTR)pc->lpbiIn, (DWORD_PTR)pc->lpbiOut);
if (ret != ICERR_OK)
{
ERR("Could not get output format from compressor\n");
goto error;
}
if (!pc->lpbiOut->bmiHeader.biSizeImage)
{
/* If we can't know the output frame size for sure at least allocate
* the same size of the input frame and also at least 8Kb to be sure
* that poor compressors will have enough memory to work if the input
* frame is too small.
*/
pc->lpbiOut->bmiHeader.biSizeImage = max(8192, pc->lpbiIn->bmiHeader.biSizeImage);
ERR("Bad codec! Invalid output frame size, guessing from input\n");
}
/* Flag to show that we allocated lpbiOutput for proper cleanup */
pc->dwFlags |= 0x80000000;
}
TRACE("Input: %ux%u, fcc %s, bpp %u, size %u\n",
pc->lpbiIn->bmiHeader.biWidth, pc->lpbiIn->bmiHeader.biHeight,
wine_dbgstr_fcc(pc->lpbiIn->bmiHeader.biCompression),