Commit cc9e70a8 authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

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

parent 4a9d238c
......@@ -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),
......
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