Commit a26a2ca2 authored by Michael Günnewig's avatar Michael Günnewig Committed by Alexandre Julliard

- Move the API into a new api.c file.

- Added IClassFactory implementation. - Added IPersistFile implementation to the AVI-file handler.
parent 9f47e978
......@@ -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@
......
......@@ -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
......
......@@ -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
......
/*
* Copyright 2002 Michael Gnnewig
*
* 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
/*
* Copyright 2002 Michael Gnnewig
*
* 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment