- Fixed some signed/unsigned mismatches.

- Fixed bugs in AVISaveOptions dialog handling.
- Fixed bug in AVIFILE_LoadFile -- now check for more than
  MAX_AVISTREAMS streams in file.
- Implemented AVIMakeFileFromStreams and AVISaveVA method.
- Added IAVIEditStream interface.
- Implemented EditStream* methods.
- Added stubs for AVISaveVW, CreateEditableStream.
- Added stubs for clipboard handling.
This commit is contained in:
Michael Günnewig 2003-06-23 18:10:06 +00:00 committed by Alexandre Julliard
parent 5caccaf621
commit 9f67cfef42
13 changed files with 814 additions and 96 deletions

View File

@ -20,6 +20,7 @@ C_SRCS = \
factory.c \
getframe.c \
icmstream.c \
tmpfile.c \
wavfile.c
RC_SRCS = \

View File

@ -279,9 +279,9 @@ static HRESULT WINAPI ACMStream_fnInfo(IAVIStream *iface,LPAVISTREAMINFOW psi,
return hr;
}
memcpy(psi, &This->sInfo, min(size, sizeof(This->sInfo)));
memcpy(psi, &This->sInfo, min(size, (LONG)sizeof(This->sInfo)));
if (size < sizeof(This->sInfo))
if (size < (LONG)sizeof(This->sInfo))
return AVIERR_BUFFERTOOSMALL;
return AVIERR_OK;
}
@ -402,7 +402,7 @@ static HRESULT WINAPI ACMStream_fnRead(IAVIStream *iface, LONG start,
ICOM_THIS(IAVIStreamImpl,iface);
HRESULT hr;
LONG size;
DWORD size;
TRACE("(%p,%ld,%ld,%p,%ld,%p,%p)\n", iface, start, samples, buffer,
buffersize, bytesread, samplesread);
@ -618,11 +618,11 @@ static HRESULT WINAPI ACMStream_fnDelete(IAVIStream *iface, LONG start,
return AVIERR_BADPARAM;
/* Delete before start of stream? */
if (start + samples < This->sInfo.dwStart)
if ((DWORD)(start + samples) < This->sInfo.dwStart)
return AVIERR_OK;
/* Delete after end of stream? */
if (start > This->sInfo.dwLength)
if ((DWORD)start > This->sInfo.dwLength)
return AVIERR_OK;
/* For the rest we need write capability */
@ -722,7 +722,7 @@ static HRESULT AVIFILE_OpenCompressor(IAVIStreamImpl *This)
This->sInfo.dwSampleSize = This->lpOutFormat->nBlockAlign;
This->sInfo.dwScale = This->lpOutFormat->nBlockAlign;
This->sInfo.dwRate = This->lpOutFormat->nAvgBytesPerSec;
This->sInfo.dwQuality = ICQUALITY_DEFAULT;
This->sInfo.dwQuality = (DWORD)ICQUALITY_DEFAULT;
SetRectEmpty(&This->sInfo.rcFrame);
/* convert positions ansd sizes to output format */

View File

@ -71,13 +71,13 @@ static struct {
*/
static HRESULT AVIFILE_CLSIDFromString(LPCSTR idstr, LPCLSID id)
{
BYTE *s = (BYTE*)idstr;
BYTE const *s = (BYTE const*)idstr;
BYTE *p;
INT i;
BYTE table[256];
if (!s) {
memset(s, 0, sizeof(CLSID));
memset(id, 0, sizeof(CLSID));
return S_OK;
} else { /* validate the CLSID string */
if (lstrlenA(s) != 38)
@ -321,7 +321,7 @@ HRESULT WINAPI AVIFileInfoA(PAVIFILE pfile, LPAVIFILEINFOA afi, LONG size)
if (pfile == NULL)
return AVIERR_BADHANDLE;
if (size < sizeof(AVIFILEINFOA))
if ((DWORD)size < sizeof(AVIFILEINFOA))
return AVIERR_BADSIZE;
hres = IAVIFile_Info(pfile, &afiw, sizeof(afiw));
@ -364,6 +364,7 @@ HRESULT WINAPI AVIFileGetStream(PAVIFILE pfile, PAVISTREAM *avis,
/***********************************************************************
* AVIFileCreateStreamA (AVIFIL32.@)
* AVIFileCreateStream (AVIFILE.144)
*/
HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE pfile, PAVISTREAM *ppavi,
LPAVISTREAMINFOA psi)
@ -396,6 +397,7 @@ HRESULT WINAPI AVIFileCreateStreamW(PAVIFILE pfile, PAVISTREAM *avis,
/***********************************************************************
* AVIFileWriteData (AVIFIL32.@)
* AVIFileWriteData (AVIFILE.146)
*/
HRESULT WINAPI AVIFileWriteData(PAVIFILE pfile,DWORD fcc,LPVOID lp,LONG size)
{
@ -409,6 +411,7 @@ HRESULT WINAPI AVIFileWriteData(PAVIFILE pfile,DWORD fcc,LPVOID lp,LONG size)
/***********************************************************************
* AVIFileReadData (AVIFIL32.@)
* AVIFileReadData (AVIFILE.147)
*/
HRESULT WINAPI AVIFileReadData(PAVIFILE pfile,DWORD fcc,LPVOID lp,LPLONG size)
{
@ -501,6 +504,7 @@ HRESULT WINAPI AVIStreamCreate(PAVISTREAM *ppavi, LONG lParam1, LONG lParam2,
/***********************************************************************
* AVIStreamInfoA (AVIFIL32.@)
* AVIStreamInfo (AVIFILE.162)
*/
HRESULT WINAPI AVIStreamInfoA(PAVISTREAM pstream, LPAVISTREAMINFOA asi,
LONG size)
@ -512,7 +516,7 @@ HRESULT WINAPI AVIStreamInfoA(PAVISTREAM pstream, LPAVISTREAMINFOA asi,
if (pstream == NULL)
return AVIERR_BADHANDLE;
if (size < sizeof(AVISTREAMINFOA))
if ((DWORD)size < sizeof(AVISTREAMINFOA))
return AVIERR_BADSIZE;
hres = IAVIStream_Info(pstream, &asiw, sizeof(asiw));
@ -541,6 +545,7 @@ HRESULT WINAPI AVIStreamInfoW(PAVISTREAM pstream, LPAVISTREAMINFOW asi,
/***********************************************************************
* AVIStreamFindSample (AVIFIL32.@)
* AVIStreamFindSample (AVIFILE.163)
*/
HRESULT WINAPI AVIStreamFindSample(PAVISTREAM pstream, LONG pos, DWORD flags)
{
@ -554,6 +559,7 @@ HRESULT WINAPI AVIStreamFindSample(PAVISTREAM pstream, LONG pos, DWORD flags)
/***********************************************************************
* AVIStreamReadFormat (AVIFIL32.@)
* AVIStreamReadFormat (AVIFILE.164)
*/
HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM pstream, LONG pos,
LPVOID format, LPLONG formatsize)
@ -568,6 +574,7 @@ HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM pstream, LONG pos,
/***********************************************************************
* AVIStreamSetFormat (AVIFIL32.@)
* AVIStreamSetFormat (AVIFILE.169)
*/
HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM pstream, LONG pos,
LPVOID format, LONG formatsize)
@ -582,6 +589,7 @@ HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM pstream, LONG pos,
/***********************************************************************
* AVIStreamRead (AVIFIL32.@)
* AVIStreamRead (AVIFILE.167)
*/
HRESULT WINAPI AVIStreamRead(PAVISTREAM pstream, LONG start, LONG samples,
LPVOID buffer, LONG buffersize,
@ -599,6 +607,7 @@ HRESULT WINAPI AVIStreamRead(PAVISTREAM pstream, LONG start, LONG samples,
/***********************************************************************
* AVIStreamWrite (AVIFIL32.@)
* AVIStreamWrite (AVIFILE.168)
*/
HRESULT WINAPI AVIStreamWrite(PAVISTREAM pstream, LONG start, LONG samples,
LPVOID buffer, LONG buffersize, DWORD flags,
@ -616,6 +625,7 @@ HRESULT WINAPI AVIStreamWrite(PAVISTREAM pstream, LONG start, LONG samples,
/***********************************************************************
* AVIStreamReadData (AVIFIL32.@)
* AVIStreamReadData (AVIFILE.165)
*/
HRESULT WINAPI AVIStreamReadData(PAVISTREAM pstream, DWORD fcc, LPVOID lp,
LPLONG lpread)
@ -630,6 +640,7 @@ HRESULT WINAPI AVIStreamReadData(PAVISTREAM pstream, DWORD fcc, LPVOID lp,
/***********************************************************************
* AVIStreamWriteData (AVIFIL32.@)
* AVIStreamWriteData (AVIFILE.166)
*/
HRESULT WINAPI AVIStreamWriteData(PAVISTREAM pstream, DWORD fcc, LPVOID lp,
LONG size)
@ -644,6 +655,7 @@ HRESULT WINAPI AVIStreamWriteData(PAVISTREAM pstream, DWORD fcc, LPVOID lp,
/***********************************************************************
* AVIStreamGetFrameOpen (AVIFIL32.@)
* AVIStreamGetFrameOpen (AVIFILE.112)
*/
PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM pstream,
LPBITMAPINFOHEADER lpbiWanted)
@ -669,6 +681,7 @@ PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM pstream,
/***********************************************************************
* AVIStreamGetFrame (AVIFIL32.@)
* AVIStreamGetFrame (AVIFILE.110)
*/
LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pg, LONG pos)
{
@ -681,7 +694,8 @@ LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pg, LONG pos)
}
/***********************************************************************
* AVIStreamGetFrameClose (AVIFIL32.@)
* AVIStreamGetFrameClose (AVIFIL32.@)
* AVIStreamGetFrameClose (AVIFILE.111)
*/
HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pg)
{
@ -745,6 +759,24 @@ HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed,
return hr;
}
/***********************************************************************
* AVIMakeFileFromStreams (AVIFIL32.@)
*/
HRESULT WINAPI AVIMakeFileFromStreams(PAVIFILE *ppfile, int nStreams,
PAVISTREAM *ppStreams)
{
TRACE("(%p,%d,%p)\n", ppfile, nStreams, ppStreams);
if (nStreams < 0 || ppfile == NULL || ppStreams == NULL)
return AVIERR_BADPARAM;
*ppfile = AVIFILE_CreateAVITempFile(nStreams, ppStreams);
if (*ppfile == NULL)
return AVIERR_MEMORY;
return AVIERR_OK;
}
/***********************************************************************
* AVIStreamOpenFromFile (AVIFILE.103)
* AVIStreamOpenFromFileA (AVIFIL32.@)
@ -884,6 +916,7 @@ LONG WINAPI AVIStreamTimeToSample(PAVISTREAM pstream, LONG lTime)
/***********************************************************************
* AVIBuildFilterA (AVIFIL32.@)
* AVIBuildFilter (AVIFILE.123)
*/
HRESULT WINAPI AVIBuildFilterA(LPSTR szFilter, LONG cbFilter, BOOL fSaving)
{
@ -931,9 +964,9 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
WCHAR szFileExt[10];
WCHAR szValue[128];
HKEY hKey;
LONG n, i;
DWORD n, i;
LONG size;
LONG count = 0;
DWORD count = 0;
TRACE("(%p,%ld,%d)\n", szFilter, cbFilter, fSaving);
@ -972,7 +1005,7 @@ HRESULT WINAPI AVIBuildFilterW(LPWSTR szFilter, LONG cbFilter, BOOL fSaving)
break; /* a new one */
}
if (count - i == -1) {
if (count - i == -1U) {
/* it's a new CLSID */
/* FIXME: How do we get info's about read/write capabilities? */
@ -1094,7 +1127,7 @@ static BOOL AVISaveOptionsFmtChoose(HWND hWnd)
memset(pOptions, 0, sizeof(AVICOMPRESSOPTIONS));
pOptions->fccType = streamtypeVIDEO;
pOptions->fccHandler = comptypeDIB;
pOptions->dwQuality = ICQUALITY_DEFAULT;
pOptions->dwQuality = (DWORD)ICQUALITY_DEFAULT;
}
cv.cbSize = sizeof(cv);
@ -1117,6 +1150,7 @@ static BOOL AVISaveOptionsFmtChoose(HWND hWnd)
SaveOpts.ppavis[SaveOpts.nCurrent], &cv, NULL);
if (ret) {
pOptions->fccHandler = cv.fccHandler;
pOptions->lpParms = cv.lpState;
pOptions->cbParms = cv.cbState;
pOptions->dwQuality = cv.lQ;
@ -1151,7 +1185,7 @@ static BOOL AVISaveOptionsFmtChoose(HWND hWnd)
if ((pOptions->cbFormat == 0 || pOptions->lpFormat == NULL) && size != 0) {
pOptions->lpFormat = GlobalAllocPtr(GMEM_MOVEABLE, size);
pOptions->cbFormat = size;
} else if (pOptions->cbFormat < size) {
} else if (pOptions->cbFormat < (DWORD)size) {
pOptions->lpFormat = GlobalReAllocPtr(pOptions->lpFormat, size, GMEM_MOVEABLE);
pOptions->cbFormat = size;
}
@ -1163,7 +1197,7 @@ static BOOL AVISaveOptionsFmtChoose(HWND hWnd)
size = 0;
AVIStreamFormatSize(SaveOpts.ppavis[SaveOpts.nCurrent],
sInfo.dwStart, &size);
if (size < sizeof(PCMWAVEFORMAT))
if (size < (LONG)sizeof(PCMWAVEFORMAT))
size = sizeof(PCMWAVEFORMAT);
afmtc.pwfxEnum = GlobalAllocPtr(GHND, size);
if (afmtc.pwfxEnum != NULL) {
@ -1287,7 +1321,7 @@ INT_PTR CALLBACK AVISaveOptionsDlgProc(HWND hWnd, UINT uMsg,
SaveOpts.nCurrent = 0;
if (SaveOpts.nStreams == 1) {
EndDialog(hWnd, AVISaveOptionsFmtChoose(hWnd));
return FALSE;
return TRUE;
}
/* add streams */
@ -1318,7 +1352,7 @@ INT_PTR CALLBACK AVISaveOptionsDlgProc(HWND hWnd, UINT uMsg,
EnableWindow(GetDlgItem(hWnd, IDC_INTERLEAVEEVERY), bIsInterleaved);
break;
case WM_COMMAND:
switch (GET_WM_COMMAND_CMD(wParam, lParam)) {
switch (GET_WM_COMMAND_ID(wParam, lParam)) {
case IDOK:
/* get data from controls and save them */
dwInterleave = GetDlgItemInt(hWnd, IDC_INTERLEAVEEVERY, NULL, 0);
@ -1350,10 +1384,10 @@ INT_PTR CALLBACK AVISaveOptionsDlgProc(HWND hWnd, UINT uMsg,
AVISaveOptionsFmtChoose(hWnd);
break;
};
return FALSE;
return TRUE;
};
return TRUE;
return FALSE;
}
/***********************************************************************
@ -1409,6 +1443,7 @@ BOOL WINAPI AVISaveOptions(HWND hWnd, UINT uFlags, INT nStreams,
/***********************************************************************
* AVISaveOptionsFree (AVIFIL32.@)
* AVISaveOptionsFree (AVIFILE.124)
*/
HRESULT WINAPI AVISaveOptionsFree(INT nStreams,LPAVICOMPRESSOPTIONS*ppOptions)
{
@ -1436,3 +1471,316 @@ HRESULT WINAPI AVISaveOptionsFree(INT nStreams,LPAVICOMPRESSOPTIONS*ppOptions)
return AVIERR_OK;
}
/***********************************************************************
* AVISaveVA (AVIFIL32.@)
*/
HRESULT WINAPI AVISaveVA(LPCSTR szFile, CLSID *pclsidHandler,
AVISAVECALLBACK lpfnCallback, int nStream,
PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *plpOptions)
{
LPWSTR wszFile = NULL;
HRESULT hr;
int len;
TRACE("%s,%p,%p,%d,%p,%p)\n", debugstr_a(szFile), pclsidHandler,
lpfnCallback, nStream, ppavi, plpOptions);
if (szFile == NULL || ppavi == NULL || plpOptions == NULL)
return AVIERR_BADPARAM;
/* convert ASCII string to Unicode and call Unicode function */
len = lstrlenA(szFile);
if (len <= 0)
return AVIERR_BADPARAM;
wszFile = (LPWSTR)LocalAlloc(LPTR, (len + 1) * sizeof(WCHAR));
if (wszFile == NULL)
return AVIERR_MEMORY;
MultiByteToWideChar(CP_ACP, 0, szFile, -1, wszFile, len + 1);
wszFile[len + 1] = 0;
hr = AVISaveVW(wszFile, pclsidHandler, lpfnCallback,
nStream, ppavi, plpOptions);
LocalFree((HLOCAL)wszFile);
return hr;
}
/***********************************************************************
* AVISaveVW (AVIFIL32.@)
*/
HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
AVISAVECALLBACK lpfnCallback, int nStream,
PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *plpOptions)
{
FIXME("(%s,%p,%p,%d,%p,%p), stub!\n", debugstr_w(szFile), pclsidHandler,
lpfnCallback, nStream, ppavi, plpOptions);
if (szFile == NULL || ppavi == NULL || plpOptions == NULL)
return AVIERR_BADPARAM;
return AVIERR_UNSUPPORTED;
}
/***********************************************************************
* CreateEditableStream (AVIFIL32.@)
*/
HRESULT WINAPI CreateEditableStream(PAVISTREAM *ppEditable, PAVISTREAM pSource)
{
FIXME("(%p,%p), stub!\n", ppEditable, pSource);
if (pSource == NULL)
return AVIERR_BADHANDLE;
if (ppEditable == NULL)
return AVIERR_BADPARAM;
*ppEditable = NULL;
return AVIERR_UNSUPPORTED;
}
/***********************************************************************
* EditStreamClone (AVIFIL32.@)
*/
HRESULT WINAPI EditStreamClone(PAVISTREAM pStream, PAVISTREAM *ppResult)
{
PAVIEDITSTREAM pEdit = NULL;
HRESULT hr;
TRACE("(%p,%p)\n", pStream, ppResult);
if (pStream == NULL)
return AVIERR_BADHANDLE;
if (ppResult == NULL)
return AVIERR_BADPARAM;
*ppResult = NULL;
hr = IAVIStream_QueryInterface(pStream, &IID_IAVIEditStream,(LPVOID*)&pEdit);
if (SUCCEEDED(hr) && pEdit != NULL) {
hr = IAVIEditStream_Clone(pEdit, ppResult);
IAVIEditStream_Release(pEdit);
} else
hr = AVIERR_UNSUPPORTED;
return hr;
}
/***********************************************************************
* EditStreamCopy (AVIFIL32.@)
*/
HRESULT WINAPI EditStreamCopy(PAVISTREAM pStream, LONG *plStart,
LONG *plLength, PAVISTREAM *ppResult)
{
PAVIEDITSTREAM pEdit = NULL;
HRESULT hr;
TRACE("(%p,%p,%p,%p)\n", pStream, plStart, plLength, ppResult);
if (pStream == NULL)
return AVIERR_BADHANDLE;
if (plStart == NULL || plLength == NULL || ppResult == NULL)
return AVIERR_BADPARAM;
*ppResult = NULL;
hr = IAVIStream_QueryInterface(pStream, &IID_IAVIEditStream,(LPVOID*)&pEdit);
if (SUCCEEDED(hr) && pEdit != NULL) {
hr = IAVIEditStream_Copy(pEdit, plStart, plLength, ppResult);
IAVIEditStream_Release(pEdit);
} else
hr = AVIERR_UNSUPPORTED;
return hr;
}
/***********************************************************************
* EditStreamCut (AVIFIL32.@)
*/
HRESULT WINAPI EditStreamCut(PAVISTREAM pStream, LONG *plStart,
LONG *plLength, PAVISTREAM *ppResult)
{
PAVIEDITSTREAM pEdit = NULL;
HRESULT hr;
TRACE("(%p,%p,%p,%p)\n", pStream, plStart, plLength, ppResult);
if (pStream == NULL)
return AVIERR_BADHANDLE;
if (plStart == NULL || plLength == NULL || ppResult == NULL)
return AVIERR_BADPARAM;
*ppResult = NULL;
hr = IAVIStream_QueryInterface(pStream, &IID_IAVIEditStream,(LPVOID*)&pEdit);
if (SUCCEEDED(hr) && pEdit != NULL) {
hr = IAVIEditStream_Cut(pEdit, plStart, plLength, ppResult);
IAVIEditStream_Release(pEdit);
} else
hr = AVIERR_UNSUPPORTED;
return hr;
}
/***********************************************************************
* EditStreamPaste (AVIFIL32.@)
*/
HRESULT WINAPI EditStreamPaste(PAVISTREAM pDest, LONG *plStart, LONG *plLength,
PAVISTREAM pSource, LONG lStart, LONG lEnd)
{
PAVIEDITSTREAM pEdit = NULL;
HRESULT hr;
TRACE("(%p,%p,%p,%p,%ld,%ld)\n", pDest, plStart, plLength,
pSource, lStart, lEnd);
if (pDest == NULL || pSource == NULL)
return AVIERR_BADHANDLE;
if (plStart == NULL || plLength == NULL || lStart < 0)
return AVIERR_BADPARAM;
hr = IAVIStream_QueryInterface(pDest, &IID_IAVIEditStream,(LPVOID*)&pEdit);
if (SUCCEEDED(hr) && pEdit != NULL) {
hr = IAVIEditStream_Paste(pEdit, plStart, plLength, pSource, lStart, lEnd);
IAVIEditStream_Release(pEdit);
} else
hr = AVIERR_UNSUPPORTED;
return hr;
}
/***********************************************************************
* EditStreamSetInfoA (AVIFIL32.@)
*/
HRESULT WINAPI EditStreamSetInfoA(PAVISTREAM pstream, LPAVISTREAMINFOA asi,
LONG size)
{
AVISTREAMINFOW asiw;
TRACE("(%p,%p,%ld)\n", pstream, asi, size);
if (pstream == NULL)
return AVIERR_BADHANDLE;
if ((DWORD)size < sizeof(AVISTREAMINFOA))
return AVIERR_BADSIZE;
memcpy(&asiw, asi, sizeof(asi) - sizeof(asi->szName));
MultiByteToWideChar(CP_ACP, 0, asi->szName, -1,
asiw.szName, sizeof(asiw.szName));
return EditStreamSetInfoW(pstream, &asiw, sizeof(asiw));
}
/***********************************************************************
* EditStreamSetInfoW (AVIFIL32.@)
*/
HRESULT WINAPI EditStreamSetInfoW(PAVISTREAM pstream, LPAVISTREAMINFOW asi,
LONG size)
{
PAVIEDITSTREAM pEdit = NULL;
HRESULT hr;
TRACE("(%p,%p,%ld)\n", pstream, asi, size);
hr = IAVIStream_QueryInterface(pstream, &IID_IAVIEditStream,(LPVOID*)&pEdit);
if (SUCCEEDED(hr) && pEdit != NULL) {
hr = IAVIEditStream_SetInfo(pEdit, asi, size);
IAVIEditStream_Release(pEdit);
} else
hr = AVIERR_UNSUPPORTED;
return hr;
}
/***********************************************************************
* EditStreamSetNameA (AVIFIL32.@)
*/
HRESULT WINAPI EditStreamSetNameA(PAVISTREAM pstream, LPCSTR szName)
{
AVISTREAMINFOA asia;
HRESULT hres;
TRACE("(%p,%s)\n", pstream, debugstr_a(szName));
if (pstream == NULL)
return AVIERR_BADHANDLE;
if (szName == NULL)
return AVIERR_BADPARAM;
hres = AVIStreamInfoA(pstream, &asia, sizeof(asia));
if (FAILED(hres))
return hres;
memset(asia.szName, 0, sizeof(asia.szName));
lstrcpynA(asia.szName, szName, sizeof(asia.szName)/sizeof(asia.szName[0]));
return EditStreamSetInfoA(pstream, &asia, sizeof(asia));
}
/***********************************************************************
* EditStreamSetNameW (AVIFIL32.@)
*/
HRESULT WINAPI EditStreamSetNameW(PAVISTREAM pstream, LPCWSTR szName)
{
AVISTREAMINFOW asiw;
HRESULT hres;
TRACE("(%p,%s)\n", pstream, debugstr_w(szName));
if (pstream == NULL)
return AVIERR_BADHANDLE;
if (szName == NULL)
return AVIERR_BADPARAM;
hres = IAVIStream_Info(pstream, &asiw, sizeof(asiw));
if (FAILED(hres))
return hres;
memset(asiw.szName, 0, sizeof(asiw.szName));
lstrcpynW(asiw.szName, szName, sizeof(asiw.szName)/sizeof(asiw.szName[0]));
return EditStreamSetInfoW(pstream, &asiw, sizeof(asiw));
}
/***********************************************************************
* AVIClearClipboard (AVIFIL32.@)
*/
HRESULT WINAPI AVIClearClipboard(void)
{
TRACE("()\n");
return AVIERR_UNSUPPORTED; /* OleSetClipboard(NULL); */
}
/***********************************************************************
* AVIGetFromClipboard (AVIFIL32.@)
*/
HRESULT WINAPI AVIGetFromClipboard(PAVIFILE *ppfile)
{
FIXME("(%p), stub!\n", ppfile);
*ppfile = NULL;
return AVIERR_UNSUPPORTED;
}
/***********************************************************************
* AVIPutFileOnClipboard (AVIFIL32.@)
*/
HRESULT WINAPI AVIPutFileOnClipboard(PAVIFILE pfile)
{
FIXME("(%p), stub!\n", pfile);
if (pfile == NULL)
return AVIERR_BADHANDLE;
return AVIERR_UNSUPPORTED;
}

View File

@ -1,7 +1,7 @@
@ stub AVIBuildFilter
@ stdcall AVIBuildFilterA(str long long)
@ stdcall AVIBuildFilterW(wstr long long)
@ stub AVIClearClipboard
@ stdcall AVIClearClipboard()
@ stdcall AVIFileAddRef(ptr)
@ stub AVIFileCreateStream
@ stdcall AVIFileCreateStreamA(ptr ptr ptr)
@ -19,18 +19,18 @@
@ stdcall AVIFileReadData(ptr long ptr ptr)
@ stdcall AVIFileRelease(ptr)
@ stdcall AVIFileWriteData(ptr long ptr long)
@ stub AVIGetFromClipboard
@ stdcall AVIGetFromClipboard(ptr)
@ stdcall AVIMakeCompressedStream(ptr ptr ptr ptr)
@ stub AVIMakeFileFromStreams
@ stdcall AVIMakeFileFromStreams(ptr long ptr)
@ stub AVIMakeStreamFromClipboard
@ stub AVIPutFileOnClipboard
@ stdcall AVIPutFileOnClipboard(ptr)
@ stub AVISave
@ stub AVISaveA
@ stdcall AVISaveOptions(long long long ptr ptr)
@ stdcall AVISaveOptionsFree(long ptr)
@ stub AVISaveV
@ stub AVISaveVA
@ stub AVISaveVW
@ stdcall AVISaveVA(str ptr ptr long ptr ptr)
@ stdcall AVISaveVW(wstr ptr ptr long ptr ptr)
@ stub AVISaveW
@ stdcall AVIStreamAddRef(ptr)
@ stub AVIStreamBeginStreaming
@ -58,19 +58,19 @@
@ stdcall AVIStreamWrite(ptr long long ptr long long ptr ptr)
@ stdcall AVIStreamWriteData(ptr long ptr long)
@ stub CLSID_AVISimpleUnMarshal
@ stub CreateEditableStream
@ stdcall CreateEditableStream(ptr ptr)
@ stdcall DllCanUnloadNow() AVIFILE_DllCanUnloadNow
@ stdcall DllGetClassObject(ptr ptr ptr) AVIFILE_DllGetClassObject
@ stub EditStreamClone
@ stub EditStreamCopy
@ stub EditStreamCut
@ stub EditStreamPaste
@ stdcall EditStreamClone(ptr ptr)
@ stdcall EditStreamCopy(ptr ptr ptr ptr)
@ stdcall EditStreamCut(ptr ptr ptr ptr)
@ stdcall EditStreamPaste(ptr ptr ptr ptr long long)
@ stub EditStreamSetInfo
@ stub EditStreamSetInfoA
@ stub EditStreamSetInfoW
@ stdcall EditStreamSetInfoA(ptr ptr long)
@ stdcall EditStreamSetInfoW(ptr ptr long)
@ stub EditStreamSetName
@ stub EditStreamSetNameA
@ stub EditStreamSetNameW
@ stdcall EditStreamSetNameA(ptr str)
@ stdcall EditStreamSetNameW(ptr wstr)
@ extern IID_IAVIEditStream
@ extern IID_IAVIFile
@ extern IID_IAVIStream

View File

@ -344,9 +344,9 @@ static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile *iface, LPAVIFILEINFOW afi,
AVIFILE_UpdateInfo(This);
memcpy(afi, &This->fInfo, min(size, sizeof(This->fInfo)));
memcpy(afi, &This->fInfo, min((DWORD)size, sizeof(This->fInfo)));
if (size < sizeof(This->fInfo))
if ((DWORD)size < sizeof(This->fInfo))
return AVIERR_BUFFERTOOSMALL;
return AVIERR_OK;
}
@ -735,9 +735,9 @@ static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream *iface,LPAVISTREAMINFOW psi,
if (size < 0)
return AVIERR_BADSIZE;
memcpy(psi, &This->sInfo, min(size, sizeof(This->sInfo)));
memcpy(psi, &This->sInfo, min((DWORD)size, sizeof(This->sInfo)));
if (size < sizeof(This->sInfo))
if ((DWORD)size < sizeof(This->sInfo))
return AVIERR_BUFFERTOOSMALL;
return AVIERR_OK;
}
@ -786,19 +786,21 @@ static LONG WINAPI IAVIStream_fnFindSample(IAVIStream *iface, LONG pos,
};
} else if ((flags & FIND_FORMAT) && This->idxFmtChanges != NULL &&
This->sInfo.fccType == streamtypeVIDEO) {
UINT n;
if (flags & FIND_NEXT) {
ULONG n;
for (n = 0; n < This->sInfo.dwFormatChangeCount; n++)
if (This->idxFmtChanges[n].ckid >= pos)
goto RETURN_FOUND;
} else {
for (n = This->sInfo.dwFormatChangeCount; n >= 0; n--) {
LONG n;
for (n = (LONG)This->sInfo.dwFormatChangeCount; n >= 0; n--) {
if (This->idxFmtChanges[n].ckid <= pos)
goto RETURN_FOUND;
}
if (pos > This->sInfo.dwStart)
if (pos > (LONG)This->sInfo.dwStart)
return 0; /* format changes always for first frame */
}
}
@ -850,8 +852,8 @@ static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream *iface, LONG pos,
}
/* copy initial format (only as much as will fit) */
memcpy(format, This->lpFormat, min(*formatsize, This->cbFormat));
if (*formatsize < This->cbFormat) {
memcpy(format, This->lpFormat, min(*(DWORD*)formatsize, This->cbFormat));
if (*(DWORD*)formatsize < This->cbFormat) {
*formatsize = This->cbFormat;
return AVIERR_BUFFERTOOSMALL;
}
@ -999,9 +1001,9 @@ static HRESULT WINAPI IAVIStream_fnRead(IAVIStream *iface, LONG start,
*samplesread = 0;
/* check parameters */
if (This->sInfo.dwStart > start)
if ((LONG)This->sInfo.dwStart > start)
return AVIERR_NODATA; /* couldn't read before start of stream */
if (This->sInfo.dwStart + This->sInfo.dwLength < start)
if (This->sInfo.dwStart + This->sInfo.dwLength < (DWORD)start)
return AVIERR_NODATA; /* start is past end of stream */
/* should we read as much as possible? */
@ -1017,7 +1019,7 @@ static HRESULT WINAPI IAVIStream_fnRead(IAVIStream *iface, LONG start,
}
/* limit to end of stream */
if (This->sInfo.dwLength < samples)
if ((LONG)This->sInfo.dwLength < samples)
samples = This->sInfo.dwLength;
if ((start - This->sInfo.dwStart) > (This->sInfo.dwLength - samples))
samples = This->sInfo.dwLength - (start - This->sInfo.dwStart);
@ -1392,11 +1394,11 @@ static DWORD AVIFILE_ComputeMoviStart(IAVIFileImpl *This)
/* strl,strh,strf => (3 + 2 * 2) * sizeof(DWORD) = 7 * sizeof(DWORD) */
dwPos += 7 * sizeof(DWORD) + sizeof(AVIStreamHeader);
dwPos += ((pStream->cbFormat + 1) & ~1);
dwPos += ((pStream->cbFormat + 1) & ~1U);
if (pStream->lpHandlerData != NULL && pStream->cbHandlerData > 0)
dwPos += 2 * sizeof(DWORD) + ((pStream->cbHandlerData + 1) & ~1);
dwPos += 2 * sizeof(DWORD) + ((pStream->cbHandlerData + 1) & ~1U);
if (lstrlenW(pStream->sInfo.szName) > 0)
dwPos += 2 * sizeof(DWORD) + ((lstrlenW(pStream->sInfo.szName) + 1) & ~1);
dwPos += 2 * sizeof(DWORD) + ((lstrlenW(pStream->sInfo.szName) + 1) & ~1U);
}
if (This->dwMoviChunkPos == 0) {
@ -1427,7 +1429,7 @@ static void AVIFILE_ConstructAVIStream(IAVIFileImpl *paf, DWORD nr, LPAVISTRE
pstream->ref = 0;
pstream->paf = paf;
pstream->nStream = nr;
pstream->dwCurrentFrame = -1;
pstream->dwCurrentFrame = (DWORD)-1;
pstream->lLastFrame = -1;
if (asi != NULL) {
@ -1465,7 +1467,7 @@ static void AVIFILE_DestructAVIStream(IAVIStreamImpl *This)
/* pre-conditions */
assert(This != NULL);
This->dwCurrentFrame = -1;
This->dwCurrentFrame = (DWORD)-1;
This->lLastFrame = -1;
This->paf = NULL;
if (This->idxFrames != NULL) {
@ -1542,6 +1544,12 @@ static HRESULT AVIFILE_LoadFile(IAVIFileImpl *This)
if (mmioRead(This->hmmio, (HPSTR)&MainAVIHdr, ck.cksize) != ck.cksize)
return AVIERR_FILEREAD;
/* check for MAX_AVISTREAMS limit */
if (MainAVIHdr.dwStreams > MAX_AVISTREAMS) {
WARN("file contains %lu streams, but only supports %d -- change MAX_AVISTREAMS!\n", MainAVIHdr.dwStreams, MAX_AVISTREAMS);
return AVIERR_UNSUPPORTED;
}
/* adjust permissions if copyrighted material in file */
if (MainAVIHdr.dwFlags & AVIFILEINFO_COPYRIGHTED) {
This->uMode &= ~MMIO_RWMODE;

View File

@ -20,14 +20,14 @@
105 stub AVIMAKECOMPRESSEDSTREAM
106 stub AVIMAKEFILEFROMSTREAMS
107 stub AVIMAKESTREAMFROMCLIPBOARD
110 stub AVISTREAMGETFRAME
111 stub AVISTREAMGETFRAMECLOSE
112 stub AVISTREAMGETFRAMEOPEN
110 pascal AVIStreamGetFrame(long long) AVIStreamGetFrame
111 pascal AVIStreamGetFrameClose(long) AVIStreamGetFrameClose
112 pascal AVIStreamGetFrameOpen(long ptr) AVIStreamGetFrameOpen
120 stub _AVISAVE
121 stub AVISAVEV
122 stub AVISAVEOPTIONS
123 stub AVIBUILDFILTER
124 stub AVISAVEOPTIONSFREE
123 pascal AVIBuildFilter(str long word) AVIBuildFilterA
124 pascal AVISaveOptionsFree(word ptr) AVISaveOptionsFree
130 pascal AVIStreamStart(long) AVIStreamStart
131 pascal AVIStreamLength(long) AVIStreamLength
132 pascal AVIStreamTimeToSample(long long) AVIStreamTimeToSample
@ -36,20 +36,20 @@
141 pascal AVIFileRelease(long) AVIFileRelease
142 pascal AVIFileInfo(long ptr long) AVIFileInfoA
143 pascal AVIFileGetStream(long ptr long long) AVIFileGetStream
144 stub AVIFILECREATESTREAM
146 stub AVIFILEWRITEDATA
147 stub AVIFILEREADDATA
144 pascal AVIFileCreateStream(long ptr ptr) AVIFileCreateStreamA
146 pascal AVIFileWriteData(long long ptr long) AVIFileWriteData
147 pascal AVIFileReadData(long long ptr ptr) AVIFileReadData
148 pascal AVIFileEndRecord(long) AVIFileEndRecord
160 pascal AVIStreamAddRef(long) AVIStreamAddRef
161 pascal AVIStreamRelease(long) AVIStreamRelease
162 stub AVISTREAMINFO
163 stub AVISTREAMFINDSAMPLE
164 stub AVISTREAMREADFORMAT
165 stub AVISTREAMREADDATA
166 stub AVISTREAMWRITEDATA
167 stub AVISTREAMREAD
168 stub AVISTREAMWRITE
169 stub AVISTREAMSETFORMAT
162 pascal AVIStreamInfo(long ptr long) AVIStreamInfoA
163 pascal AVIStreamFindSample(long long long) AVIStreamFindSample
164 pascal AVIStreamReadFormat(long long ptr ptr) AVIStreamReadFormat
165 pascal AVIStreamReadData(long long ptr ptr) AVIStreamReadData
166 pascal AVIStreamWriteData(long long ptr long) AVIStreamWriteData
167 pascal AVIStreamRead(long long long ptr long ptr ptr) AVIStreamRead
168 pascal AVIStreamWrite(long long long ptr long long ptr ptr) AVIStreamWrite
169 pascal AVIStreamSetFormat(long long ptr long) AVIStreamSetFormat
180 stub EDITSTREAMCOPY
181 stub EDITSTREAMCUT
182 stub EDITSTREAMPASTE

View File

@ -20,7 +20,7 @@
#define __AVIFILE_PRIVATE_H
#ifndef MAX_AVISTREAMS
#define MAX_AVISTREAMS 4
#define MAX_AVISTREAMS 8
#endif
#ifndef comptypeDIB
@ -65,6 +65,7 @@ extern HRESULT AVIFILE_CreateWAVFile(REFIID riid, LPVOID *ppobj);
extern HRESULT AVIFILE_CreateACMStream(REFIID riid, LPVOID *ppobj);
extern HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppobj);
extern PGETFRAME AVIFILE_CreateGetFrame(PAVISTREAM pstream);
extern PAVIFILE AVIFILE_CreateAVITempFile(int nStreams,PAVISTREAM *ppStreams);
extern LPCWSTR AVIFILE_BasenameW(LPCWSTR szFileName);

View File

@ -33,7 +33,7 @@ HRESULT ReadExtraChunk(LPEXTRACHUNKS extra,FOURCC ckid,LPVOID lpData,
LPLONG size)
{
LPBYTE lp;
LONG cb;
DWORD cb;
/* pre-conditions */
assert(extra != NULL);
@ -47,9 +47,10 @@ HRESULT ReadExtraChunk(LPEXTRACHUNKS extra,FOURCC ckid,LPVOID lpData,
if (((FOURCC*)lp)[0] == ckid) {
/* found correct chunk */
if (lpData != NULL && *size > 0)
memcpy(lpData, lp + 2 * sizeof(DWORD), min(((LPDWORD)lp)[1],*size));
memcpy(lpData, lp + 2 * sizeof(DWORD),
min(((LPDWORD)lp)[1], *(LPDWORD)size));
*size = ((LPDWORD)lp)[1];
*(LPDWORD)size = ((LPDWORD)lp)[1];
return AVIERR_OK;
} else {
@ -103,7 +104,7 @@ HRESULT WriteExtraChunk(LPEXTRACHUNKS extra,FOURCC ckid,LPVOID lpData,
HRESULT ReadChunkIntoExtra(LPEXTRACHUNKS extra,HMMIO hmmio,MMCKINFO *lpck)
{
LPDWORD lp;
LONG cb;
DWORD cb;
/* pre-conditions */
assert(extra != NULL);
@ -132,7 +133,7 @@ HRESULT ReadChunkIntoExtra(LPEXTRACHUNKS extra,HMMIO hmmio,MMCKINFO *lpck)
if (lpck->cksize > 0) {
if (mmioSeek(hmmio, lpck->dwDataOffset, SEEK_SET) == -1)
return AVIERR_FILEREAD;
if (mmioRead(hmmio, (HPSTR)&lp[2], lpck->cksize) != lpck->cksize)
if (mmioRead(hmmio, (HPSTR)&lp[2], lpck->cksize) != (LONG)lpck->cksize)
return AVIERR_FILEREAD;
}

View File

@ -71,9 +71,9 @@ typedef struct _IGetFrameImpl {
PAVISTREAM pStream;
LPVOID lpInBuffer;
DWORD cbInBuffer;
LONG cbInBuffer;
LPBITMAPINFOHEADER lpInFormat;
DWORD cbInFormat;
LONG cbInFormat;
LONG lCurrentFrame;
LPBITMAPINFOHEADER lpOutFormat;
@ -341,7 +341,7 @@ static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame *iface,
if (This->lpInFormat == NULL) {
HRESULT hr;
This->cbInBuffer = sInfo.dwSuggestedBufferSize;
This->cbInBuffer = (LONG)sInfo.dwSuggestedBufferSize;
if (This->cbInBuffer == 0)
This->cbInBuffer = 1024;

View File

@ -329,9 +329,9 @@ static HRESULT WINAPI ICMStream_fnInfo(IAVIStream *iface,LPAVISTREAMINFOW psi,
if (size < 0)
return AVIERR_BADSIZE;
memcpy(psi, &This->sInfo, min(size, sizeof(This->sInfo)));
memcpy(psi, &This->sInfo, min((DWORD)size, sizeof(This->sInfo)));
if (size < sizeof(This->sInfo))
if ((DWORD)size < sizeof(This->sInfo))
return AVIERR_BUFFERTOOSMALL;
return AVIERR_OK;
}
@ -885,7 +885,7 @@ static HRESULT AVIFILE_EncodeFrame(IAVIStreamImpl *This,
static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
{
LPBITMAPINFOHEADER lpbi;
LONG size;
DWORD size;
/* pre-conditions */
assert(This != NULL);
@ -910,7 +910,7 @@ static HRESULT AVIFILE_OpenGetFrame(IAVIStreamImpl *This)
/* get memory for output format */
size = ICCompressGetFormatSize(This->hic, lpbi);
if (size < sizeof(BITMAPINFOHEADER))
if ((LONG)size < (LONG)sizeof(BITMAPINFOHEADER))
return AVIERR_COMPRESSOR;
This->lpbiOutput = (LPBITMAPINFOHEADER)GlobalAllocPtr(GHND, size);
if (This->lpbiOutput == NULL)

285
dlls/avifil32/tmpfile.c Normal file
View File

@ -0,0 +1,285 @@
/*
* Copyright 2003 Michael Günnewig
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#define COM_NO_WINDOWS_H
#include <assert.h>
#include "winbase.h"
#include "winuser.h"
#include "winnls.h"
#include "winerror.h"
#include "windowsx.h"
#include "mmsystem.h"
#include "vfw.h"
#include "avifile_private.h"
#include "extrachunk.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(avifile);
/***********************************************************************/
static HRESULT WINAPI ITmpFile_fnQueryInterface(IAVIFile* iface,REFIID refiid,LPVOID *obj);
static ULONG WINAPI ITmpFile_fnAddRef(IAVIFile* iface);
static ULONG WINAPI ITmpFile_fnRelease(IAVIFile* iface);
static HRESULT WINAPI ITmpFile_fnInfo(IAVIFile*iface,AVIFILEINFOW*afi,LONG size);
static HRESULT WINAPI ITmpFile_fnGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam);
static HRESULT WINAPI ITmpFile_fnCreateStream(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi);
static HRESULT WINAPI ITmpFile_fnWriteData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG size);
static HRESULT WINAPI ITmpFile_fnReadData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG *size);
static HRESULT WINAPI ITmpFile_fnEndRecord(IAVIFile*iface);
static HRESULT WINAPI ITmpFile_fnDeleteStream(IAVIFile*iface,DWORD fccType,LONG lParam);
struct ICOM_VTABLE(IAVIFile) itmpft = {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
ITmpFile_fnQueryInterface,
ITmpFile_fnAddRef,
ITmpFile_fnRelease,
ITmpFile_fnInfo,
ITmpFile_fnGetStream,
ITmpFile_fnCreateStream,
ITmpFile_fnWriteData,
ITmpFile_fnReadData,
ITmpFile_fnEndRecord,
ITmpFile_fnDeleteStream
};
typedef struct _ITmpFileImpl {
/* IUnknown stuff */
ICOM_VFIELD(IAVIFile);
DWORD ref;
/* IAVIFile stuff */
AVIFILEINFOW fInfo;
PAVISTREAM *ppStreams;
} ITmpFileImpl;
PAVIFILE AVIFILE_CreateAVITempFile(int nStreams, PAVISTREAM *ppStreams) {
ITmpFileImpl *tmpFile;
int i;
tmpFile = LocalAlloc(LPTR, sizeof(ITmpFileImpl));
if (tmpFile == NULL)
return NULL;
tmpFile->lpVtbl = &itmpft;
tmpFile->ref = 1;
memset(&tmpFile->fInfo, 0, sizeof(tmpFile->fInfo));
tmpFile->fInfo.dwStreams = nStreams;
tmpFile->ppStreams = LocalAlloc(LPTR, nStreams * sizeof(PAVISTREAM));
if (tmpFile->ppStreams == NULL) {
LocalFree((HLOCAL)tmpFile);
return NULL;
}
for (i = 0; i < nStreams; i++) {
AVISTREAMINFOW sInfo;
tmpFile->ppStreams[i] = ppStreams[i];
AVIStreamAddRef(ppStreams[i]);
AVIStreamInfoW(ppStreams[i], &sInfo, sizeof(sInfo));
if (i == 0) {
tmpFile->fInfo.dwScale = sInfo.dwScale;
tmpFile->fInfo.dwRate = sInfo.dwRate;
if (!sInfo.dwScale || !sInfo.dwRate) {
tmpFile->fInfo.dwScale = 1;
tmpFile->fInfo.dwRate = 100;
}
}
if (tmpFile->fInfo.dwSuggestedBufferSize < sInfo.dwSuggestedBufferSize)
tmpFile->fInfo.dwSuggestedBufferSize = sInfo.dwSuggestedBufferSize;
{
register DWORD tmp;
tmp = MulDiv(AVIStreamSampleToTime(ppStreams[i], sInfo.dwLength), \
tmpFile->fInfo.dwScale, tmpFile->fInfo.dwRate * 1000);
if (tmpFile->fInfo.dwLength < tmp)
tmpFile->fInfo.dwLength = tmp;
tmp = sInfo.rcFrame.right - sInfo.rcFrame.left;
if (tmpFile->fInfo.dwWidth < tmp)
tmpFile->fInfo.dwWidth = tmp;
tmp = sInfo.rcFrame.bottom - sInfo.rcFrame.top;
if (tmpFile->fInfo.dwHeight < tmp)
tmpFile->fInfo.dwHeight = tmp;
}
}
return (PAVIFILE)tmpFile;
}
static HRESULT WINAPI ITmpFile_fnQueryInterface(IAVIFile *iface, REFIID refiid,
LPVOID *obj)
{
ICOM_THIS(ITmpFileImpl,iface);
TRACE("(%p,%s,%p)\n", This, debugstr_guid(refiid), obj);
if (IsEqualGUID(&IID_IUnknown, refiid) ||
IsEqualGUID(&IID_IAVIFile, refiid)) {
*obj = iface;
IAVIFile_AddRef(iface);
return S_OK;
}
return OLE_E_ENUM_NOMORE;
}
static ULONG WINAPI ITmpFile_fnAddRef(IAVIFile *iface)
{
ICOM_THIS(ITmpFileImpl,iface);
TRACE("(%p) -> %ld\n", iface, This->ref + 1);
return ++(This->ref);
}
static ULONG WINAPI ITmpFile_fnRelease(IAVIFile *iface)
{
ICOM_THIS(ITmpFileImpl,iface);
TRACE("(%p) -> %ld\n", iface, This->ref - 1);
if (!--(This->ref)) {
int i;
for (i = 0; i < This->fInfo.dwStreams; i++) {
if (This->ppStreams[i] != NULL) {
AVIStreamRelease(This->ppStreams[i]);
This->ppStreams[i] = NULL;
}
}
LocalFree((HLOCAL)This);
return 0;
}
return This->ref;
}
static HRESULT WINAPI ITmpFile_fnInfo(IAVIFile *iface,
AVIFILEINFOW *afi, LONG size)
{
ICOM_THIS(ITmpFileImpl,iface);
TRACE("(%p,%p,%ld)\n",iface,afi,size);
if (afi == NULL)
return AVIERR_BADPARAM;
if (size < 0)
return AVIERR_BADSIZE;
memcpy(afi, &This->fInfo, min((DWORD)size, sizeof(This->fInfo)));
if ((DWORD)size < sizeof(This->fInfo))
return AVIERR_BUFFERTOOSMALL;
return AVIERR_OK;
}
static HRESULT WINAPI ITmpFile_fnGetStream(IAVIFile *iface, PAVISTREAM *avis,
DWORD fccType, LONG lParam)
{
ICOM_THIS(ITmpFileImpl,iface);
ULONG nStream = (ULONG)-1;
TRACE("(%p,%p,0x%08lX,%ld)\n", iface, avis, fccType, lParam);
if (avis == NULL || lParam < 0)
return AVIERR_BADPARAM;
if (fccType != streamtypeANY) {
/* search the number of the specified stream */
ULONG i;
for (i = 0; i < This->fInfo.dwStreams; i++) {
AVISTREAMINFOW sInfo;
HRESULT hr;
hr = AVIStreamInfoW(This->ppStreams[i], &sInfo, sizeof(sInfo));
if (FAILED(hr))
return hr;
if (sInfo.fccType == fccType) {
if (lParam == 0) {
nStream = i;
break;
} else
lParam--;
}
}
} else
nStream = lParam;
/* Does the requested stream exist ? */
if (nStream < This->fInfo.dwStreams && This->ppStreams[nStream] != NULL) {
*avis = This->ppStreams[nStream];
AVIStreamAddRef(*avis);
return AVIERR_OK;
}
/* Sorry, but the specified stream doesn't exist */
return AVIERR_NODATA;
}
static HRESULT WINAPI ITmpFile_fnCreateStream(IAVIFile *iface,PAVISTREAM *avis,
AVISTREAMINFOW *asi)
{
TRACE("(%p,%p,%p)\n",iface,avis,asi);
return AVIERR_UNSUPPORTED;
}
static HRESULT WINAPI ITmpFile_fnWriteData(IAVIFile *iface, DWORD ckid,
LPVOID lpData, LONG size)
{
TRACE("(%p,0x%08lX,%p,%ld)\n", iface, ckid, lpData, size);
return AVIERR_UNSUPPORTED;
}
static HRESULT WINAPI ITmpFile_fnReadData(IAVIFile *iface, DWORD ckid,
LPVOID lpData, LONG *size)
{
TRACE("(%p,0x%08lX,%p,%p)\n", iface, ckid, lpData, size);
return AVIERR_UNSUPPORTED;
}
static HRESULT WINAPI ITmpFile_fnEndRecord(IAVIFile *iface)
{
TRACE("(%p)\n",iface);
return AVIERR_OK;
}
static HRESULT WINAPI ITmpFile_fnDeleteStream(IAVIFile *iface, DWORD fccType,
LONG lParam)
{
TRACE("(%p,0x%08lX,%ld)\n", iface, fccType, lParam);
return AVIERR_UNSUPPORTED;
}

View File

@ -298,9 +298,9 @@ static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile *iface, LPAVIFILEINFOW afi,
MulDiv(This->sInfo.dwSampleSize,This->sInfo.dwRate,This->sInfo.dwScale);
}
memcpy(afi, &This->fInfo, min(size, sizeof(This->fInfo)));
memcpy(afi, &This->fInfo, min((DWORD)size, sizeof(This->fInfo)));
if (size < sizeof(This->fInfo))
if ((DWORD)size < sizeof(This->fInfo))
return AVIERR_BUFFERTOOSMALL;
return AVIERR_OK;
}
@ -667,9 +667,9 @@ static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream *iface,LPAVISTREAMINFOW psi,
if (size < 0)
return AVIERR_BADSIZE;
memcpy(psi, &This->paf->sInfo, min(size, sizeof(This->paf->sInfo)));
memcpy(psi, &This->paf->sInfo, min((DWORD)size, sizeof(This->paf->sInfo)));
if (size < sizeof(This->paf->sInfo))
if ((DWORD)size < sizeof(This->paf->sInfo))
return AVIERR_BUFFERTOOSMALL;
return AVIERR_OK;
}
@ -810,7 +810,7 @@ static HRESULT WINAPI IAVIStream_fnRead(IAVIStream *iface, LONG start,
*samplesread = 0;
/* positions without data */
if (start < 0 || start > This->sInfo.dwLength)
if (start < 0 || (DWORD)start > This->sInfo.dwLength)
return AVIERR_OK;
/* check samples */
@ -818,13 +818,13 @@ static HRESULT WINAPI IAVIStream_fnRead(IAVIStream *iface, LONG start,
samples = 0;
if (buffersize > 0) {
if (samples > 0)
samples = min(samples, buffersize / This->sInfo.dwSampleSize);
samples = min((DWORD)samples, buffersize / This->sInfo.dwSampleSize);
else
samples = buffersize / This->sInfo.dwSampleSize;
}
/* limit to end of stream */
if (start + samples > This->sInfo.dwLength)
if ((DWORD)(start + samples) > This->sInfo.dwLength)
samples = This->sInfo.dwLength - start;
/* request only the sizes? */
@ -846,7 +846,7 @@ static HRESULT WINAPI IAVIStream_fnRead(IAVIStream *iface, LONG start,
return AVIERR_OK;
/* Can I atleast read one sample? */
if (buffersize < This->sInfo.dwSampleSize)
if ((DWORD)buffersize < This->sInfo.dwSampleSize)
return AVIERR_BUFFERTOOSMALL;
buffersize = samples * This->sInfo.dwSampleSize;
@ -909,7 +909,7 @@ static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream *iface, LONG start,
if (mmioWrite(This->hmmio, (HPSTR)buffer, buffersize) != buffersize)
return AVIERR_FILEWRITE;
This->sInfo.dwLength = max(This->sInfo.dwLength, start + samples);
This->sInfo.dwLength = max(This->sInfo.dwLength, (DWORD)start + samples);
This->ckData.cksize = max(This->ckData.cksize,
start * This->sInfo.dwSampleSize + buffersize);
@ -935,23 +935,23 @@ static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream *iface, LONG start,
return AVIERR_BADPARAM;
/* Delete before start of stream? */
if (start + samples < This->sInfo.dwStart)
if ((DWORD)(start + samples) < This->sInfo.dwStart)
return AVIERR_OK;
/* Delete after end of stream? */
if (start > This->sInfo.dwLength)
if ((DWORD)start > This->sInfo.dwLength)
return AVIERR_OK;
/* For the rest we need write permissions */
if ((This->uMode & MMIO_RWMODE) == 0)
return AVIERR_READONLY;
if (start + samples >= This->sInfo.dwLength) {
if ((DWORD)(start + samples) >= This->sInfo.dwLength) {
/* deletion at end */
samples = This->sInfo.dwLength - start;
This->sInfo.dwLength -= samples;
This->ckData.cksize -= samples * This->sInfo.dwSampleSize;
} else if (start <= This->sInfo.dwStart) {
} else if ((DWORD)start <= This->sInfo.dwStart) {
/* deletion at start */
samples = This->sInfo.dwStart - start;
start = This->sInfo.dwStart;

View File

@ -42,6 +42,7 @@ LONG VFWAPI TermVFW(void);
typedef struct IAVIStream IAVIStream,*PAVISTREAM;
typedef struct IAVIFile IAVIFile,*PAVIFILE;
typedef struct IGetFrame IGetFrame,*PGETFRAME;
typedef struct IAVIEditStream IAVIEditStream, *PAVIEDITSTREAM;
/* Installable Compressor Manager */
@ -743,6 +744,7 @@ typedef WORD TWOCC;
#define ckidAVINEWINDEX mmioFOURCC('i', 'd', 'x', '1')
#define streamtypeANY 0UL
#define streamtypeVIDEO mmioFOURCC('v', 'i', 'd', 's')
#define streamtypeAUDIO mmioFOURCC('a', 'u', 'd', 's')
#define streamtypeMIDI mmioFOURCC('m', 'i', 'd', 's')
@ -1042,6 +1044,7 @@ LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pg,LONG pos);
HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pg);
HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM*ppsCompressed,PAVISTREAM ppsSource,AVICOMPRESSOPTIONS *lpOptions,CLSID*pclsidHandler);
HRESULT WINAPI AVIMakeFileFromStreams(PAVIFILE *ppfile, int nStreams, PAVISTREAM *ppStreams);
HRESULT WINAPI AVIStreamOpenFromFileA(PAVISTREAM *ppavi, LPCSTR szFile,
DWORD fccType, LONG lParam,
@ -1059,6 +1062,14 @@ BOOL WINAPI AVISaveOptions(HWND hWnd,UINT uFlags,INT nStream,
PAVISTREAM *ppavi,LPAVICOMPRESSOPTIONS *ppOptions);
HRESULT WINAPI AVISaveOptionsFree(INT nStreams,LPAVICOMPRESSOPTIONS*ppOptions);
HRESULT WINAPI AVISaveVA(LPCSTR szFile, CLSID *pclsidHandler,
AVISAVECALLBACK lpfnCallback, int nStream,
PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *plpOptions);
HRESULT WINAPI AVISaveVW(LPCWSTR szFile, CLSID *pclsidHandler,
AVISAVECALLBACK lpfnCallback, int nStream,
PAVISTREAM *ppavi, LPAVICOMPRESSOPTIONS *plpOptions);
#define AVISaveV WINELIB_NAME_AW(AVISaveV)
LONG WINAPI AVIStreamStart(PAVISTREAM iface);
LONG WINAPI AVIStreamLength(PAVISTREAM iface);
LONG WINAPI AVIStreamSampleToTime(PAVISTREAM pstream, LONG lSample);
@ -1083,6 +1094,52 @@ LONG WINAPI AVIStreamTimeToSample(PAVISTREAM pstream, LONG lTime);
#define AVIStreamStartTime(pavi) \
AVIStreamSampleToTime(pavi, AVIStreamStart(pavi))
/*****************************************************************************
* IAVIEditStream interface
*/
#define INTERFACE IAVIEditStream
#define IAVIEditStream_METHODS \
IUnknown_METHODS \
STDMETHOD(Cut)(IAVIEditStream*iface,LONG*plStart,LONG*plLength,PAVISTREAM*ppResult) PURE; \
STDMETHOD(Copy)(IAVIEditStream*iface,LONG*plStart,LONG*plLength,PAVISTREAM*ppResult) PURE; \
STDMETHOD(Paste)(IAVIEditStream*iface,LONG*plStart,LONG*plLength,PAVISTREAM pSource,LONG lStart,LONG lEnd) PURE; \
STDMETHOD(Clone)(IAVIEditStream*iface,PAVISTREAM*ppResult) PURE; \
STDMETHOD(SetInfo)(IAVIEditStream*iface,LPAVISTREAMINFOW asi, LONG size) PURE;
ICOM_DEFINE(IAVIEditStream,IUnknown)
#undef INTERFACE
#ifdef COBJMACROS
/*** IUnknown methods ***/
#define IAVIEditStream_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IAVIEditStream_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IAVIEditStream_Release(p) (p)->lpVtbl->Release(p)
/*** IAVIEditStream methods ***/
#define IAVIEditStream_Cut(p,a,b,c) (p)->lpVtbl->Cut(p,a,b,c)
#define IAVIEditStream_Copy(p,a,b,c) (p)->lpVtbl->Copy(p,a,b,c)
#define IAVIEditStream_Paste(p,a,b,c,d,e) (p)->lpVtbl->Paste(p,a,b,c,d,e)
#define IAVIEditStream_Clone(p,a) (p)->lpVtbl->Clone(p,a)
#define IAVIEditStream_SetInfo(p,a,b) (p)->lpVtbl->SetInfo(p,a,b)
#endif
HRESULT WINAPI CreateEditableStream(PAVISTREAM *ppEditable,PAVISTREAM pSource);
HRESULT WINAPI EditStreamClone(PAVISTREAM pStream, PAVISTREAM *ppResult);
HRESULT WINAPI EditStreamCopy(PAVISTREAM pStream, LONG *plStart,
LONG *plLength, PAVISTREAM *ppResult);
HRESULT WINAPI EditStreamCut(PAVISTREAM pStream, LONG *plStart,
LONG *plLength, PAVISTREAM *ppResult);
HRESULT WINAPI EditStreamPaste(PAVISTREAM pDest, LONG *plStart, LONG *plLength,
PAVISTREAM pSource, LONG lStart, LONG lEnd);
HRESULT WINAPI EditStreamSetInfoA(PAVISTREAM pstream, LPAVISTREAMINFOA asi,
LONG size);
HRESULT WINAPI EditStreamSetInfoW(PAVISTREAM pstream, LPAVISTREAMINFOW asi,
LONG size);
#define EditStreamSetInfo WINELIB_NAME_AW(EditStreamSetInfo)
HRESULT WINAPI EditStreamSetNameA(PAVISTREAM pstream, LPCSTR szName);
HRESULT WINAPI EditStreamSetNameW(PAVISTREAM pstream, LPCWSTR szName);
#define EditStreamSetName WINELIB_NAME_AW(EditStreamSetName)
/*****************************************************************************
* IAVIFile interface
*/
@ -1160,6 +1217,23 @@ ICOM_DEFINE(IGetFrame,IUnknown)
#define IGetFrame_SetFormat(p,a,b,c,d,e,f) (p)->lpVtbl->SetFormat(p,a,b,c,d,e,f)
#endif
HRESULT WINAPI AVIClearClipboard(void);
HRESULT WINAPI AVIGetFromClipboard(PAVIFILE *ppfile);
HRESULT WINAPI AVIPutFileOnClipboard(PAVIFILE pfile);
#ifdef _WIN32
#ifdef OFN_READONLY
BOOL WINAPI GetOpenFileNamePreviewA(LPOPENFILENAMEA lpofn);
BOOL WINAPI GetOpenFileNamePreviewW(LPOPENFILENAMEW lpofn);
#define GetOpenFileNamePreview WINELIB_NAME_AW(GetOpenFileNamePreview)
BOOL WINAPI GetSaveFileNamePreviewA(LPOPENFILENAMEA lpofn);
BOOL WINAPI GetSaveFileNamePreviewW(LPOPENFILENAMEW lpofn);
#define GetSaveFileNamePreview WINELIB_NAME_AW(GetSaveFileNamePreview)
#endif
#endif
#define AVIERR_OK 0
#define MAKE_AVIERR(error) MAKE_SCODE(SEVERITY_ERROR,FACILITY_ITF,0x4000+error)