Commit d190b0c6 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

msrle32: Properly set compression output flags.

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