diff --git a/reactos/dll/win32/avifil32/api.c b/reactos/dll/win32/avifil32/api.c index 9ae26b94311..7f9e768990c 100644 --- a/reactos/dll/win32/avifil32/api.c +++ b/reactos/dll/win32/avifil32/api.c @@ -2256,17 +2256,85 @@ HRESULT WINAPI AVIPutFileOnClipboard(PAVIFILE pfile) HRESULT WINAPIV AVISaveA(LPCSTR szFile, CLSID * pclsidHandler, AVISAVECALLBACK lpfnCallback, int nStreams, PAVISTREAM pavi, LPAVICOMPRESSOPTIONS lpOptions, ...) { - FIXME("(%s,%p,%p,0x%08x,%p,%p), stub!\n", debugstr_a(szFile), pclsidHandler, lpfnCallback, + va_list vl; + int i; + HRESULT ret; + PAVISTREAM *streams; + LPAVICOMPRESSOPTIONS *options; + + TRACE("(%s,%p,%p,%d,%p,%p)\n", debugstr_a(szFile), pclsidHandler, lpfnCallback, nStreams, pavi, lpOptions); - return AVIERR_UNSUPPORTED; + if (nStreams <= 0) return AVIERR_BADPARAM; + + streams = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(void *)); + options = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(void *)); + if (!streams || !options) + { + ret = AVIERR_MEMORY; + goto error; + } + + streams[0] = pavi; + options[0] = lpOptions; + + va_start(vl, lpOptions); + for (i = 1; i < nStreams; i++) + { + streams[i] = va_arg(vl, void *); + options[i] = va_arg(vl, void *); + } + va_end(vl); + + for (i = 0; i < nStreams; i++) + TRACE("Pair[%d] - Stream = %p, Options = %p\n", i, streams[i], options[i]); + + ret = AVISaveVA(szFile, pclsidHandler, lpfnCallback, nStreams, streams, options); +error: + HeapFree(GetProcessHeap(), 0, streams); + HeapFree(GetProcessHeap(), 0, options); + return ret; } HRESULT WINAPIV AVISaveW(LPCWSTR szFile, CLSID * pclsidHandler, AVISAVECALLBACK lpfnCallback, int nStreams, PAVISTREAM pavi, LPAVICOMPRESSOPTIONS lpOptions, ...) { - FIXME("(%s,%p,%p,0x%08x,%p,%p), stub!\n", debugstr_w(szFile), pclsidHandler, lpfnCallback, + va_list vl; + int i; + HRESULT ret; + PAVISTREAM *streams; + LPAVICOMPRESSOPTIONS *options; + + TRACE("(%s,%p,%p,%d,%p,%p)\n", debugstr_w(szFile), pclsidHandler, lpfnCallback, nStreams, pavi, lpOptions); - return AVIERR_UNSUPPORTED; + if (nStreams <= 0) return AVIERR_BADPARAM; + + streams = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(void *)); + options = HeapAlloc(GetProcessHeap(), 0, nStreams * sizeof(void *)); + if (!streams || !options) + { + ret = AVIERR_MEMORY; + goto error; + } + + streams[0] = pavi; + options[0] = lpOptions; + + va_start(vl, lpOptions); + for (i = 1; i < nStreams; i++) + { + streams[i] = va_arg(vl, void *); + options[i] = va_arg(vl, void *); + } + va_end(vl); + + for (i = 0; i < nStreams; i++) + TRACE("Pair[%d] - Stream = %p, Options = %p\n", i, streams[i], options[i]); + + ret = AVISaveVW(szFile, pclsidHandler, lpfnCallback, nStreams, streams, options); +error: + HeapFree(GetProcessHeap(), 0, streams); + HeapFree(GetProcessHeap(), 0, options); + return ret; } diff --git a/reactos/dll/win32/avifil32/avifile.c b/reactos/dll/win32/avifil32/avifile.c index bbf825322c0..f1f65091d3a 100644 --- a/reactos/dll/win32/avifil32/avifile.c +++ b/reactos/dll/win32/avifil32/avifile.c @@ -1968,13 +1968,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; diff --git a/reactos/dll/win32/avifil32/icmstream.c b/reactos/dll/win32/avifil32/icmstream.c index 8f017904829..60b73efd76f 100644 --- a/reactos/dll/win32/avifil32/icmstream.c +++ b/reactos/dll/win32/avifil32/icmstream.c @@ -756,11 +756,11 @@ static HRESULT AVIFILE_EncodeFrame(IAVIStreamImpl *This, if (This->lKeyFrameEvery != 0) { if (This->lCurrent == This->sInfo.dwStart) { if (idxFlags & AVIIF_KEYFRAME) { - /* for keyframes allow to consume all unused bytes */ + /* allow keyframes to consume all unused bytes */ dwRequest = This->dwBytesPerFrame + This->dwUnusedBytes; This->dwUnusedBytes = 0; } else { - /* for non-keyframes only allow something of the unused bytes to be consumed */ + /* for non-keyframes only allow some of the unused bytes to be consumed */ DWORD tmp1 = 0; DWORD tmp2; @@ -782,8 +782,8 @@ static HRESULT AVIFILE_EncodeFrame(IAVIStreamImpl *This, dwRequest = MAX_FRAMESIZE; } - /* must we check for framesize to gain requested - * datarate or could we trust codec? */ + /* must we check for frame size to gain the requested + * data rate or can we trust the codec? */ doSizeCheck = (dwRequest != 0 && ((This->dwICMFlags & (VIDCF_CRUNCH|VIDCF_QUALITY)) == 0)); dwMaxQual = dwCurQual = This->sInfo.dwQuality; diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index 02a3975fd38..7dd08b3d25b 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -48,7 +48,7 @@ reactos/dll/win32/advpack # Synced to WineStaging-1.7.55 reactos/dll/win32/atl # Synced to WineStaging-1.7.55 reactos/dll/win32/atl80 # Synced to WineStaging-1.7.55 reactos/dll/win32/atl100 # Synced to WineStaging-1.7.55 -reactos/dll/win32/avifil32 # Synced to WineStaging-1.7.47 +reactos/dll/win32/avifil32 # Synced to WineStaging-1.7.55 reactos/dll/win32/bcrypt # Synced to WineStaging-1.7.47 reactos/dll/win32/browseui # Out of sync reactos/dll/win32/cabinet # Synced to WineStaging-1.7.47