diff --git a/patches/avifil32-IGetFrame_fnSetFormat/0001-avifil32-Correctly-handle-compressed-frames-when-des.patch b/patches/avifil32-IGetFrame_fnSetFormat/0001-avifil32-Correctly-handle-compressed-frames-when-des.patch new file mode 100644 index 00000000..6598fdd5 --- /dev/null +++ b/patches/avifil32-IGetFrame_fnSetFormat/0001-avifil32-Correctly-handle-compressed-frames-when-des.patch @@ -0,0 +1,141 @@ +From 23ce6bcd9ebd67d6b5ed991bad555ecbc014a08d Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Mon, 8 Feb 2016 04:55:07 +0100 +Subject: avifil32: Correctly handle compressed frames when desired format is + specified. + +--- + dlls/avifil32/getframe.c | 102 +++++++++++++++++++++++------------------------ + 1 file changed, 50 insertions(+), 52 deletions(-) + +diff --git a/dlls/avifil32/getframe.c b/dlls/avifil32/getframe.c +index 46b1683..7d98d2e 100644 +--- a/dlls/avifil32/getframe.c ++++ b/dlls/avifil32/getframe.c +@@ -406,8 +406,6 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface, + lpbi->biSize + lpbi->biClrUsed * sizeof(RGBQUAD)); + if (lpbi->biBitCount <= 8) + ICDecompressGetPalette(This->hic, This->lpInFormat, This->lpOutFormat); +- +- return AVIERR_OK; + } else { + if (bBestDisplay) { + ICGetDisplayFormat(This->hic, This->lpInFormat, +@@ -417,64 +415,64 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface, + AVIFILE_CloseCompressor(This); + return AVIERR_NOCOMPRESSOR; + } ++ } + +- /* check output format */ +- if (This->lpOutFormat->biClrUsed == 0 && +- This->lpOutFormat->biBitCount <= 8) +- This->lpOutFormat->biClrUsed = 1u << This->lpOutFormat->biBitCount; +- if (This->lpOutFormat->biSizeImage == 0 && +- This->lpOutFormat->biCompression == BI_RGB) { +- This->lpOutFormat->biSizeImage = +- DIBWIDTHBYTES(*This->lpOutFormat) * This->lpOutFormat->biHeight; +- } ++ /* check output format */ ++ if (This->lpOutFormat->biClrUsed == 0 && ++ This->lpOutFormat->biBitCount <= 8) ++ This->lpOutFormat->biClrUsed = 1u << This->lpOutFormat->biBitCount; ++ if (This->lpOutFormat->biSizeImage == 0 && ++ This->lpOutFormat->biCompression == BI_RGB) { ++ This->lpOutFormat->biSizeImage = ++ DIBWIDTHBYTES(*This->lpOutFormat) * This->lpOutFormat->biHeight; ++ } + +- if (lpBits == NULL) { +- DWORD size = This->lpOutFormat->biClrUsed * sizeof(RGBQUAD); ++ if (lpBits == NULL) { ++ DWORD size = This->lpOutFormat->biClrUsed * sizeof(RGBQUAD); + +- size += This->lpOutFormat->biSize + This->lpOutFormat->biSizeImage; +- This->lpOutFormat = HeapReAlloc(GetProcessHeap(), 0, This->lpOutFormat, size); +- if (This->lpOutFormat == NULL) { +- AVIFILE_CloseCompressor(This); +- return AVIERR_MEMORY; +- } +- This->lpOutBuffer = DIBPTR(This->lpOutFormat); +- } else +- This->lpOutBuffer = lpBits; +- +- /* for user size was irrelevant */ +- if (dx == -1) +- dx = This->lpOutFormat->biWidth; +- if (dy == -1) +- dy = This->lpOutFormat->biHeight; +- +- /* need to resize? */ +- if (x != 0 || y != 0) { +- if (dy == This->lpOutFormat->biHeight && +- dx == This->lpOutFormat->biWidth) +- This->bResize = FALSE; +- else +- This->bResize = TRUE; ++ size += This->lpOutFormat->biSize + This->lpOutFormat->biSizeImage; ++ This->lpOutFormat = HeapReAlloc(GetProcessHeap(), 0, This->lpOutFormat, size); ++ if (This->lpOutFormat == NULL) { ++ AVIFILE_CloseCompressor(This); ++ return AVIERR_MEMORY; + } ++ This->lpOutBuffer = DIBPTR(This->lpOutFormat); ++ } else ++ This->lpOutBuffer = lpBits; ++ ++ /* for user size was irrelevant */ ++ if (dx == -1) ++ dx = This->lpOutFormat->biWidth; ++ if (dy == -1) ++ dy = This->lpOutFormat->biHeight; ++ ++ /* need to resize? */ ++ if (x != 0 || y != 0) { ++ if (dy == This->lpOutFormat->biHeight && ++ dx == This->lpOutFormat->biWidth) ++ This->bResize = FALSE; ++ else ++ This->bResize = TRUE; ++ } + +- if (This->bResize) { +- This->x = x; +- This->y = y; +- This->dx = dx; +- This->dy = dy; +- +- if (ICDecompressExBegin(This->hic,0,This->lpInFormat,This->lpInBuffer,0, +- 0,This->lpInFormat->biWidth, +- This->lpInFormat->biHeight,This->lpOutFormat, +- This->lpOutBuffer, x, y, dx, dy) == ICERR_OK) +- return AVIERR_OK; +- } else if (ICDecompressBegin(This->hic, This->lpInFormat, +- This->lpOutFormat) == ICERR_OK) ++ if (This->bResize) { ++ This->x = x; ++ This->y = y; ++ This->dx = dx; ++ This->dy = dy; ++ ++ if (ICDecompressExBegin(This->hic,0,This->lpInFormat,This->lpInBuffer,0, ++ 0,This->lpInFormat->biWidth, ++ This->lpInFormat->biHeight,This->lpOutFormat, ++ This->lpOutBuffer, x, y, dx, dy) == ICERR_OK) + return AVIERR_OK; ++ } else if (ICDecompressBegin(This->hic, This->lpInFormat, ++ This->lpOutFormat) == ICERR_OK) ++ return AVIERR_OK; + +- AVIFILE_CloseCompressor(This); ++ AVIFILE_CloseCompressor(This); + +- return AVIERR_COMPRESSOR; +- } ++ return AVIERR_COMPRESSOR; + } + + static const struct IGetFrameVtbl igetframeVtbl = { +-- +2.7.0 + diff --git a/patches/avifil32-IGetFrame_fnSetFormat/definition b/patches/avifil32-IGetFrame_fnSetFormat/definition new file mode 100644 index 00000000..ca8ec398 --- /dev/null +++ b/patches/avifil32-IGetFrame_fnSetFormat/definition @@ -0,0 +1 @@ +Fixes: Correctly handle compressed frames when desired format is specified diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 604921bb..826d7903 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -92,6 +92,7 @@ patch_enable_all () enable_api_ms_win_Stub_DLLs="$1" enable_authz_Stub_Functions="$1" enable_avifil32_AVIFile_Proxies="$1" + enable_avifil32_IGetFrame_fnSetFormat="$1" enable_avifile_dll16_AVIStreamGetFrame="$1" enable_browseui_Progress_Dialog="$1" enable_combase_RoApi="$1" @@ -424,6 +425,9 @@ patch_enable () avifil32-AVIFile_Proxies) enable_avifil32_AVIFile_Proxies="$2" ;; + avifil32-IGetFrame_fnSetFormat) + enable_avifil32_IGetFrame_fnSetFormat="$2" + ;; avifile.dll16-AVIStreamGetFrame) enable_avifile_dll16_AVIStreamGetFrame="$2" ;; @@ -2772,6 +2776,18 @@ if test "$enable_avifil32_AVIFile_Proxies" -eq 1; then ) >> "$patchlist" fi +# Patchset avifil32-IGetFrame_fnSetFormat +# | +# | Modified files: +# | * dlls/avifil32/getframe.c +# | +if test "$enable_avifil32_IGetFrame_fnSetFormat" -eq 1; then + patch_apply avifil32-IGetFrame_fnSetFormat/0001-avifil32-Correctly-handle-compressed-frames-when-des.patch + ( + echo '+ { "Michael Müller", "avifil32: Correctly handle compressed frames when desired format is specified.", 1 },'; + ) >> "$patchlist" +fi + # Patchset avifile.dll16-AVIStreamGetFrame # | # | Modified files: