msrle32: Properly set compression output flags.

This commit is contained in:
Jacek Caban 2014-01-02 14:17:11 +01:00 committed by Alexandre Julliard
parent 331cb13b2f
commit d190b0c61e
2 changed files with 9 additions and 6 deletions

View File

@ -1420,6 +1420,7 @@ static LRESULT CompressBegin(CodecInfo *pi, LPCBITMAPINFOHEADER lpbiIn,
static LRESULT Compress(CodecInfo *pi, ICCOMPRESS* lpic, DWORD dwSize)
{
BOOL is_key;
int i;
TRACE("(%p,%p,%u)\n",pi,lpic,dwSize);
@ -1475,15 +1476,15 @@ static LRESULT Compress(CodecInfo *pi, ICCOMPRESS* lpic, DWORD dwSize)
pi->nPrevFrame = lpic->lFrameNum;
}
is_key = (lpic->dwFlags & ICCOMPRESS_KEYFRAME) != 0;
for (i = 0; i < 3; i++) {
lpic->lpbiOutput->biSizeImage = 0;
if (lpic->lpbiOutput->biBitCount == 4)
MSRLE32_CompressRLE4(pi, lpic->lpbiInput, lpic->lpInput,
lpic->lpbiOutput, lpic->lpOutput, (lpic->dwFlags & ICCOMPRESS_KEYFRAME) != 0);
MSRLE32_CompressRLE4(pi, lpic->lpbiInput, lpic->lpInput, lpic->lpbiOutput, lpic->lpOutput, is_key);
else
MSRLE32_CompressRLE8(pi, lpic->lpbiInput, lpic->lpInput,
lpic->lpbiOutput, lpic->lpOutput, (lpic->dwFlags & ICCOMPRESS_KEYFRAME) != 0);
MSRLE32_CompressRLE8(pi, lpic->lpbiInput, lpic->lpInput, lpic->lpbiOutput, lpic->lpOutput, is_key);
if (lpic->dwFrameSize == 0 ||
lpic->lpbiOutput->biSizeImage < lpic->dwFrameSize)
@ -1500,7 +1501,7 @@ static LRESULT Compress(CodecInfo *pi, ICCOMPRESS* lpic, DWORD dwSize)
if (lpic->dwFrameSize == 0 ||
lpic->lpbiOutput->biSizeImage < lpic->dwFrameSize) {
WARN("switched to keyframe, was small enough!\n");
*lpic->lpdwFlags |= ICCOMPRESS_KEYFRAME;
is_key = TRUE;
*lpic->lpckid = MAKEAVICKID(cktypeDIBbits,
StreamFromFOURCC(*lpic->lpckid));
break;
@ -1522,6 +1523,8 @@ static LRESULT Compress(CodecInfo *pi, ICCOMPRESS* lpic, DWORD dwSize)
pi->nPrevFrame = lpic->lFrameNum;
}
/* FIXME: What is AVIIF_TWOCC? */
*lpic->lpdwFlags |= AVIIF_TWOCC | (is_key ? AVIIF_KEYFRAME : 0);
return ICERR_OK;
}

View File

@ -92,7 +92,7 @@ static void test_encode(void)
res = ICCompress(hic, ICCOMPRESS_KEYFRAME, output_header, buf, &input_header.header, input1, 0, &flags, 0, 0, 0, NULL, NULL);
ok(res == ICERR_OK, "ICCompress failed: %ld\n", res);
test_output(buf, output_header->biSizeImage, output1, sizeof(output1));
todo_wine ok(flags == (AVIIF_TWOCC|AVIIF_KEYFRAME), "flags = %x\n", flags);
ok(flags == (AVIIF_TWOCC|AVIIF_KEYFRAME), "flags = %x\n", flags);
HeapFree(GetProcessHeap(), 0, output_header);