- Move the API into a new api.c file.
- Added IClassFactory implementation. - Added IPersistFile implementation to the AVI-file handler.
This commit is contained in:
parent
9f47e97818
commit
a26a2ca224
|
@ -763,7 +763,8 @@ x11drv/__install__: x11drv.dll$(DLLEXT)
|
|||
|
||||
advapi32: kernel32.dll$(DLLEXT) ntdll.dll$(DLLEXT)
|
||||
avicap32: ntdll.dll$(DLLEXT)
|
||||
avifil32: msvfw32.dll$(DLLEXT) kernel32.dll$(DLLEXT)
|
||||
avifil32: msvfw32.dll$(DLLEXT) shell32.dll$(DLLEXT) user32.dll$(DLLEXT) advapi32.dll$(DLLEXT) \
|
||||
kernel32.dll$(DLLEXT)
|
||||
comcat: ole32.dll$(DLLEXT) user32.dll$(DLLEXT) advapi32.dll$(DLLEXT) kernel32.dll$(DLLEXT)
|
||||
comctl32: user32.dll$(DLLEXT) gdi32.dll$(DLLEXT) advapi32.dll$(DLLEXT) kernel32.dll$(DLLEXT) \
|
||||
winmm.dll$(DLLEXT)
|
||||
|
|
|
@ -3,7 +3,7 @@ TOPOBJDIR = ../..
|
|||
SRCDIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
MODULE = avifil32.dll
|
||||
IMPORTS = msvfw32 kernel32
|
||||
IMPORTS = msvfw32 shell32 user32 advapi32 kernel32
|
||||
ALTNAMES = avifile.dll
|
||||
EXTRALIBS = $(LIBUUID)
|
||||
|
||||
|
@ -11,7 +11,9 @@ LDDLLFLAGS = @LDDLLFLAGS@
|
|||
SYMBOLFILE = $(MODULE).tmp.o
|
||||
|
||||
C_SRCS = \
|
||||
avifile.c
|
||||
api.c \
|
||||
avifile.c \
|
||||
factory.c
|
||||
|
||||
@MAKE_DLL_RULES@
|
||||
|
||||
|
|
|
@ -0,0 +1,822 @@
|
|||
/*
|
||||
* Copyright 1999 Marcus Meissner
|
||||
* Copyright 2002 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
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "winbase.h"
|
||||
#include "winnls.h"
|
||||
#include "winuser.h"
|
||||
#include "winreg.h"
|
||||
#include "winerror.h"
|
||||
|
||||
#include "ole2.h"
|
||||
#include "shellapi.h"
|
||||
#include "vfw.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(avifile);
|
||||
|
||||
/***********************************************************************
|
||||
* copied from dlls/shell32/undocshell.h
|
||||
*/
|
||||
HRESULT WINAPI SHCoCreateInstance(LPCSTR lpszClsid,REFCLSID rClsid,
|
||||
LPUNKNOWN pUnkOuter,REFIID riid,LPVOID *ppv);
|
||||
|
||||
/***********************************************************************
|
||||
* copied from dlls/ole32/compobj.c
|
||||
*/
|
||||
static HRESULT AVIFILE_CLSIDFromString(LPCSTR idstr, LPCLSID id)
|
||||
{
|
||||
BYTE *s = (BYTE*)idstr;
|
||||
BYTE *p;
|
||||
INT i;
|
||||
BYTE table[256];
|
||||
|
||||
if (!s) {
|
||||
memset(s, 0, sizeof(CLSID));
|
||||
return S_OK;
|
||||
} else { /* validate the CLSID string */
|
||||
if (lstrlenA(s) != 38)
|
||||
return CO_E_CLASSSTRING;
|
||||
|
||||
if ((s[0]!='{') || (s[9]!='-') || (s[14]!='-') || (s[19]!='-') ||
|
||||
(s[24]!='-') || (s[37]!='}'))
|
||||
return CO_E_CLASSSTRING;
|
||||
|
||||
for (i = 1; i < 37; i++) {
|
||||
if ((i == 9) || (i == 14) || (i == 19) || (i == 24))
|
||||
continue;
|
||||
if (!(((s[i] >= '0') && (s[i] <= '9')) ||
|
||||
((s[i] >= 'a') && (s[i] <= 'f')) ||
|
||||
((s[i] >= 'A') && (s[i] <= 'F')))
|
||||
)
|
||||
return CO_E_CLASSSTRING;
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("%s -> %p\n", s, id);
|
||||
|
||||
/* quick lookup table */
|
||||
memset(table, 0, 256);
|
||||
|
||||
for (i = 0; i < 10; i++)
|
||||
table['0' + i] = i;
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
table['A' + i] = i+10;
|
||||
table['a' + i] = i+10;
|
||||
}
|
||||
|
||||
/* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */
|
||||
p = (BYTE *) id;
|
||||
|
||||
s++; /* skip leading brace */
|
||||
for (i = 0; i < 4; i++) {
|
||||
p[3 - i] = table[*s]<<4 | table[*(s+1)];
|
||||
s += 2;
|
||||
}
|
||||
p += 4;
|
||||
s++; /* skip - */
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
p[1-i] = table[*s]<<4 | table[*(s+1)];
|
||||
s += 2;
|
||||
}
|
||||
p += 2;
|
||||
s++; /* skip - */
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
p[1-i] = table[*s]<<4 | table[*(s+1)];
|
||||
s += 2;
|
||||
}
|
||||
p += 2;
|
||||
s++; /* skip - */
|
||||
|
||||
/* these are just sequential bytes */
|
||||
for (i = 0; i < 2; i++) {
|
||||
*p++ = table[*s]<<4 | table[*(s+1)];
|
||||
s += 2;
|
||||
}
|
||||
s++; /* skip - */
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
*p++ = table[*s]<<4 | table[*(s+1)];
|
||||
s += 2;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileInit (AVIFIL32.@)
|
||||
* AVIFileInit (AVIFILE.100)
|
||||
*/
|
||||
void WINAPI AVIFileInit(void) {
|
||||
/* need to load ole32.dll if not already done and get some functions */
|
||||
FIXME("(): stub!\n");
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileExit (AVIFIL32.@)
|
||||
* AVIFileExit (AVIFILE.101)
|
||||
*/
|
||||
void WINAPI AVIFileExit(void) {
|
||||
/* need to free ole32.dll if we are the last exit call */
|
||||
FIXME("(): stub!\n");
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileOpenA (AVIFIL32.@)
|
||||
* AVIFileOpenA (AVIFILE.102)
|
||||
*/
|
||||
HRESULT WINAPI AVIFileOpenA(PAVIFILE *ppfile, LPCSTR szFile, UINT uMode,
|
||||
LPCLSID lpHandler)
|
||||
{
|
||||
LPWSTR wszFile = NULL;
|
||||
HRESULT hr;
|
||||
int len;
|
||||
|
||||
TRACE("(%p,%s,0x%08X,%s)\n", ppfile, debugstr_a(szFile), uMode,
|
||||
debugstr_guid(lpHandler));
|
||||
|
||||
/* check parameters */
|
||||
if (ppfile == NULL || szFile == 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 = AVIFileOpenW(ppfile, wszFile, uMode, lpHandler);
|
||||
|
||||
LocalFree((HLOCAL)wszFile);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileOpenW (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIFileOpenW(PAVIFILE *ppfile, LPCWSTR szFile, UINT uMode,
|
||||
LPCLSID lpHandler)
|
||||
{
|
||||
IPersistFile *ppersist = NULL;
|
||||
CLSID clsidHandler;
|
||||
HRESULT hr;
|
||||
|
||||
FIXME("(%p,%s,0x%X,%s): stub!\n", ppfile, debugstr_w(szFile), uMode,
|
||||
debugstr_guid(lpHandler));
|
||||
|
||||
/* check parameters */
|
||||
if (ppfile == NULL || szFile == NULL)
|
||||
return AVIERR_BADPARAM;
|
||||
|
||||
*ppfile = NULL;
|
||||
|
||||
/* if no handler then try guessing it by extension */
|
||||
if (lpHandler == NULL) {
|
||||
FIXME(": must read HKEY_CLASSES_ROOT\\AVIFile\\Extensions\\%s\n", debugstr_w(strrchrW(szFile, L'.')));
|
||||
} else
|
||||
memcpy(&clsidHandler, lpHandler, sizeof(clsidHandler));
|
||||
|
||||
/* crete instance of handler */
|
||||
hr = SHCoCreateInstance(NULL, &clsidHandler, NULL,
|
||||
&IID_IAVIFile, (LPVOID*)ppfile);
|
||||
if (FAILED(hr) || *ppfile == NULL)
|
||||
return hr;
|
||||
|
||||
/* ask for IPersistFile interface for loading/creating the file */
|
||||
hr = IAVIFile_QueryInterface(*ppfile, &IID_IPersistFile, (LPVOID*)&ppersist);
|
||||
if (FAILED(hr) || ppersist == NULL) {
|
||||
IAVIFile_Release(*ppfile);
|
||||
*ppfile = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
||||
hr = IPersistFile_Load(ppersist, szFile, uMode);
|
||||
IPersistFile_Release(ppersist);
|
||||
if (FAILED(hr)) {
|
||||
IAVIFile_Release(*ppfile);
|
||||
*ppfile = NULL;
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileAddRef (AVIFIL32.@)
|
||||
* AVIFileAddRef (AVIFILE.140)
|
||||
*/
|
||||
ULONG WINAPI AVIFileAddRef(PAVIFILE pfile)
|
||||
{
|
||||
TRACE("(%p)\n", pfile);
|
||||
|
||||
if (pfile == NULL) {
|
||||
ERR(": bad handle passed!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return IAVIFile_AddRef(pfile);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileRelease (AVIFIL32.@)
|
||||
* AVIFileRelease (AVIFILE.141)
|
||||
*/
|
||||
ULONG WINAPI AVIFileRelease(PAVIFILE pfile)
|
||||
{
|
||||
TRACE("(%p)\n", pfile);
|
||||
|
||||
if (pfile == NULL) {
|
||||
ERR(": bad handle passed!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return IAVIFile_Release(pfile);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileInfoA (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIFileInfoA(PAVIFILE pfile, LPAVIFILEINFOA afi, LONG size)
|
||||
{
|
||||
AVIFILEINFOW afiw;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p,%p,%ld)\n", pfile, afi, size);
|
||||
|
||||
if (pfile == NULL)
|
||||
return AVIERR_BADHANDLE;
|
||||
if (size < sizeof(AVIFILEINFOA))
|
||||
return AVIERR_BADSIZE;
|
||||
|
||||
hres = IAVIFile_Info(pfile, &afiw, sizeof(afiw));
|
||||
|
||||
memcpy(afi, &afiw, sizeof(*afi) - sizeof(afi->szFileType));
|
||||
WideCharToMultiByte(CP_ACP, 0, afiw.szFileType, -1, afi->szFileType,
|
||||
sizeof(afi->szFileType), NULL, NULL);
|
||||
afi->szFileType[sizeof(afi->szFileType) - 1] = 0;
|
||||
|
||||
return hres;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileInfoW (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIFileInfoW(PAVIFILE pfile, LPAVIFILEINFOW afiw, LONG size)
|
||||
{
|
||||
TRACE("(%p,%p,%ld)\n", pfile, afiw, size);
|
||||
|
||||
if (pfile == NULL)
|
||||
return AVIERR_BADHANDLE;
|
||||
|
||||
return IAVIFile_Info(pfile, afiw, size);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileGetStream (AVIFIL32.@)
|
||||
* AVIFileGetStream (AVIFILE.143)
|
||||
*/
|
||||
HRESULT WINAPI AVIFileGetStream(PAVIFILE pfile, PAVISTREAM *avis,
|
||||
DWORD fccType, LONG lParam)
|
||||
{
|
||||
TRACE("(%p,%p,'%4.4s',%ld)\n", pfile, avis, (char*)&fccType, lParam);
|
||||
|
||||
if (pfile == NULL)
|
||||
return AVIERR_BADHANDLE;
|
||||
|
||||
return IAVIFile_GetStream(pfile, avis, fccType, lParam);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileCreateStreamA (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE pfile, PAVISTREAM *ppavi,
|
||||
LPAVISTREAMINFOA psi)
|
||||
{
|
||||
AVISTREAMINFOW psiw;
|
||||
|
||||
TRACE("(%p,%p,%p)\n", pfile, ppavi, psi);
|
||||
|
||||
if (pfile == NULL)
|
||||
return AVIERR_BADHANDLE;
|
||||
|
||||
/* Only the szName at the end is different */
|
||||
memcpy(&psiw, psi, sizeof(*psi) - sizeof(psi->szName));
|
||||
MultiByteToWideChar(CP_ACP, 0, psi->szName, -1, psiw.szName,
|
||||
sizeof(psiw.szName) / sizeof(psiw.szName[0]));
|
||||
|
||||
return IAVIFile_CreateStream(pfile, ppavi, &psiw);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileCreateStreamW (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIFileCreateStreamW(PAVIFILE pfile, PAVISTREAM *avis,
|
||||
LPAVISTREAMINFOW asi)
|
||||
{
|
||||
TRACE("(%p,%p,%p)\n", pfile, avis, asi);
|
||||
|
||||
return IAVIFile_CreateStream(pfile, avis, asi);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileWriteData (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIFileWriteData(PAVIFILE pfile,DWORD fcc,LPVOID lp,LONG size)
|
||||
{
|
||||
TRACE("(%p,'%4.4s',%p,%ld)\n", pfile, (char*)&fcc, lp, size);
|
||||
|
||||
if (pfile == NULL)
|
||||
return AVIERR_BADHANDLE;
|
||||
|
||||
return IAVIFile_WriteData(pfile, fcc, lp, size);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileReadData (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIFileReadData(PAVIFILE pfile,DWORD fcc,LPVOID lp,LPLONG size)
|
||||
{
|
||||
TRACE("(%p,'%4.4s',%p,%p)\n", pfile, (char*)&fcc, lp, size);
|
||||
|
||||
if (pfile == NULL)
|
||||
return AVIERR_BADHANDLE;
|
||||
|
||||
return IAVIFile_ReadData(pfile, fcc, lp, size);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIFileEndRecord (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIFileEndRecord(PAVIFILE pfile)
|
||||
{
|
||||
TRACE("(%p)\n", pfile);
|
||||
|
||||
if (pfile == NULL)
|
||||
return AVIERR_BADHANDLE;
|
||||
|
||||
return IAVIFile_EndRecord(pfile);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamAddRef (AVIFIL32.@)
|
||||
*/
|
||||
ULONG WINAPI AVIStreamAddRef(PAVISTREAM pstream)
|
||||
{
|
||||
TRACE("(%p)\n", pstream);
|
||||
|
||||
if (pstream == NULL) {
|
||||
ERR(": bad handle passed!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return IAVIStream_AddRef(pstream);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamRelease (AVIFIL32.@)
|
||||
*/
|
||||
ULONG WINAPI AVIStreamRelease(PAVISTREAM pstream)
|
||||
{
|
||||
TRACE("(%p)\n", pstream);
|
||||
|
||||
if (pstream == NULL) {
|
||||
ERR(": bad handle passed!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return IAVIStream_Release(pstream);
|
||||
}
|
||||
|
||||
HRESULT WINAPI AVIStreamCreate(PAVISTREAM *ppavi, LONG lParam1, LONG lParam2,
|
||||
LPCLSID pclsidHandler)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p,0x%08lX,0x%08lX,%s)\n", ppavi, lParam1, lParam2,
|
||||
debugstr_guid(pclsidHandler));
|
||||
|
||||
if (ppavi == NULL)
|
||||
return AVIERR_BADPARAM;
|
||||
|
||||
*ppavi = NULL;
|
||||
if (pclsidHandler == NULL)
|
||||
return AVIERR_UNSUPPORTED;
|
||||
|
||||
hr = SHCoCreateInstance(NULL, pclsidHandler, NULL,
|
||||
&IID_IAVIStream, (LPVOID*)ppavi);
|
||||
if (FAILED(hr) || *ppavi == NULL)
|
||||
return hr;
|
||||
|
||||
hr = IAVIStream_Create(*ppavi, lParam1, lParam2);
|
||||
if (FAILED(hr)) {
|
||||
IAVIStream_Release(*ppavi);
|
||||
*ppavi = NULL;
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamInfoA (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamInfoA(PAVISTREAM pstream, LPAVISTREAMINFOA asi,
|
||||
LONG size)
|
||||
{
|
||||
AVISTREAMINFOW asiw;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p,%p,%ld)\n", pstream, asi, size);
|
||||
|
||||
if (pstream == NULL)
|
||||
return AVIERR_BADHANDLE;
|
||||
if (size < sizeof(AVISTREAMINFOA))
|
||||
return AVIERR_BADSIZE;
|
||||
|
||||
hres = IAVIStream_Info(pstream, &asiw, sizeof(asiw));
|
||||
|
||||
memcpy(asi, &asiw, sizeof(asiw) - sizeof(asiw.szName));
|
||||
WideCharToMultiByte(CP_ACP, 0, asiw.szName, -1, asi->szName,
|
||||
sizeof(asi->szName), NULL, NULL);
|
||||
asi->szName[sizeof(asi->szName) - 1] = 0;
|
||||
|
||||
return hres;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamInfoW (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamInfoW(PAVISTREAM pstream, LPAVISTREAMINFOW asi,
|
||||
LONG size)
|
||||
{
|
||||
TRACE("(%p,%p,%ld)\n", pstream, asi, size);
|
||||
|
||||
if (pstream == NULL)
|
||||
return AVIERR_BADHANDLE;
|
||||
|
||||
return IAVIStream_Info(pstream, asi, size);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamFindSample (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamFindSample(PAVISTREAM pstream, LONG pos, DWORD flags)
|
||||
{
|
||||
TRACE("(%p,%ld,0x%lX)\n", pstream, pos, flags);
|
||||
|
||||
if (pstream == NULL)
|
||||
return -1;
|
||||
|
||||
return IAVIStream_FindSample(pstream, pos, flags);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamReadFormat (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM pstream, LONG pos,
|
||||
LPVOID format, LPLONG formatsize)
|
||||
{
|
||||
TRACE("(%p,%ld,%p,%p)\n", pstream, pos, format, formatsize);
|
||||
|
||||
if (pstream == NULL)
|
||||
return AVIERR_BADHANDLE;
|
||||
|
||||
return IAVIStream_ReadFormat(pstream, pos, format, formatsize);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamSetFormat (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM pstream, LONG pos,
|
||||
LPVOID format, LONG formatsize)
|
||||
{
|
||||
TRACE("(%p,%ld,%p,%ld)\n", pstream, pos, format, formatsize);
|
||||
|
||||
if (pstream == NULL)
|
||||
return AVIERR_BADHANDLE;
|
||||
|
||||
return IAVIStream_SetFormat(pstream, pos, format, formatsize);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamRead (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamRead(PAVISTREAM pstream, LONG start, LONG samples,
|
||||
LPVOID buffer, LONG buffersize,
|
||||
LPLONG bytesread, LPLONG samplesread)
|
||||
{
|
||||
TRACE("(%p,%ld,%ld,%p,%ld,%p,%p)\n", pstream, start, samples, buffer,
|
||||
buffersize, bytesread, samplesread);
|
||||
|
||||
if (pstream == NULL)
|
||||
return AVIERR_BADHANDLE;
|
||||
|
||||
return IAVIStream_Read(pstream, start, samples, buffer, buffersize,
|
||||
bytesread, samplesread);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamWrite (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamWrite(PAVISTREAM pstream, LONG start, LONG samples,
|
||||
LPVOID buffer, LONG buffersize, DWORD flags,
|
||||
LPLONG sampwritten, LPLONG byteswritten)
|
||||
{
|
||||
TRACE("(%p,%ld,%ld,%p,%ld,0x%lX,%p,%p)\n", pstream, start, samples, buffer,
|
||||
buffersize, flags, sampwritten, byteswritten);
|
||||
|
||||
if (pstream == NULL)
|
||||
return AVIERR_BADHANDLE;
|
||||
|
||||
return IAVIStream_Write(pstream, start, samples, buffer, buffersize,
|
||||
flags, sampwritten, byteswritten);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamReadData (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamReadData(PAVISTREAM pstream, DWORD fcc, LPVOID lp,
|
||||
LPLONG lpread)
|
||||
{
|
||||
TRACE("(%p,'%4.4s',%p,%p)\n", pstream, (char*)&fcc, lp, lpread);
|
||||
|
||||
if (pstream == NULL)
|
||||
return AVIERR_BADHANDLE;
|
||||
|
||||
return IAVIStream_ReadData(pstream, fcc, lp, lpread);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamWriteData (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamWriteData(PAVISTREAM pstream, DWORD fcc, LPVOID lp,
|
||||
LONG size)
|
||||
{
|
||||
TRACE("(%p,'%4.4s',%p,%ld)\n", pstream, (char*)&fcc, lp, size);
|
||||
|
||||
if (pstream == NULL)
|
||||
return AVIERR_BADHANDLE;
|
||||
|
||||
return IAVIStream_WriteData(pstream, fcc, lp, size);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamGetFrameOpen (AVIFIL32.@)
|
||||
*/
|
||||
PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM pstream,
|
||||
LPBITMAPINFOHEADER lpbiWanted)
|
||||
{
|
||||
PGETFRAME pg = NULL;
|
||||
|
||||
TRACE("(%p,%p)\n", pstream, lpbiWanted);
|
||||
|
||||
if (FAILED(IAVIStream_QueryInterface(pstream, &IID_IGetFrame, (LPVOID*)&pg)) ||
|
||||
pg == NULL) {
|
||||
FIXME(": need internal class for IGetFrame!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (FAILED(IGetFrame_SetFormat(pg, lpbiWanted, NULL, 0, 0, -1, -1))) {
|
||||
IGetFrame_Release(pg);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pg;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamGetFrame (AVIFIL32.@)
|
||||
*/
|
||||
LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pg, LONG pos)
|
||||
{
|
||||
TRACE("(%p,%ld)\n", pg, pos);
|
||||
|
||||
if (pg == NULL)
|
||||
return NULL;
|
||||
|
||||
return IGetFrame_GetFrame(pg, pos);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamGetFrameClose (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pg)
|
||||
{
|
||||
TRACE("(%p)\n", pg);
|
||||
|
||||
if (pg != NULL)
|
||||
return IGetFrame_Release(pg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIMakeCompressedStream (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed,
|
||||
PAVISTREAM psSource,
|
||||
LPAVICOMPRESSOPTIONS aco,
|
||||
LPCLSID pclsidHandler)
|
||||
{
|
||||
AVISTREAMINFOW asiw;
|
||||
CHAR szRegKey[25];
|
||||
CHAR szValue[100];
|
||||
CLSID clsidHandler;
|
||||
HRESULT hr;
|
||||
LONG size = sizeof(szValue);
|
||||
|
||||
TRACE("(%p,%p,%p,%s)\n", ppsCompressed, psSource, aco,
|
||||
debugstr_guid(pclsidHandler));
|
||||
|
||||
if (ppsCompressed == NULL)
|
||||
return AVIERR_BADPARAM;
|
||||
if (psSource == NULL)
|
||||
return AVIERR_BADHANDLE;
|
||||
|
||||
*ppsCompressed = NULL;
|
||||
|
||||
/* if no handler given get default ones based on streamtype */
|
||||
if (pclsidHandler == NULL) {
|
||||
hr = IAVIStream_Info(psSource, &asiw, sizeof(asiw));
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
|
||||
wsprintfA(szRegKey, "AVIFile\\Compressors\\%4.4s", (char*)&asiw.fccHandler);
|
||||
if (RegQueryValueA(HKEY_CLASSES_ROOT, szRegKey, szValue, &size) != ERROR_SUCCESS)
|
||||
return AVIERR_UNSUPPORTED;
|
||||
if (AVIFILE_CLSIDFromString(szValue, &clsidHandler) != S_OK)
|
||||
return AVIERR_UNSUPPORTED;
|
||||
} else
|
||||
memcpy(&clsidHandler, pclsidHandler, sizeof(clsidHandler));
|
||||
|
||||
hr = SHCoCreateInstance(NULL, &clsidHandler, NULL,
|
||||
&IID_IAVIStream, (LPVOID*)ppsCompressed);
|
||||
if (FAILED(hr) || *ppsCompressed == NULL)
|
||||
return hr;
|
||||
|
||||
hr = IAVIStream_Create(*ppsCompressed, (LPARAM)psSource, (LPARAM)aco);
|
||||
if (FAILED(hr)) {
|
||||
IAVIStream_Release(*ppsCompressed);
|
||||
*ppsCompressed = NULL;
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamOpenFromFileA (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamOpenFromFileA(PAVISTREAM *ppavi, LPCSTR szFile,
|
||||
DWORD fccType, LONG lParam,
|
||||
UINT mode, LPCLSID pclsidHandler)
|
||||
{
|
||||
PAVIFILE pfile = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p,%s,'%4.4s',%ld,0x%X,%s)\n", ppavi, debugstr_a(szFile),
|
||||
(char*)&fccType, lParam, mode, debugstr_guid(pclsidHandler));
|
||||
|
||||
if (ppavi == NULL || szFile == NULL)
|
||||
return AVIERR_BADPARAM;
|
||||
|
||||
*ppavi = NULL;
|
||||
|
||||
hr = AVIFileOpenA(&pfile, szFile, mode, pclsidHandler);
|
||||
if (FAILED(hr) || pfile == NULL)
|
||||
return hr;
|
||||
|
||||
hr = IAVIFile_GetStream(pfile, ppavi, fccType, lParam);
|
||||
IAVIFile_Release(pfile);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamOpenFromFileW (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIStreamOpenFromFileW(PAVISTREAM *ppavi, LPCWSTR szFile,
|
||||
DWORD fccType, LONG lParam,
|
||||
UINT mode, LPCLSID pclsidHandler)
|
||||
{
|
||||
PAVIFILE pfile = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p,%s,'%4.4s',%ld,0x%X,%s)\n", ppavi, debugstr_w(szFile),
|
||||
(char*)&fccType, lParam, mode, debugstr_guid(pclsidHandler));
|
||||
|
||||
if (ppavi == NULL || szFile == NULL)
|
||||
return AVIERR_BADPARAM;
|
||||
|
||||
*ppavi = NULL;
|
||||
|
||||
hr = AVIFileOpenW(&pfile, szFile, mode, pclsidHandler);
|
||||
if (FAILED(hr) || pfile == NULL)
|
||||
return hr;
|
||||
|
||||
hr = IAVIFile_GetStream(pfile, ppavi, fccType, lParam);
|
||||
IAVIFile_Release(pfile);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamStart (AVIFIL32.@)
|
||||
*/
|
||||
LONG WINAPI AVIStreamStart(PAVISTREAM pstream)
|
||||
{
|
||||
AVISTREAMINFOW asiw;
|
||||
|
||||
TRACE("(%p)\n", pstream);
|
||||
|
||||
if (pstream == NULL)
|
||||
return 0;
|
||||
|
||||
if (FAILED(IAVIStream_Info(pstream, &asiw, sizeof(asiw))))
|
||||
return 0;
|
||||
|
||||
return asiw.dwLength;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamLength (AVIFIL32.@)
|
||||
*/
|
||||
LONG WINAPI AVIStreamLength(PAVISTREAM pstream)
|
||||
{
|
||||
AVISTREAMINFOW asiw;
|
||||
|
||||
TRACE("(%p)\n", pstream);
|
||||
|
||||
if (pstream == NULL)
|
||||
return 0;
|
||||
|
||||
if (FAILED(IAVIStream_Info(pstream, &asiw, sizeof(asiw))))
|
||||
return 0;
|
||||
|
||||
return asiw.dwLength;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamSampleToTime (AVIFIL32.@)
|
||||
*/
|
||||
LONG WINAPI AVIStreamSampleToTime(PAVISTREAM pstream, LONG lSample)
|
||||
{
|
||||
AVISTREAMINFOW asiw;
|
||||
|
||||
TRACE("(%p,%ld)\n", pstream, lSample);
|
||||
|
||||
if (pstream == NULL)
|
||||
return -1;
|
||||
|
||||
if (FAILED(IAVIStream_Info(pstream, &asiw, sizeof(asiw))))
|
||||
return -1;
|
||||
if (asiw.dwRate == 0)
|
||||
return -1;
|
||||
|
||||
return (LONG)(((float)lSample * asiw.dwScale * 1000.0) / asiw.dwRate);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AVIStreamTimeToSample (AVIFIL32.@)
|
||||
*/
|
||||
LONG WINAPI AVIStreamTimeToSample(PAVISTREAM pstream, LONG lTime)
|
||||
{
|
||||
AVISTREAMINFOW asiw;
|
||||
|
||||
TRACE("(%p,%ld)\n", pstream, lTime);
|
||||
|
||||
if (pstream == NULL)
|
||||
return -1;
|
||||
|
||||
if (FAILED(IAVIStream_Info(pstream, &asiw, sizeof(asiw))))
|
||||
return -1;
|
||||
if (asiw.dwScale == 0)
|
||||
return -1;
|
||||
|
||||
return (LONG)(((float)lTime * asiw.dwRate) / asiw.dwScale / 1000.0);
|
||||
}
|
|
@ -2,11 +2,11 @@
|
|||
@ stub AVIBuildFilterA
|
||||
@ stub AVIBuildFilterW
|
||||
@ stub AVIClearClipboard
|
||||
@ stub AVIFileAddRef
|
||||
@ stdcall AVIFileAddRef(ptr) AVIFileAddRef
|
||||
@ stub AVIFileCreateStream
|
||||
@ stdcall AVIFileCreateStreamA(ptr ptr ptr) AVIFileCreateStreamA
|
||||
@ stdcall AVIFileCreateStreamW(ptr ptr ptr) AVIFileCreateStreamW
|
||||
@ stub AVIFileEndRecord
|
||||
@ stdcall AVIFileEndRecord(ptr) AVIFileEndRecord
|
||||
@ stdcall AVIFileExit() AVIFileExit
|
||||
@ stdcall AVIFileGetStream(ptr ptr long long) AVIFileGetStream
|
||||
@ stdcall AVIFileInfo (ptr ptr long) AVIFileInfoA # A in both Win95 and NT
|
||||
|
@ -15,10 +15,10 @@
|
|||
@ stdcall AVIFileInit() AVIFileInit
|
||||
@ stub AVIFileOpen
|
||||
@ stdcall AVIFileOpenA(ptr str long ptr) AVIFileOpenA
|
||||
@ stub AVIFileOpenW
|
||||
@ stub AVIFileReadData
|
||||
@ stdcall AVIFileOpenW(ptr str long ptr) AVIFileOpenW
|
||||
@ stdcall AVIFileReadData(ptr long ptr ptr) AVIFileReadData
|
||||
@ stdcall AVIFileRelease(ptr) AVIFileRelease
|
||||
@ stub AVIFileWriteData
|
||||
@ stdcall AVIFileWriteData(ptr long ptr long) AVIFileWriteData
|
||||
@ stub AVIGetFromClipboard
|
||||
@ stdcall AVIMakeCompressedStream(ptr ptr ptr ptr) AVIMakeCompressedStream
|
||||
@ stub AVIMakeFileFromStreams
|
||||
|
@ -32,11 +32,11 @@
|
|||
@ stub AVISaveVA
|
||||
@ stub AVISaveVW
|
||||
@ stub AVISaveW
|
||||
@ stub AVIStreamAddRef
|
||||
@ stdcall AVIStreamAddRef(ptr) AVIStreamAddRef
|
||||
@ stub AVIStreamBeginStreaming
|
||||
@ stub AVIStreamCreate
|
||||
@ stdcall AVIStreamCreate(ptr long long ptr) AVIStreamCreate
|
||||
@ stub AVIStreamEndStreaming
|
||||
@ stub AVIStreamFindSample
|
||||
@ stdcall AVIStreamFindSample(ptr long long) AVIStreamFindSample
|
||||
@ stdcall AVIStreamGetFrame(ptr long) AVIStreamGetFrame
|
||||
@ stdcall AVIStreamGetFrameClose(ptr) AVIStreamGetFrameClose
|
||||
@ stdcall AVIStreamGetFrameOpen(ptr ptr) AVIStreamGetFrameOpen
|
||||
|
@ -45,16 +45,16 @@
|
|||
@ stdcall AVIStreamInfoW(ptr ptr long) AVIStreamInfoW
|
||||
@ stdcall AVIStreamLength(ptr) AVIStreamLength
|
||||
@ stub AVIStreamOpenFromFile
|
||||
@ stub AVIStreamOpenFromFileA
|
||||
@ stub AVIStreamOpenFromFileW
|
||||
@ stdcall AVIStreamOpenFromFileA(ptr str long long long ptr) AVIStreamOpenFromFileA
|
||||
@ stdcall AVIStreamOpenFromFileW(ptr wstr long long long ptr) AVIStreamOpenFromFileW
|
||||
@ stdcall AVIStreamRead(ptr long long ptr long ptr ptr) AVIStreamRead
|
||||
@ stdcall AVIStreamReadData(ptr long ptr ptr) AVIStreamReadData
|
||||
@ stdcall AVIStreamReadFormat(ptr long ptr long) AVIStreamReadFormat
|
||||
@ stdcall AVIStreamRelease(ptr) AVIStreamRelease
|
||||
@ stub AVIStreamSampleToTime
|
||||
@ stdcall AVIStreamSampleToTime(ptr long) AVIStreamSampleToTime
|
||||
@ stdcall AVIStreamSetFormat(ptr long ptr long) AVIStreamSetFormat
|
||||
@ stdcall AVIStreamStart(ptr) AVIStreamStart
|
||||
@ stub AVIStreamTimeToSample
|
||||
@ stdcall AVIStreamTimeToSample(ptr long) AVIStreamTimeToSample
|
||||
@ stdcall AVIStreamWrite(ptr long long ptr long long ptr ptr) AVIStreamWrite
|
||||
@ stdcall AVIStreamWriteData(ptr long ptr long) AVIStreamWriteData
|
||||
@ stub CLSID_AVISimpleUnMarshal
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -15,8 +15,8 @@
|
|||
100 pascal AVIFileInit() AVIFileInit
|
||||
101 pascal AVIFileExit() AVIFileExit
|
||||
102 pascal AVIFileOpen(ptr str word ptr) AVIFileOpenA
|
||||
103 stub AVISTREAMOPENFROMFILE
|
||||
104 stub AVISTREAMCREATE
|
||||
103 pascal AVIStreamOpenFromFile(ptr str long word ptr) AVIStreamOpenFromFileA
|
||||
104 pascal AVIStreamCreate(ptr long long ptr) AVIStreamCreate
|
||||
105 stub AVIMAKECOMPRESSEDSTREAM
|
||||
106 stub AVIMAKEFILEFROMSTREAMS
|
||||
107 stub AVIMAKESTREAMFROMCLIPBOARD
|
||||
|
@ -28,20 +28,20 @@
|
|||
122 stub AVISAVEOPTIONS
|
||||
123 stub AVIBUILDFILTER
|
||||
124 stub AVISAVEOPTIONSFREE
|
||||
130 stub AVISTREAMSTART
|
||||
131 stub AVISTREAMLENGTH
|
||||
132 stub AVISTREAMTIMETOSAMPLE
|
||||
133 stub AVISTREAMSAMPLETOTIME
|
||||
140 stub AVIFILEADDREF
|
||||
130 pascal AVIStreamStart(long) AVIStreamStart
|
||||
131 pascal AVIStreamLength(long) AVIStreamLength
|
||||
132 pascal AVIStreamTimeToSample(long long) AVIStreamTimeToSample
|
||||
133 pascal AVIStreamSampleToTime(long long) AVIStreamSampleToTime
|
||||
140 pascal AVIFileAddRef(long) AVIFileAddRef
|
||||
141 pascal AVIFileRelease(long) AVIFileRelease
|
||||
142 stub AVIFILEINFO
|
||||
142 pascal AVIFileInfo(long ptr long) AVIFileInfoA
|
||||
143 pascal AVIFileGetStream(long ptr long long) AVIFileGetStream
|
||||
144 stub AVIFILECREATESTREAM
|
||||
146 stub AVIFILEWRITEDATA
|
||||
147 stub AVIFILEREADDATA
|
||||
148 stub AVIFILEENDRECORD
|
||||
160 stub AVISTREAMADDREF
|
||||
161 stub AVISTREAMRELEASE
|
||||
148 pascal AVIFileEndRecord(long) AVIFileEndRecord
|
||||
160 pascal AVIStreamAddRef(long) AVIStreamAddRef
|
||||
161 pascal AVIStreamRelease(long) AVIStreamRelease
|
||||
162 stub AVISTREAMINFO
|
||||
163 stub AVISTREAMFINDSAMPLE
|
||||
164 stub AVISTREAMREADFORMAT
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright 2002 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
|
||||
*/
|
||||
|
||||
#ifndef __AVIFILE_PRIVATE_H
|
||||
#define __AVIFILE_PRIVATE_H
|
||||
|
||||
#ifndef MAX_AVISTREAMS
|
||||
#define MAX_AVISTREAMS 4
|
||||
#endif
|
||||
|
||||
DEFINE_AVIGUID(CLSID_ICMStream, 0x00020001, 0, 0);
|
||||
DEFINE_AVIGUID(CLSID_WAVFile, 0x00020003, 0, 0);
|
||||
DEFINE_AVIGUID(CLSID_ACMStream, 0x0002000F, 0, 0);
|
||||
|
||||
extern HMODULE AVIFILE_hModule;
|
||||
|
||||
extern HRESULT AVIFILE_CreateAVIFile(REFIID riid, LPVOID *ppobj);
|
||||
extern HRESULT AVIFILE_CreateWAVFile(REFIID riid, LPVOID *ppobj);
|
||||
extern HRESULT AVIFILE_CreateACMStream(REFIID riid, LPVOID *ppobj);
|
||||
extern HRESULT AVIFILE_CreateICMStream(REFIID riid, LPVOID *ppobj);
|
||||
|
||||
#endif
|
|
@ -0,0 +1,200 @@
|
|||
/*
|
||||
* Copyright 2002 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
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
|
||||
#include "ole2.h"
|
||||
#include "vfw.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(avifile);
|
||||
|
||||
#include "initguid.h"
|
||||
#include "avifile_private.h"
|
||||
|
||||
HMODULE AVIFILE_hModule = (HMODULE)NULL;
|
||||
|
||||
BOOL AVIFILE_bLocked = FALSE;
|
||||
UINT AVIFILE_uUseCount = 0;
|
||||
|
||||
static HRESULT WINAPI IClassFactory_fnQueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj);
|
||||
static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface);
|
||||
static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface);
|
||||
static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj);
|
||||
static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface,BOOL dolock);
|
||||
|
||||
static ICOM_VTABLE(IClassFactory) iclassfact = {
|
||||
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
|
||||
IClassFactory_fnQueryInterface,
|
||||
IClassFactory_fnAddRef,
|
||||
IClassFactory_fnRelease,
|
||||
IClassFactory_fnCreateInstance,
|
||||
IClassFactory_fnLockServer
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/* IUnknown fields */
|
||||
ICOM_VFIELD(IClassFactory);
|
||||
DWORD dwRef;
|
||||
|
||||
CLSID clsid;
|
||||
} IClassFactoryImpl;
|
||||
|
||||
static HRESULT AVIFILE_CreateClassFactory(const CLSID *pclsid, const IID *riid,
|
||||
LPVOID *ppv)
|
||||
{
|
||||
IClassFactoryImpl *pClassFactory = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
*ppv = NULL;
|
||||
|
||||
pClassFactory = (IClassFactoryImpl*)LocalAlloc(LPTR, sizeof(*pClassFactory));
|
||||
if (pClassFactory == NULL)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
ICOM_VTBL(pClassFactory) = &iclassfact;
|
||||
pClassFactory->dwRef = 0;
|
||||
memcpy(&pClassFactory->clsid, pclsid, sizeof(pClassFactory->clsid));
|
||||
|
||||
hr = IUnknown_QueryInterface((IUnknown*)pClassFactory, riid, ppv);
|
||||
if (FAILED(hr)) {
|
||||
LocalFree((HLOCAL)pClassFactory);
|
||||
*ppv = NULL;
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IClassFactory_fnQueryInterface(LPCLASSFACTORY iface,
|
||||
REFIID riid,LPVOID *ppobj)
|
||||
{
|
||||
TRACE("(%p,%p,%p)\n", iface, riid, ppobj);
|
||||
|
||||
if ((IsEqualGUID(&IID_IUnknown, riid)) ||
|
||||
(IsEqualGUID(&IID_IClassFactory, riid))) {
|
||||
*ppobj = iface;
|
||||
IClassFactory_AddRef(iface);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface)
|
||||
{
|
||||
ICOM_THIS(IClassFactoryImpl,iface);
|
||||
|
||||
TRACE("(%p)\n", iface);
|
||||
|
||||
return ++(This->dwRef);
|
||||
}
|
||||
|
||||
static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface)
|
||||
{
|
||||
ICOM_THIS(IClassFactoryImpl,iface);
|
||||
|
||||
TRACE("(%p)\n", iface);
|
||||
if ((--(This->dwRef)) > 0)
|
||||
return This->dwRef;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY iface,
|
||||
LPUNKNOWN pOuter,
|
||||
REFIID riid,LPVOID *ppobj)
|
||||
{
|
||||
ICOM_THIS(IClassFactoryImpl,iface);
|
||||
|
||||
FIXME("(%p,%p,%s,%p): stub!\n", iface, pOuter, debugstr_guid(riid), ppobj);
|
||||
|
||||
if (ppobj == NULL || pOuter != NULL)
|
||||
return E_FAIL;
|
||||
*ppobj = NULL;
|
||||
|
||||
if (IsEqualGUID(&CLSID_AVIFile, &This->clsid))
|
||||
return AVIFILE_CreateAVIFile(riid,ppobj);
|
||||
/* if (IsEqualGUID(&CLSID_ICMStream, This->clsid)) */
|
||||
/* return AVIFILE_CreateICMStream(riid,ppobj); */
|
||||
/* if (IsEqualGUID(&CLSID_WAVFile, This->clsid)) */
|
||||
/* return AVIFILE_CreateWAVFile(riid,ppobj); */
|
||||
/* if (IsEqualGUID(&CLSID_ACMStream, This->clsid)) */
|
||||
/* return AVIFILE_CreateACMStream(riid,ppobj); */
|
||||
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface,BOOL dolock)
|
||||
{
|
||||
TRACE("(%p,%d)\n",iface,dolock);
|
||||
|
||||
AVIFILE_bLocked = dolock;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* DllGetClassObject (AVIFIL32.@)
|
||||
*/
|
||||
HRESULT WINAPI AVIFILE_DllGetClassObject(const CLSID* pclsid,REFIID piid,LPVOID *ppv)
|
||||
{
|
||||
TRACE("(%s,%s,%p)\n", debugstr_guid(pclsid), debugstr_guid(piid), ppv);
|
||||
|
||||
if (pclsid == NULL || piid == NULL || ppv == NULL)
|
||||
return E_FAIL;
|
||||
|
||||
return AVIFILE_CreateClassFactory(pclsid,piid,ppv);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* DllCanUnloadNow (AVIFIL32.@)
|
||||
*/
|
||||
DWORD WINAPI AVIFILE_DllCanUnloadNow(void)
|
||||
{
|
||||
return ((AVIFILE_bLocked || AVIFILE_uUseCount) ? S_FALSE : S_OK);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* AVIFILE_DllMain [internal]
|
||||
*/
|
||||
BOOL WINAPI AVIFILE_DllMain(HINSTANCE hInstDll, DWORD fdwReason,
|
||||
LPVOID lpvReserved)
|
||||
{
|
||||
TRACE("(%d,%lu,%p)\n", hInstDll, fdwReason, lpvReserved);
|
||||
|
||||
switch (fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
if (AVIFILE_hModule == (HMODULE)NULL)
|
||||
AVIFILE_hModule = (HMODULE)hInstDll;
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
case DLL_THREAD_ATTACH:
|
||||
break;
|
||||
case DLL_THREAD_DETACH:
|
||||
break;
|
||||
};
|
||||
|
||||
return TRUE;
|
||||
}
|
|
@ -1020,24 +1020,26 @@ ICOM_DEFINE(IAVIStream, IUnknown)
|
|||
#define IAVIStream_WriteData(p,a,b,c) ICOM_CALL3(WriteData,p,a,b,c)
|
||||
#define IAVIStream_SetInfo(p,a,b) ICOM_CALL2(SetInfo,p,a,b)
|
||||
|
||||
HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM*ppsCompressed,PAVISTREAM ppsSource,AVICOMPRESSOPTIONS *lpOptions,CLSID*pclsidHandler);
|
||||
|
||||
ULONG WINAPI AVIStreamAddRef(PAVISTREAM iface);
|
||||
ULONG WINAPI AVIStreamRelease(PAVISTREAM iface);
|
||||
HRESULT WINAPI AVIStreamCreate(PAVISTREAM*,LONG,LONG,CLSID*);
|
||||
HRESULT WINAPI AVIStreamInfoA(PAVISTREAM iface,AVISTREAMINFOA *asi,LONG size);
|
||||
HRESULT WINAPI AVIStreamInfoW(PAVISTREAM iface,AVISTREAMINFOW *asi,LONG size);
|
||||
#define AVIStreamInfo WINELIB_NAME_AW(AVIStreamInfo)
|
||||
LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pg,LONG pos);
|
||||
HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pg);
|
||||
PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM pavi,LPBITMAPINFOHEADER lpbiWanted);
|
||||
LONG WINAPI AVIStreamLength(PAVISTREAM iface);
|
||||
HRESULT WINAPI AVIStreamRead(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread);
|
||||
HRESULT WINAPI AVIStreamReadData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG *lpread);
|
||||
HRESULT WINAPI AVIStreamFindSample(PAVISTREAM pstream, LONG pos, DWORD flags);
|
||||
HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG *formatsize);
|
||||
ULONG WINAPI AVIStreamRelease(PAVISTREAM iface);
|
||||
HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG formatsize);
|
||||
LONG WINAPI AVIStreamStart(PAVISTREAM iface);
|
||||
HRESULT WINAPI AVIStreamRead(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread);
|
||||
HRESULT WINAPI AVIStreamWrite(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten);
|
||||
HRESULT WINAPI AVIStreamReadData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG *lpread);
|
||||
HRESULT WINAPI AVIStreamWriteData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG size);
|
||||
|
||||
PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM pavi,LPBITMAPINFOHEADER lpbiWanted);
|
||||
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 AVIStreamOpenFromFileA(PAVISTREAM *ppavi, LPCSTR szFile,
|
||||
DWORD fccType, LONG lParam,
|
||||
UINT mode, CLSID *pclsidHandler);
|
||||
|
@ -1046,6 +1048,11 @@ HRESULT WINAPI AVIStreamOpenFromFileW(PAVISTREAM *ppavi, LPCWSTR szFile,
|
|||
UINT mode, CLSID *pclsidHandler);
|
||||
#define AVIStreamOpenFromFile WINELIB_NAME_AW(AVIStreamOpenFromFile)
|
||||
|
||||
LONG WINAPI AVIStreamStart(PAVISTREAM iface);
|
||||
LONG WINAPI AVIStreamLength(PAVISTREAM iface);
|
||||
LONG WINAPI AVIStreamSampleToTime(PAVISTREAM pstream, LONG lSample);
|
||||
LONG WINAPI AVIStreamTimeToSample(PAVISTREAM pstream, LONG lTime);
|
||||
|
||||
#define AVIStreamFormatSize(pavi, lPos, plSize) \
|
||||
AVIStreamReadFormat(pavi, lPos, NULL, plSize)
|
||||
|
||||
|
@ -1081,20 +1088,25 @@ ICOM_DEFINE(IAVIFile,IUnknown)
|
|||
#define IAVIFile_EndRecord(p) ICOM_CALL (EndRecord,p)
|
||||
#define IAVIFile_DeleteStream(p,a,b) ICOM_CALL2(DeleteStream,p,a,b)
|
||||
|
||||
HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE pfile,PAVISTREAM* ppavi,AVISTREAMINFOA* psi);
|
||||
HRESULT WINAPI AVIFileCreateStreamW(PAVIFILE pfile,PAVISTREAM* ppavi,AVISTREAMINFOW* psi);
|
||||
#define AVIFileCreateStream WINELIB_NAME_AW(AVIFileCreateStream)
|
||||
void WINAPI AVIFileExit(void);
|
||||
HRESULT WINAPI AVIFileGetStream(PAVIFILE pfile,PAVISTREAM* avis,DWORD fccType,LONG lParam);
|
||||
HRESULT WINAPI AVIFileInfoA(PAVIFILE pfile,PAVIFILEINFOA pfi,LONG lSize);
|
||||
HRESULT WINAPI AVIFileInfoW(PAVIFILE pfile,PAVIFILEINFOW pfi,LONG lSize);
|
||||
#define AVIFileInfo WINELIB_NAME_AW(AVIFileInfo)
|
||||
void WINAPI AVIFileInit(void);
|
||||
void WINAPI AVIFileExit(void);
|
||||
|
||||
HRESULT WINAPI AVIFileOpenA(PAVIFILE* ppfile,LPCSTR szFile,UINT uMode,LPCLSID lpHandler);
|
||||
HRESULT WINAPI AVIFileOpenW(PAVIFILE* ppfile,LPCWSTR szFile,UINT uMode,LPCLSID lpHandler);
|
||||
#define AVIFileOpen WINELIB_NAME_AW(AVIFileOpen)
|
||||
ULONG WINAPI AVIFileRelease(PAVIFILE iface);
|
||||
|
||||
ULONG WINAPI AVIFileAddRef(PAVIFILE pfile);
|
||||
ULONG WINAPI AVIFileRelease(PAVIFILE pfile);
|
||||
HRESULT WINAPI AVIFileInfoA(PAVIFILE pfile,PAVIFILEINFOA pfi,LONG lSize);
|
||||
HRESULT WINAPI AVIFileInfoW(PAVIFILE pfile,PAVIFILEINFOW pfi,LONG lSize);
|
||||
#define AVIFileInfo WINELIB_NAME_AW(AVIFileInfo)
|
||||
HRESULT WINAPI AVIFileGetStream(PAVIFILE pfile,PAVISTREAM* avis,DWORD fccType,LONG lParam);
|
||||
HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE pfile,PAVISTREAM* ppavi,AVISTREAMINFOA* psi);
|
||||
HRESULT WINAPI AVIFileCreateStreamW(PAVIFILE pfile,PAVISTREAM* ppavi,AVISTREAMINFOW* psi);
|
||||
#define AVIFileCreateStream WINELIB_NAME_AW(AVIFileCreateStream)
|
||||
HRESULT WINAPI AVIFileWriteData(PAVIFILE pfile,DWORD fcc,LPVOID lp,LONG size);
|
||||
HRESULT WINAPI AVIFileReadData(PAVIFILE pfile,DWORD fcc,LPVOID lp,LPLONG size);
|
||||
HRESULT WINAPI AVIFileEndRecord(PAVIFILE pfile);
|
||||
|
||||
/*****************************************************************************
|
||||
* IGetFrame interface
|
||||
|
|
Loading…
Reference in New Issue