Bruno Jesus : msvfw32: Ask the codec to fill the lpbiOutput info when it is not available.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Oct 20 11:28:29 CDT 2015
Module: wine
Branch: master
Commit: cc9e70a80aa03942fd0c545f1bbf935a91ae6019
URL: http://source.winehq.org/git/wine.git/?a=commit;h=cc9e70a80aa03942fd0c545f1bbf935a91ae6019
Author: Bruno Jesus <00cpxxx at gmail.com>
Date: Tue Oct 20 14:56:56 2015 +0800
msvfw32: Ask the codec to fill the lpbiOutput info when it is not available.
Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msvfw32/msvideo_main.c | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/dlls/msvfw32/msvideo_main.c b/dlls/msvfw32/msvideo_main.c
index 1e05396..204d53a 100644
--- a/dlls/msvfw32/msvideo_main.c
+++ b/dlls/msvfw32/msvideo_main.c
@@ -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),
More information about the wine-cvs
mailing list