36#define MAX_FRAMESIZE (16 * 1024 * 1024)
37#define MAX_FRAMESIZE_DIFF 512
88 This->dwUnusedBytes = 0;
100 *
obj = &
This->IAVIStream_iface;
190 TRACE(
"(%p,0x%08lX,0x%08lX)\n", iface, lParam1, lParam2);
209 This->sInfo.fccHandler =
pco->fccHandler;
216 if (
pco->cbParms > 0 &&
pco->lpParms !=
NULL) {
221 This->sInfo.dwQuality =
pco->dwQuality;
232 This->lKeyFrameEvery =
pco->dwKeyFrameEvery;
234 This->lKeyFrameEvery = 1;
245 This->sInfo.dwScale,
This->sInfo.dwRate);
247 pco->dwBytesPerSecond = 0;
248 This->dwBytesPerFrame = 0;
252 memset(&icFrames, 0,
sizeof(icFrames));
303 WARN(
": FIND_RET flags will be ignored!\n");
311 if (
This->lLastKey <=
pos || pos < This->lCurrent)
314 return This->lLastKey;
336 if (formatsize ==
NULL)
368 if (*formatsize < This->cbOutput)
373 *formatsize =
This->cbOutput;
390 WARN(
": need RGB data as input\n");
397 if (
This->cbInput != formatsize)
409 if (
This->sInfo.dwLength +
This->sInfo.dwStart >
pos)
413 if (
This->sInfo.fccHandler == 0 ||
431 This->cbInput = formatsize;
446 This->sInfo.rcFrame.right =
447 This->sInfo.rcFrame.left +
This->lpbiOutput->biWidth;
448 This->sInfo.rcFrame.bottom =
449 This->sInfo.rcFrame.top +
This->lpbiOutput->biHeight;
464 if (
This->lKeyFrameEvery != 1 &&
473 if (
This->lpbiPrev->biSizeImage == 0) {
474 This->lpbiPrev->biSizeImage =
479 size +=
This->lpbiPrev->biSizeImage;
493 if (lpbi->
biSize !=
This->lpbiInput->biSize ||
512 if (
This->lKeyFrameEvery != 1 &&
536 TRACE(
"(%p,%d,%d,%p,%d,%p,%p)\n", iface,
start,
samples,
buffer,
537 buffersize, bytesread, samplesread);
540 if (bytesread !=
NULL)
542 if (samplesread !=
NULL)
570 if (buffersize < lpbi->biSizeImage)
577 if (bytesread !=
NULL)
602 if (
This->lpbiCur->biSizeImage > buffersize)
609 if (bytesread !=
NULL)
610 *bytesread =
This->lpbiCur->biSizeImage;
614 if (samplesread !=
NULL)
630 TRACE(
"(%p,%d,%d,%p,%d,0x%08X,%p,%p)\n", iface,
start,
samples,
631 buffer, buffersize,
flags, sampwritten, byteswritten);
634 if (sampwritten !=
NULL)
636 if (byteswritten !=
NULL)
648 flags, sampwritten, byteswritten);
663 This->lpbiCur->biSizeImage,
flags, byteswritten,
683 TRACE(
"(%p,0x%08X,%p,%p)\n", iface, fcc, lp, lpread);
695 TRACE(
"(%p,0x%08x,%p,%d)\n", iface, fcc, lp,
size);
705 FIXME(
"(%p,%p,%d): stub\n", iface,
info, infolen);
710static const struct IAVIStreamVtbl
iicmst = {
755 DWORD dwMinQual, dwMaxQual, dwCurQual;
764 if ((
This->lKeyFrameEvery != 0 &&
765 (
This->lCurrent -
This->lLastKey) >=
This->lKeyFrameEvery) ||
766 This->lCurrent ==
This->sInfo.dwStart) {
771 if (
This->lKeyFrameEvery != 0) {
772 if (
This->lCurrent ==
This->sInfo.dwStart) {
775 dwRequest =
This->dwBytesPerFrame +
This->dwUnusedBytes;
776 This->dwUnusedBytes = 0;
782 if (
This->dwBytesPerFrame >=
This->dwUnusedBytes)
783 tmp1 =
This->dwBytesPerFrame /
This->lKeyFrameEvery;
784 tmp2 = (
This->dwUnusedBytes + tmp1) /
This->lKeyFrameEvery;
786 dwRequest =
This->dwBytesPerFrame - tmp1 + tmp2;
787 This->dwUnusedBytes -= tmp2;
793 if (
This->lCurrent ==
This->sInfo.dwStart) {
794 dwRequest =
This->dwBytesPerFrame +
This->dwUnusedBytes;
795 This->dwUnusedBytes = 0;
804 dwMaxQual = dwCurQual =
This->sInfo.dwQuality;
817 &idxCkid, &idxFlags,
This->lCurrent, dwRequest, dwCurQual,
820 FIXME(
": codec has changed palette -- unhandled!\n");
828 if (dwRequest >=
This->lpbiCur->biSizeImage) {
830 if (dwMaxQual - dwCurQual > 10) {
831 DWORD tmp = dwRequest / 8;
836 if (tmp < dwRequest - This->lpbiCur->biSizeImage && bDecreasedQual) {
838 dwCurQual = (dwMinQual + dwMaxQual) / 2;
844 }
else if (dwMaxQual - dwMinQual <= 1) {
847 dwMaxQual = dwCurQual;
849 if (bDecreasedQual || dwCurQual ==
This->dwLastQuality)
850 dwCurQual = (dwMinQual + dwMaxQual) / 2;
852 FIXME(
": no new quality computed min=%u cur=%u max=%u last=%u\n",
853 dwMinQual, dwCurQual, dwMaxQual,
This->dwLastQuality);
855 bDecreasedQual =
TRUE;
860 This->dwLastQuality = dwCurQual;
861 This->dwUnusedBytes = dwRequest -
This->lpbiCur->biSizeImage;
912 This->sInfo.rcFrame.right =
913 This->sInfo.rcFrame.left +
This->lpbiOutput->biWidth;
914 This->sInfo.rcFrame.bottom =
915 This->sInfo.rcFrame.top +
This->lpbiOutput->biHeight;
916 This->sInfo.dwSuggestedBufferSize =
924 size +=
This->sInfo.dwSuggestedBufferSize;
932 if (
This->lKeyFrameEvery != 1 &&
941 if (
This->lpbiPrev->biSizeImage == 0) {
942 This->lpbiPrev->biSizeImage =
947 size +=
This->lpbiPrev->biSizeImage;
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
#define InterlockedIncrement
#define InterlockedDecrement
#define DIBWIDTHBYTES(bi)
static const WCHAR avifile[]
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM pstream, LPBITMAPINFOHEADER lpbiWanted)
HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pg)
LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pg, LONG pos)
#define HeapFree(x, y, z)
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
static HRESULT WINAPI ICMStream_fnReadFormat(IAVIStream *iface, LONG pos, LPVOID format, LONG *formatsize)
static HRESULT WINAPI ICMStream_fnReadData(IAVIStream *iface, DWORD fcc, LPVOID lp, LPLONG lpread)
static HRESULT WINAPI ICMStream_fnWrite(IAVIStream *iface, LONG start, LONG samples, LPVOID buffer, LONG buffersize, DWORD flags, LPLONG sampwritten, LPLONG byteswritten)
static void AVIFILE_Reset(IAVIStreamImpl *This)
static LONG WINAPI ICMStream_fnFindSample(IAVIStream *iface, LONG pos, LONG flags)
static HRESULT WINAPI ICMStream_fnQueryInterface(IAVIStream *iface, REFIID refiid, LPVOID *obj)
#define MAX_FRAMESIZE_DIFF
static HRESULT WINAPI ICMStream_fnRead(IAVIStream *iface, LONG start, LONG samples, LPVOID buffer, LONG buffersize, LPLONG bytesread, LPLONG samplesread)
struct _IAVIStreamImpl IAVIStreamImpl
static const struct IAVIStreamVtbl iicmst
HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppv)
static HRESULT WINAPI ICMStream_fnSetInfo(IAVIStream *iface, LPAVISTREAMINFOW info, LONG infolen)
static ULONG WINAPI ICMStream_fnRelease(IAVIStream *iface)
static IAVIStreamImpl * impl_from_IAVIStream(IAVIStream *iface)
static HRESULT WINAPI ICMStream_fnDelete(IAVIStream *iface, LONG start, LONG samples)
static HRESULT WINAPI ICMStream_fnInfo(IAVIStream *iface, LPAVISTREAMINFOW psi, LONG size)
static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
static HRESULT WINAPI ICMStream_fnSetFormat(IAVIStream *iface, LONG pos, LPVOID format, LONG formatsize)
static ULONG WINAPI ICMStream_fnAddRef(IAVIStream *iface)
static HRESULT WINAPI ICMStream_fnWriteData(IAVIStream *iface, DWORD fcc, LPVOID lp, LONG size)
static HRESULT WINAPI ICMStream_fnCreate(IAVIStream *iface, LPARAM lParam1, LPARAM lParam2)
static HRESULT AVIFILE_EncodeFrame(IAVIStreamImpl *This, LPBITMAPINFOHEADER lpbi, LPVOID lpBits)
#define memcpy(s1, s2, n)
#define mmioFOURCC(c0, c1, c2, c3)
HIC VFWAPI ICOpen(DWORD fccType, DWORD fccHandler, UINT wMode)
DWORD VFWAPIV ICDecompress(HIC hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiFormat, LPVOID lpData, LPBITMAPINFOHEADER lpbi, LPVOID lpBits)
LRESULT VFWAPI ICSendMessage(HIC hic, UINT msg, DWORD_PTR lParam1, DWORD_PTR lParam2)
LRESULT VFWAPI ICGetInfo(HIC hic, ICINFO *picinfo, DWORD cb)
DWORD VFWAPIV ICCompress(HIC hic, DWORD dwFlags, LPBITMAPINFOHEADER lpbiOutput, LPVOID lpData, LPBITMAPINFOHEADER lpbiInput, LPVOID lpBits, LPDWORD lpckid, LPDWORD lpdwFlags, LONG lFrameNum, DWORD dwFrameSize, DWORD dwQuality, LPBITMAPINFOHEADER lpbiPrev, LPVOID lpPrev)
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
#define IsEqualGUID(rguid1, rguid2)
LPBITMAPINFOHEADER lpbiInput
LPBITMAPINFOHEADER lpbiOutput
LPBITMAPINFOHEADER lpbiOutput
LPBITMAPINFOHEADER lpbiCur
IAVIStream IAVIStream_iface
LPBITMAPINFOHEADER lpbiPrev
LPBITMAPINFOHEADER lpbiInput
#define CONTAINING_RECORD(address, type, field)
#define IAVIStream_SetFormat(p, a, b, c)
#define IAVIStream_AddRef(p)
#define AVIERR_NOCOMPRESSOR
#define IAVIStream_WriteData(p, a, b, c)
#define ICCompressGetSize(hic, lpbiInput, lpbiOutput)
#define IAVIStream_QueryInterface(p, a, b)
#define AVIERR_UNSUPPORTED
#define IAVIStream_Delete(p, a, b)
#define VIDCF_COMPRESSFRAMES
#define ICQUALITY_DEFAULT
#define AVICOMPRESSF_KEYFRAMES
#define AVICOMPRESSF_DATARATE
#define ICCompressGetFormat(hic, lpbiInput, lpbiOutput)
#define IAVIStream_Read(p, a, b, c, d, e, f)
#define ICSetState(hic, pv, cb)
#define AVIFILECAPS_CANWRITE
#define VIDCF_FASTTEMPORALC
#define ICCOMPRESS_KEYFRAME
#define ICDecompressBegin(hic, lpbiInput, lpbiOutput)
struct AVICOMPRESSOPTIONS * LPAVICOMPRESSOPTIONS
#define IAVIStream_ReadData(p, a, b, c)
#define ICDecompressGetFormatSize(hic, lpbi)
#define ICDecompressGetFormat(hic, lpbiInput, lpbiOutput)
#define ICDecompressEnd(hic)
#define ICCompressEnd(hic)
#define ICCompressBegin(hic, lpbiInput, lpbiOutput)
#define AVIERR_COMPRESSOR
struct IAVIStream * PAVISTREAM
#define ICM_COMPRESS_FRAMES_INFO
#define AVIERR_BUFFERTOOSMALL
static DWORD ICGetDefaultQuality(HIC hic)
#define IAVIStream_Write(p, a, b, c, d, e, f, g)
#define IAVIStream_Release(p)
#define IAVIStream_Info(p, a, b)
#define ICCompressGetFormatSize(hic, lpbi)
struct IGetFrame * PGETFRAME
_In_ SURFOBJ _In_ CLIPOBJ * pco
#define OLE_E_ENUM_NOMORE