avifil32: Absolute addresses already point to the correct place in the frame

Bruno Jesus 00cpxxx at gmail.com
Sat Oct 17 12:05:39 CDT 2015


Signed-off-by: Bruno Jesus <00cpxxx at gmail.com>

Small video clips from Starship Titanic [1] won't play because their
data is rejected by the cinepak codec, and that happens because the
codec receives the data 4 bytes ahead of the correct position. When
parsing an absolute AVI index the offset is already in the correct
place so there is no need to add sizeof(DWORD) to it.

Fixes the minor issue from [1]

[1] https://bugs.winehq.org/show_bug.cgi?id=33022
-------------- next part --------------
diff --git a/dlls/avifil32/avifile.c b/dlls/avifil32/avifile.c
index f5abc1c..f649d05 100644
--- a/dlls/avifil32/avifile.c
+++ b/dlls/avifil32/avifile.c
@@ -1987,13 +1987,17 @@ static HRESULT AVIFILE_ParseIndex(const IAVIFileImpl *This, AVIINDEXENTRY *lp,
     if (nStream > This->fInfo.dwStreams)
       return AVIERR_BADFORMAT;
 
+    /* Video frames can be either indexed in a relative position to the
+     * "movi" chunk or in a absolute position in the file. If the index
+     * is relative the frame offset will always be so small that it will
+     * virtually never reach the "movi" offset so we can detect if the
+     * video is relative very fast.
+     */
     if (*bAbsolute && lp->dwChunkOffset < This->dwMoviChunkPos)
       *bAbsolute = FALSE;
 
-    if (*bAbsolute)
-      lp->dwChunkOffset += sizeof(DWORD);
-    else
-      lp->dwChunkOffset += pos;
+    if (!*bAbsolute)
+      lp->dwChunkOffset += pos; /* make the offset absolute */
 
     if (FAILED(AVIFILE_AddFrame(This->ppStreams[nStream], lp->ckid, lp->dwChunkLength, lp->dwChunkOffset, lp->dwFlags)))
       return AVIERR_MEMORY;


More information about the wine-patches mailing list