Removed a bunch of multimedia code at Hidenori's request.

oldstable
Alexandre Julliard 2002-05-02 01:29:18 +00:00
parent d1d63927be
commit b6a7ca5855
96 changed files with 836 additions and 39188 deletions

View File

@ -517,8 +517,8 @@ advapi32/advapi32.dll$(DLLEXT): dummy kernel32.dll$(DLLEXT) ntdll.dll$(DLLEXT)
avicap32/avicap32.dll$(DLLEXT): dummy ntdll.dll$(DLLEXT)
@cd avicap32 && $(MAKE) avicap32.dll$(DLLEXT)
avifil32/avifil32.dll$(DLLEXT): dummy msvfw32.dll$(DLLEXT) ole32.dll$(DLLEXT) \
kernel32.dll$(DLLEXT) ntdll.dll$(DLLEXT)
avifil32/avifil32.dll$(DLLEXT): dummy msvfw32.dll$(DLLEXT) kernel32.dll$(DLLEXT) \
ntdll.dll$(DLLEXT)
@cd avifil32 && $(MAKE) avifil32.dll$(DLLEXT)
comctl32/comctl32.dll$(DLLEXT): dummy winmm.dll$(DLLEXT) user32.dll$(DLLEXT) \
@ -577,8 +577,7 @@ icmp/icmp.dll$(DLLEXT): dummy kernel32.dll$(DLLEXT) ntdll.dll$(DLLEXT)
imagehlp/imagehlp.dll$(DLLEXT): dummy kernel32.dll$(DLLEXT) ntdll.dll$(DLLEXT)
@cd imagehlp && $(MAKE) imagehlp.dll$(DLLEXT)
imm32/imm32.dll$(DLLEXT): dummy user32.dll$(DLLEXT) gdi32.dll$(DLLEXT) \
advapi32.dll$(DLLEXT) kernel32.dll$(DLLEXT) ntdll.dll$(DLLEXT)
imm32/imm32.dll$(DLLEXT): dummy kernel32.dll$(DLLEXT) ntdll.dll$(DLLEXT)
@cd imm32 && $(MAKE) imm32.dll$(DLLEXT)
kernel/kernel32.dll$(DLLEXT): dummy ntdll.dll$(DLLEXT) libntdll.dll.$(LIBEXT)
@ -674,9 +673,7 @@ psapi/psapi.dll$(DLLEXT): dummy kernel32.dll$(DLLEXT) ntdll.dll$(DLLEXT)
qcap/qcap.dll$(DLLEXT): dummy ntdll.dll$(DLLEXT)
@cd qcap && $(MAKE) qcap.dll$(DLLEXT)
quartz/quartz.dll$(DLLEXT): dummy oleaut32.dll$(DLLEXT) ole32.dll$(DLLEXT) \
msvfw32.dll$(DLLEXT) msacm32.dll$(DLLEXT) winmm.dll$(DLLEXT) user32.dll$(DLLEXT) \
gdi32.dll$(DLLEXT) advapi32.dll$(DLLEXT) kernel32.dll$(DLLEXT) ntdll.dll$(DLLEXT)
quartz/quartz.dll$(DLLEXT): dummy ntdll.dll$(DLLEXT)
@cd quartz && $(MAKE) quartz.dll$(DLLEXT)
rasapi32/rasapi32.dll$(DLLEXT): dummy kernel32.dll$(DLLEXT) ntdll.dll$(DLLEXT)

View File

@ -10,15 +10,8 @@ LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o
C_SRCS = \
api.c \
comentry.c \
iafile.c \
iastream.c \
igframe.c \
main.c \
string.c
avifile.c
@MAKE_DLL_RULES@
### Dependencies:

View File

@ -1,566 +0,0 @@
/*
* Copyright 1999 Marcus Meissner
* Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 <string.h>
#include <stdio.h>
#include <assert.h>
#include "winbase.h"
#include "winnls.h"
#include "mmsystem.h"
#include "winerror.h"
#include "ole2.h"
#include "vfw.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(avifile);
#include "avifile_private.h"
/***********************************************************************
* AVIFileInit (AVIFILE.100)
* AVIFileInit (AVIFIL32.@)
*/
void WINAPI AVIFileInit(void)
{
TRACE("()\n");
if ( AVIFILE_data.dwAVIFileRef == 0 )
{
if ( FAILED(CoInitialize(NULL)) )
AVIFILE_data.fInitCOM = FALSE;
else
AVIFILE_data.fInitCOM = TRUE;
}
AVIFILE_data.dwAVIFileRef ++;
}
/***********************************************************************
* AVIFileExit (AVIFILE.101)
* AVIFileExit (AVIFIL32.@)
*/
void WINAPI AVIFileExit(void)
{
TRACE("()\n");
if ( AVIFILE_data.dwAVIFileRef == 0 )
{
ERR( "unexpected AVIFileExit()\n" );
return;
}
AVIFILE_data.dwAVIFileRef --;
if ( AVIFILE_data.dwAVIFileRef == 0 )
{
if ( AVIFILE_data.fInitCOM )
{
CoUninitialize();
AVIFILE_data.fInitCOM = FALSE;
}
}
}
/***********************************************************************
* AVIFileAddRef (AVIFIL32.@)
*/
ULONG WINAPI AVIFileAddRef(PAVIFILE pfile)
{
return IAVIFile_AddRef( pfile );
}
/***********************************************************************
* AVIFileRelease (AVIFILE.141)
* AVIFileRelease (AVIFIL32.@)
*/
ULONG WINAPI AVIFileRelease(PAVIFILE pfile)
{
return IAVIFile_Release( pfile );
}
/***********************************************************************
* AVIFileOpen (AVIFILE.102)
* AVIFileOpenA (AVIFIL32.@)
*/
HRESULT WINAPI AVIFileOpenA(
PAVIFILE* ppfile,LPCSTR szFile,UINT uMode,LPCLSID lpHandler )
{
WCHAR* pwsz;
HRESULT hr;
TRACE("(%p,%p,%u,%p)\n",ppfile,szFile,uMode,lpHandler);
pwsz = AVIFILE_strdupAtoW( szFile );
if ( pwsz == NULL )
return AVIERR_MEMORY;
hr = AVIFileOpenW(ppfile,pwsz,uMode,lpHandler);
HeapFree( AVIFILE_data.hHeap, 0, pwsz );
return hr;
}
/***********************************************************************
* AVIFileOpenW (AVIFIL32.@)
*/
HRESULT WINAPI AVIFileOpenW(
PAVIFILE* ppfile,LPCWSTR szFile,UINT uMode,LPCLSID lpHandler )
{
HRESULT hr;
IClassFactory* pcf;
CLSID clsRIFF;
TRACE("(%p,%p,%u,%p)\n",ppfile,szFile,uMode,lpHandler);
*ppfile = (PAVIFILE)NULL;
if ( lpHandler == NULL )
{
/* FIXME - check RIFF type and get a handler from registry
* if IAVIFile::Open is worked...
*/
memcpy( &clsRIFF, &CLSID_AVIFile, sizeof(CLSID) );
lpHandler = &clsRIFF;
}
/*
* FIXME - MS says IAVIFile::Open will be called,
* but no such method in vfw.h... why????
*/
if ( !IsEqualGUID( lpHandler, &CLSID_AVIFile ) )
return REGDB_E_CLASSNOTREG;
hr = AVIFILE_DllGetClassObject(&CLSID_AVIFile,
&IID_IClassFactory,(void**)&pcf);
if ( hr != S_OK )
return hr;
hr = IClassFactory_CreateInstance( pcf, NULL, &IID_IAVIFile,
(void**)ppfile );
IClassFactory_Release( pcf );
if ( hr == S_OK )
{
/* FIXME??? */
hr = AVIFILE_IAVIFile_Open( *ppfile, szFile, uMode );
if ( hr != S_OK )
{
IAVIFile_Release( (*ppfile) );
*ppfile = NULL;
}
}
return hr;
}
/***********************************************************************
* AVIFileInfoW (AVIFIL32.@)
*/
HRESULT WINAPI AVIFileInfoW(PAVIFILE pfile,AVIFILEINFOW* pfi,LONG lSize)
{
return IAVIFile_Info( pfile, pfi, lSize );
}
/***********************************************************************
* AVIFileInfo (AVIFIL32.@)
* AVIFileInfoA (AVIFIL32.@)
*/
HRESULT WINAPI AVIFileInfoA(PAVIFILE pfile,AVIFILEINFOA* pfi,LONG lSize)
{
AVIFILEINFOW fiw;
HRESULT hr;
if ( lSize < sizeof(AVIFILEINFOA) )
return AVIERR_BADSIZE;
hr = AVIFileInfoW( pfile, &fiw, sizeof(AVIFILEINFOW) );
if ( hr != S_OK )
return hr;
memcpy( pfi,&fiw,sizeof(AVIFILEINFOA) );
AVIFILE_strncpyWtoA( pfi->szFileType, fiw.szFileType,
sizeof(pfi->szFileType) );
pfi->szFileType[sizeof(pfi->szFileType)-1] = 0;
return S_OK;
}
/***********************************************************************
* AVIFileGetStream (AVIFILE.143)
* AVIFileGetStream (AVIFIL32.@)
*/
HRESULT WINAPI AVIFileGetStream(PAVIFILE pfile,PAVISTREAM* pas,DWORD fccType,LONG lParam)
{
return IAVIFile_GetStream(pfile,pas,fccType,lParam);
}
/***********************************************************************
* AVIFileCreateStreamW (AVIFIL32.@)
*/
HRESULT WINAPI AVIFileCreateStreamW(PAVIFILE pfile,PAVISTREAM* ppas,AVISTREAMINFOW* pasi)
{
return IAVIFile_CreateStream(pfile,ppas,pasi);
}
/***********************************************************************
* AVIFileCreateStreamA (AVIFIL32.@)
*/
HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE pfile,PAVISTREAM* ppas,AVISTREAMINFOA* pasi)
{
AVISTREAMINFOW siw;
HRESULT hr;
memcpy( &siw,pasi,sizeof(AVISTREAMINFOA) );
AVIFILE_strncpyAtoW( siw.szName, pasi->szName,
sizeof(siw.szName)/sizeof(siw.szName[0]) );
siw.szName[sizeof(siw.szName)/sizeof(siw.szName[0])-1] = 0;
hr = AVIFileCreateStreamW(pfile,ppas,&siw);
return hr;
}
/***********************************************************************
* AVIFileWriteData (AVIFIL32.@)
*/
HRESULT WINAPI AVIFileWriteData(
PAVIFILE pfile,DWORD dwChunkId,LPVOID lpvData,LONG cbData )
{
return IAVIFile_WriteData( pfile,dwChunkId,lpvData,cbData );
}
/***********************************************************************
* AVIFileReadData (AVIFIL32.@)
*/
HRESULT WINAPI AVIFileReadData(
PAVIFILE pfile,DWORD dwChunkId,LPVOID lpvData,LPLONG pcbData )
{
return IAVIFile_ReadData( pfile,dwChunkId,lpvData,pcbData );
}
/***********************************************************************
* AVIFileEndRecord (AVIFIL32.@)
*/
HRESULT WINAPI AVIFileEndRecord( PAVIFILE pfile )
{
return IAVIFile_EndRecord( pfile );
}
/***********************************************************************
* AVIStreamAddRef (AVIFIL32.@)
*/
ULONG WINAPI AVIStreamAddRef(PAVISTREAM pas)
{
return IAVIStream_Release(pas);
}
/***********************************************************************
* AVIStreamRelease (AVIFIL32.@)
*/
ULONG WINAPI AVIStreamRelease(PAVISTREAM pas)
{
return IAVIStream_Release(pas);
}
/***********************************************************************
* AVIStreamInfoW (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamInfoW(PAVISTREAM pas,AVISTREAMINFOW* psi,LONG lSize)
{
return IAVIStream_Info(pas,psi,lSize);
}
/***********************************************************************
* AVIStreamInfo (AVIFIL32.@)
* AVIStreamInfoA (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamInfoA(PAVISTREAM pas,AVISTREAMINFOA* psi,LONG lSize)
{
AVISTREAMINFOW siw;
HRESULT hr;
if (lSize < sizeof(AVISTREAMINFOA))
return AVIERR_BADSIZE;
hr = AVIStreamInfoW(pas,&siw,sizeof(AVISTREAMINFOW));
if ( hr != S_OK )
return hr;
memcpy( psi,&siw,sizeof(AVIFILEINFOA) );
AVIFILE_strncpyWtoA( psi->szName, siw.szName, sizeof(psi->szName) );
psi->szName[sizeof(psi->szName)-1] = 0;
return hr;
}
/***********************************************************************
* AVIStreamFindSample (AVIFIL32.@)
*/
LONG WINAPI AVIStreamFindSample(PAVISTREAM pas,LONG lPos,LONG lFlags)
{
return IAVIStream_FindSample(pas,lPos,lFlags);
}
/***********************************************************************
* AVIStreamReadFormat (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM pas,LONG pos,LPVOID format,LONG *formatsize) {
return IAVIStream_ReadFormat(pas,pos,format,formatsize);
}
/***********************************************************************
* AVIStreamSetFormat (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM pas,LONG pos,LPVOID format,LONG formatsize) {
return IAVIStream_SetFormat(pas,pos,format,formatsize);
}
/***********************************************************************
* AVIStreamReadData (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamReadData(PAVISTREAM pas,DWORD fcc,LPVOID lp,LONG *lpread) {
return IAVIStream_ReadData(pas,fcc,lp,lpread);
}
/***********************************************************************
* AVIStreamWriteData (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamWriteData(PAVISTREAM pas,DWORD fcc,LPVOID lp,LONG size) {
return IAVIStream_WriteData(pas,fcc,lp,size);
}
/***********************************************************************
* AVIStreamRead (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamRead(PAVISTREAM pas,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread)
{
return IAVIStream_Read(pas,start,samples,buffer,buffersize,bytesread,samplesread);
}
/***********************************************************************
* AVIStreamWrite (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamWrite(PAVISTREAM pas,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten) {
return IAVIStream_Write(pas,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);
}
/***********************************************************************
* AVIStreamStart (AVIFIL32.@)
*/
LONG WINAPI AVIStreamStart(PAVISTREAM pas)
{
AVISTREAMINFOW si;
HRESULT hr;
hr = IAVIStream_Info(pas,&si,sizeof(si));
if (hr != S_OK)
return -1;
return (LONG)si.dwStart;
}
/***********************************************************************
* AVIStreamLength (AVIFIL32.@)
*/
LONG WINAPI AVIStreamLength(PAVISTREAM pas)
{
AVISTREAMINFOW si;
HRESULT hr;
hr = IAVIStream_Info(pas,&si,sizeof(si));
if (hr != S_OK)
return -1;
return (LONG)si.dwLength;
}
/***********************************************************************
* AVIStreamTimeToSample (AVIFIL32.@)
*/
LONG WINAPI AVIStreamTimeToSample(PAVISTREAM pas,LONG lTime)
{
AVISTREAMINFOW si;
HRESULT hr;
hr = IAVIStream_Info(pas,&si,sizeof(si));
if (hr != S_OK)
return -1;
/* I am too lazy... */
FIXME("(%p,%ld)",pas,lTime);
return (LONG)-1L;
}
/***********************************************************************
* AVIStreamSampleToTime (AVIFIL32.@)
*/
LONG WINAPI AVIStreamSampleToTime(PAVISTREAM pas,LONG lSample)
{
AVISTREAMINFOW si;
HRESULT hr;
hr = IAVIStream_Info(pas,&si,sizeof(si));
if (hr != S_OK)
return -1;
/* I am too lazy... */
FIXME("(%p,%ld)",pas,lSample);
return (LONG)-1L;
}
/***********************************************************************
* AVIStreamBeginStreaming (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamBeginStreaming(PAVISTREAM pas,LONG lStart,LONG lEnd,LONG lRate)
{
FIXME("(%p)->(%ld,%ld,%ld),stub!\n",pas,lStart,lEnd,lRate);
return E_FAIL;
}
/***********************************************************************
* AVIStreamEndStreaming (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamEndStreaming(PAVISTREAM pas)
{
FIXME("(%p)->(),stub!\n",pas);
return E_FAIL;
}
/***********************************************************************
* AVIStreamGetFrameOpen (AVIFIL32.@)
*/
PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM pas,LPBITMAPINFOHEADER pbi)
{
IGetFrame* pgf;
HRESULT hr;
AVISTREAMINFOW si;
FIXME("(%p,%p)\n",pas,pbi);
hr = IAVIStream_Info(pas,&si,sizeof(si));
if (hr != S_OK)
return NULL;
hr = AVIFILE_CreateIGetFrame((void**)&pgf,pas,pbi);
if ( hr != S_OK )
return NULL;
hr = IGetFrame_Begin( pgf, si.dwStart, si.dwLength, 1000 );
if ( hr != S_OK )
{
IGetFrame_Release( pgf );
return NULL;
}
return pgf;
}
/***********************************************************************
* AVIStreamGetFrame (AVIFIL32.@)
*/
LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pgf, LONG lPos)
{
return IGetFrame_GetFrame(pgf,lPos);
}
/***********************************************************************
* AVIStreamGetFrameClose (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pgf)
{
return IGetFrame_End(pgf);
}
/***********************************************************************
* AVIStreamOpenFromFileA (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamOpenFromFileA(PAVISTREAM* ppas, LPCSTR szFile, DWORD fccType, LONG lParam, UINT uMode, CLSID* lpHandler)
{
WCHAR* pwsz;
HRESULT hr;
pwsz = AVIFILE_strdupAtoW( szFile );
if ( pwsz == NULL )
return AVIERR_MEMORY;
hr = AVIStreamOpenFromFileW(ppas,pwsz,fccType,lParam,uMode,lpHandler);
HeapFree( AVIFILE_data.hHeap, 0, pwsz );
return hr;
}
/***********************************************************************
* AVIStreamOpenFromFileW (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamOpenFromFileW(PAVISTREAM* ppas, LPCWSTR szFile, DWORD fccType, LONG lParam, UINT uMode, CLSID* lpHandler)
{
HRESULT hr;
PAVIFILE paf;
AVIFILEINFOW fi;
*ppas = NULL;
hr = AVIFileOpenW(&paf,szFile,uMode,lpHandler);
if ( hr != S_OK )
return hr;
hr = AVIFileInfoW(paf,&fi,sizeof(AVIFILEINFOW));
if ( hr == S_OK )
hr = AVIFileGetStream(paf,ppas,fccType,lParam);
IAVIFile_Release(paf);
return hr;
}
/***********************************************************************
* AVIStreamCreate (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamCreate(PAVISTREAM* ppas, LONG lParam1, LONG lParam2, CLSID* lpHandler)
{
HRESULT hr;
IClassFactory* pcf;
*ppas = NULL;
if ( lpHandler == NULL )
{
hr = AVIFILE_DllGetClassObject(&CLSID_AVIFile,
&IID_IClassFactory,(void**)&pcf);
}
else
{
if ( !AVIFILE_data.fInitCOM )
return E_UNEXPECTED;
hr = CoGetClassObject(lpHandler,CLSCTX_INPROC_SERVER,
NULL,&IID_IClassFactory,(void**)&pcf);
}
if ( hr != S_OK )
return hr;
hr = IClassFactory_CreateInstance( pcf, NULL, &IID_IAVIStream,
(void**)ppas );
IClassFactory_Release( pcf );
if ( hr == S_OK )
{
hr = IAVIStream_Create((*ppas),lParam1,lParam2);
if ( hr != S_OK )
{
IAVIStream_Release((*ppas));
*ppas = NULL;
}
}
return hr;
}
/***********************************************************************
* AVIMakeCompressedStream (AVIFIL32.@)
*/
HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed,PAVISTREAM ppsSource,AVICOMPRESSOPTIONS *aco,CLSID *pclsidHandler)
{
FIXME("(%p,%p,%p,%p)\n",ppsCompressed,ppsSource,aco,pclsidHandler);
return E_FAIL;
}

View File

@ -1,9 +1,7 @@
name avifil32
type win32
init AVIFILE_DllMain
import msvfw32.dll
import ole32.dll
import kernel32.dll
import ntdll.dll
@ -13,11 +11,11 @@ debug_channels (avifile)
@ stub AVIBuildFilterA
@ stub AVIBuildFilterW
@ stub AVIClearClipboard
@ stdcall AVIFileAddRef(ptr) AVIFileAddRef
@ stub AVIFileAddRef
@ stub AVIFileCreateStream
@ stdcall AVIFileCreateStreamA(ptr ptr ptr) AVIFileCreateStreamA
@ stdcall AVIFileCreateStreamW(ptr ptr ptr) AVIFileCreateStreamW
@ stdcall AVIFileEndRecord(ptr) AVIFileEndRecord
@ stub AVIFileEndRecord
@ stdcall AVIFileExit() AVIFileExit
@ stdcall AVIFileGetStream(ptr ptr long long) AVIFileGetStream
@ stdcall AVIFileInfo (ptr ptr long) AVIFileInfoA # A in both Win95 and NT
@ -26,10 +24,10 @@ debug_channels (avifile)
@ stdcall AVIFileInit() AVIFileInit
@ stub AVIFileOpen
@ stdcall AVIFileOpenA(ptr str long ptr) AVIFileOpenA
@ stdcall AVIFileOpenW(ptr wstr long ptr) AVIFileOpenW
@ stdcall AVIFileReadData(ptr long ptr ptr) AVIFileReadData
@ stub AVIFileOpenW
@ stub AVIFileReadData
@ stdcall AVIFileRelease(ptr) AVIFileRelease
@ stdcall AVIFileWriteData(ptr long ptr long) AVIFileWriteData
@ stub AVIFileWriteData
@ stub AVIGetFromClipboard
@ stdcall AVIMakeCompressedStream(ptr ptr ptr ptr) AVIMakeCompressedStream
@ stub AVIMakeFileFromStreams
@ -43,11 +41,11 @@ debug_channels (avifile)
@ stub AVISaveVA
@ stub AVISaveVW
@ stub AVISaveW
@ stdcall AVIStreamAddRef(ptr) AVIStreamAddRef
@ stdcall AVIStreamBeginStreaming(ptr long long long) AVIStreamBeginStreaming
@ stdcall AVIStreamCreate(ptr long long ptr) AVIStreamCreate
@ stdcall AVIStreamEndStreaming(ptr) AVIStreamEndStreaming
@ stdcall AVIStreamFindSample(ptr long long) AVIStreamFindSample
@ stub AVIStreamAddRef
@ stub AVIStreamBeginStreaming
@ stub AVIStreamCreate
@ stub AVIStreamEndStreaming
@ stub AVIStreamFindSample
@ stdcall AVIStreamGetFrame(ptr long) AVIStreamGetFrame
@ stdcall AVIStreamGetFrameClose(ptr) AVIStreamGetFrameClose
@ stdcall AVIStreamGetFrameOpen(ptr ptr) AVIStreamGetFrameOpen
@ -56,16 +54,16 @@ debug_channels (avifile)
@ stdcall AVIStreamInfoW(ptr ptr long) AVIStreamInfoW
@ stdcall AVIStreamLength(ptr) AVIStreamLength
@ stub AVIStreamOpenFromFile
@ stdcall AVIStreamOpenFromFileA(ptr str long long long ptr) AVIStreamOpenFromFileA
@ stdcall AVIStreamOpenFromFileW(ptr wstr long long long ptr) AVIStreamOpenFromFileW
@ stub AVIStreamOpenFromFileA
@ stub 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
@ stdcall AVIStreamSampleToTime(ptr long) AVIStreamSampleToTime
@ stub AVIStreamSampleToTime
@ stdcall AVIStreamSetFormat(ptr long ptr long) AVIStreamSetFormat
@ stdcall AVIStreamStart(ptr) AVIStreamStart
@ stdcall AVIStreamTimeToSample(ptr long) AVIStreamTimeToSample
@ stub AVIStreamTimeToSample
@ stdcall AVIStreamWrite(ptr long long ptr long long ptr ptr) AVIStreamWrite
@ stdcall AVIStreamWriteData(ptr long ptr long) AVIStreamWriteData
@ stub CLSID_AVISimpleUnMarshal

View File

@ -0,0 +1,616 @@
/*
* Copyright 1999 Marcus Meissner
*
* 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 <string.h>
#include <stdio.h>
#include <assert.h>
#include "winbase.h"
#include "winnls.h"
#include "mmsystem.h"
#include "winerror.h"
#include "vfw.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(avifile);
static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile* iface,REFIID refiid,LPVOID *obj);
static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile* iface);
static ULONG WINAPI IAVIFile_fnRelease(IAVIFile* iface);
static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile*iface,AVIFILEINFOW*afi,LONG size);
static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam);
static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi);
static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG size);
static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG *size);
static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile*iface);
static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile*iface,DWORD fccType,LONG lParam);
struct ICOM_VTABLE(IAVIFile) iavift = {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IAVIFile_fnQueryInterface,
IAVIFile_fnAddRef,
IAVIFile_fnRelease,
IAVIFile_fnInfo,
IAVIFile_fnGetStream,
IAVIFile_fnCreateStream,
IAVIFile_fnWriteData,
IAVIFile_fnReadData,
IAVIFile_fnEndRecord,
IAVIFile_fnDeleteStream
};
static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj);
static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface);
static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface);
static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream*iface,LPARAM lParam1,LPARAM lParam2);
static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream*iface,AVISTREAMINFOW *psi,LONG size);
static LONG WINAPI IAVIStream_fnFindSample(IAVIStream*iface,LONG pos,LONG flags);
static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG *formatsize);
static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize);
static HRESULT WINAPI IAVIStream_fnRead(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread);
static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten);
static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream*iface,LONG start,LONG samples);
static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG *lpread);
static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG size);
static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,LONG infolen);
struct ICOM_VTABLE(IAVIStream) iavist = {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IAVIStream_fnQueryInterface,
IAVIStream_fnAddRef,
IAVIStream_fnRelease,
IAVIStream_fnCreate,
IAVIStream_fnInfo,
IAVIStream_fnFindSample,
IAVIStream_fnReadFormat,
IAVIStream_fnSetFormat,
IAVIStream_fnRead,
IAVIStream_fnWrite,
IAVIStream_fnDelete,
IAVIStream_fnReadData,
IAVIStream_fnWriteData,
IAVIStream_fnSetInfo
};
typedef struct IAVIStreamImpl {
/* IUnknown stuff */
ICOM_VFIELD(IAVIStream);
DWORD ref;
/* IAVIStream stuff */
LPVOID lpInputFormat;
DWORD inputformatsize;
BOOL iscompressing;
DWORD curframe;
/* Compressor stuff */
HIC hic;
LPVOID lpCompressFormat;
ICINFO icinfo;
DWORD compbufsize;
LPVOID compbuffer;
DWORD decompbufsize;
LPVOID decompbuffer;
LPVOID decompformat;
AVICOMPRESSOPTIONS aco;
LPVOID lpPrev; /* pointer to decompressed frame later */
LPVOID lpPrevFormat; /* pointer to decompressed info later */
} IAVIStreamImpl;
/***********************************************************************
* AVIFileInit (AVIFIL32.@)
* AVIFileInit (AVIFILE.100)
*/
void WINAPI
AVIFileInit(void) {
FIXME("(),stub!\n");
}
typedef struct IAVIFileImpl {
/* IUnknown stuff */
ICOM_VFIELD(IAVIFile);
DWORD ref;
/* IAVIFile stuff... */
} IAVIFileImpl;
static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile* iface,REFIID refiid,LPVOID *obj) {
ICOM_THIS(IAVIFileImpl,iface);
TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);
if ( !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
!memcmp(&IID_IAVIFile,refiid,sizeof(IID_IAVIFile))
) {
*obj = iface;
return S_OK;
}
return OLE_E_ENUM_NOMORE;
}
static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile* iface) {
ICOM_THIS(IAVIFileImpl,iface);
FIXME("(%p)->AddRef()\n",iface);
return ++(This->ref);
}
static ULONG WINAPI IAVIFile_fnRelease(IAVIFile* iface) {
ICOM_THIS(IAVIFileImpl,iface);
FIXME("(%p)->Release()\n",iface);
if (!--(This->ref)) {
HeapFree(GetProcessHeap(),0,iface);
return 0;
}
return This->ref;
}
static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile*iface,AVIFILEINFOW*afi,LONG size) {
FIXME("(%p)->Info(%p,%ld)\n",iface,afi,size);
/* FIXME: fill out struct? */
return E_FAIL;
}
static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam) {
FIXME("(%p)->GetStream(%p,0x%08lx,%ld)\n",iface,avis,fccType,lParam);
/* FIXME: create interface etc. */
return E_FAIL;
}
static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi) {
ICOM_THIS(IAVIStreamImpl,iface);
char fcc[5];
IAVIStreamImpl *istream;
FIXME("(%p,%p,%p)\n",This,avis,asi);
istream = (IAVIStreamImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IAVIStreamImpl));
istream->ref = 1;
ICOM_VTBL(istream) = &iavist;
fcc[4]='\0';
memcpy(fcc,(char*)&(asi->fccType),4);
FIXME("\tfccType '%s'\n",fcc);
memcpy(fcc,(char*)&(asi->fccHandler),4);
FIXME("\tfccHandler '%s'\n",fcc);
FIXME("\tdwFlags 0x%08lx\n",asi->dwFlags);
FIXME("\tdwCaps 0x%08lx\n",asi->dwCaps);
FIXME("\tname %s\n",debugstr_w(asi->szName));
istream->curframe = 0;
*avis = (PAVISTREAM)istream;
return S_OK;
}
static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG size) {
FIXME("(%p)->WriteData(0x%08lx,%p,%ld)\n",iface,ckid,lpData,size);
/* FIXME: write data to file */
return E_FAIL;
}
static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG *size) {
FIXME("(%p)->ReadData(0x%08lx,%p,%p)\n",iface,ckid,lpData,size);
/* FIXME: read at most size bytes from file */
return E_FAIL;
}
static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile*iface) {
FIXME("(%p)->EndRecord()\n",iface);
/* FIXME: end record? */
return E_FAIL;
}
static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile*iface,DWORD fccType,LONG lParam) {
FIXME("(%p)->DeleteStream(0x%08lx,%ld)\n",iface,fccType,lParam);
/* FIXME: delete stream? */
return E_FAIL;
}
/***********************************************************************
* AVIFileOpenA (AVIFIL32.@)
* AVIFileOpenA (AVIFILE.102)
*/
HRESULT WINAPI AVIFileOpenA(
PAVIFILE * ppfile,LPCSTR szFile,UINT uMode,LPCLSID lpHandler
) {
IAVIFileImpl *iavi;
FIXME("(%p,%s,0x%08lx,%s),stub!\n",ppfile,szFile,(DWORD)uMode,debugstr_guid(lpHandler));
iavi = (IAVIFileImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IAVIFileImpl));
iavi->ref = 1;
ICOM_VTBL(iavi) = &iavift;
*ppfile = (LPVOID)iavi;
return S_OK;
}
static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj) {
ICOM_THIS(IAVIStreamImpl,iface);
TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);
if ( !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) ||
!memcmp(&IID_IAVIStream,refiid,sizeof(IID_IAVIStream))
) {
*obj = This;
return S_OK;
}
/* can return IGetFrame interface too */
return OLE_E_ENUM_NOMORE;
}
static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface) {
ICOM_THIS(IAVIStreamImpl,iface);
FIXME("(%p)->AddRef()\n",iface);
return ++(This->ref);
}
static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface) {
ICOM_THIS(IAVIStreamImpl,iface);
FIXME("(%p)->Release()\n",iface);
if (!--(This->ref)) {
HeapFree(GetProcessHeap(),0,This);
return 0;
}
return This->ref;
}
static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream*iface,LPARAM lParam1,LPARAM lParam2) {
FIXME("(%p)->Create(0x%08lx,0x%08lx)\n",iface,lParam1,lParam2);
return E_FAIL;
}
static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream*iface,AVISTREAMINFOW *psi,LONG size) {
FIXME("(%p)->Info(%p,%ld)\n",iface,psi,size);
return E_FAIL;
}
static LONG WINAPI IAVIStream_fnFindSample(IAVIStream*iface,LONG pos,LONG flags) {
FIXME("(%p)->FindSample(%ld,0x%08lx)\n",iface,pos,flags);
return E_FAIL;
}
static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG *formatsize) {
FIXME("(%p)->ReadFormat(%ld,%p,%p)\n",iface,pos,format,formatsize);
return E_FAIL;
}
/***********************************************************************
* IAVIStream::SetFormat
*/
static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize) {
IAVIStreamImpl *as = (IAVIStreamImpl*)iface;
FIXME("(%p)->SetFormat(%ld,%p,%ld)\n",iface,pos,format,formatsize);
if (as->lpInputFormat) HeapFree(GetProcessHeap(),0,as->lpInputFormat);
as->inputformatsize = formatsize;
as->lpInputFormat = HeapAlloc(GetProcessHeap(),0,formatsize);
memcpy(as->lpInputFormat,format,formatsize);
if (as->iscompressing) {
int xsize;
/* Set up the Compressor part */
xsize = ICCompressGetFormatSize(as->hic,as->lpInputFormat);
as->lpCompressFormat = HeapAlloc(GetProcessHeap(),0,xsize);
ICCompressGetFormat(as->hic,as->lpInputFormat,as->lpCompressFormat);
ICCompressBegin(as->hic,as->lpInputFormat,as->lpCompressFormat);
as->compbufsize = ICCompressGetSize(as->hic,as->lpInputFormat,as->lpCompressFormat);
as->compbuffer = HeapAlloc(GetProcessHeap(),0,as->compbufsize);
/* Set up the Decompressor part (for prev frames?) */
xsize=ICDecompressGetFormatSize(as->hic,as->lpCompressFormat);
as->decompformat = HeapAlloc(GetProcessHeap(),0,xsize);
ICDecompressGetFormat(as->hic,as->lpCompressFormat,as->decompformat);
as->decompbufsize=((LPBITMAPINFOHEADER)as->decompbuffer)->biSizeImage;
as->decompbuffer = HeapReAlloc(GetProcessHeap(),0,as->decompbuffer,as->decompbufsize);
memset(as->decompbuffer,0xff,as->decompbufsize);
assert(HeapValidate(GetProcessHeap(),0,NULL));
ICDecompressGetFormat(as->hic,as->lpCompressFormat,as->decompformat);
ICDecompressBegin(as->hic,as->lpCompressFormat,as->decompformat);
as->lpPrev = as->lpPrevFormat = NULL;
}
return S_OK;
}
static HRESULT WINAPI IAVIStream_fnRead(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread) {
FIXME("(%p)->Read(%ld,%ld,%p,%ld,%p,%p)\n",iface,start,samples,buffer,buffersize,bytesread,samplesread);
return E_FAIL;
}
static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten) {
IAVIStreamImpl *as = (IAVIStreamImpl*)iface;
DWORD ckid,xflags;
FIXME("(%p)->Write(%ld,%ld,%p,%ld,0x%08lx,%p,%p)\n",iface,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);
ICCompress(
as->hic,flags,
as->lpCompressFormat,
as->compbuffer,
as->lpInputFormat,buffer,
&ckid,&xflags,
as->curframe,0xffffff/*framesize*/,as->aco.dwQuality,
as->lpPrevFormat,as->lpPrev
);
ICDecompress(
as->hic,
flags, /* FIXME: check */
as->lpCompressFormat,
as->compbuffer,
as->decompformat,
as->decompbuffer
);
/* We now have a prev format for the next compress ... */
as->lpPrevFormat = as->decompformat;
as->lpPrev = as->decompbuffer;
return S_OK;
}
static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream*iface,LONG start,LONG samples) {
FIXME("(%p)->Delete(%ld,%ld)\n",iface,start,samples);
return E_FAIL;
}
static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG *lpread) {
FIXME("(%p)->ReadData(0x%08lx,%p,%p)\n",iface,fcc,lp,lpread);
return E_FAIL;
}
static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG size) {
FIXME("(%p)->WriteData(0x%08lx,%p,%ld)\n",iface,fcc,lp,size);
return E_FAIL;
}
static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,LONG infolen) {
FIXME("(%p)->SetInfo(%p,%ld)\n",iface,info,infolen);
return E_FAIL;
}
/***********************************************************************
* AVIFileCreateStreamA (AVIFIL32.@)
*/
HRESULT WINAPI AVIFileCreateStreamA(PAVIFILE iface,PAVISTREAM *ppavi,AVISTREAMINFOA * psi) {
AVISTREAMINFOW psiw;
/* 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(WCHAR) );
return IAVIFile_CreateStream(iface,ppavi,&psiw);
}
/***********************************************************************
* AVIFileCreateStreamW (AVIFIL32.@)
*/
HRESULT WINAPI AVIFileCreateStreamW(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi) {
return IAVIFile_CreateStream(iface,avis,asi);
}
/***********************************************************************
* AVIFileGetStream (AVIFIL32.@)
* AVIFileGetStream (AVIFILE.143)
*/
HRESULT WINAPI AVIFileGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam) {
return IAVIFile_GetStream(iface,avis,fccType,lParam);
}
/***********************************************************************
* AVIFileInfoA (AVIFIL32.@)
*/
HRESULT WINAPI AVIFileInfoA(PAVIFILE iface,LPAVIFILEINFOA afi,LONG size) {
AVIFILEINFOW afiw;
HRESULT hres;
if (size < sizeof(AVIFILEINFOA))
return AVIERR_BADSIZE;
hres = IAVIFile_Info(iface,&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;
}
/***********************************************************************
* AVIStreamInfoW (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamInfoW(PAVISTREAM iface,AVISTREAMINFOW *asi,LONG
size) {
return IAVIFile_Info(iface,asi,size);
}
/***********************************************************************
* AVIStreamInfoA (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamInfoA(PAVISTREAM iface,AVISTREAMINFOA *asi,LONG
size) {
AVISTREAMINFOW asiw;
HRESULT hres;
if (size<sizeof(AVISTREAMINFOA))
return AVIERR_BADSIZE;
hres = IAVIFile_Info(iface,&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;
}
/***********************************************************************
* AVIFileInfoW (AVIFIL32.@)
*/
HRESULT WINAPI AVIFileInfoW(PAVIFILE iface,LPAVIFILEINFOW afi,LONG size) {
return IAVIFile_Info(iface,afi,size);
}
/***********************************************************************
* AVIMakeCompressedStream (AVIFIL32.@)
*/
HRESULT WINAPI AVIMakeCompressedStream(PAVISTREAM *ppsCompressed,PAVISTREAM ppsSource,AVICOMPRESSOPTIONS *aco,CLSID *pclsidHandler) {
char fcc[5];
IAVIStreamImpl *as;
FIXME("(%p,%p,%p,%p)\n",ppsCompressed,ppsSource,aco,pclsidHandler);
fcc[4]='\0';
memcpy(fcc,&(aco->fccType),4);
FIXME("\tfccType: '%s'\n",fcc);
memcpy(fcc,&(aco->fccHandler),4);
FIXME("\tfccHandler: '%s'\n",fcc);
FIXME("\tdwFlags: 0x%08lx\n",aco->dwFlags);
/* we just create a duplicate for now */
IAVIStream_AddRef(ppsSource);
*ppsCompressed = ppsSource;
as = (IAVIStreamImpl*)ppsSource;
/* this is where the fun begins. Open a compressor and prepare it. */
as->hic = ICOpen(aco->fccType,aco->fccHandler,ICMODE_COMPRESS);
/* May happen. for instance if the codec is not able to compress */
if (!as->hic)
return AVIERR_UNSUPPORTED;
ICGetInfo(as->hic,&(as->icinfo),sizeof(ICINFO));
FIXME("Opened compressor: %s %s\n",debugstr_w(as->icinfo.szName),debugstr_w(as->icinfo.szDescription));
as->iscompressing = TRUE;
memcpy(&(as->aco),aco,sizeof(*aco));
if (as->icinfo.dwFlags & VIDCF_COMPRESSFRAMES) {
ICCOMPRESSFRAMES icf;
/* now what to fill in there ... Hmm */
memset(&icf,0,sizeof(icf));
icf.lDataRate = aco->dwBytesPerSecond;
icf.lQuality = aco->dwQuality;
icf.lKeyRate = aco->dwKeyFrameEvery;
icf.GetData = (void *)0xdead4242;
icf.PutData = (void *)0xdead4243;
ICSendMessage(as->hic,ICM_COMPRESS_FRAMES_INFO,(LPARAM)&icf,sizeof(icf));
}
return S_OK;
}
/***********************************************************************
* AVIStreamSetFormat (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamSetFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG formatsize) {
return IAVIStream_SetFormat(iface,pos,format,formatsize);
}
/***********************************************************************
* AVIStreamReadFormat (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamReadFormat(PAVISTREAM iface,LONG pos,LPVOID format,LONG *formatsize) {
return IAVIStream_ReadFormat(iface,pos,format,formatsize);
}
/***********************************************************************
* AVIStreamWrite (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamWrite(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten) {
return IAVIStream_Write(iface,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);
}
/***********************************************************************
* AVIStreamRead (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamRead(PAVISTREAM iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread) {
return IAVIStream_Read(iface,start,samples,buffer,buffersize,bytesread,samplesread);
}
/***********************************************************************
* AVIStreamWriteData (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamWriteData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG size) {
return IAVIStream_WriteData(iface,fcc,lp,size);
}
/***********************************************************************
* AVIStreamReadData (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamReadData(PAVISTREAM iface,DWORD fcc,LPVOID lp,LONG *lpread) {
return IAVIStream_ReadData(iface,fcc,lp,lpread);
}
/***********************************************************************
* AVIStreamStart (AVIFIL32.@)
*/
LONG WINAPI AVIStreamStart(PAVISTREAM iface) {
AVISTREAMINFOW si;
IAVIStream_Info(iface,&si,sizeof(si));
return si.dwStart;
}
/***********************************************************************
* AVIStreamLength (AVIFIL32.@)
*/
LONG WINAPI AVIStreamLength(PAVISTREAM iface) {
AVISTREAMINFOW si;
HRESULT ret;
ret = IAVIStream_Info(iface,&si,sizeof(si));
if (ret) /* error */
return 1;
return si.dwLength;
}
/***********************************************************************
* AVIStreamRelease (AVIFIL32.@)
*/
ULONG WINAPI AVIStreamRelease(PAVISTREAM iface) {
return IAVIStream_Release(iface);
}
/***********************************************************************
* AVIStreamGetFrameOpen (AVIFIL32.@)
*/
PGETFRAME WINAPI AVIStreamGetFrameOpen(PAVISTREAM iface,LPBITMAPINFOHEADER bmi) {
FIXME("(%p)->(%p),stub!\n",iface,bmi);
return NULL;
}
/***********************************************************************
* AVIStreamGetFrame (AVIFIL32.@)
*/
LPVOID WINAPI AVIStreamGetFrame(PGETFRAME pg,LONG pos) {
return IGetFrame_GetFrame(pg,pos);
}
/***********************************************************************
* AVIStreamGetFrameClose (AVIFIL32.@)
*/
HRESULT WINAPI AVIStreamGetFrameClose(PGETFRAME pg) {
if (pg) IGetFrame_Release(pg);
return 0;
}
/***********************************************************************
* AVIFileRelease (AVIFIL32.@)
* AVIFileRelease (AVIFILE.141)
*/
ULONG WINAPI AVIFileRelease(PAVIFILE iface) {
return IAVIFile_Release(iface);
}
/***********************************************************************
* AVIFileExit (AVIFIL32.@)
* AVIFileExit (AVIFILE.101)
*/
void WINAPI AVIFileExit(void) {
FIXME("(), stub.\n");
}

View File

@ -1,86 +0,0 @@
/*
* Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 __WINE_AVIFILE_PRIVATE_H
#define __WINE_AVIFILE_PRIVATE_H
typedef struct
{
HANDLE hHeap;
DWORD dwAVIFileRef;
DWORD dwClassObjRef;
BOOL fInitCOM;
} WINE_AVIFILE_DATA;
extern WINE_AVIFILE_DATA AVIFILE_data;
INT AVIFILE_strlenAtoW( LPCSTR lpstr );
INT AVIFILE_strlenWtoA( LPCWSTR lpwstr );
LPWSTR AVIFILE_strncpyAtoW( LPWSTR lpwstr, LPCSTR lpstr, INT wbuflen );
LPSTR AVIFILE_strncpyWtoA( LPSTR lpstr, LPCWSTR lpwstr, INT abuflen );
LPWSTR AVIFILE_strdupAtoW( LPCSTR lpstr );
LPSTR AVIFILE_strdupWtoA( LPCWSTR lpwstr );
HRESULT WINAPI AVIFILE_DllGetClassObject(const CLSID* pclsid,const IID* piid,void** ppv);
HRESULT AVIFILE_CreateIAVIFile(void** ppobj);
HRESULT AVIFILE_IAVIFile_Open( PAVIFILE paf, LPCWSTR szFile, UINT uMode );
HRESULT AVIFILE_IAVIFile_GetIndexTable( PAVIFILE paf, DWORD dwStreamIndex,
AVIINDEXENTRY** ppIndexEntry,
DWORD* pdwCountOfIndexEntry );
HRESULT AVIFILE_IAVIFile_ReadMovieData( PAVIFILE paf, DWORD dwOffset,
DWORD dwLength, LPVOID lpvBuf );
HRESULT AVIFILE_CreateIAVIStream(void** ppobj);
HRESULT AVIFILE_CreateIGetFrame(void** ppobj,
IAVIStream* pstr,LPBITMAPINFOHEADER lpbi);
typedef struct
{
DWORD dwStreamIndex;
AVIStreamHeader* pstrhdr;
BYTE* pbFmt;
DWORD dwFmtLen;
} WINE_AVISTREAM_DATA;
WINE_AVISTREAM_DATA* AVIFILE_Alloc_IAVIStreamData( DWORD dwFmtLen );
void AVIFILE_Free_IAVIStreamData( WINE_AVISTREAM_DATA* pData );
/* this should be moved to vfw.h */
#ifndef FIND_DIR
#define FIND_DIR 0x0000000FL
#define FIND_NEXT 0x00000001L
#define FIND_PREV 0x00000004L
#define FIND_FROM_START 0x00000008L
#define FIND_TYPE 0x000000F0L
#define FIND_KEY 0x00000010L
#define FIND_ANY 0x00000020L
#define FIND_FORMAT 0x00000040L
#define FIND_RET 0x0000F000L
#define FIND_POS 0x00000000L
#define FIND_LENGTH 0x00001000L
#define FIND_OFFSET 0x00002000L
#define FIND_SIZE 0x00003000L
#define FIND_INDEX 0x00004000L
#endif
#endif /* __WINE_AVIFILE_PRIVATE_H */

View File

@ -1,156 +0,0 @@
/*
* Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 <string.h>
#include <stdio.h>
#include <assert.h>
#include "winbase.h"
#include "winnls.h"
#include "mmsystem.h"
#include "winerror.h"
#include "ole2.h"
#include "vfw.h"
#include "wine/debug.h"
#include "avifile_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(avifile);
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 ref;
} IClassFactoryImpl;
static IClassFactoryImpl AVIFILE_GlobalCF = {&iclassfact, 0 };
static HRESULT WINAPI
IClassFactory_fnQueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
{
ICOM_THIS(IClassFactoryImpl,iface);
TRACE("(%p)->(%p,%p)\n",This,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",This);
if ( (This->ref) == 0 )
AVIFILE_data.dwClassObjRef ++;
return ++(This->ref);
}
static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface)
{
ICOM_THIS(IClassFactoryImpl,iface);
TRACE("(%p)->()\n",This);
if ( (--(This->ref)) > 0 )
return This->ref;
AVIFILE_data.dwClassObjRef --;
return 0;
}
static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj)
{
/*ICOM_THIS(IClassFactoryImpl,iface);*/
*ppobj = NULL;
if ( pOuter != NULL )
return E_FAIL;
if ( IsEqualGUID( &IID_IAVIFile, riid ) )
return AVIFILE_CreateIAVIFile(ppobj);
if ( IsEqualGUID( &IID_IAVIStream, riid ) )
return AVIFILE_CreateIAVIStream(ppobj);
return E_NOINTERFACE;
}
static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface,BOOL dolock)
{
ICOM_THIS(IClassFactoryImpl,iface);
HRESULT hr;
FIXME("(%p)->(%d),stub!\n",This,dolock);
if (dolock)
hr = IClassFactory_AddRef(iface);
else
hr = IClassFactory_Release(iface);
return hr;
}
/***********************************************************************
* DllGetClassObject (AVIFIL32.@)
*/
HRESULT WINAPI AVIFILE_DllGetClassObject(const CLSID* pclsid,const IID* piid,void** ppv)
{
*ppv = NULL;
if ( IsEqualCLSID( &IID_IClassFactory, piid ) )
{
*ppv = (LPVOID)&AVIFILE_GlobalCF;
IClassFactory_AddRef((IClassFactory*)*ppv);
return S_OK;
}
return CLASS_E_CLASSNOTAVAILABLE;
}
/*****************************************************************************
* DllCanUnloadNow (AVIFIL32.@)
*/
DWORD WINAPI AVIFILE_DllCanUnloadNow(void)
{
return ( AVIFILE_data.dwClassObjRef == 0 ) ? S_OK : S_FALSE;
}

View File

@ -1,758 +0,0 @@
/*
* Copyright 1999 Marcus Meissner
* Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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
*
* FIXME - implements editing/writing.
*/
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "winbase.h"
#include "winnls.h"
#include "mmsystem.h"
#include "winerror.h"
#include "vfw.h"
#include "wine/debug.h"
#include "avifile_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(avifile);
#define AVIFILE_STREAMS_MAX 4
static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile* iface,REFIID refiid,LPVOID *obj);
static ULONG WINAPI IAVIFile_fnAddRef(IAVIFile* iface);
static ULONG WINAPI IAVIFile_fnRelease(IAVIFile* iface);
static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile*iface,AVIFILEINFOW*afi,LONG size);
static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam);
static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi);
static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG size);
static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG *size);
static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile*iface);
static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile*iface,DWORD fccType,LONG lParam);
struct ICOM_VTABLE(IAVIFile) iavift = {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IAVIFile_fnQueryInterface,
IAVIFile_fnAddRef,
IAVIFile_fnRelease,
IAVIFile_fnInfo,
IAVIFile_fnGetStream,
IAVIFile_fnCreateStream,
IAVIFile_fnWriteData,
IAVIFile_fnReadData,
IAVIFile_fnEndRecord,
IAVIFile_fnDeleteStream,
/* IAVIFILE_fnOpen */ /* FIXME? */
};
typedef struct IAVIFileImpl
{
ICOM_VFIELD(IAVIFile);
/* IUnknown stuff */
DWORD ref;
/* IAVIFile stuff */
HANDLE hf;
DWORD dwAVIFileCaps;
DWORD dwAVIFileScale;
DWORD dwAVIFileRate;
DWORD dwAVIFileLength;
DWORD dwAVIFileEditCount;
MainAVIHeader hdr;
IAVIStream* pStreams[AVIFILE_STREAMS_MAX];
AVIStreamHeader strhdrs[AVIFILE_STREAMS_MAX];
DWORD dwMoviTop;
DWORD dwCountOfIndexEntry;
AVIINDEXENTRY* pIndexEntry;
AVIINDEXENTRY* pStreamIndexEntry[AVIFILE_STREAMS_MAX+1];
} IAVIFileImpl;
/****************************************************************************
* AVI file parser.
*/
static HRESULT AVIFILE_IAVIFile_ReadNextChunkHeader(
IAVIFileImpl* This, FOURCC* pfcc, DWORD* pdwSize )
{
BYTE buf[8];
DWORD dwRead;
if ( ( !ReadFile( This->hf, buf, 8, &dwRead, NULL ) ) ||
( 8 != dwRead ) )
return AVIERR_FILEREAD;
*pfcc = mmioFOURCC(buf[0],buf[1],buf[2],buf[3]);
*pdwSize = ( ((DWORD)buf[4]) ) |
( ((DWORD)buf[5]) << 8 ) |
( ((DWORD)buf[6]) << 16 ) |
( ((DWORD)buf[7]) << 24 );
return S_OK;
}
static HRESULT AVIFILE_IAVIFile_SkipChunkData(
IAVIFileImpl* This, DWORD dwChunkSize )
{
LONG lHigh = 0;
DWORD dwRes;
if ( dwChunkSize == 0 )
return S_OK;
SetLastError(NO_ERROR);
dwRes = SetFilePointer( This->hf, (LONG)dwChunkSize,
&lHigh, FILE_CURRENT );
if ( dwRes == (DWORD)0xffffffff && GetLastError() != NO_ERROR )
return AVIERR_FILEREAD;
return S_OK;
}
static HRESULT AVIFILE_IAVIFile_ReadChunkData(
IAVIFileImpl* This, DWORD dwChunkSize,
LPVOID lpvBuf, DWORD dwBufSize, LPDWORD lpdwRead )
{
if ( dwBufSize > dwChunkSize )
dwBufSize = dwChunkSize;
if ( ( !ReadFile( This->hf, lpvBuf, dwBufSize, lpdwRead, NULL ) ) ||
( dwBufSize != *lpdwRead ) )
return AVIERR_FILEREAD;
return AVIFILE_IAVIFile_SkipChunkData( This, dwChunkSize - dwBufSize );
}
static HRESULT AVIFILE_IAVIFile_SeekToSpecifiedChunk(
IAVIFileImpl* This, FOURCC fccType, DWORD* pdwLen )
{
HRESULT hr;
FOURCC fcc;
BYTE buf[4];
DWORD dwRead;
while ( 1 )
{
hr = AVIFILE_IAVIFile_ReadNextChunkHeader(
This, &fcc, pdwLen );
if ( hr != S_OK )
return hr;
if ( fcc == fccType )
return S_OK;
if ( fcc == FOURCC_LIST )
{
if ( ( !ReadFile( This->hf, buf, 4, &dwRead, NULL ) ) ||
( 4 != dwRead ) )
return AVIERR_FILEREAD;
}
else
{
hr = AVIFILE_IAVIFile_SkipChunkData(
This, *pdwLen );
if ( hr != S_OK )
return hr;
}
}
}
WINE_AVISTREAM_DATA* AVIFILE_Alloc_IAVIStreamData( DWORD dwFmtLen )
{
WINE_AVISTREAM_DATA* pData;
pData = (WINE_AVISTREAM_DATA*)
HeapAlloc( AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,
sizeof(WINE_AVISTREAM_DATA) );
if ( pData == NULL )
return NULL;
if ( dwFmtLen > 0 )
{
pData->pbFmt = (BYTE*)
HeapAlloc( AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,
sizeof(BYTE)*dwFmtLen );
if ( pData->pbFmt == NULL )
{
AVIFILE_Free_IAVIStreamData( pData );
return NULL;
}
}
pData->dwFmtLen = dwFmtLen;
return pData;
}
void AVIFILE_Free_IAVIStreamData( WINE_AVISTREAM_DATA* pData )
{
if ( pData != NULL )
{
if ( pData->pbFmt != NULL )
HeapFree( AVIFILE_data.hHeap,0,pData->pbFmt );
HeapFree( AVIFILE_data.hHeap,0,pData );
}
}
static void AVIFILE_IAVIFile_InitIndexTable(
IAVIFileImpl* This,
AVIINDEXENTRY* pIndexBuf,
AVIINDEXENTRY* pIndexData,
DWORD dwCountOfIndexEntry )
{
DWORD dwStreamIndex;
DWORD dwIndex;
FOURCC ckid;
dwStreamIndex = 0;
for ( ; dwStreamIndex < (AVIFILE_STREAMS_MAX+1); dwStreamIndex ++ )
This->pStreamIndexEntry[dwStreamIndex] = NULL;
dwStreamIndex = 0;
for ( ; dwStreamIndex < This->hdr.dwStreams; dwStreamIndex ++ )
{
ckid = mmioFOURCC('0','0'+dwStreamIndex,0,0);
TRACE( "testing ckid %c%c%c%c\n",
(int)(ckid>> 0)&0xff,
(int)(ckid>> 8)&0xff,
(int)(ckid>>16)&0xff,
(int)(ckid>>24)&0xff );
This->pStreamIndexEntry[dwStreamIndex] = pIndexBuf;
FIXME( "pIndexBuf = %p\n", pIndexBuf );
for ( dwIndex = 0; dwIndex < dwCountOfIndexEntry; dwIndex++ )
{
TRACE( "ckid %c%c%c%c\n",
(int)(pIndexData[dwIndex].ckid>> 0)&0xff,
(int)(pIndexData[dwIndex].ckid>> 8)&0xff,
(int)(pIndexData[dwIndex].ckid>>16)&0xff,
(int)(pIndexData[dwIndex].ckid>>24)&0xff );
if ( (pIndexData[dwIndex].ckid & mmioFOURCC(0xff,0xff,0,0))
== ckid )
{
memcpy( pIndexBuf, &pIndexData[dwIndex],
sizeof(AVIINDEXENTRY) );
pIndexBuf ++;
}
}
FIXME( "pIndexBuf = %p\n", pIndexBuf );
}
This->pStreamIndexEntry[This->hdr.dwStreams] = pIndexBuf;
}
/****************************************************************************
* Create an IAVIFile object.
*/
static HRESULT AVIFILE_IAVIFile_Construct( IAVIFileImpl* This );
static void AVIFILE_IAVIFile_Destruct( IAVIFileImpl* This );
HRESULT AVIFILE_CreateIAVIFile(void** ppobj)
{
IAVIFileImpl *This;
HRESULT hr;
TRACE("(%p)\n",ppobj);
*ppobj = NULL;
This = (IAVIFileImpl*)HeapAlloc(AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,
sizeof(IAVIFileImpl));
if ( This == NULL )
return AVIERR_MEMORY;
This->ref = 1;
ICOM_VTBL(This) = &iavift;
hr = AVIFILE_IAVIFile_Construct( This );
if ( hr != S_OK )
{
AVIFILE_IAVIFile_Destruct( This );
return hr;
}
TRACE("new -> %p\n",This);
*ppobj = (LPVOID)This;
return S_OK;
}
/****************************************************************************
* IUnknown interface
*/
static HRESULT WINAPI IAVIFile_fnQueryInterface(IAVIFile* iface,REFIID refiid,LPVOID *obj) {
ICOM_THIS(IAVIFileImpl,iface);
TRACE("(%p)->QueryInterface(%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 IAVIFile_fnAddRef(IAVIFile* iface) {
ICOM_THIS(IAVIFileImpl,iface);
TRACE("(%p)->AddRef()\n",iface);
return ++(This->ref);
}
static ULONG WINAPI IAVIFile_fnRelease(IAVIFile* iface) {
ICOM_THIS(IAVIFileImpl,iface);
TRACE("(%p)->Release()\n",iface);
if ( (--(This->ref)) > 0 )
return This->ref;
AVIFILE_IAVIFile_Destruct(This);
HeapFree(AVIFILE_data.hHeap,0,iface);
return 0;
}
/****************************************************************************
* IAVIFile interface
*/
static HRESULT AVIFILE_IAVIFile_Construct( IAVIFileImpl* This )
{
DWORD dwIndex;
This->hf = INVALID_HANDLE_VALUE;
This->dwAVIFileCaps = 0;
This->dwAVIFileScale = 0;
This->dwAVIFileRate = 0;
This->dwAVIFileLength = 0;
This->dwAVIFileEditCount = 0;
for ( dwIndex = 0; dwIndex < AVIFILE_STREAMS_MAX; dwIndex++ )
This->pStreams[dwIndex] = NULL;
This->dwCountOfIndexEntry = 0;
This->pIndexEntry = NULL;
AVIFILE_data.dwClassObjRef ++;
return S_OK;
}
static void AVIFILE_IAVIFile_Destruct( IAVIFileImpl* This )
{
DWORD dwIndex;
if ( This->pIndexEntry != NULL )
{
HeapFree(AVIFILE_data.hHeap,0,This->pIndexEntry);
This->pIndexEntry = NULL;
}
for ( dwIndex = 0; dwIndex < AVIFILE_STREAMS_MAX; dwIndex++ )
{
if ( This->pStreams[dwIndex] != NULL )
{
IAVIStream_Release( This->pStreams[dwIndex] );
This->pStreams[dwIndex] = NULL;
}
}
if ( This->hf != INVALID_HANDLE_VALUE )
CloseHandle( This->hf );
AVIFILE_data.dwClassObjRef --;
}
static HRESULT WINAPI IAVIFile_fnInfo(IAVIFile*iface,AVIFILEINFOW*afi,LONG size)
{
ICOM_THIS(IAVIFileImpl,iface);
AVIFILEINFOW fiw;
FIXME("(%p)->Info(%p,%ld)\n",iface,afi,size);
memset( &fiw, 0, sizeof(fiw) );
fiw.dwMaxBytesPerSec = This->hdr.dwMaxBytesPerSec;
fiw.dwFlags = This->hdr.dwFlags;
fiw.dwCaps = This->dwAVIFileCaps;
fiw.dwStreams = This->hdr.dwStreams;
fiw.dwSuggestedBufferSize = This->hdr.dwSuggestedBufferSize;
fiw.dwWidth = This->hdr.dwWidth;
fiw.dwHeight = This->hdr.dwHeight;
fiw.dwScale = This->dwAVIFileScale; /* FIXME */
fiw.dwRate = This->dwAVIFileRate; /* FIXME */
fiw.dwLength = This->dwAVIFileLength; /* FIXME */
fiw.dwEditCount = This->dwAVIFileEditCount; /* FIXME */
/* fiw.szFileType[64]; */
if ( size > sizeof(AVIFILEINFOW) )
size = sizeof(AVIFILEINFOW);
memcpy( afi, &fiw, size );
return S_OK;
}
static HRESULT WINAPI IAVIFile_fnGetStream(IAVIFile*iface,PAVISTREAM*avis,DWORD fccType,LONG lParam)
{
ICOM_THIS(IAVIFileImpl,iface);
FIXME("(%p)->GetStream(%p,0x%08lx,%ld)\n",iface,avis,fccType,lParam);
if ( fccType != 0 )
return E_FAIL;
if ( lParam < 0 || lParam >= This->hdr.dwStreams )
return E_FAIL;
*avis = This->pStreams[lParam];
IAVIStream_AddRef( *avis );
return S_OK;
}
static HRESULT WINAPI IAVIFile_fnCreateStream(IAVIFile*iface,PAVISTREAM*avis,AVISTREAMINFOW*asi)
{
ICOM_THIS(IAVIFileImpl,iface);
FIXME("(%p,%p,%p)\n",This,avis,asi);
return E_FAIL;
}
static HRESULT WINAPI IAVIFile_fnWriteData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG size)
{
ICOM_THIS(IAVIFileImpl,iface);
FIXME("(%p)->WriteData(0x%08lx,%p,%ld)\n",This,ckid,lpData,size);
/* FIXME: write data to file */
return E_FAIL;
}
static HRESULT WINAPI IAVIFile_fnReadData(IAVIFile*iface,DWORD ckid,LPVOID lpData,LONG *size)
{
ICOM_THIS(IAVIFileImpl,iface);
FIXME("(%p)->ReadData(0x%08lx,%p,%p)\n",This,ckid,lpData,size);
/* FIXME: read at most size bytes from file */
return E_FAIL;
}
static HRESULT WINAPI IAVIFile_fnEndRecord(IAVIFile*iface)
{
ICOM_THIS(IAVIFileImpl,iface);
FIXME("(%p)->EndRecord()\n",This);
/* FIXME: end record? */
return E_FAIL;
}
static HRESULT WINAPI IAVIFile_fnDeleteStream(IAVIFile*iface,DWORD fccType,LONG lParam)
{
ICOM_THIS(IAVIFileImpl,iface);
FIXME("(%p)->DeleteStream(0x%08lx,%ld)\n",This,fccType,lParam);
/* FIXME: delete stream? */
return E_FAIL;
}
/*****************************************************************************
* AVIFILE_IAVIFile_Open (internal)
*/
HRESULT AVIFILE_IAVIFile_Open( PAVIFILE paf, LPCWSTR szFile, UINT uMode )
{
ICOM_THIS(IAVIFileImpl,paf);
HRESULT hr;
DWORD dwAcc;
DWORD dwShared;
DWORD dwCreate;
BYTE buf[12];
DWORD dwRead;
FOURCC fccFileType;
DWORD dwLen;
DWORD dwIndex;
FIXME("(%p)->Open(%p,%u)\n",This,szFile,uMode);
if ( This->hf != INVALID_HANDLE_VALUE )
{
CloseHandle( This->hf );
This->hf = INVALID_HANDLE_VALUE;
}
switch ( uMode & 0x3 )
{
case OF_READ: /* 0x0 */
dwAcc = GENERIC_READ;
dwCreate = OPEN_EXISTING;
This->dwAVIFileCaps = AVIFILECAPS_CANREAD;
break;
case OF_WRITE: /* 0x1 */
dwAcc = GENERIC_WRITE;
dwCreate = OPEN_ALWAYS;
This->dwAVIFileCaps = AVIFILECAPS_CANWRITE;
break;
case OF_READWRITE: /* 0x2 */
dwAcc = GENERIC_READ|GENERIC_WRITE;
dwCreate = OPEN_ALWAYS;
This->dwAVIFileCaps = AVIFILECAPS_CANREAD|AVIFILECAPS_CANWRITE;
break;
default:
return E_FAIL;
}
if ( This->dwAVIFileCaps & AVIFILECAPS_CANWRITE )
{
FIXME( "editing AVI is currently not supported!\n" );
return E_FAIL;
}
switch ( uMode & 0x70 )
{
case OF_SHARE_COMPAT: /* 0x00 */
dwShared = FILE_SHARE_READ|FILE_SHARE_WRITE;
break;
case OF_SHARE_EXCLUSIVE: /* 0x10 */
dwShared = 0;
break;
case OF_SHARE_DENY_WRITE: /* 0x20 */
dwShared = FILE_SHARE_READ;
break;
case OF_SHARE_DENY_READ: /* 0x30 */
dwShared = FILE_SHARE_WRITE;
break;
case OF_SHARE_DENY_NONE: /* 0x40 */
dwShared = FILE_SHARE_READ|FILE_SHARE_WRITE;
break;
default:
return E_FAIL;
}
if ( uMode & OF_CREATE )
dwCreate = CREATE_ALWAYS;
This->hf = CreateFileW( szFile, dwAcc, dwShared, NULL,
dwCreate, FILE_ATTRIBUTE_NORMAL,
(HANDLE)NULL );
if ( This->hf == INVALID_HANDLE_VALUE )
return AVIERR_FILEOPEN;
if ( dwAcc & GENERIC_READ )
{
if ( !ReadFile( This->hf, buf, 12, &dwRead, NULL ) )
return AVIERR_FILEREAD;
if ( dwRead == 12 )
{
if ( mmioFOURCC(buf[0],buf[1],buf[2],buf[3]) != FOURCC_RIFF )
return AVIERR_BADFORMAT;
fccFileType = mmioFOURCC(buf[8],buf[9],buf[10],buf[11]);
if ( fccFileType != formtypeAVI )
return AVIERR_BADFORMAT;
/* get AVI main header. */
hr = AVIFILE_IAVIFile_SeekToSpecifiedChunk(
This, ckidAVIMAINHDR, &dwLen );
if ( hr != S_OK )
return hr;
if ( dwLen < (sizeof(DWORD)*10) )
return AVIERR_BADFORMAT;
hr = AVIFILE_IAVIFile_ReadChunkData(
This, dwLen,
&(This->hdr), sizeof(MainAVIHeader), &dwLen );
if ( This->hdr.dwStreams == 0 ||
This->hdr.dwStreams > AVIFILE_STREAMS_MAX )
return AVIERR_BADFORMAT;
/* get stream headers. */
dwIndex = 0;
while ( dwIndex < This->hdr.dwStreams )
{
WINE_AVISTREAM_DATA* pData;
hr = AVIFILE_IAVIFile_SeekToSpecifiedChunk(
This, ckidSTREAMHEADER, &dwLen );
if ( hr != S_OK )
return hr;
if ( dwLen < (sizeof(DWORD)*12) )
return AVIERR_BADFORMAT;
hr = AVIFILE_IAVIFile_ReadChunkData(
This, dwLen,
&This->strhdrs[dwIndex],
sizeof(AVIStreamHeader), &dwLen );
hr = AVIFILE_IAVIFile_SeekToSpecifiedChunk(
This, ckidSTREAMFORMAT, &dwLen );
if ( hr != S_OK )
return hr;
pData = AVIFILE_Alloc_IAVIStreamData( dwLen );
if ( pData == NULL )
return AVIERR_MEMORY;
hr = AVIFILE_IAVIFile_ReadChunkData(
This, dwLen,
pData->pbFmt, dwLen, &dwLen );
if ( hr != S_OK )
{
AVIFILE_Free_IAVIStreamData( pData );
return hr;
}
pData->dwStreamIndex = dwIndex;
pData->pstrhdr = &This->strhdrs[dwIndex];
hr = AVIStreamCreate(&This->pStreams[dwIndex],
(LONG)paf, (LONG)(pData), NULL );
if ( hr != S_OK )
{
AVIFILE_Free_IAVIStreamData( pData );
return hr;
}
if ( (This->strhdrs[dwIndex].fccType
== mmioFOURCC('v','i','d','s')) ||
(This->strhdrs[dwIndex].fccType
== mmioFOURCC('V','I','D','S')) )
{
This->dwAVIFileScale =
This->strhdrs[dwIndex].dwScale;
This->dwAVIFileRate =
This->strhdrs[dwIndex].dwRate;
This->dwAVIFileLength =
This->strhdrs[dwIndex].dwLength;
}
else
if ( This->dwAVIFileScale == 0 )
{
This->dwAVIFileScale =
This->strhdrs[dwIndex].dwScale;
This->dwAVIFileRate =
This->strhdrs[dwIndex].dwRate;
This->dwAVIFileLength =
This->strhdrs[dwIndex].dwLength;
}
dwIndex ++;
}
/* skip movi. */
while ( 1 )
{
hr = AVIFILE_IAVIFile_SeekToSpecifiedChunk(
This, FOURCC_LIST, &dwLen );
if ( hr != S_OK )
return hr;
if ( dwLen < 4 )
return AVIERR_BADFORMAT;
This->dwMoviTop = SetFilePointer( This->hf,0,NULL,FILE_CURRENT );
if ( This->dwMoviTop == 0xffffffff )
return AVIERR_BADFORMAT;
if ( ( !ReadFile(This->hf, buf, 4, &dwRead, NULL) ) ||
( dwRead != 4 ) )
return AVIERR_FILEREAD;
hr = AVIFILE_IAVIFile_SkipChunkData(
This, dwLen - 4 );
if ( hr != S_OK )
return hr;
if ( mmioFOURCC(buf[0],buf[1],buf[2],buf[3])
== mmioFOURCC('m', 'o', 'v', 'i') )
break;
}
/* get idx1. */
hr = AVIFILE_IAVIFile_SeekToSpecifiedChunk(
This, ckidAVINEWINDEX, &dwLen );
if ( hr != S_OK )
return hr;
This->dwCountOfIndexEntry = dwLen / sizeof(AVIINDEXENTRY);
This->pIndexEntry = (AVIINDEXENTRY*)
HeapAlloc(AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,
sizeof(AVIINDEXENTRY) *
This->dwCountOfIndexEntry * 2 );
if ( This->pIndexEntry == NULL )
return AVIERR_MEMORY;
hr = AVIFILE_IAVIFile_ReadChunkData(
This, dwLen,
This->pIndexEntry + This->dwCountOfIndexEntry,
sizeof(AVIINDEXENTRY) *
This->dwCountOfIndexEntry, &dwLen );
if ( hr != S_OK )
return hr;
AVIFILE_IAVIFile_InitIndexTable(
This, This->pIndexEntry,
This->pIndexEntry + This->dwCountOfIndexEntry,
This->dwCountOfIndexEntry );
}
else
{
/* FIXME - create the handle has GENERIC_WRITE access. */
return AVIERR_FILEREAD;
}
}
else
{
return AVIERR_FILEOPEN; /* FIXME */
}
return S_OK;
}
/*****************************************************************************
* AVIFILE_IAVIFile_GetIndexTable (internal)
*/
HRESULT AVIFILE_IAVIFile_GetIndexTable( PAVIFILE paf, DWORD dwStreamIndex,
AVIINDEXENTRY** ppIndexEntry,
DWORD* pdwCountOfIndexEntry )
{
ICOM_THIS(IAVIFileImpl,paf);
if ( dwStreamIndex < 0 || dwStreamIndex >= This->hdr.dwStreams )
{
FIXME( "invalid stream index %lu\n", dwStreamIndex );
return E_FAIL;
}
FIXME( "cur %p, next %p\n",
This->pStreamIndexEntry[dwStreamIndex],
This->pStreamIndexEntry[dwStreamIndex+1] );
*ppIndexEntry = This->pStreamIndexEntry[dwStreamIndex];
*pdwCountOfIndexEntry =
This->pStreamIndexEntry[dwStreamIndex+1] -
This->pStreamIndexEntry[dwStreamIndex];
return S_OK;
}
/*****************************************************************************
* AVIFILE_IAVIFile_ReadMovieData (internal)
*/
HRESULT AVIFILE_IAVIFile_ReadMovieData( PAVIFILE paf, DWORD dwOffset,
DWORD dwLength, LPVOID lpvBuf )
{
ICOM_THIS(IAVIFileImpl,paf);
LONG lHigh = 0;
DWORD dwRes;
if ( dwLength == 0 )
return S_OK;
SetLastError(NO_ERROR);
dwRes = SetFilePointer( This->hf, (LONG)(dwOffset+This->dwMoviTop),
&lHigh, FILE_BEGIN );
if ( dwRes == (DWORD)0xffffffff && GetLastError() != NO_ERROR )
return AVIERR_FILEREAD;
if ( ( !ReadFile(This->hf, lpvBuf, dwLength, &dwRes, NULL) ) ||
( dwLength != dwRes ) )
{
FIXME( "error in ReadFile()\n" );
return AVIERR_FILEREAD;
}
return S_OK;
}

View File

@ -1,433 +0,0 @@
/*
* Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 <string.h>
#include <stdio.h>
#include <assert.h>
#include "winbase.h"
#include "winnls.h"
#include "mmsystem.h"
#include "winerror.h"
#include "vfw.h"
#include "wine/debug.h"
#include "avifile_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(avifile);
static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj);
static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface);
static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface);
static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream*iface,LPARAM lParam1,LPARAM lParam2);
static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream*iface,AVISTREAMINFOW *psi,LONG size);
static LONG WINAPI IAVIStream_fnFindSample(IAVIStream*iface,LONG pos,LONG flags);
static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG *formatsize);
static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize);
static HRESULT WINAPI IAVIStream_fnRead(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread);
static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten);
static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream*iface,LONG start,LONG samples);
static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG *lpread);
static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG size);
static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,LONG infolen);
struct ICOM_VTABLE(IAVIStream) iavist = {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IAVIStream_fnQueryInterface,
IAVIStream_fnAddRef,
IAVIStream_fnRelease,
IAVIStream_fnCreate,
IAVIStream_fnInfo,
IAVIStream_fnFindSample,
IAVIStream_fnReadFormat,
IAVIStream_fnSetFormat,
IAVIStream_fnRead,
IAVIStream_fnWrite,
IAVIStream_fnDelete,
IAVIStream_fnReadData,
IAVIStream_fnWriteData,
IAVIStream_fnSetInfo
};
typedef struct IAVIStreamImpl
{
ICOM_VFIELD(IAVIStream);
/* IUnknown stuff */
DWORD ref;
/* IAVIStream stuff */
IAVIFile* paf;
WINE_AVISTREAM_DATA* pData;
} IAVIStreamImpl;
static HRESULT IAVIStream_Construct( IAVIStreamImpl* This );
static void IAVIStream_Destruct( IAVIStreamImpl* This );
HRESULT AVIFILE_CreateIAVIStream(void** ppobj)
{
IAVIStreamImpl *This;
HRESULT hr;
*ppobj = NULL;
This = (IAVIStreamImpl*)HeapAlloc(AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,
sizeof(IAVIStreamImpl));
This->ref = 1;
ICOM_VTBL(This) = &iavist;
hr = IAVIStream_Construct( This );
if ( hr != S_OK )
{
IAVIStream_Destruct( This );
return hr;
}
*ppobj = (LPVOID)This;
return S_OK;
}
/****************************************************************************
* IUnknown interface
*/
static HRESULT WINAPI IAVIStream_fnQueryInterface(IAVIStream*iface,REFIID refiid,LPVOID *obj) {
ICOM_THIS(IAVIStreamImpl,iface);
TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);
if ( IsEqualGUID(&IID_IUnknown,refiid) ||
IsEqualGUID(&IID_IAVIStream,refiid) )
{
IAVIStream_AddRef(iface);
*obj = iface;
return S_OK;
}
/* can return IGetFrame interface too */
return OLE_E_ENUM_NOMORE;
}
static ULONG WINAPI IAVIStream_fnAddRef(IAVIStream*iface) {
ICOM_THIS(IAVIStreamImpl,iface);
TRACE("(%p)->AddRef()\n",iface);
return ++(This->ref);
}
static ULONG WINAPI IAVIStream_fnRelease(IAVIStream* iface) {
ICOM_THIS(IAVIStreamImpl,iface);
TRACE("(%p)->Release()\n",iface);
if ((--(This->ref)) > 0 )
return This->ref;
IAVIStream_Destruct(This);
HeapFree(AVIFILE_data.hHeap,0,iface);
return 0;
}
/****************************************************************************
* IAVIStream interface
*/
static HRESULT IAVIStream_Construct( IAVIStreamImpl* This )
{
This->paf = NULL;
This->pData = NULL;
AVIFILE_data.dwClassObjRef ++;
return S_OK;
}
static void IAVIStream_Destruct( IAVIStreamImpl* This )
{
AVIFILE_data.dwClassObjRef --;
}
static HRESULT WINAPI IAVIStream_fnCreate(IAVIStream*iface,LPARAM lParam1,LPARAM lParam2)
{
ICOM_THIS(IAVIStreamImpl,iface);
FIXME("(%p)->Create(%ld,%ld)\n",iface,lParam1,lParam2);
This->paf = (IAVIFile*)lParam1;
This->pData = (WINE_AVISTREAM_DATA*)lParam2;
return S_OK;
}
static HRESULT WINAPI IAVIStream_fnInfo(IAVIStream*iface,AVISTREAMINFOW *psi,LONG size)
{
ICOM_THIS(IAVIStreamImpl,iface);
AVISTREAMINFOW siw;
FIXME("(%p)->Info(%p,%ld)\n",iface,psi,size);
if ( This->pData == NULL )
return E_UNEXPECTED;
memset( &siw, 0, sizeof(AVISTREAMINFOW) );
siw.fccType = This->pData->pstrhdr->fccType;
siw.fccHandler = This->pData->pstrhdr->fccHandler;
siw.dwFlags = This->pData->pstrhdr->dwFlags;
siw.dwCaps = 0; /* FIXME */
siw.wPriority = This->pData->pstrhdr->wPriority;
siw.wLanguage = This->pData->pstrhdr->wLanguage;
siw.dwScale = This->pData->pstrhdr->dwScale;
siw.dwRate = This->pData->pstrhdr->dwRate;
siw.dwStart = This->pData->pstrhdr->dwStart;
siw.dwLength = This->pData->pstrhdr->dwLength;
siw.dwInitialFrames = This->pData->pstrhdr->dwInitialFrames;
siw.dwSuggestedBufferSize = This->pData->pstrhdr->dwSuggestedBufferSize;
siw.dwQuality = This->pData->pstrhdr->dwQuality;
siw.dwSampleSize = This->pData->pstrhdr->dwSampleSize;
siw.rcFrame.left = This->pData->pstrhdr->rcFrame.left;
siw.rcFrame.top = This->pData->pstrhdr->rcFrame.top;
siw.rcFrame.right = This->pData->pstrhdr->rcFrame.right;
siw.rcFrame.bottom = This->pData->pstrhdr->rcFrame.bottom;
siw.dwEditCount = 0; /* FIXME */
siw.dwFormatChangeCount = 0; /* FIXME */
/* siw.szName[64] */
if ( size > sizeof(AVISTREAMINFOW) )
size = sizeof(AVISTREAMINFOW);
memcpy( psi, &siw, size );
return S_OK;
}
static LONG WINAPI IAVIStream_fnFindSample(IAVIStream*iface,LONG pos,LONG flags)
{
ICOM_THIS(IAVIStreamImpl,iface);
HRESULT hr;
AVIINDEXENTRY* pIndexEntry;
DWORD dwCountOfIndexEntry;
LONG lCur, lAdd, lEnd;
FIXME("(%p)->FindSample(%ld,0x%08lx)\n",This,pos,flags);
hr = AVIFILE_IAVIFile_GetIndexTable(
This->paf, This->pData->dwStreamIndex,
&pIndexEntry, &dwCountOfIndexEntry );
if ( hr != S_OK )
return -1L;
if ( flags & (~(FIND_DIR|FIND_TYPE|FIND_RET)) )
{
FIXME( "unknown flag %08lx\n", flags );
return -1L;
}
switch ( flags & FIND_DIR )
{
case FIND_NEXT:
lCur = pos;
lAdd = 1;
lEnd = dwCountOfIndexEntry;
if ( lCur > dwCountOfIndexEntry )
return -1L;
break;
case FIND_PREV:
lCur = pos;
if ( lCur > dwCountOfIndexEntry )
lCur = dwCountOfIndexEntry;
lAdd = -1;
lEnd = 0;
break;
case FIND_FROM_START:
lCur = 0;
lAdd = 1;
lEnd = dwCountOfIndexEntry;
break;
default:
FIXME( "unknown direction flag %08lx\n", (flags & FIND_DIR) );
return -1L;
}
switch ( flags & FIND_TYPE )
{
case FIND_KEY:
while ( 1 )
{
if ( pIndexEntry[lCur].dwFlags & AVIIF_KEYFRAME )
break;
if ( lCur == lEnd )
return -1L;
lCur += lAdd;
}
break;
case FIND_ANY:
while ( 1 )
{
if ( !(pIndexEntry[lCur].dwFlags & AVIIF_NOTIME) )
break;
if ( lCur == lEnd )
return -1L;
lCur += lAdd;
}
break;
case FIND_FORMAT:
FIXME( "FIND_FORMAT is not implemented.\n" );
return -1L;
default:
FIXME( "unknown type flag %08lx\n", (flags & FIND_TYPE) );
return -1L;
}
switch ( flags & FIND_RET )
{
case FIND_POS:
return lCur;
case FIND_LENGTH:
FIXME( "FIND_LENGTH is not implemented.\n" );
return -1L;
case FIND_OFFSET:
return pIndexEntry[lCur].dwChunkOffset;
case FIND_SIZE:
return pIndexEntry[lCur].dwChunkLength;
case FIND_INDEX:
FIXME( "FIND_INDEX is not implemented.\n" );
return -1L;
default:
FIXME( "unknown return type flag %08lx\n", (flags & FIND_RET) );
break;
}
return -1L;
}
static HRESULT WINAPI IAVIStream_fnReadFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG *formatsize) {
ICOM_THIS(IAVIStreamImpl,iface);
TRACE("(%p)->ReadFormat(%ld,%p,%p)\n",This,pos,format,formatsize);
if ( This->pData == NULL )
return E_UNEXPECTED;
/* FIXME - check pos. */
if ( format == NULL )
{
*formatsize = This->pData->dwFmtLen;
return S_OK;
}
if ( (*formatsize) < This->pData->dwFmtLen )
return AVIERR_BUFFERTOOSMALL;
memcpy( format, This->pData->pbFmt, This->pData->dwFmtLen );
*formatsize = This->pData->dwFmtLen;
return S_OK;
}
static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream*iface,LONG pos,LPVOID format,LONG formatsize) {
ICOM_THIS(IAVIStreamImpl,iface);
FIXME("(%p)->SetFormat(%ld,%p,%ld)\n",This,pos,format,formatsize);
return E_FAIL;
}
static HRESULT WINAPI IAVIStream_fnRead(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,LONG *bytesread,LONG *samplesread) {
ICOM_THIS(IAVIStreamImpl,iface);
HRESULT hr;
AVIINDEXENTRY* pIndexEntry;
DWORD dwCountOfIndexEntry;
DWORD dwFrameLength;
FIXME("(%p)->Read(%ld,%ld,%p,%ld,%p,%p)\n",This,start,samples,buffer,buffersize,bytesread,samplesread);
*bytesread = 0;
*samplesread = 0;
hr = AVIFILE_IAVIFile_GetIndexTable(
This->paf, This->pData->dwStreamIndex,
&pIndexEntry, &dwCountOfIndexEntry );
if ( hr != S_OK )
return hr;
if ( start < 0 )
return E_FAIL;
if ( start >= dwCountOfIndexEntry || samples <= 0 )
{
FIXME("start %ld,samples %ld,total %ld\n",start,samples,dwCountOfIndexEntry);
return S_OK;
}
/* FIXME - no audio support. */
dwFrameLength = pIndexEntry[start].dwChunkLength;
if ( buffer == NULL )
{
*bytesread = dwFrameLength;
*samplesread = 1;
return S_OK;
}
if ( buffersize < dwFrameLength )
{
FIXME( "buffer is too small!\n" );
return AVIERR_BUFFERTOOSMALL;
}
hr = AVIFILE_IAVIFile_ReadMovieData(
This->paf,
pIndexEntry[start].dwChunkOffset + sizeof(DWORD)*2,
dwFrameLength, buffer );
if ( hr != S_OK )
{
FIXME( "ReadMovieData failed!\n");
return hr;
}
*bytesread = dwFrameLength;
*samplesread = 1;
return S_OK;
}
static HRESULT WINAPI IAVIStream_fnWrite(IAVIStream*iface,LONG start,LONG samples,LPVOID buffer,LONG buffersize,DWORD flags,LONG *sampwritten,LONG *byteswritten) {
ICOM_THIS(IAVIStreamImpl,iface);
FIXME("(%p)->Write(%ld,%ld,%p,%ld,0x%08lx,%p,%p)\n",This,start,samples,buffer,buffersize,flags,sampwritten,byteswritten);
return E_FAIL;
}
static HRESULT WINAPI IAVIStream_fnDelete(IAVIStream*iface,LONG start,LONG samples) {
ICOM_THIS(IAVIStreamImpl,iface);
FIXME("(%p)->Delete(%ld,%ld)\n",This,start,samples);
return E_FAIL;
}
static HRESULT WINAPI IAVIStream_fnReadData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG *lpread) {
ICOM_THIS(IAVIStreamImpl,iface);
FIXME("(%p)->ReadData(0x%08lx,%p,%p)\n",This,fcc,lp,lpread);
return E_FAIL;
}
static HRESULT WINAPI IAVIStream_fnWriteData(IAVIStream*iface,DWORD fcc,LPVOID lp,LONG size) {
ICOM_THIS(IAVIStreamImpl,iface);
FIXME("(%p)->WriteData(0x%08lx,%p,%ld)\n",This,fcc,lp,size);
return E_FAIL;
}
static HRESULT WINAPI IAVIStream_fnSetInfo(IAVIStream*iface,AVISTREAMINFOW*info,LONG infolen) {
ICOM_THIS(IAVIStreamImpl,iface);
FIXME("(%p)->SetInfo(%p,%ld)\n",This,info,infolen);
return E_FAIL;
}

View File

@ -1,428 +0,0 @@
/*
* Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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
*
* FIXME - implements color space(depth) converter.
*/
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "winbase.h"
#include "winnls.h"
#include "mmsystem.h"
#include "winerror.h"
#include "vfw.h"
#include "wine/debug.h"
#include "avifile_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(avifile);
static HRESULT WINAPI IGetFrame_fnQueryInterface(IGetFrame* iface,REFIID refiid,LPVOID *obj);
static ULONG WINAPI IGetFrame_fnAddRef(IGetFrame* iface);
static ULONG WINAPI IGetFrame_fnRelease(IGetFrame* iface);
static LPVOID WINAPI IGetFrame_fnGetFrame(IGetFrame* iface,LONG lPos);
static HRESULT WINAPI IGetFrame_fnBegin(IGetFrame* iface,LONG lStart,LONG lEnd,LONG lRate);
static HRESULT WINAPI IGetFrame_fnEnd(IGetFrame* iface);
static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame* iface,LPBITMAPINFOHEADER lpbi,LPVOID lpBits,INT x,INT y,INT dx,INT dy);
struct ICOM_VTABLE(IGetFrame) igetfrm = {
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IGetFrame_fnQueryInterface,
IGetFrame_fnAddRef,
IGetFrame_fnRelease,
IGetFrame_fnGetFrame,
IGetFrame_fnBegin,
IGetFrame_fnEnd,
IGetFrame_fnSetFormat,
};
typedef struct IGetFrameImpl
{
ICOM_VFIELD(IGetFrame);
/* IUnknown stuff */
DWORD ref;
/* IGetFrame stuff */
IAVIStream* pas;
HIC hIC;
LONG lCachedFrame;
BITMAPINFO* pbiICIn;
BITMAPINFO* pbiICOut;
LPVOID pvICOutBits;
LPVOID pvICInFmtBuf;
DWORD dwICInDataBufSize;
LPVOID pvICInDataBuf;
LPVOID pvICOutBuf;
} IGetFrameImpl;
static HRESULT IGetFrame_Construct( IGetFrameImpl* This,
IAVIStream* pstr,
LPBITMAPINFOHEADER lpbi );
static void IGetFrame_Destruct( IGetFrameImpl* This );
static LPVOID AVIFILE_IGetFrame_DecodeFrame(IGetFrameImpl* This,LONG lPos)
{
HRESULT hr;
DWORD dwRes;
LONG lFrameLength;
LONG lSampleCount;
ICDECOMPRESS icd;
if ( This->hIC == (HIC)NULL )
return NULL;
hr = IAVIStream_Read(This->pas,lPos,1,NULL,0,
&lFrameLength,&lSampleCount);
if ( hr != S_OK || lSampleCount <= 0 )
{
FIXME( "IAVIStream_Read failed! res = %08lx\n", hr );
return NULL;
}
TRACE( "frame length = %ld\n", lFrameLength );
if ( This->dwICInDataBufSize < lFrameLength )
{
LPVOID lpv;
if ( This->pvICInDataBuf == NULL )
{
lpv = HeapAlloc(
AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,
lFrameLength );
}
else
{
lpv = HeapReAlloc(
AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,
This->pvICInDataBuf,lFrameLength );
}
if ( lpv == NULL )
{
ERR( "out of memory!\n" );
return NULL;
}
This->pvICInDataBuf = lpv;
This->dwICInDataBufSize = lFrameLength;
}
hr = IAVIStream_Read(This->pas,lPos,1,
This->pvICInDataBuf,This->dwICInDataBufSize,
&lFrameLength,&lSampleCount);
if ( hr != S_OK || lSampleCount <= 0 )
{
FIXME( "IAVIStream_Read to buffer failed! res = %08lx\n", hr );
return NULL;
}
This->pbiICIn->bmiHeader.biSizeImage = lFrameLength;
TRACE( "call ICM_DECOMPRESS\n" );
icd.dwFlags = 0;
if ( IAVIStream_FindSample(This->pas,lPos,FIND_PREV|FIND_KEY) != lPos )
icd.dwFlags = ICDECOMPRESS_NOTKEYFRAME;
icd.lpbiInput = &This->pbiICIn->bmiHeader;
icd.lpInput = (BYTE*)This->pvICInDataBuf;
icd.lpbiOutput = &This->pbiICOut->bmiHeader;
icd.lpOutput = This->pvICOutBits;
icd.ckid = *((DWORD*)This->pvICInDataBuf);
dwRes = ICSendMessage(This->hIC,ICM_DECOMPRESS,
(DWORD)(&icd),sizeof(ICDECOMPRESS) );
TRACE( "returned from ICM_DECOMPRESS\n" );
if ( dwRes != ICERR_OK )
{
ERR( "ICDecompress failed!\n" );
return NULL;
}
This->lCachedFrame = lPos;
return This->pvICOutBits;
}
/****************************************************************************/
HRESULT AVIFILE_CreateIGetFrame(void** ppobj,
IAVIStream* pstr,LPBITMAPINFOHEADER lpbi)
{
IGetFrameImpl *This;
HRESULT hr;
*ppobj = NULL;
This = (IGetFrameImpl*)HeapAlloc(AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,
sizeof(IGetFrameImpl));
This->ref = 1;
ICOM_VTBL(This) = &igetfrm;
hr = IGetFrame_Construct( This, pstr, lpbi );
if ( hr != S_OK )
{
IGetFrame_Destruct( This );
return hr;
}
*ppobj = (LPVOID)This;
return S_OK;
}
/****************************************************************************
* IUnknown interface
*/
static HRESULT WINAPI IGetFrame_fnQueryInterface(IGetFrame* iface,REFIID refiid,LPVOID *obj)
{
ICOM_THIS(IGetFrameImpl,iface);
TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj);
if ( IsEqualGUID(&IID_IUnknown,refiid) ||
IsEqualGUID(&IID_IGetFrame,refiid) )
{
IGetFrame_AddRef(iface);
*obj = iface;
return S_OK;
}
return OLE_E_ENUM_NOMORE;
}
static ULONG WINAPI IGetFrame_fnAddRef(IGetFrame* iface)
{
ICOM_THIS(IGetFrameImpl,iface);
TRACE("(%p)->AddRef()\n",iface);
return ++(This->ref);
}
static ULONG WINAPI IGetFrame_fnRelease(IGetFrame* iface)
{
ICOM_THIS(IGetFrameImpl,iface);
TRACE("(%p)->Release()\n",iface);
if ((--(This->ref)) > 0 )
return This->ref;
IGetFrame_Destruct(This);
if ( This->pas != NULL )
IAVIStream_Release( This->pas );
HeapFree(AVIFILE_data.hHeap,0,iface);
return 0;
}
/****************************************************************************
* IGetFrrame interface
*/
static LPVOID WINAPI IGetFrame_fnGetFrame(IGetFrame* iface,LONG lPos)
{
ICOM_THIS(IGetFrameImpl,iface);
LPVOID lpv;
LONG lKeyFrame;
TRACE( "(%p)->(%ld)\n", This, lPos );
if ( lPos < 0 )
return NULL;
if ( This->lCachedFrame == lPos )
return This->pvICOutBits;
if ( (This->lCachedFrame+1) != lPos )
{
lKeyFrame = IAVIStream_FindSample( This->pas, lPos,
FIND_KEY | FIND_PREV );
if ( lKeyFrame < 0 || lKeyFrame > lPos )
return NULL;
while ( ++lKeyFrame < lPos )
{
lpv = AVIFILE_IGetFrame_DecodeFrame(This, lKeyFrame);
if ( lpv == NULL )
return NULL;
}
}
lpv = AVIFILE_IGetFrame_DecodeFrame(This, lPos);
TRACE( "lpv = %p\n",lpv );
if ( lpv == NULL )
return NULL;
return lpv;
}
static HRESULT WINAPI IGetFrame_fnBegin(IGetFrame* iface,LONG lStart,LONG lEnd,LONG lRate)
{
ICOM_THIS(IGetFrameImpl,iface);
TRACE( "(%p)->(%ld,%ld,%ld)\n", This, lStart, lEnd, lRate );
if ( This->hIC == (HIC)NULL )
return E_UNEXPECTED;
if ( ICDecompressBegin( This->hIC,
This->pbiICIn,
This->pbiICOut ) != ICERR_OK )
return E_FAIL;
return S_OK;
}
static HRESULT WINAPI IGetFrame_fnEnd(IGetFrame* iface)
{
ICOM_THIS(IGetFrameImpl,iface);
TRACE( "(%p)->()\n", This );
if ( This->hIC == (HIC)NULL )
return E_UNEXPECTED;
if ( ICDecompressEnd( This->hIC ) != ICERR_OK )
return E_FAIL;
return S_OK;
}
static HRESULT WINAPI IGetFrame_fnSetFormat(IGetFrame* iface,LPBITMAPINFOHEADER lpbi,LPVOID lpBits,INT x,INT y,INT dx,INT dy)
{
ICOM_THIS(IGetFrameImpl,iface);
HRESULT hr;
LONG fmtlen;
BITMAPINFOHEADER biTemp;
DWORD dwSizeImage;
FIXME( "(%p)->(%p,%p,%d,%d,%d,%d)\n",This,lpbi,lpBits,x,y,dx,dy );
IGetFrame_Destruct(This);
hr = IAVIStream_ReadFormat(This->pas,0,NULL,&fmtlen);
if ( hr != S_OK )
return hr;
This->pvICInFmtBuf = HeapAlloc(
AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,fmtlen);
if ( This->pvICInFmtBuf == NULL )
return AVIERR_MEMORY;
hr = IAVIStream_ReadFormat(This->pas,0,This->pvICInFmtBuf,&fmtlen);
if ( hr != S_OK )
return hr;
This->pbiICIn = (LPBITMAPINFO)This->pvICInFmtBuf;
This->hIC = (HIC)ICOpen( ICTYPE_VIDEO,
This->pbiICIn->bmiHeader.biCompression,
ICMODE_DECOMPRESS );
if ( This->hIC == (HIC)NULL )
{
ERR( "no AVI decompressor for %c%c%c%c.\n",
(int)(This->pbiICIn->bmiHeader.biCompression>> 0)&0xff,
(int)(This->pbiICIn->bmiHeader.biCompression>> 8)&0xff,
(int)(This->pbiICIn->bmiHeader.biCompression>>16)&0xff,
(int)(This->pbiICIn->bmiHeader.biCompression>>24)&0xff );
return E_FAIL;
}
if ( lpbi == NULL || lpbi == ((LPBITMAPINFOHEADER)1) )
{
memset( &biTemp, 0, sizeof(biTemp) );
biTemp.biSize = sizeof(BITMAPINFOHEADER);
biTemp.biWidth = This->pbiICIn->bmiHeader.biWidth;
biTemp.biHeight = This->pbiICIn->bmiHeader.biHeight;
biTemp.biPlanes = 1;
biTemp.biBitCount = 24;
biTemp.biCompression = 0;
lpbi = &biTemp;
}
if ( lpbi->biPlanes != 1 || lpbi->biCompression != 0 )
return E_FAIL;
dwSizeImage =
((This->pbiICIn->bmiHeader.biWidth*lpbi->biBitCount+7)/8)*
This->pbiICIn->bmiHeader.biHeight;
This->pvICOutBuf = HeapAlloc(
AVIFILE_data.hHeap,HEAP_ZERO_MEMORY,
(sizeof(BITMAPINFO)+sizeof(RGBQUAD)*256)*2+
dwSizeImage );
if ( This->pvICOutBuf == NULL )
return AVIERR_MEMORY;
This->pbiICOut = (BITMAPINFO*)This->pvICOutBuf;
This->pvICOutBits = (LPVOID)( (BYTE*)This->pvICOutBuf +
sizeof(BITMAPINFO) + sizeof(RGBQUAD)*256 );
This->pbiICOut->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
This->pbiICOut->bmiHeader.biWidth = This->pbiICIn->bmiHeader.biWidth;
This->pbiICOut->bmiHeader.biHeight = This->pbiICIn->bmiHeader.biHeight;
This->pbiICOut->bmiHeader.biPlanes = 1;
This->pbiICOut->bmiHeader.biBitCount = lpbi->biBitCount;
This->pbiICOut->bmiHeader.biSizeImage = dwSizeImage;
memcpy( This->pvICOutBits, This->pbiICOut, sizeof(BITMAPINFOHEADER) );
return S_OK;
}
static HRESULT IGetFrame_Construct( IGetFrameImpl* This,
IAVIStream* pstr,
LPBITMAPINFOHEADER lpbi )
{
HRESULT hr;
TRACE( "(%p)->(%p,%p)\n",This,pstr,lpbi );
IAVIStream_AddRef( pstr );
This->pas = pstr;
This->hIC = (HIC)NULL;
This->lCachedFrame = -1L;
This->pbiICIn = NULL;
This->pbiICOut = NULL;
This->pvICInFmtBuf = NULL;
This->pvICInDataBuf = NULL;
This->dwICInDataBufSize = 0;
This->pvICOutBuf = NULL;
hr = IGetFrame_SetFormat((IGetFrame*)This,lpbi,NULL,0,0,0,0);
if ( hr != S_OK )
return hr;
return S_OK;
}
static void IGetFrame_Destruct( IGetFrameImpl* This )
{
if ( This->hIC != (HIC)NULL )
{
ICClose( This->hIC );
This->hIC = (HIC)NULL;
}
if ( This->pvICInFmtBuf != NULL )
{
HeapFree( AVIFILE_data.hHeap, 0, This->pvICInFmtBuf );
This->pvICInFmtBuf = NULL;
}
if ( This->pvICInDataBuf != NULL )
{
HeapFree( AVIFILE_data.hHeap, 0, This->pvICInDataBuf );
This->pvICInDataBuf = NULL;
}
if ( This->pvICOutBuf != NULL )
{
HeapFree( AVIFILE_data.hHeap, 0, This->pvICOutBuf );
This->pvICOutBuf = NULL;
}
This->lCachedFrame = -1L;
This->pbiICIn = NULL;
This->pbiICOut = NULL;
This->dwICInDataBufSize = 0;
}

View File

@ -1,103 +0,0 @@
/*
* Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 <string.h>
#include <stdio.h>
#include <assert.h>
#include "winbase.h"
#include "winnls.h"
#include "mmsystem.h"
#include "winerror.h"
#include "vfw.h"
#include "wine/debug.h"
#include "avifile_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(avifile);
WINE_AVIFILE_DATA AVIFILE_data;
/***********************************************************************
* AVIFILE_InitProcess (internal)
*/
static BOOL AVIFILE_InitProcess( void )
{
TRACE("()\n");
AVIFILE_data.dwAVIFileRef = 0;
AVIFILE_data.dwClassObjRef = 0;
AVIFILE_data.hHeap = (HANDLE)NULL;
AVIFILE_data.hHeap = HeapCreate( 0, 0x10000, 0 );
if ( AVIFILE_data.hHeap == (HANDLE)NULL )
{
ERR( "cannot allocate heap for AVIFILE.\n" );
return FALSE;
}
return TRUE;
}
/***********************************************************************
* AVIFILE_UninitProcess (internal)
*/
static void AVIFILE_UninitProcess( void )
{
TRACE("()\n");
if ( AVIFILE_data.dwAVIFileRef != 0 )
ERR( "you must call AVIFileExit()\n" );
if ( AVIFILE_data.dwClassObjRef != 0 )
ERR( "you must release some objects allocated from AVIFile.\n" );
if ( AVIFILE_data.hHeap != (HANDLE)NULL )
{
HeapDestroy( AVIFILE_data.hHeap );
AVIFILE_data.hHeap = (HANDLE)NULL;
}
}
/***********************************************************************
* AVIFILE_DllMain
*/
BOOL WINAPI AVIFILE_DllMain(
HINSTANCE hInstDLL,
DWORD fdwReason,
LPVOID lpvReserved )
{
switch ( fdwReason )
{
case DLL_PROCESS_ATTACH:
if ( !AVIFILE_InitProcess() )
return FALSE;
break;
case DLL_PROCESS_DETACH:
AVIFILE_UninitProcess();
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
return TRUE;
}

View File

@ -1,109 +0,0 @@
/*
* Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 <string.h>
#include <stdio.h>
#include <assert.h>
#include "winbase.h"
#include "winnls.h"
#include "mmsystem.h"
#include "winerror.h"
#include "vfw.h"
#include "wine/debug.h"
#include "avifile_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(avifile);
/****************************************************************************
* string APIs (internal) - Copied from wine/dlls/imm32/string.c
*/
INT AVIFILE_strlenAtoW( LPCSTR lpstr )
{
INT len;
len = MultiByteToWideChar( CP_ACP, 0, lpstr, -1, NULL, 0 );
return ( len > 0 ) ? (len-1) : 0;
}
INT AVIFILE_strlenWtoA( LPCWSTR lpwstr )
{
INT len;
len = WideCharToMultiByte( CP_ACP, 0, lpwstr, -1,
NULL, 0, NULL, NULL );
return ( len > 0 ) ? (len-1) : 0;
}
LPWSTR AVIFILE_strncpyAtoW( LPWSTR lpwstr, LPCSTR lpstr, INT wbuflen )
{
INT len;
len = MultiByteToWideChar( CP_ACP, 0, lpstr, -1, lpwstr, wbuflen );
if ( len == 0 )
*lpwstr = 0;
return lpwstr;
}
LPSTR AVIFILE_strncpyWtoA( LPSTR lpstr, LPCWSTR lpwstr, INT abuflen )
{
INT len;
len = WideCharToMultiByte( CP_ACP, 0, lpwstr, -1,
lpstr, abuflen, NULL, NULL );
if ( len == 0 )
*lpstr = 0;
return lpstr;
}
LPWSTR AVIFILE_strdupAtoW( LPCSTR lpstr )
{
INT len;
LPWSTR lpwstr = NULL;
len = AVIFILE_strlenAtoW( lpstr );
if ( len > 0 )
{
lpwstr = (LPWSTR)HeapAlloc( AVIFILE_data.hHeap, 0, sizeof(WCHAR)*(len+1) );
if ( lpwstr != NULL )
(void)AVIFILE_strncpyAtoW( lpwstr, lpstr, len+1 );
}
return lpwstr;
}
LPSTR AVIFILE_strdupWtoA( LPCWSTR lpwstr )
{
INT len;
LPSTR lpstr = NULL;
len = AVIFILE_strlenWtoA( lpwstr );
if ( len > 0 )
{
lpstr = (LPSTR)HeapAlloc( AVIFILE_data.hHeap, 0, sizeof(CHAR)*(len+1) );
if ( lpstr != NULL )
(void)AVIFILE_strncpyWtoA( lpstr, lpwstr, len+1 );
}
return lpstr;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,34 +1,25 @@
name imm32
type win32
init IMM32_DllMain
import user32.dll
# NOTE: gdi32.dll will be required for implementing IME global class.
import gdi32.dll
import advapi32.dll
import kernel32.dll
import ntdll.dll
debug_channels (imm)
@ stdcall ImmAssociateContext(long long) ImmAssociateContext
@ stub ImmAssociateContextEx
@ stub ImmConfigureIME
@ stdcall ImmConfigureIMEA(long long long ptr) ImmConfigureIMEA
@ stdcall ImmConfigureIMEW(long long long ptr) ImmConfigureIMEW
@ stdcall ImmCreateContext() ImmCreateContext
@ stdcall ImmCreateIMCC(long) ImmCreateIMCC
@ stdcall ImmCreateSoftKeyboard(long long long long) ImmCreateSoftKeyboard
@ stub ImmCreateIMCC
@ stub ImmCreateSoftKeyboard
@ stdcall ImmDestroyContext(long) ImmDestroyContext
@ stdcall ImmDestroyIMCC(long) ImmDestroyIMCC
@ stdcall ImmDestroySoftKeyboard(long) ImmDestroySoftKeyboard
@ stdcall ImmDisableIME(long) ImmDisableIME
@ stub ImmEnumInputContext
@ stub ImmDestroyIMCC
@ stub ImmDestroySoftKeyboard
@ stdcall ImmEnumRegisterWordA(long ptr str long str ptr) ImmEnumRegisterWordA
@ stdcall ImmEnumRegisterWordW(long ptr wstr long wstr ptr) ImmEnumRegisterWordW
@ stdcall ImmEscapeA(long long long ptr) ImmEscapeA
@ stdcall ImmEscapeW(long long long ptr) ImmEscapeW
@ stdcall ImmGenerateMessage(long) ImmGenerateMessage
@ stub ImmGenerateMessage
@ stdcall ImmGetCandidateListA(long long ptr long) ImmGetCandidateListA
@ stdcall ImmGetCandidateListCountA(long ptr) ImmGetCandidateListCountA
@ stdcall ImmGetCandidateListCountW(long ptr) ImmGetCandidateListCountW
@ -48,10 +39,10 @@ debug_channels (imm)
@ stdcall ImmGetDescriptionW(long wstr long) ImmGetDescriptionW
@ stdcall ImmGetGuideLineA(long long str long) ImmGetGuideLineA
@ stdcall ImmGetGuideLineW(long long wstr long) ImmGetGuideLineW
@ stdcall ImmGetHotKey(long ptr ptr ptr) ImmGetHotKey
@ stdcall ImmGetIMCCLockCount(long) ImmGetIMCCLockCount
@ stdcall ImmGetIMCCSize(long) ImmGetIMCCSize
@ stdcall ImmGetIMCLockCount(long) ImmGetIMCLockCount
@ stub ImmGetHotKey
@ stub ImmGetIMCCLockCount
@ stub ImmGetIMCCSize
@ stub ImmGetIMCLockCount
@ stdcall ImmGetIMEFileNameA(long str long) ImmGetIMEFileNameA
@ stdcall ImmGetIMEFileNameW(long wstr long) ImmGetIMEFileNameW
@ stdcall ImmGetOpenStatus(long) ImmGetOpenStatus
@ -65,15 +56,13 @@ debug_channels (imm)
@ stdcall ImmIsIME(long) ImmIsIME
@ stdcall ImmIsUIMessageA(long long long long) ImmIsUIMessageA
@ stdcall ImmIsUIMessageW(long long long long) ImmIsUIMessageW
@ stdcall ImmLockIMC(long) ImmLockIMC
@ stdcall ImmLockIMCC(long) ImmLockIMCC
@ stub ImmLockIMC
@ stub ImmLockIMCC
@ stdcall ImmNotifyIME(long long long long) ImmNotifyIME
@ stdcall ImmReSizeIMCC(long long) ImmReSizeIMCC
@ stub ImmReSizeIMCC
@ stdcall ImmRegisterWordA(long str long str) ImmRegisterWordA
@ stdcall ImmRegisterWordW(long wstr long wstr) ImmRegisterWordW
@ stdcall ImmReleaseContext(long long) ImmReleaseContext
@ stub ImmRequestMessageA
@ stub ImmRequestMessageW
@ stdcall ImmSetCandidateWindow(long ptr) ImmSetCandidateWindow
@ stdcall ImmSetCompositionFontA(long ptr) ImmSetCompositionFontA
@ stdcall ImmSetCompositionFontW(long ptr) ImmSetCompositionFontW
@ -81,13 +70,12 @@ debug_channels (imm)
@ stdcall ImmSetCompositionStringW(long long ptr long ptr long) ImmSetCompositionStringW
@ stdcall ImmSetCompositionWindow(long ptr) ImmSetCompositionWindow
@ stdcall ImmSetConversionStatus(long long long) ImmSetConversionStatus
@ stdcall ImmSetHotKey(long long long long) ImmSetHotKey
@ stub ImmSetHotKey
@ stdcall ImmSetOpenStatus(long long) ImmSetOpenStatus
@ stdcall ImmSetStatusWindowPos(long ptr) ImmSetStatusWindowPos
@ stdcall ImmShowSoftKeyboard(long long) ImmShowSoftKeyboard
@ stub ImmShowSoftKeyboard
@ stdcall ImmSimulateHotKey(long long) ImmSimulateHotKey
@ stdcall ImmUnlockIMC(long) ImmUnlockIMC
@ stdcall ImmUnlockIMCC(long) ImmUnlockIMCC
@ stub ImmUnlockIMC
@ stub ImmUnlockIMCC
@ stdcall ImmUnregisterWordA(long str long str) ImmUnregisterWordA
@ stdcall ImmUnregisterWordW(long wstr long wstr) ImmUnregisterWordW
@ stub SKWndProcT1

View File

@ -1,144 +0,0 @@
/*
* DDK version of imm.h - imm.h for IMM and IME.
*
* Copyright 2000 Hidenori Takeshima
*
* 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 __WINE_IMMDDK_H
#define __WINE_IMMDDK_H
#include "imm.h"
/*** IMM and IME Structures ***/
typedef struct tagINPUTCONTEXT {
HWND hWnd;
BOOL fOpen;
POINT ptStatusWndPos;
POINT ptSoftKbdPos;
DWORD fdwConversion;
DWORD fdwSentence;
union {
LOGFONTA A;
LOGFONTW W;
} lfFont;
COMPOSITIONFORM cfCompForm;
CANDIDATEFORM cfCandForm[4];
HIMCC hCompStr;
HIMCC hCandInfo;
HIMCC hGuideLine;
HIMCC hPrivate;
DWORD dwNumMsgBuf;
HIMCC hMsgBuf;
DWORD fdwInit;
DWORD dwReserve[3];
} INPUTCONTEXT, * LPINPUTCONTEXT;
typedef struct tagCOMPOSITIONSTRING
{
DWORD dwSize;
DWORD dwCompReadAttrLen;
DWORD dwCompReadAttrOffset;
DWORD dwCompReadClauseLen;
DWORD dwCompReadClauseOffset;
DWORD dwCompReadStrLen;
DWORD dwCompReadStrOffset;
DWORD dwCompAttrLen;
DWORD dwCompAttrOffset;
DWORD dwCompClauseLen;
DWORD dwCompClauseOffset;
DWORD dwCompStrLen;
DWORD dwCompStrOffset;
DWORD dwCursorPos;
DWORD dwDeltaStart;
DWORD dwResultReadClauseLen;
DWORD dwResultReadClauseOffset;
DWORD dwResultReadStrLen;
DWORD dwResultReadStrOffset;
DWORD dwResultClauseLen;
DWORD dwResultClauseOffset;
DWORD dwResultStrLen;
DWORD dwResultStrOffset;
DWORD dwPrivateSize;
DWORD dwPrivateOffset;
} COMPOSITIONSTRING, * LPCOMPOSITIONSTRING;
typedef struct tagCANDIDATEINFO
{
DWORD dwSize;
DWORD dwCount;
DWORD dwOffset[32];
DWORD dwPrivateSize;
DWORD dwPrivateOffset;
} CANDIDATEINFO, * LPCANDIDATEINFO;
typedef struct tagGUIDELINE
{
DWORD dwSize;
DWORD dwLevel;
DWORD dwIndex;
DWORD dwStrLen;
DWORD dwStrOffset;
DWORD dwPrivateSize;
DWORD dwPrivateOffset;
} GUIDELINE, * LPGUIDELINE;
/*** IME Management Structures ***/
typedef struct tagIMEINFO
{
DWORD dwPrivateDataSize;
DWORD fdwProperty;
DWORD fdwConversionCaps;
DWORD fdwSentenceCaps;
DWORD fdwUICaps;
DWORD fdwSCSCaps;
DWORD fdwSelectCaps;
} IMEINFO, * LPIMEINFO;
/*** IME Communication Structures ***/
typedef struct tagSOFTKBDDATA
{
UINT uCount;
WORD wCode[1][256];
} SOFTKBDDATA, * LPSOFTKBDDATA;
/*** IMM DDK APIs ***/
HWND WINAPI ImmCreateSoftKeyboard(UINT uType, HWND hwndOwner, int x, int y);
BOOL WINAPI ImmDestroySoftKeyboard(HWND hwndSoftKeyboard);
BOOL WINAPI ImmShowSoftKeyboard(HWND hwndSoftKeyboard, int nCmdShow);
LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC);
BOOL WINAPI ImmUnlockIMC(HIMC hIMC);
DWORD WINAPI ImmGetIMCLockCount(HIMC hIMC);
HIMCC WINAPI ImmCreateIMCC(DWORD dwSize);
HIMCC WINAPI ImmDestroyIMCC(HIMCC hIMCC);
LPVOID WINAPI ImmLockIMCC(HIMCC hIMCC);
BOOL WINAPI ImmUnlockIMCC(HIMCC hIMCC);
DWORD WINAPI ImmGetIMCCLockCount(HIMCC hIMCC);
HIMCC WINAPI ImmReSizeIMCC(HIMCC hIMCC, DWORD dwSize);
DWORD WINAPI ImmGetIMCCSize(HIMCC hIMCC);
#endif /* __WINE_IMMDDK_H */

View File

@ -3,57 +3,12 @@ TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = quartz.dll
EXTRALIBS = $(LIBUUID) @JPEGLIB@
LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o
C_SRCS = \
acmwrap.c \
amundoc.c \
asyncsrc.c \
audioutl.c \
audren.c \
avidec.c \
aviparse.c \
basefilt.c \
basepin.c \
capgraph.c \
complist.c \
csconv.c \
devenum.c \
enumunk.c \
fgevent.c \
fgpass.c \
fgraph.c \
filesink.c \
fmap.c \
ifgraph.c \
ijgdec.c \
imcntl.c \
imfilter.c \
impos.c \
imseek.c \
iunk.c \
main.c \
memalloc.c \
midparse.c \
mjpgdec.c \
mpadec.c \
mpgparse.c \
mpvdec.c \
mtype.c \
parser.c \
qtdec.c \
qtparse.c \
regsvr.c \
sample.c \
seekpass.c \
sysclock.c \
videoblt.c \
vidren.c \
wavparse.c \
xform.c
main.c
@MAKE_DLL_RULES@

View File

@ -1,32 +0,0 @@
notes for implementing quartz.dll
FIXMEs
- deadlocks
- merge some C sources
- implement filters
- color-space converter
- sort active filters in filter graph
- plug-in distributors
- seeking
- ACM wrapper
- mciqtz(mci driver for quartz)
- renderers
- notifications
known issues
- all FIXMEs.
known/unconfirmed patent issues
- Some kinds of implementation of asynchronous I/O
- ASF
- WM?
- MPEG-1/video
- MPEG-1/audio
- DVD navigator
- AC3 parser

View File

@ -1,695 +0,0 @@
/*
* Implements ACM Wrapper(CLSID_ACMWrapper).
*
* FIXME - stub
* FIXME - no encoding
*
* Copyright (C) 2002 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "msacm.h"
#include "strmif.h"
#include "control.h"
#include "amvideo.h"
#include "vfwmsgs.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "xform.h"
#include "mtype.h"
static const WCHAR ACMWrapper_FilterName[] =
{'A','C','M',' ','W','r','a','p','p','e','r',0};
typedef struct CACMWrapperImpl
{
HACMSTREAM has;
WAVEFORMATEX* pwfxIn;
AM_MEDIA_TYPE* pmtOuts;
DWORD cOuts;
BYTE* pConvBuf;
DWORD cbConvBlockSize;
DWORD cbConvCached;
DWORD cbConvAllocated;
} CACMWrapperImpl;
static
void ACMWrapper_CleanupMTypes( CACMWrapperImpl* This )
{
DWORD n;
if ( This->pmtOuts == NULL ) return;
for ( n = 0; n < This->cOuts; n++ )
{
QUARTZ_MediaType_Free( &This->pmtOuts[n] );
}
QUARTZ_FreeMem( This->pmtOuts );
This->pmtOuts = NULL;
This->cOuts = 0;
}
static
void ACMWrapper_CleanupConvBuf( CACMWrapperImpl* This )
{
if ( This->pConvBuf != NULL )
{
QUARTZ_FreeMem( This->pConvBuf );
This->pConvBuf = NULL;
}
This->cbConvBlockSize = 0;
This->cbConvCached = 0;
This->cbConvAllocated = 0;
}
static
const WAVEFORMATEX* ACMWrapper_GetAudioFmt( const AM_MEDIA_TYPE* pmt )
{
const WAVEFORMATEX* pwfx;
if ( !IsEqualGUID( &pmt->majortype, &MEDIATYPE_Audio ) )
return NULL;
if ( !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_NULL ) &&
!QUARTZ_MediaSubType_IsFourCC( &pmt->subtype ) )
return NULL;
if ( !IsEqualGUID( &pmt->formattype, &FORMAT_WaveFormatEx ) )
return NULL;
if ( pmt->pbFormat == NULL ||
pmt->cbFormat < (sizeof(WAVEFORMATEX)-sizeof(WORD)) )
return NULL;
pwfx = (const WAVEFORMATEX*)pmt->pbFormat;
if ( pwfx->wFormatTag != 1 && pmt->cbFormat < sizeof(WAVEFORMATEX) )
return NULL;
return pwfx;
}
static
HRESULT ACMWrapper_SetupAudioFmt(
AM_MEDIA_TYPE* pmt,
DWORD cbFormat, WORD wFormatTag, DWORD dwBlockAlign )
{
ZeroMemory( pmt, sizeof(AM_MEDIA_TYPE) );
memcpy( &pmt->majortype, &MEDIATYPE_Audio, sizeof(GUID) );
QUARTZ_MediaSubType_FromFourCC( &pmt->subtype, (DWORD)wFormatTag );
pmt->bFixedSizeSamples = 1;
pmt->bTemporalCompression = 1;
pmt->lSampleSize = dwBlockAlign;
memcpy( &pmt->formattype, &FORMAT_WaveFormatEx, sizeof(GUID) );
pmt->pUnk = NULL;
pmt->cbFormat = cbFormat;
pmt->pbFormat = (BYTE*)CoTaskMemAlloc( cbFormat );
if ( pmt->pbFormat == NULL )
return E_OUTOFMEMORY;
return S_OK;
}
static
void ACMWrapper_FillFmtPCM(
WAVEFORMATEX* pwfxOut,
const WAVEFORMATEX* pwfxIn,
WORD wBitsPerSampOut )
{
pwfxOut->wFormatTag = 1;
pwfxOut->nChannels = pwfxIn->nChannels;
pwfxOut->nSamplesPerSec = pwfxIn->nSamplesPerSec;
pwfxOut->nAvgBytesPerSec = ((DWORD)pwfxIn->nSamplesPerSec * (DWORD)pwfxIn->nChannels * (DWORD)wBitsPerSampOut) >> 3;
pwfxOut->nBlockAlign = (pwfxIn->nChannels * wBitsPerSampOut) >> 3;
pwfxOut->wBitsPerSample = wBitsPerSampOut;
pwfxOut->cbSize = 0;
}
static
BOOL ACMWrapper_IsSupported(
WAVEFORMATEX* pwfxOut,
WAVEFORMATEX* pwfxIn )
{
MMRESULT mr;
mr = acmStreamOpen(
NULL,(HACMDRIVER)NULL,
pwfxIn,pwfxOut,NULL,
0,0,ACM_STREAMOPENF_QUERY);
if ( mr == ACMERR_NOTPOSSIBLE )
mr = acmStreamOpen(
NULL,(HACMDRIVER)NULL,
pwfxIn,pwfxOut,NULL,
0,0,ACM_STREAMOPENF_NONREALTIME|ACM_STREAMOPENF_QUERY);
return !!(mr == MMSYSERR_NOERROR);
}
static
HRESULT ACMWrapper_StreamOpen(
HACMSTREAM* phas,
WAVEFORMATEX* pwfxOut,
WAVEFORMATEX* pwfxIn )
{
HACMSTREAM has = (HACMSTREAM)NULL;
MMRESULT mr;
mr = acmStreamOpen(
&has,(HACMDRIVER)NULL,
pwfxIn,pwfxOut,NULL,
0,0,0);
if ( mr == ACMERR_NOTPOSSIBLE )
mr = acmStreamOpen(
&has,(HACMDRIVER)NULL,
pwfxIn,pwfxOut,NULL,
0,0,ACM_STREAMOPENF_NONREALTIME);
if ( mr != MMSYSERR_NOERROR )
{
if ( mr == MMSYSERR_NOMEM )
return E_OUTOFMEMORY;
return E_FAIL;
}
*phas = has;
return S_OK;
}
/***************************************************************************
*
* CACMWrapperImpl methods
*
*/
static void ACMWrapper_Close( CACMWrapperImpl* This )
{
if ( This->has != (HACMSTREAM)NULL )
{
acmStreamReset( This->has, 0 );
acmStreamClose( This->has, 0 );
This->has = (HACMSTREAM)NULL;
}
}
static HRESULT ACMWrapper_Init( CTransformBaseImpl* pImpl )
{
CACMWrapperImpl* This = pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This != NULL )
return NOERROR;
This = (CACMWrapperImpl*)QUARTZ_AllocMem( sizeof(CACMWrapperImpl) );
if ( This == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This, sizeof(CACMWrapperImpl) );
pImpl->m_pUserData = This;
/* construct */
This->has = (HACMSTREAM)NULL;
This->pwfxIn = NULL;
This->pmtOuts = NULL;
This->cOuts = 0;
This->pConvBuf = NULL;
return S_OK;
}
static HRESULT ACMWrapper_Cleanup( CTransformBaseImpl* pImpl )
{
CACMWrapperImpl* This = pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This == NULL )
return NOERROR;
/* destruct */
ACMWrapper_Close( This );
QUARTZ_FreeMem( This->pwfxIn );
ACMWrapper_CleanupMTypes( This );
ACMWrapper_CleanupConvBuf( This );
QUARTZ_FreeMem( This );
pImpl->m_pUserData = NULL;
return S_OK;
}
static HRESULT ACMWrapper_CheckMediaType( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut )
{
CACMWrapperImpl* This = pImpl->m_pUserData;
const WAVEFORMATEX* pwfxIn;
const WAVEFORMATEX* pwfxOut;
WAVEFORMATEX wfx;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
pwfxIn = ACMWrapper_GetAudioFmt(pmtIn);
if ( pwfxIn == NULL ||
pwfxIn->wFormatTag == 0 ||
pwfxIn->wFormatTag == 1 )
{
TRACE("pwfxIn is not a compressed audio\n");
return E_FAIL;
}
if ( pmtOut != NULL )
{
pwfxOut = ACMWrapper_GetAudioFmt(pmtOut);
if ( pwfxOut == NULL || pwfxOut->wFormatTag != 1 )
{
TRACE("pwfxOut is not a linear PCM\n");
return E_FAIL;
}
if ( pwfxIn->nChannels != pwfxOut->nChannels ||
pwfxIn->nSamplesPerSec != pwfxOut->nSamplesPerSec )
{
TRACE("nChannels or nSamplesPerSec is not matched\n");
return E_FAIL;
}
if ( !ACMWrapper_IsSupported((WAVEFORMATEX*)pwfxOut,(WAVEFORMATEX*)pwfxIn) )
{
TRACE("specified formats are not supported by ACM\n");
return E_FAIL;
}
}
else
{
ACMWrapper_FillFmtPCM(&wfx,pwfxIn,8);
if ( ACMWrapper_IsSupported(&wfx,(WAVEFORMATEX*)pwfxIn) )
{
TRACE("compressed audio - can be decoded to 8bit\n");
return S_OK;
}
ACMWrapper_FillFmtPCM(&wfx,pwfxIn,16);
if ( ACMWrapper_IsSupported(&wfx,(WAVEFORMATEX*)pwfxIn) )
{
TRACE("compressed audio - can be decoded to 16bit\n");
return S_OK;
}
TRACE("unhandled audio %04x\n",(unsigned)pwfxIn->wFormatTag);
return E_FAIL;
}
return S_OK;
}
static HRESULT ACMWrapper_GetOutputTypes( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE** ppmtAcceptTypes, ULONG* pcAcceptTypes )
{
CACMWrapperImpl* This = pImpl->m_pUserData;
HRESULT hr;
const WAVEFORMATEX* pwfxIn;
AM_MEDIA_TYPE* pmtTry;
WAVEFORMATEX* pwfxTry;
FIXME("(%p)\n",This);
hr = ACMWrapper_CheckMediaType( pImpl, pmtIn, NULL );
if ( FAILED(hr) )
return hr;
pwfxIn = (const WAVEFORMATEX*)pmtIn->pbFormat;
ACMWrapper_CleanupMTypes( This );
This->pmtOuts = QUARTZ_AllocMem( sizeof(AM_MEDIA_TYPE) * 2 );
if ( This->pmtOuts == NULL )
return E_OUTOFMEMORY;
This->cOuts = 0;
pmtTry = &This->pmtOuts[This->cOuts];
hr = ACMWrapper_SetupAudioFmt(
pmtTry,
sizeof(WAVEFORMATEX), 1,
(pwfxIn->nChannels * 8) >> 3 );
if ( FAILED(hr) ) goto err;
pwfxTry = (WAVEFORMATEX*)pmtTry->pbFormat;
ACMWrapper_FillFmtPCM( pwfxTry, pwfxIn, 8 );
if ( ACMWrapper_IsSupported( pwfxTry, (WAVEFORMATEX*)pwfxIn ) )
This->cOuts ++;
pmtTry = &This->pmtOuts[This->cOuts];
hr = ACMWrapper_SetupAudioFmt(
pmtTry,
sizeof(WAVEFORMATEX), 1,
(pwfxIn->nChannels * 16) >> 3 );
if ( FAILED(hr) ) goto err;
pwfxTry = (WAVEFORMATEX*)pmtTry->pbFormat;
ACMWrapper_FillFmtPCM( pwfxTry, pwfxIn, 16 );
if ( ACMWrapper_IsSupported( pwfxTry, (WAVEFORMATEX*)pwfxIn ) )
This->cOuts ++;
*ppmtAcceptTypes = This->pmtOuts;
*pcAcceptTypes = This->cOuts;
return S_OK;
err:
ACMWrapper_CleanupMTypes( This );
return hr;
}
static HRESULT
ACMWrapper_GetConvBufSize(
CTransformBaseImpl* pImpl,
CACMWrapperImpl* This,
DWORD* pcbInput, DWORD* pcbOutput,
const AM_MEDIA_TYPE* pmtOut, const AM_MEDIA_TYPE* pmtIn )
{
HRESULT hr;
const WAVEFORMATEX* pwfxIn;
const WAVEFORMATEX* pwfxOut;
HACMSTREAM has;
MMRESULT mr;
DWORD cbInput;
DWORD cbOutput;
if ( This == NULL )
return E_UNEXPECTED;
hr = ACMWrapper_CheckMediaType( pImpl, pmtIn, pmtOut );
if ( FAILED(hr) )
return hr;
pwfxIn = (const WAVEFORMATEX*)pmtIn->pbFormat;
pwfxOut = (const WAVEFORMATEX*)pmtOut->pbFormat;
hr = ACMWrapper_StreamOpen(
&has, (WAVEFORMATEX*)pwfxOut, (WAVEFORMATEX*)pwfxIn );
if ( FAILED(hr) )
return hr;
cbInput = (pwfxIn->nAvgBytesPerSec + pwfxIn->nBlockAlign - 1) / pwfxIn->nBlockAlign * pwfxIn->nBlockAlign;
cbOutput = 0;
mr = acmStreamSize( has, cbInput, &cbOutput, ACM_STREAMSIZEF_SOURCE );
acmStreamClose( has, 0 );
if ( mr != MMSYSERR_NOERROR || cbOutput == 0 )
return E_FAIL;
TRACE("size %lu -> %lu\n", cbInput, cbOutput);
if ( pcbInput != NULL ) *pcbInput = cbInput;
if ( pcbOutput != NULL ) *pcbOutput = cbOutput;
return S_OK;
}
static HRESULT ACMWrapper_GetAllocProp( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, ALLOCATOR_PROPERTIES* pProp, BOOL* pbTransInPlace, BOOL* pbTryToReuseSample )
{
CACMWrapperImpl* This = pImpl->m_pUserData;
HRESULT hr;
DWORD cbOutput;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = ACMWrapper_GetConvBufSize(
pImpl, This, NULL, &cbOutput, pmtOut, pmtIn );
if ( FAILED(hr) )
return hr;
pProp->cBuffers = 1;
pProp->cbBuffer = cbOutput;
*pbTransInPlace = FALSE;
*pbTryToReuseSample = FALSE;
return S_OK;
}
static HRESULT ACMWrapper_BeginTransform( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, BOOL bReuseSample )
{
CACMWrapperImpl* This = pImpl->m_pUserData;
HRESULT hr;
const WAVEFORMATEX* pwfxIn;
const WAVEFORMATEX* pwfxOut;
DWORD cbInput;
FIXME("(%p,%p,%p,%d)\n",This,pmtIn,pmtOut,bReuseSample);
if ( This == NULL )
return E_UNEXPECTED;
ACMWrapper_Close( This );
ACMWrapper_CleanupMTypes( This );
ACMWrapper_CleanupConvBuf( This );
hr = ACMWrapper_GetConvBufSize(
pImpl, This, &cbInput, NULL, pmtOut, pmtIn );
if ( FAILED(hr) )
return hr;
pwfxIn = (const WAVEFORMATEX*)pmtIn->pbFormat;
pwfxOut = (const WAVEFORMATEX*)pmtOut->pbFormat;
This->pConvBuf = (BYTE*)QUARTZ_AllocMem( cbInput );
if ( This->pConvBuf == NULL )
return E_OUTOFMEMORY;
This->cbConvBlockSize = pwfxIn->nBlockAlign;
This->cbConvCached = 0;
This->cbConvAllocated = cbInput;
hr = ACMWrapper_StreamOpen(
&This->has,
(WAVEFORMATEX*)pmtOut, (WAVEFORMATEX*)pmtIn );
if ( FAILED(hr) )
return E_FAIL;
return S_OK;
}
static HRESULT ACMWrapper_Convert(
CTransformBaseImpl* pImpl,
CACMWrapperImpl* This,
BYTE* pbSrc, DWORD cbSrcLen,
DWORD dwConvertFlags )
{
ACMSTREAMHEADER ash;
MMRESULT mr;
HRESULT hr = E_FAIL;
DWORD dwConvCallFlags;
DWORD cb;
IMediaSample* pSampOut = NULL;
BYTE* pOutBuf;
LONG lOutBufLen;
TRACE("()\n");
if ( This->pConvBuf == NULL )
return E_UNEXPECTED;
dwConvCallFlags = ACM_STREAMCONVERTF_BLOCKALIGN;
if ( dwConvertFlags & ACM_STREAMCONVERTF_START )
{
dwConvCallFlags |= ACM_STREAMCONVERTF_START;
This->cbConvCached = 0;
}
while ( 1 )
{
cb = cbSrcLen + This->cbConvCached;
if ( cb > This->cbConvAllocated )
cb = This->cbConvAllocated;
cb -= This->cbConvCached;
if ( cb > 0 )
{
memcpy( This->pConvBuf+This->cbConvCached,
pbSrc, cb );
pbSrc += cb;
cbSrcLen -= cb;
This->cbConvCached += cb;
}
cb = This->cbConvCached / This->cbConvBlockSize * This->cbConvBlockSize;
if ( cb == 0 )
{
if ( dwConvertFlags & ACM_STREAMCONVERTF_END )
{
dwConvCallFlags &= ~ACM_STREAMCONVERTF_BLOCKALIGN;
dwConvCallFlags |= ACM_STREAMCONVERTF_END;
cb = This->cbConvCached;
}
if ( cb == 0 )
{
hr = S_OK;
break;
}
}
ZeroMemory( &ash, sizeof(ash) );
ash.cbStruct = sizeof(ash);
ash.pbSrc = This->pConvBuf;
ash.cbSrcLength = cb;
hr = IMemAllocator_GetBuffer(
pImpl->m_pOutPinAllocator,
&pSampOut, NULL, NULL, 0 );
if ( FAILED(hr) )
break;
hr = IMediaSample_SetSyncPoint( pSampOut, TRUE );
if ( FAILED(hr) )
break;
if ( dwConvCallFlags & ACM_STREAMCONVERTF_START )
{
hr = IMediaSample_SetDiscontinuity( pSampOut, TRUE );
if ( FAILED(hr) )
break;
}
hr = IMediaSample_GetPointer( pSampOut, &pOutBuf );
if ( FAILED(hr) )
break;
lOutBufLen = IMediaSample_GetSize( pSampOut );
if ( lOutBufLen <= 0 )
{
hr = E_FAIL;
break;
}
ash.pbDst = pOutBuf;
ash.cbDstLength = lOutBufLen;
mr = acmStreamPrepareHeader(
This->has, &ash, 0 );
if ( mr == MMSYSERR_NOERROR )
mr = acmStreamConvert(
This->has, &ash, dwConvCallFlags );
if ( mr == MMSYSERR_NOERROR )
mr = acmStreamUnprepareHeader(
This->has, &ash, 0 );
if ( mr != MMSYSERR_NOERROR || ash.cbSrcLengthUsed == 0 )
{
hr = E_FAIL;
break;
}
if ( ash.cbDstLengthUsed > 0 )
{
hr = IMediaSample_SetActualDataLength( pSampOut, ash.cbDstLengthUsed );
if ( FAILED(hr) )
break;
hr = CPinBaseImpl_SendSample(
&pImpl->pOutPin->pin,
pSampOut );
if ( FAILED(hr) )
break;
}
if ( This->cbConvCached == ash.cbSrcLengthUsed )
{
This->cbConvCached = 0;
}
else
{
This->cbConvCached -= ash.cbSrcLengthUsed;
memmove( This->pConvBuf,
This->pConvBuf + ash.cbSrcLengthUsed,
This->cbConvCached );
}
IMediaSample_Release( pSampOut ); pSampOut = NULL;
dwConvCallFlags &= ~ACM_STREAMCONVERTF_START;
}
if ( pSampOut != NULL )
IMediaSample_Release( pSampOut );
return hr;
}
static HRESULT ACMWrapper_ProcessReceive( CTransformBaseImpl* pImpl, IMediaSample* pSampIn )
{
CACMWrapperImpl* This = pImpl->m_pUserData;
BYTE* pDataIn = NULL;
LONG lDataInLen;
HRESULT hr;
DWORD dwConvFlags = 0;
FIXME("(%p)\n",This);
if ( This == NULL || This->has == (HACMSTREAM)NULL )
return E_UNEXPECTED;
hr = IMediaSample_GetPointer( pSampIn, &pDataIn );
if ( FAILED(hr) )
return hr;
lDataInLen = IMediaSample_GetActualDataLength( pSampIn );
if ( lDataInLen < 0 )
return E_FAIL;
if ( IMediaSample_IsDiscontinuity( pSampIn ) != S_OK )
dwConvFlags |= ACM_STREAMCONVERTF_START;
return ACMWrapper_Convert(
pImpl, This, pDataIn, (DWORD)lDataInLen,
dwConvFlags );
}
static HRESULT ACMWrapper_EndTransform( CTransformBaseImpl* pImpl )
{
CACMWrapperImpl* This = pImpl->m_pUserData;
HRESULT hr;
DWORD dwConvFlags = ACM_STREAMCONVERTF_END;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = ACMWrapper_Convert(
pImpl, This, NULL, 0,
dwConvFlags );
ACMWrapper_Close( This );
ACMWrapper_CleanupMTypes( This );
ACMWrapper_CleanupConvBuf( This );
return hr;
}
static const TransformBaseHandlers transhandlers =
{
ACMWrapper_Init,
ACMWrapper_Cleanup,
ACMWrapper_CheckMediaType,
ACMWrapper_GetOutputTypes,
ACMWrapper_GetAllocProp,
ACMWrapper_BeginTransform,
ACMWrapper_ProcessReceive,
NULL,
ACMWrapper_EndTransform,
};
HRESULT QUARTZ_CreateACMWrapper(IUnknown* punkOuter,void** ppobj)
{
return QUARTZ_CreateTransformBase(
punkOuter,ppobj,
&CLSID_ACMWrapper,
ACMWrapper_FilterName,
NULL, NULL,
&transhandlers );
}

View File

@ -1,76 +0,0 @@
/*
* Copyright (C) Hidenori TAKESHIMA
*
* 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 "config.h"
#include <math.h>
#include "windef.h"
#include "wine/obj_base.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
/***********************************************************************
* AmpFactorToDB (QUARTZ.@)
*
* undocumented.
* converting from Amp to dB?
*
*/
LONG WINAPI QUARTZ_AmpFactorToDB( LONG amp )
{
LONG dB;
TRACE( "(%ld)\n", amp );
if ( amp <= 0 || amp > 65536 )
return 0;
dB = (LONG)(2000.0 * log10((double)amp / 65536.0) + 0.5);
if ( dB >= 0 ) dB = 0;
if ( dB < -10000 ) dB = -10000;
return dB;
}
/***********************************************************************
* DBToAmpFactor (QUARTZ.@)
*
* undocumented.
* converting from dB to Amp?
*/
LONG WINAPI QUARTZ_DBToAmpFactor( LONG dB )
{
LONG amp;
TRACE( "(%ld)\n", dB );
if ( dB >= 0 )
return 65535;
if ( dB < -10000 )
return 0;
amp = (LONG)(pow(10.0,dB / 2000.0) * 65536.0 + 0.5);
if ( amp <= 0 ) amp = 1;
if ( amp >= 65536 ) amp = 65535;
return amp;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,144 +0,0 @@
/*
* Implements Asynchronous File/URL Source.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 WINE_DSHOW_ASYNCSRC_H
#define WINE_DSHOW_ASYNCSRC_H
#include "iunk.h"
#include "basefilt.h"
typedef struct CAsyncSourceImpl CAsyncSourceImpl;
typedef struct CAsyncSourcePinImpl CAsyncSourcePinImpl;
typedef struct AsyncSourceRequest AsyncSourceRequest;
typedef struct AsyncSourceHandlers AsyncSourceHandlers;
typedef struct CAsyncReaderImpl
{
ICOM_VFIELD(IAsyncReader);
/* IUnknown fields */
IUnknown* punkControl;
/* IAsyncReader fields */
CAsyncSourceImpl* pSource;
CRITICAL_SECTION m_csReader;
BOOL m_bInFlushing;
CRITICAL_SECTION m_csRequest;
CRITICAL_SECTION m_csReply;
AsyncSourceRequest* m_pReplyFirst;
CRITICAL_SECTION m_csFree;
AsyncSourceRequest* m_pFreeFirst;
} CAsyncReaderImpl;
typedef struct CFileSourceFilterImpl
{
ICOM_VFIELD(IFileSourceFilter);
/* IUnknown fields */
IUnknown* punkControl;
/* IFileSourceFilter fields */
CAsyncSourceImpl* pSource;
CRITICAL_SECTION* pcsFileSource;
WCHAR* m_pwszFileName;
DWORD m_cbFileName;
AM_MEDIA_TYPE m_mt;
} CFileSourceFilterImpl;
struct CAsyncSourceImpl
{
QUARTZ_IUnkImpl unk;
CBaseFilterImpl basefilter;
CFileSourceFilterImpl filesrc;
CRITICAL_SECTION csFilter;
CAsyncSourcePinImpl* pPin;
const AsyncSourceHandlers* m_pHandler;
void* m_pUserData;
};
struct CAsyncSourcePinImpl
{
QUARTZ_IUnkImpl unk;
CPinBaseImpl pin;
CAsyncReaderImpl async;
QUARTZ_IFDelegation qiext;
BOOL bAsyncReaderQueried;
CAsyncSourceImpl* pSource;
};
struct AsyncSourceRequest
{
AsyncSourceRequest* pNext;
IMediaSample* pSample; /* for async req. */
DWORD_PTR dwContext; /* for async req. */
HRESULT hr;
};
struct AsyncSourceHandlers
{
/* all handlers MUST be implemented. */
HRESULT (*pLoad)( CAsyncSourceImpl* pImpl, LPCWSTR lpwszSourceName );
HRESULT (*pCleanup)( CAsyncSourceImpl* pImpl );
HRESULT (*pGetLength)( CAsyncSourceImpl* pImpl, LONGLONG* pllTotal, LONGLONG* pllAvailable );
/* S_OK = OK / S_FALSE = Canceled / other = error */
/* hEventCancel may be NULL */
HRESULT (*pRead)( CAsyncSourceImpl* pImpl, LONGLONG llOfsStart, LONG lLength, BYTE* pBuf, LONG* plReturned, HANDLE hEventCancel );
};
#define CAsyncSourceImpl_THIS(iface,member) CAsyncSourceImpl* This = ((CAsyncSourceImpl*)(((char*)iface)-offsetof(CAsyncSourceImpl,member)))
#define CAsyncSourcePinImpl_THIS(iface,member) CAsyncSourcePinImpl* This = ((CAsyncSourcePinImpl*)(((char*)iface)-offsetof(CAsyncSourcePinImpl,member)))
HRESULT CAsyncReaderImpl_InitIAsyncReader(
CAsyncReaderImpl* This, IUnknown* punkControl,
CAsyncSourceImpl* pSource );
void CAsyncReaderImpl_UninitIAsyncReader(
CAsyncReaderImpl* This );
HRESULT CFileSourceFilterImpl_InitIFileSourceFilter(
CFileSourceFilterImpl* This, IUnknown* punkControl,
CAsyncSourceImpl* pSource,
CRITICAL_SECTION* pcsFileSource );
void CFileSourceFilterImpl_UninitIFileSourceFilter(
CFileSourceFilterImpl* This );
HRESULT QUARTZ_CreateAsyncSource(
IUnknown* punkOuter,void** ppobj,
const CLSID* pclsidAsyncSource,
LPCWSTR pwszAsyncSourceName,
LPCWSTR pwszOutPinName,
const AsyncSourceHandlers* pHandler );
HRESULT QUARTZ_CreateAsyncSourcePin(
CAsyncSourceImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CAsyncSourcePinImpl** ppPin,
LPCWSTR pwszPinName );
HRESULT QUARTZ_CreateAsyncReader(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateURLReader(IUnknown* punkOuter,void** ppobj);
#define ASYNCSRC_FILE_BLOCKSIZE 16384
#endif /* WINE_DSHOW_ASYNCSRC_H */

View File

@ -1,77 +0,0 @@
/*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "audioutl.h"
void AUDIOUTL_ChangeSign8( BYTE* pbData, DWORD cbData )
{
BYTE* pbEnd = pbData + cbData;
while ( pbData < pbEnd )
{
*pbData ^= 0x80;
pbData ++;
}
}
void AUDIOUTL_ChangeSign16LE( BYTE* pbData, DWORD cbData )
{
BYTE* pbEnd = pbData + cbData;
pbData ++;
while ( pbData < pbEnd )
{
*pbData ^= 0x80;
pbData += 2;
}
}
void AUDIOUTL_ChangeSign16BE( BYTE* pbData, DWORD cbData )
{
BYTE* pbEnd = pbData + cbData;
while ( pbData < pbEnd )
{
*pbData ^= 0x80;
pbData += 2;
}
}
void AUDIOUTL_ByteSwap( BYTE* pbData, DWORD cbData )
{
BYTE* pbEnd = pbData + cbData - 1;
BYTE bTemp;
while ( pbData < pbEnd )
{
bTemp = pbData[0];
pbData[0] = pbData[1];
pbData[1] = bTemp;
pbData += 2;
}
}

View File

@ -1,29 +0,0 @@
/*
* Copyright (C) Hidenori TAKESHIMA
*
* 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 QUARTZ_AUDIOUTL_H
#define QUARTZ_AUDIOUTL_H
void AUDIOUTL_ChangeSign8( BYTE* pbData, DWORD cbData );
void AUDIOUTL_ChangeSign16LE( BYTE* pbData, DWORD cbData );
void AUDIOUTL_ChangeSign16BE( BYTE* pbData, DWORD cbData );
void AUDIOUTL_ByteSwap( BYTE* pbData, DWORD cbData );
#endif /* QUARTZ_AUDIOUTL_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,91 +0,0 @@
/*
* Audio Renderer (CLSID_AudioRender)
*
* FIXME
* - implements IRefereneceClock.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 WINE_DSHOW_AUDREN_H
#define WINE_DSHOW_AUDREN_H
#include "iunk.h"
#include "basefilt.h"
#include "seekpass.h"
#define WINE_QUARTZ_WAVEOUT_COUNT 4
typedef struct CAudioRendererImpl CAudioRendererImpl;
typedef struct CAudioRendererPinImpl CAudioRendererPinImpl;
typedef struct AudRen_IBasicAudioImpl
{
ICOM_VFIELD(IBasicAudio);
} AudRen_IBasicAudioImpl;
struct CAudioRendererImpl
{
QUARTZ_IUnkImpl unk;
CBaseFilterImpl basefilter;
AudRen_IBasicAudioImpl basaud;
QUARTZ_IFDelegation qiext;
CSeekingPassThru* pSeekPass;
CAudioRendererPinImpl* pPin;
CRITICAL_SECTION m_csReceive;
BOOL m_fInFlush;
/* for waveOut */
long m_lAudioVolume;
long m_lAudioBalance;
BOOL m_fWaveOutInit;
HANDLE m_hEventRender;
HWAVEOUT m_hWaveOut;
DWORD m_dwBlockSize;
WAVEHDR* m_phdrCur;
WAVEHDR m_hdr[WINE_QUARTZ_WAVEOUT_COUNT];
};
struct CAudioRendererPinImpl
{
QUARTZ_IUnkImpl unk;
CPinBaseImpl pin;
CMemInputPinBaseImpl meminput;
CAudioRendererImpl* pRender;
};
#define CAudioRendererImpl_THIS(iface,member) CAudioRendererImpl* This = ((CAudioRendererImpl*)(((char*)iface)-offsetof(CAudioRendererImpl,member)))
#define CAudioRendererPinImpl_THIS(iface,member) CAudioRendererPinImpl* This = ((CAudioRendererPinImpl*)(((char*)iface)-offsetof(CAudioRendererPinImpl,member)))
HRESULT CAudioRendererImpl_InitIBasicAudio( CAudioRendererImpl* This );
void CAudioRendererImpl_UninitIBasicAudio( CAudioRendererImpl* This );
HRESULT QUARTZ_CreateAudioRenderer(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateAudioRendererPin(
CAudioRendererImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CRITICAL_SECTION* pcsPinReceive,
CAudioRendererPinImpl** ppPin);
#endif /* WINE_DSHOW_AUDREN_H */

View File

@ -1,458 +0,0 @@
/*
* Implements AVI Decompressor(CLSID_AVIDec).
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "vfw.h"
#include "strmif.h"
#include "control.h"
#include "amvideo.h"
#include "vfwmsgs.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "xform.h"
static const WCHAR AVIDec_FilterName[] =
{'A','V','I',' ','D','e','c','o','m','p','r','e','s','s','o','r',0};
typedef struct CAVIDecImpl
{
HIC hicCached;
HIC hicTrans;
AM_MEDIA_TYPE m_mtOut;
BITMAPINFO* m_pbiIn;
BITMAPINFO* m_pbiOut;
BYTE* m_pOutBuf;
} CAVIDecImpl;
/***************************************************************************
*
* CAVIDecImpl methods
*
*/
static void AVIDec_ReleaseDIBBuffers(CAVIDecImpl* This)
{
TRACE("(%p)\n",This);
if ( This->m_pbiIn != NULL )
{
QUARTZ_FreeMem(This->m_pbiIn); This->m_pbiIn = NULL;
}
if ( This->m_pbiOut != NULL )
{
QUARTZ_FreeMem(This->m_pbiOut); This->m_pbiOut = NULL;
}
if ( This->m_pOutBuf != NULL )
{
QUARTZ_FreeMem(This->m_pOutBuf); This->m_pOutBuf = NULL;
}
}
static BITMAPINFO* AVIDec_DuplicateBitmapInfo(const BITMAPINFO* pbi)
{
DWORD dwSize;
BITMAPINFO* pbiRet;
dwSize = pbi->bmiHeader.biSize;
if ( dwSize < sizeof(BITMAPINFOHEADER) )
return NULL;
if ( pbi->bmiHeader.biBitCount <= 8 )
{
if ( pbi->bmiHeader.biClrUsed == 0 )
dwSize += sizeof(RGBQUAD)*(1<<pbi->bmiHeader.biBitCount);
else
dwSize += sizeof(RGBQUAD)*pbi->bmiHeader.biClrUsed;
}
if ( pbi->bmiHeader.biCompression == 3 &&
dwSize == sizeof(BITMAPINFOHEADER) )
dwSize += sizeof(DWORD)*3;
pbiRet = (BITMAPINFO*)QUARTZ_AllocMem(dwSize);
if ( pbiRet != NULL )
memcpy( pbiRet, pbi, dwSize );
return pbiRet;
}
static HRESULT AVIDec_Init( CTransformBaseImpl* pImpl )
{
CAVIDecImpl* This = pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This != NULL )
return NOERROR;
This = (CAVIDecImpl*)QUARTZ_AllocMem( sizeof(CAVIDecImpl) );
if ( This == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This, sizeof(CAVIDecImpl) );
pImpl->m_pUserData = This;
/* construct */
This->hicCached = (HIC)NULL;
This->hicTrans = (HIC)NULL;
ZeroMemory( &This->m_mtOut, sizeof(AM_MEDIA_TYPE) );
This->m_pbiIn = NULL;
This->m_pbiOut = NULL;
This->m_pOutBuf = NULL;
return NOERROR;
}
static HRESULT AVIDec_Cleanup( CTransformBaseImpl* pImpl )
{
CAVIDecImpl* This = pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This == NULL )
return NOERROR;
/* destruct */
QUARTZ_MediaType_Free( &This->m_mtOut );
AVIDec_ReleaseDIBBuffers(This);
if ( This->hicCached != (HIC)NULL )
ICClose(This->hicCached);
if ( This->hicTrans != (HIC)NULL )
ICClose(This->hicTrans);
QUARTZ_FreeMem( This );
pImpl->m_pUserData = NULL;
return NOERROR;
}
static HRESULT AVIDec_CheckMediaType( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut )
{
CAVIDecImpl* This = pImpl->m_pUserData;
BITMAPINFO* pbiIn = NULL;
BITMAPINFO* pbiOut = NULL;
HIC hic;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
if ( !IsEqualGUID( &pmtIn->majortype, &MEDIATYPE_Video ) )
return E_FAIL;
if ( !IsEqualGUID( &pmtIn->formattype, &FORMAT_VideoInfo ) )
return E_FAIL;
pbiIn = (BITMAPINFO*)(&((VIDEOINFOHEADER*)pmtIn->pbFormat)->bmiHeader);
if ( pmtOut != NULL )
{
if ( !IsEqualGUID( &pmtOut->majortype, &MEDIATYPE_Video ) )
return E_FAIL;
if ( !IsEqualGUID( &pmtOut->formattype, &FORMAT_VideoInfo ) )
return E_FAIL;
pbiOut = (BITMAPINFO*)(&((VIDEOINFOHEADER*)pmtOut->pbFormat)->bmiHeader);
}
if ( This->hicCached != (HIC)NULL &&
ICDecompressQuery( This->hicCached, pbiIn, pbiOut ) == ICERR_OK )
{
TRACE("supported format\n");
return NOERROR;
}
TRACE("try to find a decoder...\n");
hic = ICLocate(
mmioFOURCC('V','I','D','C'), 0,
&pbiIn->bmiHeader, &pbiOut->bmiHeader, ICMODE_DECOMPRESS );
if ( hic == (HIC)NULL )
{
WARN("no decoder for %c%c%c%c\n",
(int)(( pbiIn->bmiHeader.biCompression >> 0 ) & 0xff),
(int)(( pbiIn->bmiHeader.biCompression >> 8 ) & 0xff),
(int)(( pbiIn->bmiHeader.biCompression >> 16 ) & 0xff),
(int)(( pbiIn->bmiHeader.biCompression >> 24 ) & 0xff) );
return E_FAIL;
}
TRACE("found\n");
if ( This->hicCached != (HIC)NULL )
ICClose(This->hicCached);
This->hicCached = hic;
return NOERROR;
}
static HRESULT AVIDec_GetOutputTypes( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE** ppmtAcceptTypes, ULONG* pcAcceptTypes )
{
CAVIDecImpl* This = pImpl->m_pUserData;
HRESULT hr;
LONG cbFmt;
BITMAPINFO* pbiIn = NULL;
BITMAPINFO* pbiOut = NULL;
TRACE("(%p)\n",This);
hr = AVIDec_CheckMediaType( pImpl, pmtIn, NULL );
if ( FAILED(hr) )
return hr;
TRACE("(%p) - get size of format\n",This);
pbiIn = (BITMAPINFO*)(&((VIDEOINFOHEADER*)pmtIn->pbFormat)->bmiHeader);
cbFmt = (LONG)ICDecompressGetFormatSize( This->hicCached, pbiIn );
if ( cbFmt < sizeof(BITMAPINFOHEADER) )
return E_FAIL;
QUARTZ_MediaType_Free( &This->m_mtOut );
ZeroMemory( &This->m_mtOut, sizeof(AM_MEDIA_TYPE) );
memcpy( &This->m_mtOut.majortype, &MEDIATYPE_Video, sizeof(GUID) );
memcpy( &This->m_mtOut.formattype, &FORMAT_VideoInfo, sizeof(GUID) );
This->m_mtOut.cbFormat = sizeof(VIDEOINFOHEADER) + cbFmt + sizeof(RGBQUAD)*256;
This->m_mtOut.pbFormat = (BYTE*)CoTaskMemAlloc(This->m_mtOut.cbFormat);
if ( This->m_mtOut.pbFormat == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This->m_mtOut.pbFormat, This->m_mtOut.cbFormat );
pbiOut = (BITMAPINFO*)(&((VIDEOINFOHEADER*)This->m_mtOut.pbFormat)->bmiHeader);
TRACE("(%p) - get format\n",This);
if ( ICDecompressGetFormat( This->hicCached, pbiIn, pbiOut ) != ICERR_OK )
return E_FAIL;
hr = QUARTZ_MediaSubType_FromBitmap( &This->m_mtOut.subtype, &pbiOut->bmiHeader );
if ( FAILED(hr) )
return hr;
if ( hr != S_OK )
QUARTZ_MediaSubType_FromFourCC( &This->m_mtOut.subtype, pbiOut->bmiHeader.biCompression );
This->m_mtOut.bFixedSizeSamples = (pbiOut->bmiHeader.biCompression == 0) ? 1 : 0;
This->m_mtOut.lSampleSize = (pbiOut->bmiHeader.biCompression == 0) ? DIBSIZE(pbiOut->bmiHeader) : pbiOut->bmiHeader.biSizeImage;
/* get palette */
if ( pbiOut->bmiHeader.biBitCount <= 8 )
{
TRACE("(%p) - get palette\n",This);
if ( ICDecompressGetPalette( This->hicCached, pbiIn, pbiOut ) != ICERR_OK )
{
TRACE("(%p) - use the input palette\n",This);
if ( pbiIn->bmiHeader.biBitCount != pbiOut->bmiHeader.biBitCount )
{
FIXME( "no palette...FIXME?\n" );
return E_FAIL;
}
if ( pbiOut->bmiHeader.biClrUsed == 0 )
pbiOut->bmiHeader.biClrUsed = 1<<pbiOut->bmiHeader.biBitCount;
if ( pbiOut->bmiHeader.biClrUsed > (1<<pbiOut->bmiHeader.biBitCount) )
{
ERR( "biClrUsed=%ld\n", pbiOut->bmiHeader.biClrUsed );
return E_FAIL;
}
memcpy( pbiOut->bmiColors, pbiIn->bmiColors,
sizeof(RGBQUAD) * pbiOut->bmiHeader.biClrUsed );
}
}
TRACE("(%p) - return format\n",This);
*ppmtAcceptTypes = &This->m_mtOut;
*pcAcceptTypes = 1;
return NOERROR;
}
static HRESULT AVIDec_GetAllocProp( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, ALLOCATOR_PROPERTIES* pProp, BOOL* pbTransInPlace, BOOL* pbTryToReuseSample )
{
CAVIDecImpl* This = pImpl->m_pUserData;
BITMAPINFO* pbiOut = NULL;
HRESULT hr;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = AVIDec_CheckMediaType( pImpl, pmtIn, pmtOut );
if ( FAILED(hr) )
return hr;
pbiOut = (BITMAPINFO*)(&((VIDEOINFOHEADER*)pmtOut->pbFormat)->bmiHeader);
pProp->cBuffers = 1;
if ( pbiOut->bmiHeader.biCompression == 0 )
pProp->cbBuffer = DIBSIZE(pbiOut->bmiHeader);
else
pProp->cbBuffer = pbiOut->bmiHeader.biSizeImage;
*pbTransInPlace = FALSE;
*pbTryToReuseSample = TRUE;
return NOERROR;
}
static HRESULT AVIDec_BeginTransform( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, BOOL bReuseSample )
{
CAVIDecImpl* This = pImpl->m_pUserData;
BITMAPINFO* pbiIn = NULL;
BITMAPINFO* pbiOut = NULL;
HRESULT hr;
TRACE("(%p,%p,%p,%d)\n",This,pmtIn,pmtOut,bReuseSample);
if ( This == NULL ||
This->hicTrans != (HIC)NULL )
return E_UNEXPECTED;
hr = AVIDec_CheckMediaType( pImpl, pmtIn, pmtOut );
if ( FAILED(hr) )
return hr;
AVIDec_ReleaseDIBBuffers(This);
pbiIn = (BITMAPINFO*)(&((VIDEOINFOHEADER*)pmtIn->pbFormat)->bmiHeader);
pbiOut = (BITMAPINFO*)(&((VIDEOINFOHEADER*)pmtOut->pbFormat)->bmiHeader);
This->m_pbiIn = AVIDec_DuplicateBitmapInfo(pbiIn);
This->m_pbiOut = AVIDec_DuplicateBitmapInfo(pbiOut);
if ( This->m_pbiIn == NULL || This->m_pbiOut == NULL )
return E_OUTOFMEMORY;
if ( This->m_pbiOut->bmiHeader.biCompression == 0 || This->m_pbiOut->bmiHeader.biCompression == 3 )
This->m_pbiOut->bmiHeader.biSizeImage = DIBSIZE(This->m_pbiOut->bmiHeader);
if ( !bReuseSample )
{
This->m_pOutBuf = QUARTZ_AllocMem(This->m_pbiOut->bmiHeader.biSizeImage);
if ( This->m_pOutBuf == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This->m_pOutBuf, This->m_pbiOut->bmiHeader.biSizeImage );
}
if ( ICERR_OK != ICDecompressBegin(
This->hicCached, This->m_pbiIn, This->m_pbiOut ) )
return E_FAIL;
This->hicTrans = This->hicCached;
This->hicCached = (HIC)NULL;
return NOERROR;
}
static HRESULT AVIDec_Transform( CTransformBaseImpl* pImpl, IMediaSample* pSampIn, IMediaSample* pSampOut )
{
CAVIDecImpl* This = pImpl->m_pUserData;
DWORD dwFlags;
BYTE* pDataIn = NULL;
BYTE* pDataOut = NULL;
HRESULT hr;
TRACE("(%p)\n",This);
if ( This == NULL || pSampOut == NULL ||
This->hicTrans == (HIC)NULL ||
This->m_pbiIn == NULL ||
This->m_pbiOut == NULL )
return E_UNEXPECTED;
hr = IMediaSample_GetPointer( pSampIn, &pDataIn );
if ( FAILED(hr) )
return hr;
hr = IMediaSample_GetPointer( pSampOut, &pDataOut );
if ( FAILED(hr) )
return hr;
dwFlags = 0;
/*** FIXME!!!
*
* if ( IMediaSample_IsSyncPoint(pSampIn) != S_OK )
* dwFlags |= ICDECOMPRESS_NOTKEYFRAME;
****/
if ( IMediaSample_IsPreroll(pSampIn) == S_OK )
dwFlags |= ICDECOMPRESS_PREROLL;
if ( ICERR_OK != ICDecompress(
This->hicTrans,
dwFlags,
&This->m_pbiIn->bmiHeader,
pDataIn,
&This->m_pbiOut->bmiHeader,
( This->m_pOutBuf != NULL ) ? This->m_pOutBuf : pDataOut ) )
return E_FAIL;
if ( This->m_pOutBuf != NULL )
memcpy( pDataOut, This->m_pOutBuf,
This->m_pbiOut->bmiHeader.biSizeImage );
return NOERROR;
}
static HRESULT AVIDec_EndTransform( CTransformBaseImpl* pImpl )
{
CAVIDecImpl* This = pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
if ( This->hicTrans == (HIC)NULL )
return NOERROR;
ICDecompressEnd(This->hicTrans);
if ( This->hicCached != (HIC)NULL )
ICClose(This->hicCached);
This->hicCached = This->hicTrans;
This->hicTrans = (HIC)NULL;
AVIDec_ReleaseDIBBuffers(This);
return NOERROR;
}
static const TransformBaseHandlers transhandlers =
{
AVIDec_Init,
AVIDec_Cleanup,
AVIDec_CheckMediaType,
AVIDec_GetOutputTypes,
AVIDec_GetAllocProp,
AVIDec_BeginTransform,
NULL,
AVIDec_Transform,
AVIDec_EndTransform,
};
HRESULT QUARTZ_CreateAVIDec(IUnknown* punkOuter,void** ppobj)
{
return QUARTZ_CreateTransformBase(
punkOuter,ppobj,
&CLSID_AVIDec,
AVIDec_FilterName,
NULL, NULL,
&transhandlers );
}

View File

@ -1,720 +0,0 @@
/*
* Implements AVI Parser(Splitter).
*
* FIXME - no seeking
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "mmsystem.h"
#include "vfw.h"
#include "winerror.h"
#include "strmif.h"
#include "control.h"
#include "vfwmsgs.h"
#include "amvideo.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "parser.h"
#include "mtype.h"
static const WCHAR QUARTZ_AVIParser_Name[] =
{ 'A','V','I',' ','S','p','l','i','t','t','e','r',0 };
static const WCHAR QUARTZ_AVIParserInPin_Name[] =
{ 'I','n',0 };
static const WCHAR QUARTZ_AVIParserOutPin_Basename[] =
{ 'S','t','r','e','a','m',0 };
#define WINE_QUARTZ_AVIPINNAME_MAX 64
/****************************************************************************
*
* CAVIParseImpl
*/
typedef struct CAVIParseImpl CAVIParseImpl;
typedef struct CAVIParseStream CAVIParseStream;
struct CAVIParseImpl
{
MainAVIHeader avih;
CAVIParseStream* pStreamsBuf;
DWORD cIndexEntries;
AVIINDEXENTRY* pIndexEntriesBuf;
WCHAR wchWork[ WINE_QUARTZ_AVIPINNAME_MAX ];
};
struct CAVIParseStream
{
AVIStreamHeader strh;
DWORD cbFmt;
BYTE* pFmtBuf;
DWORD cIndexEntries;
AVIINDEXENTRY* pIndexEntries;
DWORD cIndexCur;
REFERENCE_TIME rtCur;
REFERENCE_TIME rtInternal;
BOOL bDataDiscontinuity;
};
static HRESULT CAVIParseImpl_ParseStreamList(
CParserImpl* pImpl, CAVIParseImpl* This, ULONG nStreamIndex,
LONGLONG llOfsTop, DWORD dwListLen, CAVIParseStream* pStream )
{
HRESULT hr;
LONGLONG llOfs;
DWORD dwChunkLength;
TRACE("search strh\n");
hr = RIFF_SearchChunk(
pImpl, dwListLen,
llOfsTop, PARSER_strh,
&llOfs, &dwChunkLength );
if ( hr == S_OK )
{
TRACE("strh has been detected\n");
if ( dwChunkLength < sizeof(AVIStreamHeader) )
hr = E_FAIL;
else
hr = IAsyncReader_SyncRead( pImpl->m_pReader,
llOfs, sizeof(AVIStreamHeader), (BYTE*)&pStream->strh );
}
if ( FAILED(hr) )
return hr;
if ( hr != S_OK )
return E_FAIL;
TRACE("search strf\n");
hr = RIFF_SearchChunk(
pImpl, dwListLen,
llOfsTop, PARSER_strf,
&llOfs, &dwChunkLength );
if ( hr == S_OK && dwChunkLength > 0 )
{
TRACE("strf has been detected\n");
pStream->cbFmt = dwChunkLength;
pStream->pFmtBuf = (BYTE*)QUARTZ_AllocMem( dwChunkLength );
if ( pStream->pFmtBuf == NULL )
hr = E_OUTOFMEMORY;
else
hr = IAsyncReader_SyncRead( pImpl->m_pReader,
llOfs, dwChunkLength, pStream->pFmtBuf );
}
if ( FAILED(hr) )
return hr;
TRACE("search indx\n");
hr = RIFF_SearchChunk(
pImpl, dwListLen,
llOfsTop, PARSER_indx,
&llOfs, &dwChunkLength );
if ( FAILED(hr) )
return hr;
if ( hr == S_OK )
{
FIXME( "'indx' has been detected - not implemented now!\n" );
/*return E_FAIL;*/
}
return NOERROR;
}
static HRESULT CAVIParseImpl_InitParser( CParserImpl* pImpl, ULONG* pcStreams )
{
CAVIParseImpl* This = NULL;
BYTE riffhdr[12];
ULONG i;
ULONG nIndex;
HRESULT hr;
LONGLONG llOfs_hdrl;
DWORD dwLen_hdrl;
LONGLONG llOfs;
DWORD dwChunkId;
DWORD dwChunkLength;
AVIINDEXENTRY* pEntriesBuf = NULL;
ULONG cEntries;
ULONG cEntriesCur;
TRACE("(%p,%p)\n",pImpl,pcStreams);
hr = IAsyncReader_SyncRead( pImpl->m_pReader, 0, 12, riffhdr );
if ( FAILED(hr) )
return hr;
if ( hr != S_OK )
return E_FAIL;
if ( memcmp( &riffhdr[0], "RIFF", 4 ) != 0 ||
memcmp( &riffhdr[8], "AVI ", 4 ) != 0 )
return E_FAIL;
TRACE("it's AVI\n");
This = (CAVIParseImpl*)QUARTZ_AllocMem( sizeof(CAVIParseImpl) );
if ( This == NULL )
return E_OUTOFMEMORY;
pImpl->m_pUserData = This;
ZeroMemory( This, sizeof(CAVIParseImpl) );
This->pStreamsBuf = NULL;
This->cIndexEntries = 0;
This->pIndexEntriesBuf = 0;
hr = RIFF_SearchList(
pImpl, (DWORD)0xffffffff,
PARSER_RIFF_OfsFirst, PARSER_hdrl,
&llOfs_hdrl, &dwLen_hdrl );
if ( FAILED(hr) )
return hr;
if ( hr != S_OK )
return E_FAIL;
/* read 'avih' */
TRACE("read avih\n");
hr = RIFF_SearchChunk(
pImpl, dwLen_hdrl,
llOfs_hdrl, PARSER_avih,
&llOfs, &dwChunkLength );
if ( FAILED(hr) )
return hr;
if ( hr != S_OK )
return E_FAIL;
if ( dwChunkLength > sizeof(MainAVIHeader) )
dwChunkLength = sizeof(MainAVIHeader);
hr = IAsyncReader_SyncRead( pImpl->m_pReader, llOfs, dwChunkLength, (BYTE*)&(This->avih) );
if ( FAILED(hr) )
return hr;
if ( hr != S_OK )
return E_FAIL;
if ( This->avih.dwStreams == 0 )
return E_FAIL;
/* initialize streams. */
This->pStreamsBuf = (CAVIParseStream*)QUARTZ_AllocMem(
sizeof(CAVIParseStream) * This->avih.dwStreams );
if ( This->pStreamsBuf == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This->pStreamsBuf,
sizeof(CAVIParseStream) * This->avih.dwStreams );
llOfs = llOfs_hdrl;
for ( nIndex = 0; nIndex < This->avih.dwStreams; nIndex++ )
{
TRACE("search strl for stream %lu\n",nIndex);
hr = RIFF_SearchList(
pImpl,
dwLen_hdrl, llOfs, PARSER_strl,
&llOfs, &dwChunkLength );
if ( FAILED(hr) )
return hr;
if ( hr != S_OK )
return E_FAIL;
/* read 'strl'. */
hr = CAVIParseImpl_ParseStreamList(
pImpl, This, nIndex,
llOfs, dwChunkLength, &This->pStreamsBuf[nIndex] );
if ( FAILED(hr) )
return hr;
if ( hr != S_OK )
return E_FAIL;
llOfs += dwChunkLength;
}
/* initialize idx1. */
TRACE("search idx1\n");
hr = RIFF_SearchChunk(
pImpl, (DWORD)0xffffffff,
PARSER_RIFF_OfsFirst, PARSER_idx1,
&llOfs, &dwChunkLength );
if ( FAILED(hr) )
return hr;
if ( hr == S_OK )
{
/* read idx1. */
This->cIndexEntries = dwChunkLength / sizeof(AVIINDEXENTRY);
This->pIndexEntriesBuf = (AVIINDEXENTRY*)QUARTZ_AllocMem(
sizeof(AVIINDEXENTRY) * This->cIndexEntries );
if ( This->pIndexEntriesBuf == NULL )
return E_OUTOFMEMORY;
hr = IAsyncReader_SyncRead( pImpl->m_pReader, llOfs, sizeof(AVIINDEXENTRY) * This->cIndexEntries, (BYTE*)This->pIndexEntriesBuf );
if ( FAILED(hr) )
return hr;
if ( hr != S_OK )
return E_FAIL;
pEntriesBuf = (AVIINDEXENTRY*)QUARTZ_AllocMem(
sizeof(AVIINDEXENTRY) * This->cIndexEntries );
if ( pEntriesBuf == NULL )
return E_OUTOFMEMORY;
cEntries = 0;
for ( nIndex = 0; nIndex < This->avih.dwStreams; nIndex++ )
{
cEntriesCur = cEntries;
dwChunkId = (((nIndex%10)+'0')<<8) | ((nIndex/10)+'0');
for ( i = 0; i < This->cIndexEntries; i++ )
{
if ( (This->pIndexEntriesBuf[i].ckid & 0xffff) == dwChunkId )
memcpy( &pEntriesBuf[cEntries++], &This->pIndexEntriesBuf[i], sizeof(AVIINDEXENTRY) );
}
This->pStreamsBuf[nIndex].pIndexEntries = &pEntriesBuf[cEntriesCur];
This->pStreamsBuf[nIndex].cIndexEntries = cEntries - cEntriesCur;
This->pStreamsBuf[nIndex].cIndexCur = 0;
This->pStreamsBuf[nIndex].rtCur = 0;
This->pStreamsBuf[nIndex].rtInternal = 0;
TRACE("stream %lu - %lu entries\n",nIndex,This->pStreamsBuf[nIndex].cIndexEntries);
This->pStreamsBuf[nIndex].bDataDiscontinuity = TRUE;
}
QUARTZ_FreeMem(This->pIndexEntriesBuf);
This->pIndexEntriesBuf = pEntriesBuf;
This->avih.dwSuggestedBufferSize = 0;
for ( i = 0; i < This->cIndexEntries; i++ )
{
if ( This->avih.dwSuggestedBufferSize < This->pIndexEntriesBuf[i].dwChunkLength )
This->avih.dwSuggestedBufferSize = This->pIndexEntriesBuf[i].dwChunkLength;
}
}
else
{
return E_FAIL;
}
if ( This->avih.dwStreams > 100 )
return E_FAIL;
*pcStreams = This->avih.dwStreams;
return NOERROR;
}
static HRESULT CAVIParseImpl_UninitParser( CParserImpl* pImpl )
{
CAVIParseImpl* This = (CAVIParseImpl*)pImpl->m_pUserData;
ULONG nIndex;
TRACE("(%p)\n",This);
if ( This == NULL )
return NOERROR;
/* destruct */
if ( This->pStreamsBuf != NULL )
{
for ( nIndex = 0; nIndex < This->avih.dwStreams; nIndex++ )
{
/* release this stream */
if ( This->pStreamsBuf[nIndex].pFmtBuf != NULL )
QUARTZ_FreeMem(This->pStreamsBuf[nIndex].pFmtBuf);
}
QUARTZ_FreeMem( This->pStreamsBuf );
This->pStreamsBuf = NULL;
}
if ( This->pIndexEntriesBuf != NULL )
{
QUARTZ_FreeMem( This->pIndexEntriesBuf );
This->pIndexEntriesBuf = NULL;
}
QUARTZ_FreeMem( This );
pImpl->m_pUserData = NULL;
return NOERROR;
}
static LPCWSTR CAVIParseImpl_GetOutPinName( CParserImpl* pImpl, ULONG nStreamIndex )
{
CAVIParseImpl* This = (CAVIParseImpl*)pImpl->m_pUserData;
int wlen;
TRACE("(%p,%lu)\n",This,nStreamIndex);
if ( This == NULL || nStreamIndex >= This->avih.dwStreams )
return NULL;
wlen = lstrlenW(QUARTZ_AVIParserOutPin_Basename);
memcpy( This->wchWork, QUARTZ_AVIParserOutPin_Basename, sizeof(WCHAR)*wlen );
This->wchWork[ wlen ] = (nStreamIndex/10) + '0';
This->wchWork[ wlen+1 ] = (nStreamIndex%10) + '0';
This->wchWork[ wlen+2 ] = 0;
return This->wchWork;
}
static HRESULT CAVIParseImpl_GetStreamType( CParserImpl* pImpl, ULONG nStreamIndex, AM_MEDIA_TYPE* pmt )
{
CAVIParseImpl* This = (CAVIParseImpl*)pImpl->m_pUserData;
VIDEOINFOHEADER* pvi;
BITMAPINFOHEADER* pbi;
WAVEFORMATEX* pwfx;
DWORD cbFmt;
DWORD cb;
HRESULT hr;
TRACE("(%p,%lu,%p)\n",This,nStreamIndex,pmt);
if ( This == NULL )
return E_UNEXPECTED;
if ( nStreamIndex >= This->avih.dwStreams )
return E_INVALIDARG;
cbFmt = This->pStreamsBuf[nStreamIndex].cbFmt;
ZeroMemory( pmt, sizeof(AM_MEDIA_TYPE) );
switch ( This->pStreamsBuf[nStreamIndex].strh.fccType )
{
case PARSER_vids:
pbi = (BITMAPINFOHEADER*)This->pStreamsBuf[nStreamIndex].pFmtBuf;
if ( pbi == NULL || cbFmt < sizeof(BITMAPINFOHEADER) )
goto unknown_format;
memcpy( &pmt->majortype, &MEDIATYPE_Video, sizeof(GUID) );
hr = QUARTZ_MediaSubType_FromBitmap( &pmt->subtype, pbi );
if ( FAILED(hr) )
goto unknown_format;
if ( hr != S_OK )
QUARTZ_MediaSubType_FromFourCC( &pmt->subtype, (DWORD)pbi->biCompression );
pmt->bFixedSizeSamples = QUARTZ_BitmapHasFixedSample( pbi ) ? 1 : 0;
pmt->bTemporalCompression = 0; /* FIXME - 1 if inter-frame compression is used */
pmt->lSampleSize = ( pbi->biCompression == 0 ) ? DIBSIZE(*pbi) : pbi->biSizeImage;
memcpy( &pmt->formattype, &FORMAT_VideoInfo, sizeof(GUID) );
cb = sizeof(VIDEOINFOHEADER) + cbFmt;
pmt->pbFormat = (BYTE*)CoTaskMemAlloc( cb );
if ( pmt->pbFormat == NULL )
return E_OUTOFMEMORY;
ZeroMemory( pmt->pbFormat, cb );
pvi = (VIDEOINFOHEADER*)pmt->pbFormat;
pmt->cbFormat = cb;
memcpy( &pvi->bmiHeader, pbi, cbFmt );
break;
case PARSER_auds:
pwfx = (WAVEFORMATEX*)This->pStreamsBuf[nStreamIndex].pFmtBuf;
if ( pwfx == NULL || cbFmt < (sizeof(WAVEFORMATEX)-2) )
goto unknown_format;
memcpy( &pmt->majortype, &MEDIATYPE_Audio, sizeof(GUID) );
QUARTZ_MediaSubType_FromFourCC( &pmt->subtype, (DWORD)pwfx->wFormatTag );
pmt->bFixedSizeSamples = 1;
pmt->bTemporalCompression = 0;
pmt->lSampleSize = pwfx->nBlockAlign;
memcpy( &pmt->formattype, &FORMAT_WaveFormatEx, sizeof(GUID) );
pmt->pUnk = NULL;
cb = ( cbFmt < sizeof(WAVEFORMATEX) ) ? sizeof(WAVEFORMATEX) : cbFmt;
pmt->pbFormat = (BYTE*)CoTaskMemAlloc( cb );
if ( pmt->pbFormat == NULL )
return E_OUTOFMEMORY;
ZeroMemory( pmt->pbFormat, cb );
pmt->cbFormat = cbFmt;
memcpy( pmt->pbFormat, pwfx, cbFmt );
break;
case PARSER_mids:
/* FIXME? */
memcpy( &pmt->majortype, &MEDIATYPE_Midi, sizeof(GUID) );
memcpy( &pmt->subtype, &MEDIASUBTYPE_NULL, sizeof(GUID) );
pmt->bFixedSizeSamples = 0;
pmt->bTemporalCompression = 0;
pmt->lSampleSize = 1;
memcpy( &pmt->formattype, &FORMAT_None, sizeof(GUID) );
pmt->pUnk = NULL;
pmt->cbFormat = 0;
pmt->pbFormat = NULL;
break;
case PARSER_txts:
/* FIXME? */
memcpy( &pmt->majortype, &MEDIATYPE_Text, sizeof(GUID) );
memcpy( &pmt->subtype, &MEDIASUBTYPE_NULL, sizeof(GUID) );
pmt->bFixedSizeSamples = 0;
pmt->bTemporalCompression = 0;
pmt->lSampleSize = 1;
memcpy( &pmt->formattype, &FORMAT_None, sizeof(GUID) );
pmt->pUnk = NULL;
pmt->cbFormat = 0;
pmt->pbFormat = NULL;
break;
default:
goto unknown_format;
}
return NOERROR;
unknown_format:;
FIXME( "(%p) unsupported stream type %c%c%c%c\n",This,
(int)((This->pStreamsBuf[nStreamIndex].strh.fccType>> 0)&0xff),
(int)((This->pStreamsBuf[nStreamIndex].strh.fccType>> 8)&0xff),
(int)((This->pStreamsBuf[nStreamIndex].strh.fccType>>16)&0xff),
(int)((This->pStreamsBuf[nStreamIndex].strh.fccType>>24)&0xff) );
memcpy( &pmt->majortype, &MEDIATYPE_NULL, sizeof(GUID) );
memcpy( &pmt->subtype, &MEDIASUBTYPE_NULL, sizeof(GUID) );
pmt->bFixedSizeSamples = 0;
pmt->bTemporalCompression = 0;
pmt->lSampleSize = 1;
memcpy( &pmt->formattype, &FORMAT_None, sizeof(GUID) );
pmt->pUnk = NULL;
pmt->cbFormat = 0;
pmt->pbFormat = NULL;
return NOERROR;
}
static HRESULT CAVIParseImpl_CheckStreamType( CParserImpl* pImpl, ULONG nStreamIndex, const AM_MEDIA_TYPE* pmt )
{
CAVIParseImpl* This = (CAVIParseImpl*)pImpl->m_pUserData;
HRESULT hr;
AM_MEDIA_TYPE mt;
VIDEOINFOHEADER* pvi;
VIDEOINFOHEADER* pviCheck;
WAVEFORMATEX* pwfx;
WAVEFORMATEX* pwfxCheck;
TRACE("(%p,%lu,%p)\n",This,nStreamIndex,pmt);
hr = CAVIParseImpl_GetStreamType( pImpl, nStreamIndex, &mt );
if ( FAILED(hr) )
return hr;
TRACE("check GUIDs - %s,%s\n",debugstr_guid(&pmt->majortype),debugstr_guid(&pmt->subtype));
if ( !IsEqualGUID( &pmt->majortype, &mt.majortype ) ||
!IsEqualGUID( &pmt->subtype, &mt.subtype ) ||
!IsEqualGUID( &pmt->formattype, &mt.formattype ) )
{
hr = E_FAIL;
goto end;
}
TRACE("check format\n");
hr = S_OK;
switch ( This->pStreamsBuf[nStreamIndex].strh.fccType )
{
case PARSER_vids:
TRACE("check vids\n");
pvi = (VIDEOINFOHEADER*)mt.pbFormat;
pviCheck = (VIDEOINFOHEADER*)pmt->pbFormat;
if ( pvi == NULL || pviCheck == NULL || pmt->cbFormat < sizeof(VIDEOINFOHEADER) )
hr = E_FAIL;
if ( pvi->bmiHeader.biWidth != pviCheck->bmiHeader.biWidth ||
pvi->bmiHeader.biHeight != pviCheck->bmiHeader.biHeight ||
pvi->bmiHeader.biPlanes != pviCheck->bmiHeader.biPlanes ||
pvi->bmiHeader.biBitCount != pviCheck->bmiHeader.biBitCount ||
pvi->bmiHeader.biCompression != pviCheck->bmiHeader.biCompression ||
pvi->bmiHeader.biClrUsed != pviCheck->bmiHeader.biClrUsed )
hr = E_FAIL;
break;
case PARSER_auds:
TRACE("check auds\n");
pwfx = (WAVEFORMATEX*)mt.pbFormat;
pwfxCheck = (WAVEFORMATEX*)pmt->pbFormat;
if ( pwfx == NULL || pwfxCheck == NULL || pmt->cbFormat < (sizeof(WAVEFORMATEX)-2) )
hr = E_FAIL;
if ( pwfx->wFormatTag != pwfxCheck->wFormatTag ||
pwfx->nBlockAlign != pwfxCheck->nBlockAlign ||
pwfx->wBitsPerSample != pwfxCheck->wBitsPerSample ||
pwfx->nChannels != pwfxCheck->nChannels ||
pwfx->nSamplesPerSec != pwfxCheck->nSamplesPerSec )
hr = E_FAIL;
break;
case PARSER_mids:
case PARSER_txts:
break;
default:
break;
}
end:
QUARTZ_MediaType_Free( &mt );
TRACE("%08lx\n",hr);
return hr;
}
static HRESULT CAVIParseImpl_GetAllocProp( CParserImpl* pImpl, ALLOCATOR_PROPERTIES* pReqProp )
{
CAVIParseImpl* This = (CAVIParseImpl*)pImpl->m_pUserData;
TRACE("(%p,%p)\n",This,pReqProp);
if ( This == NULL )
return E_UNEXPECTED;
ZeroMemory( pReqProp, sizeof(ALLOCATOR_PROPERTIES) );
pReqProp->cBuffers = This->avih.dwStreams;
pReqProp->cbBuffer = This->avih.dwSuggestedBufferSize;
return NOERROR;
}
static HRESULT CAVIParseImpl_GetNextRequest( CParserImpl* pImpl, ULONG* pnStreamIndex, LONGLONG* pllStart, LONG* plLength, REFERENCE_TIME* prtStart, REFERENCE_TIME* prtStop, DWORD* pdwSampleFlags )
{
CAVIParseImpl* This = (CAVIParseImpl*)pImpl->m_pUserData;
REFERENCE_TIME rtNext;
DWORD nIndexNext;
DWORD nIndex;
CAVIParseStream* pStream;
const WAVEFORMATEX* pwfx;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
*pdwSampleFlags = AM_SAMPLE_SPLICEPOINT;
nIndexNext = This->avih.dwStreams;
rtNext = ((REFERENCE_TIME)0x7fffffff<<32)|((REFERENCE_TIME)0xffffffff);
for ( nIndex = 0; nIndex < This->avih.dwStreams; nIndex++ )
{
TRACE("stream %lu - %lu,%lu\n",nIndex,(unsigned long)(This->pStreamsBuf[nIndex].rtCur*1000/QUARTZ_TIMEUNITS),This->pStreamsBuf[nIndex].cIndexCur);
if ( rtNext > This->pStreamsBuf[nIndex].rtCur &&
This->pStreamsBuf[nIndex].cIndexCur < This->pStreamsBuf[nIndex].cIndexEntries )
{
nIndexNext = nIndex;
rtNext = This->pStreamsBuf[nIndex].rtCur;
}
}
if ( nIndexNext >= This->avih.dwStreams )
return S_FALSE;
if ( This->pIndexEntriesBuf != NULL )
{
pStream = &This->pStreamsBuf[nIndexNext];
*pnStreamIndex = nIndexNext;
*pllStart = (LONGLONG)pStream->pIndexEntries[pStream->cIndexCur].dwChunkOffset + 8;
*plLength = (LONG)pStream->pIndexEntries[pStream->cIndexCur].dwChunkLength;
*prtStart = rtNext;
*prtStop = rtNext;
/* FIXME - is this frame keyframe?? */
*pdwSampleFlags = AM_SAMPLE_SPLICEPOINT;
if ( pStream->bDataDiscontinuity )
{
*pdwSampleFlags |= AM_SAMPLE_DATADISCONTINUITY;
pStream->bDataDiscontinuity = FALSE;
}
switch ( pStream->strh.fccType )
{
case PARSER_vids:
TRACE("vids\n");
pStream->rtInternal ++;
rtNext = pStream->rtInternal * (REFERENCE_TIME)QUARTZ_TIMEUNITS * (REFERENCE_TIME)pStream->strh.dwScale / (REFERENCE_TIME)pStream->strh.dwRate;
/* FIXME - handle AVIPALCHANGE */
break;
case PARSER_auds:
TRACE("auds\n");
pwfx = (const WAVEFORMATEX*)pStream->pFmtBuf;
if ( pwfx != NULL && pStream->cbFmt >= (sizeof(WAVEFORMATEX)-2) )
{
pStream->rtInternal += (REFERENCE_TIME)*plLength;
rtNext = pStream->rtInternal * (REFERENCE_TIME)QUARTZ_TIMEUNITS / (REFERENCE_TIME)pwfx->nAvgBytesPerSec;
}
else
{
pStream->rtInternal += (REFERENCE_TIME)(*plLength);
rtNext = pStream->rtInternal * (REFERENCE_TIME)QUARTZ_TIMEUNITS * (REFERENCE_TIME)pStream->strh.dwScale / ((REFERENCE_TIME)pStream->strh.dwSampleSize * (REFERENCE_TIME)pStream->strh.dwRate);
}
break;
case PARSER_mids:
case PARSER_txts:
default:
pStream->rtInternal += (REFERENCE_TIME)(*plLength);
rtNext = pStream->rtInternal * (REFERENCE_TIME)QUARTZ_TIMEUNITS * (REFERENCE_TIME)pStream->strh.dwScale / ((REFERENCE_TIME)pStream->strh.dwSampleSize * (REFERENCE_TIME)pStream->strh.dwRate);
break;
}
pStream->cIndexCur ++;
pStream->rtCur = rtNext;
*prtStop = rtNext;
}
else
{
ERR( "no idx1\n" );
return E_NOTIMPL;
}
TRACE("return %lu / %ld-%ld / %lu-%lu\n",
*pnStreamIndex,(long)*pllStart,*plLength,
(unsigned long)((*prtStart)*1000/QUARTZ_TIMEUNITS),
(unsigned long)((*prtStop)*1000/QUARTZ_TIMEUNITS));
return NOERROR;
}
static HRESULT CAVIParseImpl_ProcessSample( CParserImpl* pImpl, ULONG nStreamIndex, LONGLONG llStart, LONG lLength, IMediaSample* pSample )
{
CAVIParseImpl* This = (CAVIParseImpl*)pImpl->m_pUserData;
TRACE("(%p,%lu,%ld,%ld,%p)\n",This,nStreamIndex,(long)llStart,lLength,pSample);
if ( This == NULL )
return E_UNEXPECTED;
return NOERROR;
}
static const struct ParserHandlers CAVIParseImpl_Handlers =
{
CAVIParseImpl_InitParser,
CAVIParseImpl_UninitParser,
CAVIParseImpl_GetOutPinName,
CAVIParseImpl_GetStreamType,
CAVIParseImpl_CheckStreamType,
CAVIParseImpl_GetAllocProp,
CAVIParseImpl_GetNextRequest,
CAVIParseImpl_ProcessSample,
/* for IQualityControl */
NULL, /* pQualityNotify */
/* for seeking */
NULL, /* pGetSeekingCaps */
NULL, /* pIsTimeFormatSupported */
NULL, /* pGetCurPos */
NULL, /* pSetCurPos */
NULL, /* pGetDuration */
NULL, /* pGetStopPos */
NULL, /* pSetStopPos */
NULL, /* pGetPreroll */
};
HRESULT QUARTZ_CreateAVISplitter(IUnknown* punkOuter,void** ppobj)
{
return QUARTZ_CreateParser(
punkOuter,ppobj,
&CLSID_AviSplitter,
QUARTZ_AVIParser_Name,
QUARTZ_AVIParserInPin_Name,
&CAVIParseImpl_Handlers );
}

View File

@ -1,586 +0,0 @@
/*
* Implements IBaseFilter. (internal)
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "strmif.h"
#include "vfwmsgs.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "basefilt.h"
#include "enumunk.h"
/***************************************************************************
*
* CBaseFilterImpl::IBaseFilter
*
*/
static HRESULT WINAPI
CBaseFilterImpl_fnQueryInterface(IBaseFilter* iface,REFIID riid,void** ppobj)
{
ICOM_THIS(CBaseFilterImpl,iface);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->punkControl,riid,ppobj);
}
static ULONG WINAPI
CBaseFilterImpl_fnAddRef(IBaseFilter* iface)
{
ICOM_THIS(CBaseFilterImpl,iface);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->punkControl);
}
static ULONG WINAPI
CBaseFilterImpl_fnRelease(IBaseFilter* iface)
{
ICOM_THIS(CBaseFilterImpl,iface);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->punkControl);
}
static HRESULT WINAPI
CBaseFilterImpl_fnGetClassID(IBaseFilter* iface,CLSID* pclsid)
{
ICOM_THIS(CBaseFilterImpl,iface);
TRACE("(%p)->()\n",This);
if ( pclsid == NULL )
return E_POINTER;
memcpy( pclsid, This->pclsidFilter, sizeof(CLSID) );
return NOERROR;
}
static HRESULT WINAPI
CBaseFilterImpl_fnStop(IBaseFilter* iface)
{
ICOM_THIS(CBaseFilterImpl,iface);
HRESULT hr;
TRACE("(%p)->()\n",This);
hr = NOERROR;
EnterCriticalSection( &This->csFilter );
if ( This->bIntermediateState )
{
LeaveCriticalSection( &This->csFilter );
return VFW_S_STATE_INTERMEDIATE; /* FIXME? */
}
TRACE("(%p) state = %d\n",This,This->fstate);
if ( This->fstate == State_Running )
{
if ( This->pHandlers->pOnInactive != NULL )
hr = This->pHandlers->pOnInactive( This );
if ( SUCCEEDED(hr) )
This->fstate = State_Paused;
}
if ( This->fstate == State_Paused )
{
if ( This->pHandlers->pOnStop != NULL )
hr = This->pHandlers->pOnStop( This );
if ( SUCCEEDED(hr) )
This->fstate = State_Stopped;
}
LeaveCriticalSection( &This->csFilter );
return hr;
}
static HRESULT WINAPI
CBaseFilterImpl_fnPause(IBaseFilter* iface)
{
ICOM_THIS(CBaseFilterImpl,iface);
HRESULT hr;
TRACE("(%p)->()\n",This);
hr = NOERROR;
EnterCriticalSection( &This->csFilter );
if ( This->bIntermediateState )
{
LeaveCriticalSection( &This->csFilter );
return VFW_E_WRONG_STATE; /* FIXME? */
}
TRACE("(%p) state = %d\n",This,This->fstate);
if ( This->fstate != State_Paused )
{
if ( This->pHandlers->pOnInactive != NULL )
hr = This->pHandlers->pOnInactive( This );
if ( SUCCEEDED(hr) )
This->fstate = State_Paused;
}
LeaveCriticalSection( &This->csFilter );
TRACE("hr = %08lx\n",hr);
return hr;
}
static HRESULT WINAPI
CBaseFilterImpl_fnRun(IBaseFilter* iface,REFERENCE_TIME rtStart)
{
ICOM_THIS(CBaseFilterImpl,iface);
HRESULT hr;
TRACE("(%p)->()\n",This);
hr = NOERROR;
EnterCriticalSection( &This->csFilter );
if ( This->bIntermediateState )
{
LeaveCriticalSection( &This->csFilter );
return VFW_E_WRONG_STATE; /* FIXME? */
}
TRACE("(%p) state = %d\n",This,This->fstate);
This->rtStart = rtStart;
if ( This->fstate == State_Stopped )
{
if ( This->pHandlers->pOnInactive != NULL )
hr = This->pHandlers->pOnInactive( This );
if ( SUCCEEDED(hr) )
This->fstate = State_Paused;
}
if ( This->fstate == State_Paused )
{
if ( This->pHandlers->pOnActive != NULL )
hr = This->pHandlers->pOnActive( This );
if ( SUCCEEDED(hr) )
This->fstate = State_Running;
}
LeaveCriticalSection( &This->csFilter );
return hr;
}
static HRESULT WINAPI
CBaseFilterImpl_fnGetState(IBaseFilter* iface,DWORD dw,FILTER_STATE* pState)
{
ICOM_THIS(CBaseFilterImpl,iface);
HRESULT hr = S_OK;
TRACE("(%p)->(%p)\n",This,pState);
if ( pState == NULL )
return E_POINTER;
EnterCriticalSection( &This->csFilter );
TRACE("(%p) state = %d\n",This,This->fstate);
*pState = This->fstate;
if ( This->bIntermediateState )
hr = VFW_S_STATE_INTERMEDIATE;
LeaveCriticalSection( &This->csFilter );
return hr;
}
static HRESULT WINAPI
CBaseFilterImpl_fnSetSyncSource(IBaseFilter* iface,IReferenceClock* pobjClock)
{
ICOM_THIS(CBaseFilterImpl,iface);
TRACE("(%p)->(%p)\n",This,pobjClock);
EnterCriticalSection( &This->csFilter );
if ( This->pClock != NULL )
{
IReferenceClock_Release( This->pClock );
This->pClock = NULL;
}
This->pClock = pobjClock;
if ( pobjClock != NULL )
IReferenceClock_AddRef( pobjClock );
LeaveCriticalSection( &This->csFilter );
return NOERROR;
}
static HRESULT WINAPI
CBaseFilterImpl_fnGetSyncSource(IBaseFilter* iface,IReferenceClock** ppobjClock)
{
ICOM_THIS(CBaseFilterImpl,iface);
HRESULT hr = VFW_E_NO_CLOCK;
TRACE("(%p)->(%p)\n",This,ppobjClock);
if ( ppobjClock == NULL )
return E_POINTER;
EnterCriticalSection( &This->csFilter );
*ppobjClock = This->pClock;
if ( This->pClock != NULL )
{
hr = NOERROR;
IReferenceClock_AddRef( This->pClock );
}
LeaveCriticalSection( &This->csFilter );
return hr;
}
static HRESULT WINAPI
CBaseFilterImpl_fnEnumPins(IBaseFilter* iface,IEnumPins** ppenum)
{
ICOM_THIS(CBaseFilterImpl,iface);
HRESULT hr = E_FAIL;
QUARTZ_CompList* pListPins;
QUARTZ_CompListItem* pItem;
IUnknown* punkPin;
TRACE("(%p)->(%p)\n",This,ppenum);
if ( ppenum == NULL )
return E_POINTER;
*ppenum = NULL;
pListPins = QUARTZ_CompList_Alloc();
if ( pListPins == NULL )
return E_OUTOFMEMORY;
QUARTZ_CompList_Lock( This->pInPins );
QUARTZ_CompList_Lock( This->pOutPins );
pItem = QUARTZ_CompList_GetFirst( This->pInPins );
while ( pItem != NULL )
{
punkPin = QUARTZ_CompList_GetItemPtr( pItem );
hr = QUARTZ_CompList_AddComp( pListPins, punkPin, NULL, 0 );
if ( FAILED(hr) )
goto err;
pItem = QUARTZ_CompList_GetNext( This->pInPins, pItem );
}
pItem = QUARTZ_CompList_GetFirst( This->pOutPins );
while ( pItem != NULL )
{
punkPin = QUARTZ_CompList_GetItemPtr( pItem );
hr = QUARTZ_CompList_AddComp( pListPins, punkPin, NULL, 0 );
if ( FAILED(hr) )
goto err;
pItem = QUARTZ_CompList_GetNext( This->pOutPins, pItem );
}
hr = QUARTZ_CreateEnumUnknown(
&IID_IEnumPins, (void**)ppenum, pListPins );
err:
QUARTZ_CompList_Unlock( This->pInPins );
QUARTZ_CompList_Unlock( This->pOutPins );
QUARTZ_CompList_Free( pListPins );
return hr;
}
static HRESULT WINAPI
CBaseFilterImpl_fnFindPin(IBaseFilter* iface,LPCWSTR lpwszId,IPin** ppobj)
{
ICOM_THIS(CBaseFilterImpl,iface);
FIXME("(%p)->(%s,%p) stub!\n",This,debugstr_w(lpwszId),ppobj);
if ( ppobj == NULL )
return E_POINTER;
return E_NOTIMPL;
}
static HRESULT WINAPI
CBaseFilterImpl_fnQueryFilterInfo(IBaseFilter* iface,FILTER_INFO* pfi)
{
ICOM_THIS(CBaseFilterImpl,iface);
TRACE("(%p)->(%p)\n",This,pfi);
if ( pfi == NULL )
return E_POINTER;
EnterCriticalSection( &This->csFilter );
if ( This->cbNameGraph <= sizeof(WCHAR)*MAX_FILTER_NAME )
{
memcpy( pfi->achName, This->pwszNameGraph, This->cbNameGraph );
}
else
{
memcpy( pfi->achName, This->pwszNameGraph,
sizeof(WCHAR)*MAX_FILTER_NAME );
pfi->achName[MAX_FILTER_NAME-1] = (WCHAR)0;
}
pfi->pGraph = This->pfg;
if ( pfi->pGraph != NULL )
IFilterGraph_AddRef(pfi->pGraph);
LeaveCriticalSection( &This->csFilter );
return NOERROR;
}
static HRESULT WINAPI
CBaseFilterImpl_fnJoinFilterGraph(IBaseFilter* iface,IFilterGraph* pfg,LPCWSTR lpwszName)
{
ICOM_THIS(CBaseFilterImpl,iface);
HRESULT hr;
TRACE("(%p)->(%p,%s)\n",This,pfg,debugstr_w(lpwszName));
EnterCriticalSection( &This->csFilter );
if ( This->pwszNameGraph != NULL )
{
QUARTZ_FreeMem( This->pwszNameGraph );
This->pwszNameGraph = NULL;
This->cbNameGraph = 0;
}
This->pfg = pfg;
This->cbNameGraph = sizeof(WCHAR) * (lstrlenW(lpwszName)+1);
This->pwszNameGraph = (WCHAR*)QUARTZ_AllocMem( This->cbNameGraph );
if ( This->pwszNameGraph == NULL )
{
hr = E_OUTOFMEMORY;
goto err;
}
memcpy( This->pwszNameGraph, lpwszName, This->cbNameGraph );
hr = NOERROR;
err:
LeaveCriticalSection( &This->csFilter );
return hr;
}
static HRESULT WINAPI
CBaseFilterImpl_fnQueryVendorInfo(IBaseFilter* iface,LPWSTR* lpwszVendor)
{
ICOM_THIS(CBaseFilterImpl,iface);
TRACE("(%p)->(%p)\n",This,lpwszVendor);
/* E_NOTIMPL means 'no vender information'. */
return E_NOTIMPL;
}
/***************************************************************************
*
* construct/destruct CBaseFilterImpl
*
*/
static ICOM_VTABLE(IBaseFilter) ibasefilter =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
CBaseFilterImpl_fnQueryInterface,
CBaseFilterImpl_fnAddRef,
CBaseFilterImpl_fnRelease,
/* IPersist fields */
CBaseFilterImpl_fnGetClassID,
/* IMediaFilter fields */
CBaseFilterImpl_fnStop,
CBaseFilterImpl_fnPause,
CBaseFilterImpl_fnRun,
CBaseFilterImpl_fnGetState,
CBaseFilterImpl_fnSetSyncSource,
CBaseFilterImpl_fnGetSyncSource,
/* IBaseFilter fields */
CBaseFilterImpl_fnEnumPins,
CBaseFilterImpl_fnFindPin,
CBaseFilterImpl_fnQueryFilterInfo,
CBaseFilterImpl_fnJoinFilterGraph,
CBaseFilterImpl_fnQueryVendorInfo,
};
HRESULT CBaseFilterImpl_InitIBaseFilter(
CBaseFilterImpl* This, IUnknown* punkControl,
const CLSID* pclsidFilter, LPCWSTR lpwszNameGraph,
const CBaseFilterHandlers* pHandlers )
{
TRACE("(%p,%p)\n",This,punkControl);
if ( punkControl == NULL )
{
ERR( "punkControl must not be NULL\n" );
return E_INVALIDARG;
}
ICOM_VTBL(This) = &ibasefilter;
This->punkControl = punkControl;
This->pHandlers = pHandlers;
This->pclsidFilter = pclsidFilter;
This->pInPins = NULL;
This->pOutPins = NULL;
This->pfg = NULL;
This->cbNameGraph = 0;
This->pwszNameGraph = NULL;
This->pClock = NULL;
This->rtStart = 0;
This->fstate = State_Stopped;
This->bIntermediateState = FALSE;
This->cbNameGraph = sizeof(WCHAR) * (lstrlenW(lpwszNameGraph)+1);
This->pwszNameGraph = (WCHAR*)QUARTZ_AllocMem( This->cbNameGraph );
if ( This->pwszNameGraph == NULL )
return E_OUTOFMEMORY;
memcpy( This->pwszNameGraph, lpwszNameGraph, This->cbNameGraph );
This->pInPins = QUARTZ_CompList_Alloc();
This->pOutPins = QUARTZ_CompList_Alloc();
if ( This->pInPins == NULL || This->pOutPins == NULL )
{
if ( This->pInPins != NULL )
QUARTZ_CompList_Free(This->pInPins);
if ( This->pOutPins != NULL )
QUARTZ_CompList_Free(This->pOutPins);
QUARTZ_FreeMem(This->pwszNameGraph);
return E_OUTOFMEMORY;
}
InitializeCriticalSection( &This->csFilter );
return NOERROR;
}
void CBaseFilterImpl_UninitIBaseFilter( CBaseFilterImpl* This )
{
QUARTZ_CompListItem* pListItem;
IPin* pPin;
TRACE("(%p)\n",This);
if ( This->pInPins != NULL )
{
while ( 1 )
{
pListItem = QUARTZ_CompList_GetFirst( This->pInPins );
if ( pListItem == NULL )
break;
pPin = (IPin*)QUARTZ_CompList_GetItemPtr( pListItem );
QUARTZ_CompList_RemoveComp( This->pInPins, (IUnknown*)pPin );
}
QUARTZ_CompList_Free( This->pInPins );
This->pInPins = NULL;
}
if ( This->pOutPins != NULL )
{
while ( 1 )
{
pListItem = QUARTZ_CompList_GetFirst( This->pOutPins );
if ( pListItem == NULL )
break;
pPin = (IPin*)QUARTZ_CompList_GetItemPtr( pListItem );
QUARTZ_CompList_RemoveComp( This->pOutPins, (IUnknown*)pPin );
}
QUARTZ_CompList_Free( This->pOutPins );
This->pOutPins = NULL;
}
if ( This->pwszNameGraph != NULL )
{
QUARTZ_FreeMem( This->pwszNameGraph );
This->pwszNameGraph = NULL;
}
if ( This->pClock != NULL )
{
IReferenceClock_Release( This->pClock );
This->pClock = NULL;
}
DeleteCriticalSection( &This->csFilter );
}
/***************************************************************************
*
* CBaseFilterImpl methods
*
*/
HRESULT CBaseFilterImpl_MediaEventNotify(
CBaseFilterImpl* This, long lEvent,LONG_PTR lParam1,LONG_PTR lParam2)
{
IMediaEventSink* pSink = NULL;
HRESULT hr = E_NOTIMPL;
EnterCriticalSection( &This->csFilter );
if ( This->pfg == NULL )
{
hr = E_UNEXPECTED;
goto err;
}
hr = IFilterGraph_QueryInterface( This->pfg, &IID_IMediaEventSink, (void**)&pSink );
if ( FAILED(hr) )
goto err;
if ( pSink == NULL )
{
hr = E_FAIL;
goto err;
}
hr = IMediaEventSink_Notify(pSink,lEvent,lParam1,lParam2);
IMediaEventSink_Release(pSink);
err:
LeaveCriticalSection( &This->csFilter );
return hr;
}

View File

@ -1,220 +0,0 @@
/*
* Copyright (C) Hidenori TAKESHIMA
*
* 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 WINE_DSHOW_BASEFILT_H
#define WINE_DSHOW_BASEFILT_H
/*
* The following interfaces must be used as a part of aggregation.
* The punkControl must not be NULL since all IUnknown methods are
* implemented only for aggregation.
*/
/*
* implements IBaseFilter (internal)
*
* a base class for implementing IBaseFilter.
*/
#include "complist.h"
#include "mtype.h"
typedef struct CBaseFilterHandlers CBaseFilterHandlers;
typedef struct CBasePinHandlers CBasePinHandlers;
typedef struct CBaseFilterImpl
{
/* IPersist - IMediaFilter - IBaseFilter */
ICOM_VFIELD(IBaseFilter);
/* IUnknown fields */
IUnknown* punkControl;
/* IBaseFilter fields */
const CBaseFilterHandlers* pHandlers;
CRITICAL_SECTION csFilter;
const CLSID* pclsidFilter;
QUARTZ_CompList* pInPins; /* a list of IPin-s. */
QUARTZ_CompList* pOutPins; /* a list of IPin-s. */
IFilterGraph* pfg;
DWORD cbNameGraph;
WCHAR* pwszNameGraph;
IReferenceClock* pClock;
REFERENCE_TIME rtStart;
FILTER_STATE fstate;
BOOL bIntermediateState; /* if set, fstate is ignored. */
} CBaseFilterImpl;
struct CBaseFilterHandlers
{
HRESULT (*pOnActive)( CBaseFilterImpl* pImpl );
HRESULT (*pOnInactive)( CBaseFilterImpl* pImpl );
HRESULT (*pOnStop)( CBaseFilterImpl* pImpl );
};
HRESULT CBaseFilterImpl_InitIBaseFilter(
CBaseFilterImpl* This, IUnknown* punkControl,
const CLSID* pclsidFilter, LPCWSTR lpwszNameGraph,
const CBaseFilterHandlers* pHandlers );
void CBaseFilterImpl_UninitIBaseFilter( CBaseFilterImpl* This );
HRESULT CBaseFilterImpl_MediaEventNotify(
CBaseFilterImpl* This, long lEvent,LONG_PTR lParam1,LONG_PTR lParam2);
/*
* Implements IPin, IMemInputPin, and IQualityControl. (internal)
*
* a base class for implementing IPin.
*/
typedef struct OutputPinAsyncImpl OutputPinAsyncImpl;
typedef struct CPinBaseImpl
{
/* IPin */
ICOM_VFIELD(IPin);
/* IUnknown fields */
IUnknown* punkControl;
/* IPin fields */
const CBasePinHandlers* pHandlers;
DWORD cbIdLen;
WCHAR* pwszId;
BOOL bOutput;
/* you can change AcceptTypes while pcsPin has been hold */
const AM_MEDIA_TYPE* pmtAcceptTypes;
ULONG cAcceptTypes;
CRITICAL_SECTION* pcsPin;
CRITICAL_SECTION* pcsPinReceive;
CBaseFilterImpl* pFilter;
IPin* pPinConnectedTo;
IMemInputPin* pMemInputPinConnectedTo;
AM_MEDIA_TYPE* pmtConn;
OutputPinAsyncImpl* pAsyncOut; /* for asynchronous output */
} CPinBaseImpl;
typedef struct CMemInputPinBaseImpl
{
/* IMemInputPin */
ICOM_VFIELD(IMemInputPin);
/* IUnknown fields */
IUnknown* punkControl;
/* IMemInputPin fields */
CPinBaseImpl* pPin;
IMemAllocator* pAllocator;
BOOL bReadonly;
} CMemInputPinBaseImpl;
typedef struct CQualityControlPassThruImpl
{
/* IQualityControl */
ICOM_VFIELD(IQualityControl);
/* IUnknown fields */
IUnknown* punkControl;
/* IQualityControl fields */
CPinBaseImpl* pPin;
IQualityControl* pControl;
} CQualityControlPassThruImpl;
struct CBasePinHandlers
{
HRESULT (*pOnPreConnect)( CPinBaseImpl* pImpl, IPin* pPin );
HRESULT (*pOnPostConnect)( CPinBaseImpl* pImpl, IPin* pPin );
HRESULT (*pOnDisconnect)( CPinBaseImpl* pImpl );
HRESULT (*pCheckMediaType)( CPinBaseImpl* pImpl, const AM_MEDIA_TYPE* pmt );
HRESULT (*pQualityNotify)( CPinBaseImpl* pImpl, IBaseFilter* pFilter, Quality q );
HRESULT (*pReceive)( CPinBaseImpl* pImpl, IMediaSample* pSample );
HRESULT (*pReceiveCanBlock)( CPinBaseImpl* pImpl );
HRESULT (*pEndOfStream)( CPinBaseImpl* pImpl );
HRESULT (*pBeginFlush)( CPinBaseImpl* pImpl );
HRESULT (*pEndFlush)( CPinBaseImpl* pImpl );
HRESULT (*pNewSegment)( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
};
HRESULT CPinBaseImpl_InitIPin(
CPinBaseImpl* This, IUnknown* punkControl,
CRITICAL_SECTION* pcsPin,
CRITICAL_SECTION* pcsPinReceive,
CBaseFilterImpl* pFilter, LPCWSTR pwszId,
BOOL bOutput,
const CBasePinHandlers* pHandlers );
void CPinBaseImpl_UninitIPin( CPinBaseImpl* This );
HRESULT CMemInputPinBaseImpl_InitIMemInputPin(
CMemInputPinBaseImpl* This, IUnknown* punkControl,
CPinBaseImpl* pPin );
void CMemInputPinBaseImpl_UninitIMemInputPin(
CMemInputPinBaseImpl* This );
HRESULT CQualityControlPassThruImpl_InitIQualityControl(
CQualityControlPassThruImpl* This, IUnknown* punkControl,
CPinBaseImpl* pPin );
void CQualityControlPassThruImpl_UninitIQualityControl(
CQualityControlPassThruImpl* This );
HRESULT CPinBaseImpl_SendSample( CPinBaseImpl* This, IMediaSample* pSample );
HRESULT CPinBaseImpl_SendReceiveCanBlock( CPinBaseImpl* This );
HRESULT CPinBaseImpl_SendEndOfStream( CPinBaseImpl* This );
HRESULT CPinBaseImpl_SendBeginFlush( CPinBaseImpl* This );
HRESULT CPinBaseImpl_SendEndFlush( CPinBaseImpl* This );
HRESULT CPinBaseImpl_SendNewSegment( CPinBaseImpl* This, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
/***************************************************************************
*
* handlers for output pins.
*
*/
HRESULT OutputPinSync_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample );
HRESULT OutputPinSync_ReceiveCanBlock( CPinBaseImpl* pImpl );
HRESULT OutputPinSync_EndOfStream( CPinBaseImpl* pImpl );
HRESULT OutputPinSync_BeginFlush( CPinBaseImpl* pImpl );
HRESULT OutputPinSync_EndFlush( CPinBaseImpl* pImpl );
HRESULT OutputPinSync_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
/***************************************************************************
*
* handlers for output pins (async).
*
*/
HRESULT OutputPinAsync_OnActive( CPinBaseImpl* pImpl );
HRESULT OutputPinAsync_OnInactive( CPinBaseImpl* pImpl );
HRESULT OutputPinAsync_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample );
HRESULT OutputPinAsync_ReceiveCanBlock( CPinBaseImpl* pImpl );
HRESULT OutputPinAsync_EndOfStream( CPinBaseImpl* pImpl );
HRESULT OutputPinAsync_BeginFlush( CPinBaseImpl* pImpl );
HRESULT OutputPinAsync_EndFlush( CPinBaseImpl* pImpl );
HRESULT OutputPinAsync_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate );
#endif /* WINE_DSHOW_BASEFILT_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,242 +0,0 @@
/*
* Implementation of CLSID_CaptureGraphBuilder[2].
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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
*
* FIXME - stub
* FIXME - not tested
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "strmif.h"
#include "control.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "capgraph.h"
/***************************************************************************
*
* CCaptureGraph::ICaptureGraphBuilder
*
*/
static HRESULT WINAPI
ICaptureGraphBuilder_fnQueryInterface(ICaptureGraphBuilder* iface,REFIID riid,void** ppobj)
{
CCaptureGraph_THIS(iface,capgraph1);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
ICaptureGraphBuilder_fnAddRef(ICaptureGraphBuilder* iface)
{
CCaptureGraph_THIS(iface,capgraph1);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
ICaptureGraphBuilder_fnRelease(ICaptureGraphBuilder* iface)
{
CCaptureGraph_THIS(iface,capgraph1);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
ICaptureGraphBuilder_fnSetFiltergraph(ICaptureGraphBuilder* iface,IGraphBuilder* pgb)
{
CCaptureGraph_THIS(iface,capgraph1);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
ICaptureGraphBuilder_fnGetFiltergraph(ICaptureGraphBuilder* iface,IGraphBuilder** ppgb)
{
CCaptureGraph_THIS(iface,capgraph1);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
ICaptureGraphBuilder_fnSetOutputFileName(ICaptureGraphBuilder* iface,const GUID* pguidType,LPCOLESTR pName,IBaseFilter** ppFilter,IFileSinkFilter** ppSink)
{
CCaptureGraph_THIS(iface,capgraph1);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
ICaptureGraphBuilder_fnFindInterface(ICaptureGraphBuilder* iface,const GUID* pguidCat,IBaseFilter* pFilter,REFIID riid,void** ppvobj)
{
CCaptureGraph_THIS(iface,capgraph1);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
ICaptureGraphBuilder_fnRenderStream(ICaptureGraphBuilder* iface,const GUID* pguidCat,IUnknown* pSource,IBaseFilter* pCompressor,IBaseFilter* pRenderer)
{
CCaptureGraph_THIS(iface,capgraph1);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
ICaptureGraphBuilder_fnControlStream(ICaptureGraphBuilder* iface,const GUID* pguidCat,IBaseFilter* pFilter,REFERENCE_TIME* prtStart,REFERENCE_TIME* prtStop,WORD wStartCookie,WORD wStopCookie)
{
CCaptureGraph_THIS(iface,capgraph1);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
ICaptureGraphBuilder_fnAllocCapFile(ICaptureGraphBuilder* iface,LPCOLESTR pName,DWORDLONG llSize)
{
CCaptureGraph_THIS(iface,capgraph1);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
ICaptureGraphBuilder_fnCopyCaptureFile(ICaptureGraphBuilder* iface,LPOLESTR pOrgName,LPOLESTR pNewName,int fAllowEscAbort,IAMCopyCaptureFileProgress* pCallback)
{
CCaptureGraph_THIS(iface,capgraph1);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static ICOM_VTABLE(ICaptureGraphBuilder) icapgraph1 =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
ICaptureGraphBuilder_fnQueryInterface,
ICaptureGraphBuilder_fnAddRef,
ICaptureGraphBuilder_fnRelease,
/* ICaptureGraphBuilder fields */
ICaptureGraphBuilder_fnSetFiltergraph,
ICaptureGraphBuilder_fnGetFiltergraph,
ICaptureGraphBuilder_fnSetOutputFileName,
ICaptureGraphBuilder_fnFindInterface,
ICaptureGraphBuilder_fnRenderStream,
ICaptureGraphBuilder_fnControlStream,
ICaptureGraphBuilder_fnAllocCapFile,
ICaptureGraphBuilder_fnCopyCaptureFile,
};
static HRESULT CCaptureGraph_InitICaptureGraphBuilder( CCaptureGraph* This )
{
TRACE("(%p)\n",This);
ICOM_VTBL(&This->capgraph1) = &icapgraph1;
return NOERROR;
}
static void CCaptureGraph_UninitICaptureGraphBuilder( CCaptureGraph* This )
{
TRACE("(%p)\n",This);
}
/***************************************************************************
*
* new/delete for CCaptureGraph
*
*/
/* can I use offsetof safely? - FIXME? */
static QUARTZ_IFEntry IFEntries[] =
{
{ &IID_ICaptureGraphBuilder, offsetof(CCaptureGraph,capgraph1)-offsetof(CCaptureGraph,unk) },
};
static void QUARTZ_DestroyCaptureGraph(IUnknown* punk)
{
CCaptureGraph_THIS(punk,unk);
TRACE( "(%p)\n", This );
CCaptureGraph_UninitICaptureGraphBuilder(This);
}
HRESULT QUARTZ_CreateCaptureGraph(IUnknown* punkOuter,void** ppobj)
{
CCaptureGraph* pcg;
HRESULT hr;
TRACE("(%p,%p)\n",punkOuter,ppobj);
pcg = (CCaptureGraph*)QUARTZ_AllocObj( sizeof(CCaptureGraph) );
if ( pcg == NULL )
return E_OUTOFMEMORY;
QUARTZ_IUnkInit( &pcg->unk, punkOuter );
pcg->m_pfg = NULL;
hr = CCaptureGraph_InitICaptureGraphBuilder(pcg);
if ( FAILED(hr) )
{
QUARTZ_FreeObj(pcg);
return hr;
}
pcg->unk.pEntries = IFEntries;
pcg->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
pcg->unk.pOnFinalRelease = QUARTZ_DestroyCaptureGraph;
*ppobj = (void*)(&pcg->unk);
return S_OK;
}

View File

@ -1,47 +0,0 @@
/*
* Implementation of CLSID_CaptureGraphBuilder[2].
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 WINE_DSHOW_CAPGRAPH_H
#define WINE_DSHOW_CAPGRAPH_H
#include "iunk.h"
typedef struct CapGraph_ICaptureGraphBuilderImpl
{
ICOM_VFIELD(ICaptureGraphBuilder);
} CapGraph_ICaptureGraphBuilderImpl;
typedef struct CCaptureGraph
{
QUARTZ_IUnkImpl unk;
CapGraph_ICaptureGraphBuilderImpl capgraph1;
/* ICaptureGraphBuilder fields. */
IGraphBuilder* m_pfg;
} CCaptureGraph;
#define CCaptureGraph_THIS(iface,member) CCaptureGraph* This = ((CCaptureGraph*)(((char*)iface)-offsetof(CCaptureGraph,member)))
#define CCaptureGraph_ICaptureGraphBuilder(th) ((ICaptureGraphBuilder*)&((th)->capgraph1))
HRESULT QUARTZ_CreateCaptureGraph(IUnknown* punkOuter,void** ppobj);
#endif /* WINE_DSHOW_CAPGRAPH_H */

View File

@ -1,309 +0,0 @@
/*
* List of components. (for internal use)
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wine/obj_base.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "complist.h"
struct QUARTZ_CompList
{
QUARTZ_CompListItem* pFirst;
QUARTZ_CompListItem* pLast;
CRITICAL_SECTION csList;
};
struct QUARTZ_CompListItem
{
IUnknown* punk;
QUARTZ_CompListItem* pNext;
QUARTZ_CompListItem* pPrev;
void* pvData;
DWORD dwDataLen;
};
QUARTZ_CompList* QUARTZ_CompList_Alloc( void )
{
QUARTZ_CompList* pList;
pList = (QUARTZ_CompList*)QUARTZ_AllocMem( sizeof(QUARTZ_CompList) );
if ( pList != NULL )
{
/* construct. */
pList->pFirst = NULL;
pList->pLast = NULL;
InitializeCriticalSection( &pList->csList );
}
return pList;
}
void QUARTZ_CompList_Free( QUARTZ_CompList* pList )
{
QUARTZ_CompListItem* pCur;
QUARTZ_CompListItem* pNext;
if ( pList != NULL )
{
pCur = pList->pFirst;
while ( pCur != NULL )
{
pNext = pCur->pNext;
if ( pCur->punk != NULL )
IUnknown_Release( pCur->punk );
if ( pCur->pvData != NULL )
QUARTZ_FreeMem( pCur->pvData );
QUARTZ_FreeMem( pCur );
pCur = pNext;
}
DeleteCriticalSection( &pList->csList );
QUARTZ_FreeMem( pList );
}
}
void QUARTZ_CompList_Lock( QUARTZ_CompList* pList )
{
EnterCriticalSection( &pList->csList );
}
void QUARTZ_CompList_Unlock( QUARTZ_CompList* pList )
{
LeaveCriticalSection( &pList->csList );
}
QUARTZ_CompList* QUARTZ_CompList_Dup(
const QUARTZ_CompList* pList, BOOL fDupData )
{
QUARTZ_CompList* pNewList;
const QUARTZ_CompListItem* pCur;
HRESULT hr;
pNewList = QUARTZ_CompList_Alloc();
if ( pNewList == NULL )
return NULL;
pCur = pList->pFirst;
while ( pCur != NULL )
{
if ( pCur->punk != NULL )
{
if ( fDupData )
hr = QUARTZ_CompList_AddComp(
pNewList, pCur->punk,
pCur->pvData, pCur->dwDataLen );
else
hr = QUARTZ_CompList_AddComp(
pNewList, pCur->punk, NULL, 0 );
if ( FAILED(hr) )
{
QUARTZ_CompList_Free( pNewList );
return NULL;
}
}
pCur = pCur->pNext;
}
return pNewList;
}
static QUARTZ_CompListItem* QUARTZ_CompList_AllocComp(
QUARTZ_CompList* pList, IUnknown* punk,
const void* pvData, DWORD dwDataLen )
{
QUARTZ_CompListItem* pItem;
pItem = (QUARTZ_CompListItem*)QUARTZ_AllocMem( sizeof(QUARTZ_CompListItem) );
if ( pItem == NULL )
return NULL;
pItem->pvData = NULL;
pItem->dwDataLen = 0;
if ( pvData != NULL )
{
pItem->pvData = (void*)QUARTZ_AllocMem( dwDataLen );
if ( pItem->pvData == NULL )
{
QUARTZ_FreeMem( pItem );
return NULL;
}
memcpy( pItem->pvData, pvData, dwDataLen );
pItem->dwDataLen = dwDataLen;
}
pItem->punk = punk; IUnknown_AddRef(punk);
return pItem;
}
HRESULT QUARTZ_CompList_AddComp(
QUARTZ_CompList* pList, IUnknown* punk,
const void* pvData, DWORD dwDataLen )
{
QUARTZ_CompListItem* pItem;
pItem = QUARTZ_CompList_AllocComp( pList, punk, pvData, dwDataLen );
if ( pItem == NULL )
return E_OUTOFMEMORY;
if ( pList->pFirst != NULL )
pList->pFirst->pPrev = pItem;
else
pList->pLast = pItem;
pItem->pNext = pList->pFirst;
pList->pFirst = pItem;
pItem->pPrev = NULL;
return S_OK;
}
HRESULT QUARTZ_CompList_AddTailComp(
QUARTZ_CompList* pList, IUnknown* punk,
const void* pvData, DWORD dwDataLen )
{
QUARTZ_CompListItem* pItem;
pItem = QUARTZ_CompList_AllocComp( pList, punk, pvData, dwDataLen );
if ( pItem == NULL )
return E_OUTOFMEMORY;
if ( pList->pLast != NULL )
pList->pLast->pNext = pItem;
else
pList->pFirst = pItem;
pItem->pPrev = pList->pLast;
pList->pLast = pItem;
pItem->pNext = NULL;
return S_OK;
}
HRESULT QUARTZ_CompList_RemoveComp( QUARTZ_CompList* pList, IUnknown* punk )
{
QUARTZ_CompListItem* pCur;
pCur = QUARTZ_CompList_SearchComp( pList, punk );
if ( pCur == NULL )
return S_FALSE; /* already removed. */
/* remove from list. */
if ( pCur->pNext != NULL )
pCur->pNext->pPrev = pCur->pPrev;
else
pList->pLast = pCur->pPrev;
if ( pCur->pPrev != NULL )
pCur->pPrev->pNext = pCur->pNext;
else
pList->pFirst = pCur->pNext;
/* release this item. */
if ( pCur->punk != NULL )
IUnknown_Release( pCur->punk );
if ( pCur->pvData != NULL )
QUARTZ_FreeMem( pCur->pvData );
QUARTZ_FreeMem( pCur );
return S_OK;
}
QUARTZ_CompListItem* QUARTZ_CompList_SearchComp(
QUARTZ_CompList* pList, IUnknown* punk )
{
QUARTZ_CompListItem* pCur;
pCur = pList->pFirst;
while ( pCur != NULL )
{
if ( pCur->punk == punk )
return pCur;
pCur = pCur->pNext;
}
return NULL;
}
QUARTZ_CompListItem* QUARTZ_CompList_SearchData(
QUARTZ_CompList* pList, const void* pvData, DWORD dwDataLen )
{
QUARTZ_CompListItem* pCur;
pCur = pList->pFirst;
while ( pCur != NULL )
{
if ( pCur->dwDataLen == dwDataLen &&
!memcmp( pCur->pvData, pvData, dwDataLen ) )
return pCur;
pCur = pCur->pNext;
}
return NULL;
}
QUARTZ_CompListItem* QUARTZ_CompList_GetFirst(
QUARTZ_CompList* pList )
{
return pList->pFirst;
}
QUARTZ_CompListItem* QUARTZ_CompList_GetLast(
QUARTZ_CompList* pList )
{
return pList->pLast;
}
QUARTZ_CompListItem* QUARTZ_CompList_GetNext(
QUARTZ_CompList* pList, QUARTZ_CompListItem* pPrev )
{
return pPrev->pNext;
}
QUARTZ_CompListItem* QUARTZ_CompList_GetPrev(
QUARTZ_CompList* pList, QUARTZ_CompListItem* pNext )
{
return pNext->pPrev;
}
IUnknown* QUARTZ_CompList_GetItemPtr( QUARTZ_CompListItem* pItem )
{
return pItem->punk;
}
const void* QUARTZ_CompList_GetDataPtr( QUARTZ_CompListItem* pItem )
{
return pItem->pvData;
}
DWORD QUARTZ_CompList_GetDataLength( QUARTZ_CompListItem* pItem )
{
return pItem->dwDataLen;
}

View File

@ -1,58 +0,0 @@
/*
* List of components. (for internal use)
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 QUARTZ_COMPLIST_H
#define QUARTZ_COMPLIST_H
typedef struct QUARTZ_CompList QUARTZ_CompList;
typedef struct QUARTZ_CompListItem QUARTZ_CompListItem;
QUARTZ_CompList* QUARTZ_CompList_Alloc( void );
void QUARTZ_CompList_Free( QUARTZ_CompList* pList );
void QUARTZ_CompList_Lock( QUARTZ_CompList* pList );
void QUARTZ_CompList_Unlock( QUARTZ_CompList* pList );
QUARTZ_CompList* QUARTZ_CompList_Dup(
const QUARTZ_CompList* pList, BOOL fDupData );
HRESULT QUARTZ_CompList_AddComp(
QUARTZ_CompList* pList, IUnknown* punk,
const void* pvData, DWORD dwDataLen );
HRESULT QUARTZ_CompList_AddTailComp(
QUARTZ_CompList* pList, IUnknown* punk,
const void* pvData, DWORD dwDataLen );
HRESULT QUARTZ_CompList_RemoveComp( QUARTZ_CompList* pList, IUnknown* punk );
QUARTZ_CompListItem* QUARTZ_CompList_SearchComp(
QUARTZ_CompList* pList, IUnknown* punk );
QUARTZ_CompListItem* QUARTZ_CompList_SearchData(
QUARTZ_CompList* pList, const void* pvData, DWORD dwDataLen );
QUARTZ_CompListItem* QUARTZ_CompList_GetFirst(
QUARTZ_CompList* pList );
QUARTZ_CompListItem* QUARTZ_CompList_GetLast(
QUARTZ_CompList* pList );
QUARTZ_CompListItem* QUARTZ_CompList_GetNext(
QUARTZ_CompList* pList, QUARTZ_CompListItem* pPrev );
QUARTZ_CompListItem* QUARTZ_CompList_GetPrev(
QUARTZ_CompList* pList, QUARTZ_CompListItem* pNext );
IUnknown* QUARTZ_CompList_GetItemPtr( QUARTZ_CompListItem* pItem );
const void* QUARTZ_CompList_GetDataPtr( QUARTZ_CompListItem* pItem );
DWORD QUARTZ_CompList_GetDataLength( QUARTZ_CompListItem* pItem );
#endif /* QUARTZ_COMPLIST_H */

View File

@ -1,452 +0,0 @@
/*
* Implements Color Space Converter(CLSID_Colour).
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "vfw.h"
#include "strmif.h"
#include "control.h"
#include "amvideo.h"
#include "vfwmsgs.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "xform.h"
#include "videoblt.h"
static const WCHAR ColorConv_FilterName[] =
{'C','o','l','o','r',' ','S','p','a','c','e',' ','C','o','n','v','e','r','t','e','r',0};
struct BltHandler
{
const GUID* psubtypeIn;
const GUID* psubtypeOut;
pVIDEOBLT_Blt pBlt;
};
static const struct BltHandler conv_handlers[] =
{
{ &MEDIASUBTYPE_RGB24, &MEDIASUBTYPE_RGB32, VIDEOBLT_Blt_888_to_8888 },
{ &MEDIASUBTYPE_RGB24, &MEDIASUBTYPE_RGB565, VIDEOBLT_Blt_888_to_565 },
{ &MEDIASUBTYPE_RGB24, &MEDIASUBTYPE_RGB555, VIDEOBLT_Blt_888_to_555 },
{ &MEDIASUBTYPE_RGB24, &MEDIASUBTYPE_RGB8, VIDEOBLT_Blt_888_to_332 },
{ NULL, NULL, NULL },
};
typedef struct CColorConvImpl
{
pVIDEOBLT_Blt m_pBlt;
AM_MEDIA_TYPE* m_pmtConv;
DWORD m_cConv;
LONG pitchIn;
LONG pitchOut;
} CColorConvImpl;
/***************************************************************************
*
* CColorConvImpl methods
*
*/
static void ColorConv_FreeOutTypes(CColorConvImpl* This)
{
DWORD i;
if ( This->m_pmtConv == NULL )
return;
TRACE("cConv = %lu\n",This->m_cConv);
for ( i = 0; i < This->m_cConv; i++ )
{
QUARTZ_MediaType_Free(&This->m_pmtConv[i]);
}
QUARTZ_FreeMem(This->m_pmtConv);
This->m_pmtConv = NULL;
This->m_cConv = 0;
}
static HRESULT ColorConv_FillBitmapInfo( BITMAPINFO* pbiOut, LONG biWidth, LONG biHeight, const GUID* psubtype )
{
int i;
DWORD* pdwBitf;
HRESULT hr = E_FAIL;
pbiOut->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
pbiOut->bmiHeader.biWidth = biWidth;
pbiOut->bmiHeader.biHeight = biHeight;
pbiOut->bmiHeader.biPlanes = 1;
if ( IsEqualGUID( psubtype, &MEDIASUBTYPE_RGB8 ) )
{
pbiOut->bmiHeader.biBitCount = 8;
for ( i = 0; i < 256; i++ )
{
pbiOut->bmiColors[i].rgbRed = ((i>>5)&7)*255/7;
pbiOut->bmiColors[i].rgbGreen = ((i>>2)&7)*255/7;
pbiOut->bmiColors[i].rgbBlue = (i&3)*255/3;
}
hr = S_OK;
}
if ( IsEqualGUID( psubtype, &MEDIASUBTYPE_RGB555 ) )
{
pbiOut->bmiHeader.biBitCount = 16;
hr = S_OK;
}
if ( IsEqualGUID( psubtype, &MEDIASUBTYPE_RGB565 ) )
{
pbiOut->bmiHeader.biBitCount = 16;
pbiOut->bmiHeader.biCompression = 3;
pdwBitf = (DWORD*)(&pbiOut->bmiColors[0]);
pdwBitf[0] = 0xf800;
pdwBitf[1] = 0x07e0;
pdwBitf[2] = 0x001f;
hr = S_OK;
}
if ( IsEqualGUID( psubtype, &MEDIASUBTYPE_RGB24 ) )
{
pbiOut->bmiHeader.biBitCount = 24;
hr = S_OK;
}
if ( IsEqualGUID( psubtype, &MEDIASUBTYPE_RGB32 ) )
{
pbiOut->bmiHeader.biBitCount = 32;
hr = S_OK;
}
pbiOut->bmiHeader.biSizeImage = DIBSIZE(pbiOut->bmiHeader);
return hr;
}
static HRESULT ColorConv_Init( CTransformBaseImpl* pImpl )
{
CColorConvImpl* This = pImpl->m_pUserData;
if ( This != NULL )
return NOERROR;
This = (CColorConvImpl*)QUARTZ_AllocMem( sizeof(CColorConvImpl) );
if ( This == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This, sizeof(CColorConvImpl) );
pImpl->m_pUserData = This;
/* construct */
This->m_pBlt = NULL;
This->m_pmtConv = NULL;
This->m_cConv = 0;
return NOERROR;
}
static HRESULT ColorConv_Cleanup( CTransformBaseImpl* pImpl )
{
CColorConvImpl* This = pImpl->m_pUserData;
if ( This == NULL )
return NOERROR;
/* destruct */
ColorConv_FreeOutTypes(This);
QUARTZ_FreeMem( This );
pImpl->m_pUserData = NULL;
return NOERROR;
}
static HRESULT ColorConv_CheckMediaType( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut )
{
CColorConvImpl* This = pImpl->m_pUserData;
BITMAPINFOHEADER* pbiIn = NULL;
BITMAPINFOHEADER* pbiOut = NULL;
HRESULT hr;
GUID stIn, stOut;
const struct BltHandler* phandler;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
if ( !IsEqualGUID( &pmtIn->majortype, &MEDIATYPE_Video ) )
return E_FAIL;
if ( !IsEqualGUID( &pmtIn->formattype, &FORMAT_VideoInfo ) )
return E_FAIL;
pbiIn = (&((VIDEOINFOHEADER*)pmtIn->pbFormat)->bmiHeader);
if ( pbiIn->biCompression != 0 &&
pbiIn->biCompression != 3 )
return E_FAIL;
hr = QUARTZ_MediaSubType_FromBitmap( &stIn, pbiIn );
if ( hr != S_OK || !IsEqualGUID( &pmtIn->subtype, &stIn ) )
return E_FAIL;
if ( pmtOut != NULL )
{
if ( !IsEqualGUID( &pmtOut->majortype, &MEDIATYPE_Video ) )
return E_FAIL;
if ( !IsEqualGUID( &pmtOut->formattype, &FORMAT_VideoInfo ) )
return E_FAIL;
pbiOut = (&((VIDEOINFOHEADER*)pmtOut->pbFormat)->bmiHeader);
if ( pbiOut->biCompression != 0 &&
pbiOut->biCompression != 3 )
return E_FAIL;
hr = QUARTZ_MediaSubType_FromBitmap( &stOut, pbiOut );
if ( hr != S_OK || !IsEqualGUID( &pmtOut->subtype, &stOut ) )
return E_FAIL;
if ( pbiIn->biWidth != pbiOut->biWidth ||
pbiIn->biHeight != pbiOut->biHeight ||
pbiIn->biPlanes != 1 || pbiOut->biPlanes != 1 )
return E_FAIL;
}
phandler = conv_handlers;
while ( phandler->psubtypeIn != NULL )
{
if ( IsEqualGUID( &pmtIn->subtype, phandler->psubtypeIn ) )
{
if ( pmtOut == NULL )
return S_OK;
if ( IsEqualGUID( &pmtOut->subtype, phandler->psubtypeOut ) )
return S_OK;
}
phandler ++;
}
return E_FAIL;
}
static HRESULT ColorConv_GetOutputTypes( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE** ppmtAcceptTypes, ULONG* pcAcceptTypes )
{
CColorConvImpl* This = pImpl->m_pUserData;
HRESULT hr;
const struct BltHandler* phandler;
DWORD cConv;
BITMAPINFOHEADER* pbiIn = NULL;
BITMAPINFOHEADER* pbiOut = NULL;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = ColorConv_CheckMediaType( pImpl, pmtIn, NULL );
if ( FAILED(hr) )
return hr;
pbiIn = (&((VIDEOINFOHEADER*)pmtIn->pbFormat)->bmiHeader);
ColorConv_FreeOutTypes(This);
cConv = 0;
phandler = conv_handlers;
while ( phandler->psubtypeIn != NULL )
{
if ( IsEqualGUID( &pmtIn->subtype, phandler->psubtypeIn ) )
cConv ++;
phandler ++;
}
This->m_cConv = cConv;
This->m_pmtConv = (AM_MEDIA_TYPE*)QUARTZ_AllocMem(
sizeof(AM_MEDIA_TYPE) * cConv );
if ( This->m_pmtConv == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This->m_pmtConv, sizeof(AM_MEDIA_TYPE) * cConv );
cConv = 0;
phandler = conv_handlers;
while ( phandler->psubtypeIn != NULL )
{
if ( IsEqualGUID( &pmtIn->subtype, phandler->psubtypeIn ) )
{
memcpy( &This->m_pmtConv[cConv].majortype, &MEDIATYPE_Video, sizeof(GUID) );
memcpy( &This->m_pmtConv[cConv].subtype, phandler->psubtypeOut, sizeof(GUID) );
This->m_pmtConv[cConv].bFixedSizeSamples = 1;
This->m_pmtConv[cConv].bTemporalCompression = 0;
This->m_pmtConv[cConv].lSampleSize = DIBSIZE(*pbiIn);
memcpy( &This->m_pmtConv[cConv].formattype, &FORMAT_VideoInfo, sizeof(GUID) );
This->m_pmtConv[cConv].cbFormat = sizeof(VIDEOINFO);
This->m_pmtConv[cConv].pbFormat = (BYTE*)CoTaskMemAlloc( This->m_pmtConv[cConv].cbFormat );
if ( This->m_pmtConv[cConv].pbFormat == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This->m_pmtConv[cConv].pbFormat, This->m_pmtConv[cConv].cbFormat );
pbiOut = &(((VIDEOINFOHEADER*)(This->m_pmtConv[cConv].pbFormat))->bmiHeader);
hr = ColorConv_FillBitmapInfo( (BITMAPINFO*)pbiOut, pbiIn->biWidth, pbiIn->biHeight, phandler->psubtypeOut );
if ( FAILED(hr) )
return hr;
cConv ++;
}
phandler ++;
}
*ppmtAcceptTypes = This->m_pmtConv;
*pcAcceptTypes = This->m_cConv;
return NOERROR;
}
static HRESULT ColorConv_GetAllocProp( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, ALLOCATOR_PROPERTIES* pProp, BOOL* pbTransInPlace, BOOL* pbTryToReuseSample )
{
CColorConvImpl* This = pImpl->m_pUserData;
HRESULT hr;
BITMAPINFOHEADER* pbiOut = NULL;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = ColorConv_CheckMediaType( pImpl, pmtIn, pmtOut );
if ( FAILED(hr) )
return hr;
pbiOut = (&((VIDEOINFOHEADER*)pmtOut->pbFormat)->bmiHeader);
pProp->cBuffers = 1;
pProp->cbBuffer = DIBSIZE(*pbiOut);
TRACE("%ldx%ldx%u cbBuffer = %ld\n",pbiOut->biWidth,pbiOut->biHeight,(unsigned)pbiOut->biBitCount,pProp->cbBuffer);
return NOERROR;
}
static HRESULT ColorConv_BeginTransform( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, BOOL bReuseSample )
{
CColorConvImpl* This = pImpl->m_pUserData;
HRESULT hr;
BITMAPINFOHEADER* pbiIn = NULL;
BITMAPINFOHEADER* pbiOut = NULL;
const struct BltHandler* phandler;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = ColorConv_CheckMediaType( pImpl, pmtIn, pmtOut );
if ( FAILED(hr) )
return hr;
pbiIn = (&((VIDEOINFOHEADER*)pmtIn->pbFormat)->bmiHeader);
pbiOut = (&((VIDEOINFOHEADER*)pmtOut->pbFormat)->bmiHeader);
This->pitchIn = DIBWIDTHBYTES(*pbiIn);
This->pitchOut = DIBWIDTHBYTES(*pbiOut);
This->m_pBlt = NULL;
phandler = conv_handlers;
while ( phandler->psubtypeIn != NULL )
{
if ( IsEqualGUID( &pmtIn->subtype, phandler->psubtypeIn ) )
{
if ( IsEqualGUID( &pmtOut->subtype, phandler->psubtypeOut ) )
{
This->m_pBlt = phandler->pBlt;
return S_OK;
}
}
phandler ++;
}
return E_FAIL;
}
static HRESULT ColorConv_Transform( CTransformBaseImpl* pImpl, IMediaSample* pSampIn, IMediaSample* pSampOut )
{
CColorConvImpl* This = pImpl->m_pUserData;
BYTE* pDataIn = NULL;
BYTE* pDataOut = NULL;
BITMAPINFO* pbiIn;
BITMAPINFO* pbiOut;
HRESULT hr;
if ( This == NULL )
return E_UNEXPECTED;
hr = IMediaSample_GetPointer( pSampIn, &pDataIn );
if ( FAILED(hr) )
return hr;
hr = IMediaSample_GetPointer( pSampOut, &pDataOut );
if ( FAILED(hr) )
return hr;
if ( This->m_pBlt != NULL )
{
pbiIn = (BITMAPINFO*)&(((VIDEOINFOHEADER*)pImpl->pInPin->pin.pmtConn->pbFormat)->bmiHeader);
pbiOut = (BITMAPINFO*)&(((VIDEOINFOHEADER*)pImpl->pOutPin->pin.pmtConn->pbFormat)->bmiHeader);
This->m_pBlt(
pDataOut, This->pitchOut,
pDataIn, This->pitchIn,
pbiIn->bmiHeader.biWidth,
abs(pbiIn->bmiHeader.biHeight),
&pbiIn->bmiColors[0], pbiIn->bmiHeader.biClrUsed );
hr = IMediaSample_SetActualDataLength(pSampOut,DIBSIZE(pbiOut->bmiHeader));
if ( FAILED(hr) )
return hr;
}
return NOERROR;
}
static HRESULT ColorConv_EndTransform( CTransformBaseImpl* pImpl )
{
CColorConvImpl* This = pImpl->m_pUserData;
if ( This == NULL )
return E_UNEXPECTED;
This->m_pBlt = NULL;
return NOERROR;
}
static const TransformBaseHandlers transhandlers =
{
ColorConv_Init,
ColorConv_Cleanup,
ColorConv_CheckMediaType,
ColorConv_GetOutputTypes,
ColorConv_GetAllocProp,
ColorConv_BeginTransform,
NULL,
ColorConv_Transform,
ColorConv_EndTransform,
};
HRESULT QUARTZ_CreateColour(IUnknown* punkOuter,void** ppobj)
{
return QUARTZ_CreateTransformBase(
punkOuter,ppobj,
&CLSID_Colour,
ColorConv_FilterName,
NULL, NULL,
&transhandlers );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,144 +0,0 @@
/*
* Copyright (C) Hidenori TAKESHIMA
*
* 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 WINE_DSHOW_DEVENUM_H
#define WINE_DSHOW_DEVENUM_H
/*
* implements CLSID_SystemDeviceEnum.
*
* - At least, the following interfaces should be implemented:
*
* IUnknown
* + ICreateDevEnum
*/
#include "iunk.h"
typedef struct SDE_ICreateDevEnumImpl
{
ICOM_VFIELD(ICreateDevEnum);
} SDE_ICreateDevEnumImpl;
typedef struct CSysDevEnum
{
QUARTZ_IUnkImpl unk;
SDE_ICreateDevEnumImpl createdevenum;
} CSysDevEnum;
#define CSysDevEnum_THIS(iface,member) CSysDevEnum* This = ((CSysDevEnum*)(((char*)iface)-offsetof(CSysDevEnum,member)))
HRESULT QUARTZ_CreateSystemDeviceEnum(IUnknown* punkOuter,void** ppobj);
HRESULT CSysDevEnum_InitICreateDevEnum( CSysDevEnum* psde );
void CSysDevEnum_UninitICreateDevEnum( CSysDevEnum* psde );
/*
* implements CLSID_CDeviceMoniker.
*
* - At least, the following interfaces should be implemented:
*
* IUnknown
* + IPersist - IPersistStream - IMoniker
*/
typedef struct DMON_IMonikerImpl
{
ICOM_VFIELD(IMoniker);
} DMON_IMonikerImpl;
typedef struct CDeviceMoniker
{
QUARTZ_IUnkImpl unk;
DMON_IMonikerImpl moniker;
/* IMoniker fields */
HKEY m_hkRoot;
WCHAR* m_pwszPath;
} CDeviceMoniker;
#define CDeviceMoniker_THIS(iface,member) CDeviceMoniker* This = (CDeviceMoniker*)(((char*)iface)-offsetof(CDeviceMoniker,member))
HRESULT QUARTZ_CreateDeviceMoniker(
HKEY hkRoot, LPCWSTR lpKeyPath,
IMoniker** ppMoniker );
/*
* implements IPropertyBag for accessing registry.
*
* - At least, the following interfaces should be implemented:
*
* IUnknown
* + IPropertyBag
*/
typedef struct DMON_IPropertyBagImpl
{
ICOM_VFIELD(IPropertyBag);
} DMON_IPropertyBagImpl;
typedef struct CRegPropertyBag
{
QUARTZ_IUnkImpl unk;
DMON_IPropertyBagImpl propbag;
/* IPropertyBag fields */
HKEY m_hKey;
} CRegPropertyBag;
#define CRegPropertyBag_THIS(iface,member) CRegPropertyBag* This = (CRegPropertyBag*)(((char*)iface)-offsetof(CRegPropertyBag,member))
HRESULT QUARTZ_CreateRegPropertyBag(
HKEY hkRoot, LPCWSTR lpKeyPath,
IPropertyBag** ppPropBag );
/***************************************************************************
*
* related functions (internal).
*
*/
HRESULT QUARTZ_GetFilterRegPath(
WCHAR** ppwszPath, /* [OUT] path from HKEY_CLASSES_ROOT */
const CLSID* pguidFilterCategory, /* [IN] Category */
const CLSID* pclsid, /* [IN] CLSID of this filter */
LPCWSTR lpInstance ); /* [IN] instance */
HRESULT QUARTZ_RegisterFilterToMoniker(
IMoniker* pMoniker, /* [IN] Moniker */
const CLSID* pclsid, /* [IN] CLSID of this filter */
LPCWSTR lpFriendlyName, /* [IN] friendly name */
const BYTE* pbFilterData, /* [IN] filter data */
DWORD cbFilterData ); /* [IN] size of the filter data */
HRESULT QUARTZ_RegDeleteKey( HKEY hkRoot, LPCWSTR lpKeyPath );
HRESULT QUARTZ_GetCLSIDFromMoniker(
IMoniker* pMoniker, /* [IN] Moniker */
CLSID* pclsid ); /* [OUT] */
HRESULT QUARTZ_GetMeritFromMoniker(
IMoniker* pMoniker, /* [IN] Moniker */
DWORD* pdwMerit ); /* [OUT] */
HRESULT QUARTZ_GetFilterDataFromMoniker(
IMoniker* pMoniker, /* [IN] Moniker */
BYTE** ppbFilterData, /* [OUT] */
DWORD* pcbFilterData ); /* [OUT] */
#endif /* WINE_DSHOW_DEVENUM_H */

View File

@ -1,255 +0,0 @@
/*
* Implementation of IEnumUnknown (for internal use).
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wine/obj_base.h"
#include "wine/obj_misc.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "enumunk.h"
#include "iunk.h"
typedef struct IEnumUnknownImpl
{
ICOM_VFIELD(IEnumUnknown);
} IEnumUnknownImpl;
typedef struct
{
QUARTZ_IUnkImpl unk;
IEnumUnknownImpl enumunk;
struct QUARTZ_IFEntry IFEntries[1];
QUARTZ_CompList* pCompList;
QUARTZ_CompListItem* pItemCur;
} CEnumUnknown;
#define CEnumUnknown_THIS(iface,member) CEnumUnknown* This = ((CEnumUnknown*)(((char*)iface)-offsetof(CEnumUnknown,member)))
static HRESULT WINAPI
IEnumUnknown_fnQueryInterface(IEnumUnknown* iface,REFIID riid,void** ppobj)
{
CEnumUnknown_THIS(iface,enumunk);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IEnumUnknown_fnAddRef(IEnumUnknown* iface)
{
CEnumUnknown_THIS(iface,enumunk);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IEnumUnknown_fnRelease(IEnumUnknown* iface)
{
CEnumUnknown_THIS(iface,enumunk);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IEnumUnknown_fnNext(IEnumUnknown* iface,ULONG cReq,IUnknown** ppunk,ULONG* pcFetched)
{
CEnumUnknown_THIS(iface,enumunk);
HRESULT hr;
ULONG cFetched;
TRACE("(%p)->(%lu,%p,%p)\n",This,cReq,ppunk,pcFetched);
if ( pcFetched == NULL && cReq > 1 )
return E_INVALIDARG;
if ( ppunk == NULL )
return E_POINTER;
QUARTZ_CompList_Lock( This->pCompList );
hr = NOERROR;
cFetched = 0;
while ( cReq > 0 )
{
if ( This->pItemCur == NULL )
{
hr = S_FALSE;
break;
}
ppunk[ cFetched ++ ] = QUARTZ_CompList_GetItemPtr( This->pItemCur );
IUnknown_AddRef( *ppunk );
This->pItemCur =
QUARTZ_CompList_GetNext( This->pCompList, This->pItemCur );
cReq --;
}
QUARTZ_CompList_Unlock( This->pCompList );
if ( pcFetched != NULL )
*pcFetched = cFetched;
return hr;
}
static HRESULT WINAPI
IEnumUnknown_fnSkip(IEnumUnknown* iface,ULONG cSkip)
{
CEnumUnknown_THIS(iface,enumunk);
HRESULT hr;
TRACE("(%p)->()\n",This);
QUARTZ_CompList_Lock( This->pCompList );
hr = NOERROR;
while ( cSkip > 0 )
{
if ( This->pItemCur == NULL )
{
hr = S_FALSE;
break;
}
This->pItemCur =
QUARTZ_CompList_GetNext( This->pCompList, This->pItemCur );
cSkip --;
}
QUARTZ_CompList_Unlock( This->pCompList );
return hr;
}
static HRESULT WINAPI
IEnumUnknown_fnReset(IEnumUnknown* iface)
{
CEnumUnknown_THIS(iface,enumunk);
TRACE("(%p)->()\n",This);
QUARTZ_CompList_Lock( This->pCompList );
This->pItemCur = QUARTZ_CompList_GetFirst( This->pCompList );
QUARTZ_CompList_Unlock( This->pCompList );
return NOERROR;
}
static HRESULT WINAPI
IEnumUnknown_fnClone(IEnumUnknown* iface,IEnumUnknown** ppunk)
{
CEnumUnknown_THIS(iface,enumunk);
HRESULT hr;
TRACE("(%p)->()\n",This);
if ( ppunk == NULL )
return E_POINTER;
QUARTZ_CompList_Lock( This->pCompList );
hr = QUARTZ_CreateEnumUnknown(
This->IFEntries[0].piid,
(void**)ppunk,
This->pCompList );
FIXME( "current pointer must be seeked correctly\n" );
QUARTZ_CompList_Unlock( This->pCompList );
return hr;
}
static ICOM_VTABLE(IEnumUnknown) ienumunk =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IEnumUnknown_fnQueryInterface,
IEnumUnknown_fnAddRef,
IEnumUnknown_fnRelease,
/* IEnumUnknown fields */
IEnumUnknown_fnNext,
IEnumUnknown_fnSkip,
IEnumUnknown_fnReset,
IEnumUnknown_fnClone,
};
void QUARTZ_DestroyEnumUnknown(IUnknown* punk)
{
CEnumUnknown_THIS(punk,unk);
if ( This->pCompList != NULL )
QUARTZ_CompList_Free( This->pCompList );
}
HRESULT QUARTZ_CreateEnumUnknown(
REFIID riidEnum, void** ppobj, const QUARTZ_CompList* pCompList )
{
CEnumUnknown* penum;
QUARTZ_CompList* pCompListDup;
TRACE("(%s,%p,%p)\n",debugstr_guid(riidEnum),ppobj,pCompList);
pCompListDup = QUARTZ_CompList_Dup( pCompList, FALSE );
if ( pCompListDup == NULL )
return E_OUTOFMEMORY;
penum = (CEnumUnknown*)QUARTZ_AllocObj( sizeof(CEnumUnknown) );
if ( penum == NULL )
{
QUARTZ_CompList_Free( pCompListDup );
return E_OUTOFMEMORY;
}
QUARTZ_IUnkInit( &penum->unk, NULL );
ICOM_VTBL(&penum->enumunk) = &ienumunk;
penum->IFEntries[0].piid = riidEnum;
penum->IFEntries[0].ofsVTPtr =
offsetof(CEnumUnknown,enumunk)-offsetof(CEnumUnknown,unk);
penum->pCompList = pCompListDup;
penum->pItemCur = QUARTZ_CompList_GetFirst( pCompListDup );
penum->unk.pEntries = penum->IFEntries;
penum->unk.dwEntries = 1;
penum->unk.pOnFinalRelease = QUARTZ_DestroyEnumUnknown;
*ppobj = (void*)(&penum->enumunk);
return S_OK;
}

View File

@ -1,30 +0,0 @@
/*
* Implementation of IEnumUnknown (for internal use).
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 QUARTZ_ENUMUNK_H
#define QUARTZ_ENUMUNK_H
#include "complist.h"
HRESULT QUARTZ_CreateEnumUnknown(
REFIID riidEnum, void** ppobj, const QUARTZ_CompList* pCompList );
#endif /* QUARTZ_ENUMUNK_H */

View File

@ -1,645 +0,0 @@
/*
* CLSID_FilterGraph event handling.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "strmif.h"
#include "control.h"
#include "evcode.h"
#include "uuids.h"
#include "vfwmsgs.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "fgraph.h"
#define EVENTQUEUE_BLOCKSIZE 2
#define EVENTQUEUE_MAX 1024
struct FilterGraph_MEDIAEVENT
{
long lEventCode;
LONG_PTR lParam1;
LONG_PTR lParam2;
};
static HRESULT FGEVENT_KeepEvent(
BOOL bKeep,
long lEventCode, LONG_PTR lParam1, LONG_PTR lParam2 )
{
switch ( lEventCode )
{
/*case EC_COMPLETE:*/
case EC_USERABORT:
break;
case EC_ERRORABORT:
break;
case EC_TIME:
break;
/*case EC_REPAINT:*/
case EC_STREAM_ERROR_STOPPED:
break;
case EC_STREAM_ERROR_STILLPLAYING:
break;
case EC_ERROR_STILLPLAYING:
break;
case EC_PALETTE_CHANGED:
break;
case EC_VIDEO_SIZE_CHANGED:
break;
case EC_QUALITY_CHANGE:
break;
/*case EC_SHUTTING_DOWN:*/
case EC_CLOCK_CHANGED:
break;
case EC_OPENING_FILE:
break;
case EC_BUFFERING_DATA:
break;
case EC_FULLSCREEN_LOST:
if ( bKeep )
{
if ( ((IBaseFilter*)lParam2) != NULL )
IBaseFilter_AddRef( (IBaseFilter*)lParam2 );
}
else
{
if ( ((IBaseFilter*)lParam2) != NULL )
IBaseFilter_Release( (IBaseFilter*)lParam2 );
}
break;
/*case EC_ACTIVATE:*/
/*case EC_NEED_RESTART:*/
/*case EC_WINDOW_DESTROYED:*/
/*case EC_DISPLAY_CHANGED:*/
/*case EC_STARVATION:*/
/*case EC_OLE_EVENT:*/
/*case EC_NOTIFY_WINDOW:*/
/*case EC_STREAM_CONTROL_STOPPED:*/
/*case EC_STREAM_CONTROL_STARTED:*/
/*case EC_END_OF_SEGMENT:*/
/*case EC_SEGMENT_STARTED:*/
case EC_LENGTH_CHANGED:
break;
default:
if ( lEventCode < EC_USER )
{
FIXME( "unknown system event %08lx\n", lEventCode );
return E_INVALIDARG;
}
TRACE( "user event %08lx\n", lEventCode );
break;
}
return NOERROR;
}
/***************************************************************************
*
* CLSID_FilterGraph::IMediaEvent[Ex]
*
*/
static HRESULT WINAPI
IMediaEventEx_fnQueryInterface(IMediaEventEx* iface,REFIID riid,void** ppobj)
{
CFilterGraph_THIS(iface,mediaevent);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IMediaEventEx_fnAddRef(IMediaEventEx* iface)
{
CFilterGraph_THIS(iface,mediaevent);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IMediaEventEx_fnRelease(IMediaEventEx* iface)
{
CFilterGraph_THIS(iface,mediaevent);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IMediaEventEx_fnGetTypeInfoCount(IMediaEventEx* iface,UINT* pcTypeInfo)
{
CFilterGraph_THIS(iface,mediaevent);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaEventEx_fnGetTypeInfo(IMediaEventEx* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
{
CFilterGraph_THIS(iface,mediaevent);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaEventEx_fnGetIDsOfNames(IMediaEventEx* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
{
CFilterGraph_THIS(iface,mediaevent);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaEventEx_fnInvoke(IMediaEventEx* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
CFilterGraph_THIS(iface,mediaevent);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaEventEx_fnGetEventHandle(IMediaEventEx* iface,OAEVENT* hEvent)
{
CFilterGraph_THIS(iface,mediaevent);
TRACE("(%p)->()\n",This);
*hEvent = (OAEVENT)This->m_hMediaEvent;
return NOERROR;
}
static HRESULT WINAPI
IMediaEventEx_fnGetEvent(IMediaEventEx* iface,long* plEventCode,LONG_PTR* plParam1,LONG_PTR* plParam2,long lTimeOut)
{
CFilterGraph_THIS(iface,mediaevent);
ULONG cQueued;
DWORD dw;
DWORD dwStart;
HRESULT hr;
FilterGraph_MEDIAEVENT* pEvent;
TRACE("(%p)->(%p,%p,%p,%ld)\n",This,plEventCode,
plParam1,plParam2,lTimeOut);
if ( plEventCode == NULL || plParam1 == NULL || plParam2 == NULL )
return E_POINTER;
while ( 1 )
{
dwStart = GetTickCount();
dw = WaitForSingleObject( This->m_hMediaEvent, lTimeOut );
if ( dw == WAIT_TIMEOUT )
return VFW_E_TIMEOUT;
if ( dw != WAIT_OBJECT_0 )
return E_FAIL;
EnterCriticalSection( &This->m_csMediaEvents );
hr = S_FALSE;
if ( This->m_cbMediaEventsMax > 0 )
{
cQueued =
(This->m_cbMediaEventsMax +
This->m_cbMediaEventsPut - This->m_cbMediaEventsGet) %
This->m_cbMediaEventsMax;
if ( cQueued > 0 )
{
pEvent = &This->m_pMediaEvents[This->m_cbMediaEventsGet];
*plEventCode = pEvent->lEventCode;
*plParam1 = pEvent->lParam1;
*plParam2 = pEvent->lParam2;
This->m_cbMediaEventsGet = (This->m_cbMediaEventsGet + 1) %
This->m_cbMediaEventsMax;
hr = NOERROR;
if ( This->m_cbMediaEventsPut == This->m_cbMediaEventsGet )
ResetEvent( This->m_hMediaEvent );
}
}
LeaveCriticalSection( &This->m_csMediaEvents );
if ( hr != S_FALSE )
return hr;
if ( lTimeOut != INFINITE )
{
lTimeOut -= GetTickCount() - dwStart;
if ( lTimeOut < 0 )
return VFW_E_TIMEOUT;
}
}
}
static HRESULT WINAPI
IMediaEventEx_fnWaitForCompletion(IMediaEventEx* iface,long lTimeOut,long* plEventCode)
{
CFilterGraph_THIS(iface,mediaevent);
HRESULT hr;
long lEventCode;
LONG_PTR lParam1;
LONG_PTR lParam2;
DWORD dwTimePrev;
DWORD dwTimeCur;
TRACE("(%p)->(%ld,%p)\n",This,lTimeOut,plEventCode);
if ( plEventCode == NULL )
return E_POINTER;
*plEventCode = 0;
dwTimePrev = GetTickCount();
while ( 1 )
{
hr = IMediaEventEx_GetEvent(
CFilterGraph_IMediaEventEx(This),
&lEventCode,&lParam1,&lParam2,lTimeOut);
if ( hr == VFW_E_TIMEOUT )
hr = E_ABORT;
if ( hr != NOERROR )
return hr;
IMediaEventEx_FreeEventParams(
CFilterGraph_IMediaEventEx(This),
lEventCode,lParam1,lParam2);
if ( lEventCode == EC_COMPLETE ||
lEventCode == EC_ERRORABORT ||
lEventCode == EC_USERABORT )
{
*plEventCode = lEventCode;
return NOERROR;
}
if ( lTimeOut != INFINITE )
{
dwTimeCur = GetTickCount();
lTimeOut -= dwTimeCur - dwTimePrev;
dwTimePrev = dwTimeCur;
if ( lTimeOut < 0 )
return E_ABORT;
}
}
}
static HRESULT WINAPI
IMediaEventEx_fnCancelDefaultHandling(IMediaEventEx* iface,long lEventCode)
{
CFilterGraph_THIS(iface,mediaevent);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaEventEx_fnRestoreDefaultHandling(IMediaEventEx* iface,long lEventCode)
{
CFilterGraph_THIS(iface,mediaevent);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaEventEx_fnFreeEventParams(IMediaEventEx* iface,long lEventCode,LONG_PTR lParam1,LONG_PTR lParam2)
{
CFilterGraph_THIS(iface,mediaevent);
TRACE("(%p)->(%08lx,%08x,%08x)\n",This,lEventCode,lParam1,lParam2);
return FGEVENT_KeepEvent( FALSE, lEventCode, lParam1, lParam2 );
}
static HRESULT WINAPI
IMediaEventEx_fnSetNotifyWindow(IMediaEventEx* iface,OAHWND hwnd,long message,LONG_PTR lParam)
{
CFilterGraph_THIS(iface,mediaevent);
TRACE("(%p)->(%08x,%08lx,%08x)\n",This,hwnd,message,lParam);
EnterCriticalSection( &This->m_csMediaEvents );
This->m_hwndEventNotify = (HWND)hwnd;
This->m_lEventNotifyMsg = message;
This->m_lEventNotifyParam = lParam;
LeaveCriticalSection( &This->m_csMediaEvents );
return NOERROR;
}
static HRESULT WINAPI
IMediaEventEx_fnSetNotifyFlags(IMediaEventEx* iface,long lNotifyFlags)
{
CFilterGraph_THIS(iface,mediaevent);
TRACE("(%p)->(%ld)\n",This,lNotifyFlags);
if ( lNotifyFlags != 0 && lNotifyFlags != 1 )
return E_INVALIDARG;
EnterCriticalSection( &This->m_csMediaEvents );
This->m_lEventNotifyFlags = lNotifyFlags;
LeaveCriticalSection( &This->m_csMediaEvents );
return NOERROR;
}
static HRESULT WINAPI
IMediaEventEx_fnGetNotifyFlags(IMediaEventEx* iface,long* plNotifyFlags)
{
CFilterGraph_THIS(iface,mediaevent);
TRACE("(%p)->(%p)\n",This,plNotifyFlags);
if ( plNotifyFlags == NULL )
return E_POINTER;
EnterCriticalSection( &This->m_csMediaEvents );
*plNotifyFlags = This->m_lEventNotifyFlags;
LeaveCriticalSection( &This->m_csMediaEvents );
return NOERROR;
}
static ICOM_VTABLE(IMediaEventEx) imediaevent =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IMediaEventEx_fnQueryInterface,
IMediaEventEx_fnAddRef,
IMediaEventEx_fnRelease,
/* IDispatch fields */
IMediaEventEx_fnGetTypeInfoCount,
IMediaEventEx_fnGetTypeInfo,
IMediaEventEx_fnGetIDsOfNames,
IMediaEventEx_fnInvoke,
/* IMediaEvent fields */
IMediaEventEx_fnGetEventHandle,
IMediaEventEx_fnGetEvent,
IMediaEventEx_fnWaitForCompletion,
IMediaEventEx_fnCancelDefaultHandling,
IMediaEventEx_fnRestoreDefaultHandling,
IMediaEventEx_fnFreeEventParams,
/* IMediaEventEx fields */
IMediaEventEx_fnSetNotifyWindow,
IMediaEventEx_fnSetNotifyFlags,
IMediaEventEx_fnGetNotifyFlags,
};
HRESULT CFilterGraph_InitIMediaEventEx( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
ICOM_VTBL(&pfg->mediaevent) = &imediaevent;
pfg->m_hMediaEvent = CreateEventA( NULL, TRUE, FALSE, NULL );
if ( pfg->m_hMediaEvent == (HANDLE)NULL )
return E_OUTOFMEMORY;
InitializeCriticalSection( &pfg->m_csMediaEvents );
pfg->m_pMediaEvents = NULL;
pfg->m_cbMediaEventsPut = 0;
pfg->m_cbMediaEventsGet = 0;
pfg->m_cbMediaEventsMax = 0;
pfg->m_hwndEventNotify = (HWND)NULL;
pfg->m_lEventNotifyMsg = 0;
pfg->m_lEventNotifyParam = 0;
pfg->m_lEventNotifyFlags = 0;
return NOERROR;
}
void CFilterGraph_UninitIMediaEventEx( CFilterGraph* pfg )
{
HRESULT hr;
long lEventCode;
LONG_PTR lParam1;
LONG_PTR lParam2;
TRACE("(%p)\n",pfg);
while ( 1 )
{
hr = IMediaEventEx_GetEvent(
CFilterGraph_IMediaEventEx(pfg),
&lEventCode,&lParam1,&lParam2,0);
if ( hr != NOERROR )
break;
IMediaEventEx_FreeEventParams(
CFilterGraph_IMediaEventEx(pfg),
lEventCode,lParam1,lParam2);
}
if ( pfg->m_pMediaEvents != NULL )
{
QUARTZ_FreeMem( pfg->m_pMediaEvents );
pfg->m_pMediaEvents = NULL;
}
DeleteCriticalSection( &pfg->m_csMediaEvents );
CloseHandle( pfg->m_hMediaEvent );
}
/***************************************************************************
*
* CLSID_FilterGraph::IMediaEventSink
*
*/
static HRESULT WINAPI
IMediaEventSink_fnQueryInterface(IMediaEventSink* iface,REFIID riid,void** ppobj)
{
CFilterGraph_THIS(iface,mediaeventsink);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IMediaEventSink_fnAddRef(IMediaEventSink* iface)
{
CFilterGraph_THIS(iface,mediaeventsink);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IMediaEventSink_fnRelease(IMediaEventSink* iface)
{
CFilterGraph_THIS(iface,mediaeventsink);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IMediaEventSink_fnNotify(IMediaEventSink* iface,long lEventCode,LONG_PTR lParam1,LONG_PTR lParam2)
{
CFilterGraph_THIS(iface,mediaeventsink);
HRESULT hr = NOERROR;
ULONG cQueued;
ULONG cTemp;
FilterGraph_MEDIAEVENT* pEvent;
TRACE("(%p)->(%08lx,%08x,%08x) stub!\n",This,lEventCode,lParam1,lParam2);
EnterCriticalSection( &This->m_csMediaEvents );
/* allocate a new entry. */
if ( This->m_cbMediaEventsMax == 0 )
cQueued = 0;
else
cQueued =
(This->m_cbMediaEventsMax +
This->m_cbMediaEventsPut - This->m_cbMediaEventsGet) %
This->m_cbMediaEventsMax;
if ( (cQueued + 1) >= This->m_cbMediaEventsMax )
{
if ( This->m_cbMediaEventsMax >= EVENTQUEUE_MAX )
{
hr = E_FAIL;
goto end;
}
pEvent = (FilterGraph_MEDIAEVENT*)
QUARTZ_AllocMem( sizeof(FilterGraph_MEDIAEVENT) *
(This->m_cbMediaEventsMax+EVENTQUEUE_BLOCKSIZE) );
if ( pEvent == NULL )
{
hr = E_OUTOFMEMORY;
goto end;
}
if ( cQueued > 0 )
{
if ( (This->m_cbMediaEventsGet + cQueued) >=
This->m_cbMediaEventsMax )
{
cTemp = This->m_cbMediaEventsMax - This->m_cbMediaEventsGet;
memcpy(
pEvent,
&This->m_pMediaEvents[This->m_cbMediaEventsGet],
sizeof(FilterGraph_MEDIAEVENT) * cTemp );
memcpy(
pEvent + cTemp,
&This->m_pMediaEvents[0],
sizeof(FilterGraph_MEDIAEVENT) * (cQueued - cTemp) );
}
else
{
memcpy(
pEvent,
&This->m_pMediaEvents[This->m_cbMediaEventsGet],
sizeof(FilterGraph_MEDIAEVENT) * cQueued );
}
QUARTZ_FreeMem( This->m_pMediaEvents );
}
This->m_pMediaEvents = pEvent;
This->m_cbMediaEventsMax += EVENTQUEUE_BLOCKSIZE;
This->m_cbMediaEventsPut = cQueued;
This->m_cbMediaEventsGet = 0;
}
/* duplicate params if necessary. */
hr = FGEVENT_KeepEvent( TRUE, lEventCode, lParam1, lParam2 );
if ( FAILED(hr) )
goto end;
/* add to the queue. */
pEvent = &This->m_pMediaEvents[This->m_cbMediaEventsPut];
pEvent->lEventCode = lEventCode;
pEvent->lParam1 = lParam1;
pEvent->lParam2 = lParam2;
This->m_cbMediaEventsPut =
(This->m_cbMediaEventsPut + 1) % This->m_cbMediaEventsMax;
SetEvent( This->m_hMediaEvent );
if ( This->m_hwndEventNotify != (HWND)NULL &&
This->m_lEventNotifyFlags == 0 )
{
PostMessageA(
This->m_hwndEventNotify,
This->m_lEventNotifyMsg,
(WPARAM)0,
(LPARAM)This->m_lEventNotifyParam );
}
hr = NOERROR;
end:
LeaveCriticalSection( &This->m_csMediaEvents );
return hr;
}
static ICOM_VTABLE(IMediaEventSink) imediaeventsink =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IMediaEventSink_fnQueryInterface,
IMediaEventSink_fnAddRef,
IMediaEventSink_fnRelease,
/* IMediaEventSink fields */
IMediaEventSink_fnNotify,
};
HRESULT CFilterGraph_InitIMediaEventSink( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
ICOM_VTBL(&pfg->mediaeventsink) = &imediaeventsink;
return NOERROR;
}
void CFilterGraph_UninitIMediaEventSink( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,341 +0,0 @@
/*
* Implementation of CLSID_FilterGraph.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "strmif.h"
#include "control.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "fgraph.h"
/***************************************************************************
*
* new/delete for CFilterGraph
*
*/
/* can I use offsetof safely? - FIXME? */
static QUARTZ_IFEntry IFEntries[] =
{
{ &IID_IPersist, offsetof(CFilterGraph,persist)-offsetof(CFilterGraph,unk) },
{ &IID_IDispatch, offsetof(CFilterGraph,disp)-offsetof(CFilterGraph,unk) },
{ &IID_IFilterGraph, offsetof(CFilterGraph,fgraph)-offsetof(CFilterGraph,unk) },
{ &IID_IGraphBuilder, offsetof(CFilterGraph,fgraph)-offsetof(CFilterGraph,unk) },
{ &IID_IFilterGraph2, offsetof(CFilterGraph,fgraph)-offsetof(CFilterGraph,unk) },
{ &IID_IGraphVersion, offsetof(CFilterGraph,graphversion)-offsetof(CFilterGraph,unk) },
{ &IID_IMediaControl, offsetof(CFilterGraph,mediacontrol)-offsetof(CFilterGraph,unk) },
{ &IID_IMediaFilter, offsetof(CFilterGraph,mediafilter)-offsetof(CFilterGraph,unk) },
{ &IID_IMediaEvent, offsetof(CFilterGraph,mediaevent)-offsetof(CFilterGraph,unk) },
{ &IID_IMediaEventEx, offsetof(CFilterGraph,mediaevent)-offsetof(CFilterGraph,unk) },
{ &IID_IMediaEventSink, offsetof(CFilterGraph,mediaeventsink)-offsetof(CFilterGraph,unk) },
{ &IID_IMediaPosition, offsetof(CFilterGraph,mediaposition)-offsetof(CFilterGraph,unk) },
{ &IID_IMediaSeeking, offsetof(CFilterGraph,mediaseeking)-offsetof(CFilterGraph,unk) },
{ &IID_IBasicVideo, offsetof(CFilterGraph,basvid)-offsetof(CFilterGraph,unk) },
{ &IID_IBasicAudio, offsetof(CFilterGraph,basaud)-offsetof(CFilterGraph,unk) },
{ &IID_IVideoWindow, offsetof(CFilterGraph,vidwin)-offsetof(CFilterGraph,unk) },
};
struct FGInitEntry
{
HRESULT (*pInit)(CFilterGraph*);
void (*pUninit)(CFilterGraph*);
};
static const struct FGInitEntry FGRAPH_Init[] =
{
#define FGENT(a) {&CFilterGraph_Init##a,&CFilterGraph_Uninit##a},
FGENT(IPersist)
FGENT(IDispatch)
FGENT(IFilterGraph2)
FGENT(IGraphVersion)
FGENT(IMediaControl)
FGENT(IMediaFilter)
FGENT(IMediaEventEx)
FGENT(IMediaEventSink)
FGENT(IMediaPosition)
FGENT(IMediaSeeking)
FGENT(IBasicVideo)
FGENT(IBasicAudio)
FGENT(IVideoWindow)
#undef FGENT
{ NULL, NULL },
};
static void QUARTZ_DestroyFilterGraph(IUnknown* punk)
{
CFilterGraph_THIS(punk,unk);
int i;
TRACE( "(%p)\n", punk );
/* At first, call Stop. */
IMediaControl_Stop( CFilterGraph_IMediaControl(This) );
IMediaFilter_Stop( CFilterGraph_IMediaFilter(This) );
i = 0;
while ( FGRAPH_Init[i].pInit != NULL )
{
FGRAPH_Init[i].pUninit( This );
i++;
}
TRACE( "succeeded.\n" );
}
HRESULT QUARTZ_CreateFilterGraph(IUnknown* punkOuter,void** ppobj)
{
CFilterGraph* pfg;
HRESULT hr;
int i;
TRACE("(%p,%p)\n",punkOuter,ppobj);
pfg = (CFilterGraph*)QUARTZ_AllocObj( sizeof(CFilterGraph) );
if ( pfg == NULL )
return E_OUTOFMEMORY;
QUARTZ_IUnkInit( &pfg->unk, punkOuter );
i = 0;
hr = NOERROR;
while ( FGRAPH_Init[i].pInit != NULL )
{
hr = FGRAPH_Init[i].pInit( pfg );
if ( FAILED(hr) )
break;
i++;
}
if ( FAILED(hr) )
{
while ( --i >= 0 )
FGRAPH_Init[i].pUninit( pfg );
QUARTZ_FreeObj( pfg );
return hr;
}
pfg->unk.pEntries = IFEntries;
pfg->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
pfg->unk.pOnFinalRelease = QUARTZ_DestroyFilterGraph;
*ppobj = (void*)(&pfg->unk);
return S_OK;
}
/***************************************************************************
*
* CFilterGraph::IPersist
*
*/
static HRESULT WINAPI
IPersist_fnQueryInterface(IPersist* iface,REFIID riid,void** ppobj)
{
CFilterGraph_THIS(iface,persist);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IPersist_fnAddRef(IPersist* iface)
{
CFilterGraph_THIS(iface,persist);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IPersist_fnRelease(IPersist* iface)
{
CFilterGraph_THIS(iface,persist);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IPersist_fnGetClassID(IPersist* iface,CLSID* pclsid)
{
CFilterGraph_THIS(iface,persist);
TRACE("(%p)->()\n",This);
if ( pclsid == NULL )
return E_POINTER;
memcpy( pclsid, &CLSID_FilterGraph, sizeof(CLSID) );
return E_NOTIMPL;
}
static ICOM_VTABLE(IPersist) ipersist =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IPersist_fnQueryInterface,
IPersist_fnAddRef,
IPersist_fnRelease,
/* IPersist fields */
IPersist_fnGetClassID,
};
HRESULT CFilterGraph_InitIPersist( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
ICOM_VTBL(&pfg->persist) = &ipersist;
return NOERROR;
}
void CFilterGraph_UninitIPersist( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
}
/***************************************************************************
*
* CFilterGraph::IDispatch
*
*/
static HRESULT WINAPI
IDispatch_fnQueryInterface(IDispatch* iface,REFIID riid,void** ppobj)
{
CFilterGraph_THIS(iface,disp);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IDispatch_fnAddRef(IDispatch* iface)
{
CFilterGraph_THIS(iface,disp);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IDispatch_fnRelease(IDispatch* iface)
{
CFilterGraph_THIS(iface,disp);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IDispatch_fnGetTypeInfoCount(IDispatch* iface,UINT* pcTypeInfo)
{
CFilterGraph_THIS(iface,disp);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IDispatch_fnGetTypeInfo(IDispatch* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
{
CFilterGraph_THIS(iface,disp);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IDispatch_fnGetIDsOfNames(IDispatch* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
{
CFilterGraph_THIS(iface,disp);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IDispatch_fnInvoke(IDispatch* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
CFilterGraph_THIS(iface,disp);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static ICOM_VTABLE(IDispatch) idispatch =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IDispatch_fnQueryInterface,
IDispatch_fnAddRef,
IDispatch_fnRelease,
/* IDispatch fields */
IDispatch_fnGetTypeInfoCount,
IDispatch_fnGetTypeInfo,
IDispatch_fnGetIDsOfNames,
IDispatch_fnInvoke,
};
HRESULT CFilterGraph_InitIDispatch( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
ICOM_VTBL(&pfg->disp) = &idispatch;
return NOERROR;
}
void CFilterGraph_UninitIDispatch( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
}

View File

@ -1,217 +0,0 @@
/*
* Copyright (C) Hidenori TAKESHIMA
*
* 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 WINE_DSHOW_FGRAPH_H
#define WINE_DSHOW_FGRAPH_H
/*
implements CLSID_FilterGraph.
- At least, the following interfaces should be implemented:
IUnknown
+ IPersist
+ IDispatch
+ IFilterGraph - IGraphBuilder - IFilterGraph2
+ IGraphVersion
+ IGraphConfig
+ IDispatch - IMediaControl
+ IPersist - IMediaFilter
+ IDispatch - IMediaEvent - IMediaEventEx
+ IMediaEventSink
+ IDispatch - IMediaPosition
+ IMediaSeeking
+ IDispatch - IBasicVideo (pass to a renderer)
+ IDispatch - IBasicAudio (pass to a renderer)
+ IDispatch - IVideoWindow (pass to a renderer)
(following interfaces are not implemented)
+ IMarshal
+ IFilterMapper2
FIXME - Are there any missing interfaces???
*/
#include "iunk.h"
#include "complist.h"
typedef struct FG_IPersistImpl
{
ICOM_VFIELD(IPersist);
} FG_IPersistImpl;
typedef struct FG_IDispatchImpl
{
ICOM_VFIELD(IDispatch);
} FG_IDispatchImpl;
typedef struct FG_IFilterGraph2Impl
{
ICOM_VFIELD(IFilterGraph2);
} FG_IFilterGraph2Impl;
typedef struct FG_IGraphVersionImpl
{
ICOM_VFIELD(IGraphVersion);
} FG_IGraphVersionImpl;
typedef struct FG_IMediaControlImpl
{
ICOM_VFIELD(IMediaControl);
} FG_IMediaControlImpl;
typedef struct FG_IMediaFilterImpl
{
ICOM_VFIELD(IMediaFilter);
} FG_IMediaFilterImpl;
typedef struct FG_IMediaEventImpl
{
ICOM_VFIELD(IMediaEventEx);
} FG_IMediaEventImpl;
typedef struct FG_IMediaEventSinkImpl
{
ICOM_VFIELD(IMediaEventSink);
} FG_IMediaEventSinkImpl;
typedef struct FG_IMediaPositionImpl
{
ICOM_VFIELD(IMediaPosition);
} FG_IMediaPositionImpl;
typedef struct FG_IMediaSeekingImpl
{
ICOM_VFIELD(IMediaSeeking);
} FG_IMediaSeekingImpl;
typedef struct FG_IBasicVideoImpl
{
ICOM_VFIELD(IBasicVideo);
} FG_IBasicVideoImpl;
typedef struct FG_IBasicAudioImpl
{
ICOM_VFIELD(IBasicAudio);
} FG_IBasicAudioImpl;
typedef struct FG_IVideoWindowImpl
{
ICOM_VFIELD(IVideoWindow);
} FG_IVideoWindowImpl;
typedef struct FG_FilterData
{
IBaseFilter* pFilter;
IMediaPosition* pPosition;
IMediaSeeking* pSeeking;
WCHAR* pwszName;
DWORD cbName;
} FG_FilterData;
typedef struct FilterGraph_MEDIAEVENT FilterGraph_MEDIAEVENT;
typedef struct CFilterGraph
{
QUARTZ_IUnkImpl unk;
FG_IPersistImpl persist;
FG_IDispatchImpl disp;
FG_IFilterGraph2Impl fgraph;
FG_IGraphVersionImpl graphversion;
FG_IMediaControlImpl mediacontrol;
FG_IMediaFilterImpl mediafilter;
FG_IMediaEventImpl mediaevent;
FG_IMediaEventSinkImpl mediaeventsink;
FG_IMediaPositionImpl mediaposition;
FG_IMediaSeekingImpl mediaseeking;
FG_IBasicVideoImpl basvid;
FG_IBasicAudioImpl basaud;
FG_IVideoWindowImpl vidwin;
/* IDispatch fields. */
/* IFilterGraph2 fields. */
CRITICAL_SECTION m_csFilters;
DWORD m_cActiveFilters;
FG_FilterData* m_pActiveFilters;
/* IGraphVersion fields. */
LONG m_lGraphVersion;
/* IMediaControl fields. */
/* IMediaFilter fields. */
CRITICAL_SECTION m_csGraphState;
FILTER_STATE m_stateGraph; /* must NOT accessed directly! */
CRITICAL_SECTION m_csClock;
IReferenceClock* m_pClock;
/* IMediaEvent fields. */
HANDLE m_hMediaEvent;
CRITICAL_SECTION m_csMediaEvents;
FilterGraph_MEDIAEVENT* m_pMediaEvents;
ULONG m_cbMediaEventsPut;
ULONG m_cbMediaEventsGet;
ULONG m_cbMediaEventsMax;
HWND m_hwndEventNotify;
long m_lEventNotifyMsg;
LONG_PTR m_lEventNotifyParam;
long m_lEventNotifyFlags;
/* IMediaEventSink fields. */
/* IMediaPosition fields. */
/* IMediaSeeking fields. */
/* IBasicVideo fields. */
/* IBasicAudio fields. */
/* IVideoWindow fields. */
} CFilterGraph;
#define CFilterGraph_THIS(iface,member) CFilterGraph* This = ((CFilterGraph*)(((char*)iface)-offsetof(CFilterGraph,member)))
#define CFilterGraph_IPersist(th) ((IPersist*)&((th)->persist))
#define CFilterGraph_IDispatch(th) ((IDispatch*)&((th)->disp))
#define CFilterGraph_IFilterGraph2(th) ((IFilterGraph2*)&((th)->fgraph))
#define CFilterGraph_IMediaControl(th) ((IMediaControl*)&((th)->mediacontrol))
#define CFilterGraph_IMediaFilter(th) ((IMediaFilter*)&((th)->mediafilter))
#define CFilterGraph_IMediaEventEx(th) ((IMediaEventEx*)&((th)->mediaevent))
#define CFilterGraph_IMediaEventSink(th) ((IMediaEventSink*)&((th)->mediaeventsink))
HRESULT QUARTZ_CreateFilterGraph(IUnknown* punkOuter,void** ppobj);
HRESULT CFilterGraph_InitIPersist( CFilterGraph* pfg );
void CFilterGraph_UninitIPersist( CFilterGraph* pfg );
HRESULT CFilterGraph_InitIDispatch( CFilterGraph* pfg );
void CFilterGraph_UninitIDispatch( CFilterGraph* pfg );
HRESULT CFilterGraph_InitIFilterGraph2( CFilterGraph* pfg );
void CFilterGraph_UninitIFilterGraph2( CFilterGraph* pfg );
HRESULT CFilterGraph_InitIGraphVersion( CFilterGraph* pfg );
void CFilterGraph_UninitIGraphVersion( CFilterGraph* pfg );
HRESULT CFilterGraph_InitIMediaControl( CFilterGraph* pfg );
void CFilterGraph_UninitIMediaControl( CFilterGraph* pfg );
HRESULT CFilterGraph_InitIMediaFilter( CFilterGraph* pfg );
void CFilterGraph_UninitIMediaFilter( CFilterGraph* pfg );
HRESULT CFilterGraph_InitIMediaEventEx( CFilterGraph* pfg );
void CFilterGraph_UninitIMediaEventEx( CFilterGraph* pfg );
HRESULT CFilterGraph_InitIMediaEventSink( CFilterGraph* pfg );
void CFilterGraph_UninitIMediaEventSink( CFilterGraph* pfg );
HRESULT CFilterGraph_InitIMediaPosition( CFilterGraph* pfg );
void CFilterGraph_UninitIMediaPosition( CFilterGraph* pfg );
HRESULT CFilterGraph_InitIMediaSeeking( CFilterGraph* pfg );
void CFilterGraph_UninitIMediaSeeking( CFilterGraph* pfg );
HRESULT CFilterGraph_InitIBasicVideo( CFilterGraph* pfg );
void CFilterGraph_UninitIBasicVideo( CFilterGraph* pfg );
HRESULT CFilterGraph_InitIBasicAudio( CFilterGraph* pfg );
void CFilterGraph_UninitIBasicAudio( CFilterGraph* pfg );
HRESULT CFilterGraph_InitIVideoWindow( CFilterGraph* pfg );
void CFilterGraph_UninitIVideoWindow( CFilterGraph* pfg );
#endif /* WINE_DSHOW_FGRAPH_H */

View File

@ -1,914 +0,0 @@
/*
* Implements CLSID_FileWriter.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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
*
* FIXME - not tested
*/
#include "config.h"
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "mmsystem.h"
#include "strmif.h"
#include "control.h"
#include "vfwmsgs.h"
#include "uuids.h"
#include "evcode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "filesink.h"
#include "seekpass.h"
static const WCHAR QUARTZ_FileWriter_Name[] =
{ 'F','i','l','e',' ','W','r','i','t','e','r',0 };
static const WCHAR QUARTZ_FileWriterPin_Name[] =
{ 'I','n',0 };
/* FIXME - add this flag to strmif.h */
#define AM_FILE_OVERWRITE 0x1
/***************************************************************************
*
* CFileWriterImpl methods
*
*/
static HRESULT CFileWriterImpl_OnActive( CBaseFilterImpl* pImpl )
{
CFileWriterImpl_THIS(pImpl,basefilter);
FIXME( "(%p)\n", This );
return NOERROR;
}
static HRESULT CFileWriterImpl_OnInactive( CBaseFilterImpl* pImpl )
{
CFileWriterImpl_THIS(pImpl,basefilter);
FIXME( "(%p)\n", This );
return NOERROR;
}
static const CBaseFilterHandlers filterhandlers =
{
CFileWriterImpl_OnActive, /* pOnActive */
CFileWriterImpl_OnInactive, /* pOnInactive */
NULL, /* pOnStop */
};
/***************************************************************************
*
* CFileWriterPinImpl methods
*
*/
static HRESULT CFileWriterPinImpl_OnPreConnect( CPinBaseImpl* pImpl, IPin* pPin )
{
CFileWriterPinImpl_THIS(pImpl,pin);
TRACE("(%p,%p)\n",This,pPin);
return NOERROR;
}
static HRESULT CFileWriterPinImpl_OnPostConnect( CPinBaseImpl* pImpl, IPin* pPin )
{
CFileWriterPinImpl_THIS(pImpl,pin);
TRACE("(%p,%p)\n",This,pPin);
return NOERROR;
}
static HRESULT CFileWriterPinImpl_OnDisconnect( CPinBaseImpl* pImpl )
{
CFileWriterPinImpl_THIS(pImpl,pin);
TRACE("(%p)\n",This);
if ( This->meminput.pAllocator != NULL )
{
IMemAllocator_Decommit(This->meminput.pAllocator);
IMemAllocator_Release(This->meminput.pAllocator);
This->meminput.pAllocator = NULL;
}
return NOERROR;
}
static HRESULT CFileWriterPinImpl_CheckMediaType( CPinBaseImpl* pImpl, const AM_MEDIA_TYPE* pmt )
{
CFileWriterPinImpl_THIS(pImpl,pin);
TRACE("(%p,%p)\n",This,pmt);
if ( !IsEqualGUID( &pmt->majortype, &MEDIATYPE_Stream ) )
return E_FAIL;
return NOERROR;
}
static HRESULT CFileWriterPinImpl_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample )
{
CFileWriterPinImpl_THIS(pImpl,pin);
BYTE* pData = NULL;
LONG lLength;
ULONG cbWritten;
HRESULT hr;
REFERENCE_TIME rtStart;
REFERENCE_TIME rtEnd;
LARGE_INTEGER dlibMove;
TRACE( "(%p,%p)\n",This,pSample );
if ( This->pRender->m_fInFlush )
return S_FALSE;
if ( pSample == NULL )
return E_POINTER;
hr = IMediaSample_GetPointer(pSample,&pData);
if ( FAILED(hr) )
return hr;
lLength = (LONG)IMediaSample_GetActualDataLength(pSample);
if ( lLength == 0 )
return S_OK;
if ( lLength < 0 )
{
ERR( "invalid length: %ld\n", lLength );
return S_OK;
}
hr = IMediaSample_GetTime( pSample, &rtStart, &rtEnd );
if ( FAILED(hr) )
return hr;
dlibMove.QuadPart = rtStart;
hr = IStream_Seek(CFileWriterPinImpl_IStream(This),dlibMove,STREAM_SEEK_SET,NULL);
if ( FAILED(hr) )
return hr;
hr = IStream_Write(CFileWriterPinImpl_IStream(This),pData,lLength,&cbWritten);
return hr;
}
static HRESULT CFileWriterPinImpl_ReceiveCanBlock( CPinBaseImpl* pImpl )
{
CFileWriterPinImpl_THIS(pImpl,pin);
TRACE( "(%p)\n", This );
return S_FALSE;
}
static HRESULT CFileWriterPinImpl_EndOfStream( CPinBaseImpl* pImpl )
{
CFileWriterPinImpl_THIS(pImpl,pin);
FIXME( "(%p)\n", This );
This->pRender->m_fInFlush = FALSE;
/* FIXME - don't notify twice until stopped or seeked. */
return CBaseFilterImpl_MediaEventNotify(
&This->pRender->basefilter, EC_COMPLETE,
(LONG_PTR)S_OK, (LONG_PTR)(IBaseFilter*)(This->pRender) );
}
static HRESULT CFileWriterPinImpl_BeginFlush( CPinBaseImpl* pImpl )
{
CFileWriterPinImpl_THIS(pImpl,pin);
FIXME( "(%p)\n", This );
This->pRender->m_fInFlush = TRUE;
return NOERROR;
}
static HRESULT CFileWriterPinImpl_EndFlush( CPinBaseImpl* pImpl )
{
CFileWriterPinImpl_THIS(pImpl,pin);
FIXME( "(%p)\n", This );
This->pRender->m_fInFlush = FALSE;
return NOERROR;
}
static HRESULT CFileWriterPinImpl_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate )
{
CFileWriterPinImpl_THIS(pImpl,pin);
FIXME( "(%p)\n", This );
This->pRender->m_fInFlush = FALSE;
return NOERROR;
}
static const CBasePinHandlers pinhandlers =
{
CFileWriterPinImpl_OnPreConnect, /* pOnPreConnect */
CFileWriterPinImpl_OnPostConnect, /* pOnPostConnect */
CFileWriterPinImpl_OnDisconnect, /* pOnDisconnect */
CFileWriterPinImpl_CheckMediaType, /* pCheckMediaType */
NULL, /* pQualityNotify */
CFileWriterPinImpl_Receive, /* pReceive */
CFileWriterPinImpl_ReceiveCanBlock, /* pReceiveCanBlock */
CFileWriterPinImpl_EndOfStream, /* pEndOfStream */
CFileWriterPinImpl_BeginFlush, /* pBeginFlush */
CFileWriterPinImpl_EndFlush, /* pEndFlush */
CFileWriterPinImpl_NewSegment, /* pNewSegment */
};
/***************************************************************************
*
* new/delete CFileWriterImpl
*
*/
/* can I use offsetof safely? - FIXME? */
static QUARTZ_IFEntry FilterIFEntries[] =
{
{ &IID_IPersist, offsetof(CFileWriterImpl,basefilter)-offsetof(CFileWriterImpl,unk) },
{ &IID_IMediaFilter, offsetof(CFileWriterImpl,basefilter)-offsetof(CFileWriterImpl,unk) },
{ &IID_IBaseFilter, offsetof(CFileWriterImpl,basefilter)-offsetof(CFileWriterImpl,unk) },
{ &IID_IFileSinkFilter, offsetof(CFileWriterImpl,filesink)-offsetof(CFileWriterImpl,unk) },
{ &IID_IFileSinkFilter2, offsetof(CFileWriterImpl,filesink)-offsetof(CFileWriterImpl,unk) },
};
static HRESULT CFileWriterImpl_OnQueryInterface(
IUnknown* punk, const IID* piid, void** ppobj )
{
CFileWriterImpl_THIS(punk,unk);
if ( This->pSeekPass == NULL )
return E_NOINTERFACE;
if ( IsEqualGUID( &IID_IMediaPosition, piid ) ||
IsEqualGUID( &IID_IMediaSeeking, piid ) )
{
TRACE( "IMediaSeeking(or IMediaPosition) is queried\n" );
return IUnknown_QueryInterface( (IUnknown*)(&This->pSeekPass->unk), piid, ppobj );
}
return E_NOINTERFACE;
}
static void QUARTZ_DestroyFileWriter(IUnknown* punk)
{
CFileWriterImpl_THIS(punk,unk);
TRACE( "(%p)\n", This );
CFileWriterImpl_OnInactive(&This->basefilter);
if ( This->pPin != NULL )
{
IUnknown_Release(This->pPin->unk.punkControl);
This->pPin = NULL;
}
if ( This->pSeekPass != NULL )
{
IUnknown_Release((IUnknown*)&This->pSeekPass->unk);
This->pSeekPass = NULL;
}
if ( This->m_hFile != INVALID_HANDLE_VALUE )
{
CloseHandle( This->m_hFile );
This->m_hFile = INVALID_HANDLE_VALUE;
}
if ( This->m_pszFileName != NULL )
{
QUARTZ_FreeMem( This->m_pszFileName );
This->m_pszFileName = NULL;
}
QUARTZ_MediaType_Free( &This->m_mt );
CFileWriterImpl_UninitIFileSinkFilter2(This);
CBaseFilterImpl_UninitIBaseFilter(&This->basefilter);
DeleteCriticalSection( &This->m_csReceive );
}
HRESULT QUARTZ_CreateFileWriter(IUnknown* punkOuter,void** ppobj)
{
CFileWriterImpl* This = NULL;
HRESULT hr;
TRACE("(%p,%p)\n",punkOuter,ppobj);
This = (CFileWriterImpl*)
QUARTZ_AllocObj( sizeof(CFileWriterImpl) );
if ( This == NULL )
return E_OUTOFMEMORY;
This->pSeekPass = NULL;
This->pPin = NULL;
This->m_fInFlush = FALSE;
This->m_hFile = INVALID_HANDLE_VALUE;
This->m_pszFileName = NULL;
This->m_cbFileName = 0;
This->m_dwMode = 0;
ZeroMemory( &This->m_mt, sizeof(AM_MEDIA_TYPE) );
QUARTZ_IUnkInit( &This->unk, punkOuter );
This->qiext.pNext = NULL;
This->qiext.pOnQueryInterface = &CFileWriterImpl_OnQueryInterface;
QUARTZ_IUnkAddDelegation( &This->unk, &This->qiext );
hr = CBaseFilterImpl_InitIBaseFilter(
&This->basefilter,
This->unk.punkControl,
&CLSID_FileWriter,
QUARTZ_FileWriter_Name,
&filterhandlers );
if ( SUCCEEDED(hr) )
{
hr = CFileWriterImpl_InitIFileSinkFilter2(This);
if ( FAILED(hr) )
{
CBaseFilterImpl_UninitIBaseFilter(&This->basefilter);
}
}
if ( FAILED(hr) )
{
QUARTZ_FreeObj(This);
return hr;
}
This->unk.pEntries = FilterIFEntries;
This->unk.dwEntries = sizeof(FilterIFEntries)/sizeof(FilterIFEntries[0]);
This->unk.pOnFinalRelease = QUARTZ_DestroyFileWriter;
InitializeCriticalSection( &This->m_csReceive );
hr = QUARTZ_CreateFileWriterPin(
This,
&This->basefilter.csFilter,
&This->m_csReceive,
&This->pPin );
if ( SUCCEEDED(hr) )
hr = QUARTZ_CompList_AddComp(
This->basefilter.pInPins,
(IUnknown*)&This->pPin->pin,
NULL, 0 );
if ( SUCCEEDED(hr) )
hr = QUARTZ_CreateSeekingPassThruInternal(
(IUnknown*)&(This->unk), &This->pSeekPass,
TRUE, (IPin*)&(This->pPin->pin) );
if ( FAILED(hr) )
{
IUnknown_Release( This->unk.punkControl );
return hr;
}
*ppobj = (void*)&(This->unk);
return S_OK;
}
/***************************************************************************
*
* new/delete CFileWriterPinImpl
*
*/
/* can I use offsetof safely? - FIXME? */
static QUARTZ_IFEntry PinIFEntries[] =
{
{ &IID_IPin, offsetof(CFileWriterPinImpl,pin)-offsetof(CFileWriterPinImpl,unk) },
{ &IID_IMemInputPin, offsetof(CFileWriterPinImpl,meminput)-offsetof(CFileWriterPinImpl,unk) },
{ &IID_IStream, offsetof(CFileWriterPinImpl,stream)-offsetof(CFileWriterPinImpl,unk) },
};
static void QUARTZ_DestroyFileWriterPin(IUnknown* punk)
{
CFileWriterPinImpl_THIS(punk,unk);
TRACE( "(%p)\n", This );
CPinBaseImpl_UninitIPin( &This->pin );
CMemInputPinBaseImpl_UninitIMemInputPin( &This->meminput );
CFileWriterPinImpl_UninitIStream(This);
}
HRESULT QUARTZ_CreateFileWriterPin(
CFileWriterImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CRITICAL_SECTION* pcsPinReceive,
CFileWriterPinImpl** ppPin)
{
CFileWriterPinImpl* This = NULL;
HRESULT hr;
TRACE("(%p,%p,%p,%p)\n",pFilter,pcsPin,pcsPinReceive,ppPin);
This = (CFileWriterPinImpl*)
QUARTZ_AllocObj( sizeof(CFileWriterPinImpl) );
if ( This == NULL )
return E_OUTOFMEMORY;
QUARTZ_IUnkInit( &This->unk, NULL );
This->pRender = pFilter;
hr = CPinBaseImpl_InitIPin(
&This->pin,
This->unk.punkControl,
pcsPin, pcsPinReceive,
&pFilter->basefilter,
QUARTZ_FileWriterPin_Name,
FALSE,
&pinhandlers );
if ( SUCCEEDED(hr) )
{
hr = CMemInputPinBaseImpl_InitIMemInputPin(
&This->meminput,
This->unk.punkControl,
&This->pin );
if ( SUCCEEDED(hr) )
{
hr = CFileWriterPinImpl_InitIStream(This);
if ( FAILED(hr) )
{
CMemInputPinBaseImpl_UninitIMemInputPin(&This->meminput);
}
}
if ( FAILED(hr) )
{
CPinBaseImpl_UninitIPin( &This->pin );
}
}
if ( FAILED(hr) )
{
QUARTZ_FreeObj(This);
return hr;
}
This->unk.pEntries = PinIFEntries;
This->unk.dwEntries = sizeof(PinIFEntries)/sizeof(PinIFEntries[0]);
This->unk.pOnFinalRelease = QUARTZ_DestroyFileWriterPin;
*ppPin = This;
TRACE("returned successfully.\n");
return S_OK;
}
/***************************************************************************
*
* CFileWriterPinImpl::IStream
*
*/
static HRESULT WINAPI
IStream_fnQueryInterface(IStream* iface,REFIID riid,void** ppobj)
{
CFileWriterPinImpl_THIS(iface,stream);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IStream_fnAddRef(IStream* iface)
{
CFileWriterPinImpl_THIS(iface,stream);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IStream_fnRelease(IStream* iface)
{
CFileWriterPinImpl_THIS(iface,stream);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IStream_fnRead(IStream* iface,void* pv,ULONG cb,ULONG* pcbRead)
{
CFileWriterPinImpl_THIS(iface,stream);
FIXME("(%p)->()\n",This);
return E_FAIL;
}
static HRESULT WINAPI
IStream_fnWrite(IStream* iface,const void* pv,ULONG cb,ULONG* pcbWritten)
{
CFileWriterPinImpl_THIS(iface,stream);
HRESULT hr;
FIXME("(%p)->(%p,%lu,%p)\n",This,pv,cb,pcbWritten);
EnterCriticalSection( &This->pRender->m_csReceive );
if ( This->pRender->m_hFile == INVALID_HANDLE_VALUE )
{
hr = E_UNEXPECTED;
goto err;
}
if ( ! WriteFile( This->pRender->m_hFile, pv, cb, pcbWritten, NULL ) )
{
hr = E_FAIL;
goto err;
}
hr = S_OK;
err:
LeaveCriticalSection( &This->pRender->m_csReceive );
return hr;
}
static HRESULT WINAPI
IStream_fnSeek(IStream* iface,LARGE_INTEGER dlibMove,DWORD dwOrigin,ULARGE_INTEGER* plibNewPosition)
{
CFileWriterPinImpl_THIS(iface,stream);
HRESULT hr;
DWORD dwDistLow;
LONG lDistHigh;
FIXME("(%p)->() stub!\n",This);
EnterCriticalSection( &This->pRender->m_csReceive );
if ( This->pRender->m_hFile == INVALID_HANDLE_VALUE )
{
hr = E_UNEXPECTED;
goto err;
}
dwDistLow = dlibMove.s.LowPart;
lDistHigh = dlibMove.s.HighPart;
SetLastError(0);
dwDistLow = SetFilePointer( This->pRender->m_hFile, (LONG)dwDistLow, &lDistHigh, dwOrigin );
if ( dwDistLow == 0xffffffff && GetLastError() != 0 )
{
hr = E_FAIL;
goto err;
}
if ( plibNewPosition != NULL )
{
plibNewPosition->s.LowPart = dwDistLow;
plibNewPosition->s.HighPart = lDistHigh;
}
hr = S_OK;
err:
LeaveCriticalSection( &This->pRender->m_csReceive );
return hr;
}
static HRESULT WINAPI
IStream_fnSetSize(IStream* iface,ULARGE_INTEGER libNewSize)
{
CFileWriterPinImpl_THIS(iface,stream);
FIXME("(%p)->() stub!\n",This);
if ( This->pRender->m_hFile == INVALID_HANDLE_VALUE )
return E_UNEXPECTED;
return E_NOTIMPL;
}
static HRESULT WINAPI
IStream_fnCopyTo(IStream* iface,IStream* pstrm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten)
{
CFileWriterPinImpl_THIS(iface,stream);
FIXME("(%p)->()\n",This);
return E_FAIL;
}
static HRESULT WINAPI
IStream_fnCommit(IStream* iface,DWORD grfCommitFlags)
{
CFileWriterPinImpl_THIS(iface,stream);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IStream_fnRevert(IStream* iface)
{
CFileWriterPinImpl_THIS(iface,stream);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IStream_fnLockRegion(IStream* iface,ULARGE_INTEGER libOffset,ULARGE_INTEGER cb,DWORD dwLockType)
{
CFileWriterPinImpl_THIS(iface,stream);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IStream_fnUnlockRegion(IStream* iface,ULARGE_INTEGER libOffset,ULARGE_INTEGER cb,DWORD dwLockType)
{
CFileWriterPinImpl_THIS(iface,stream);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IStream_fnStat(IStream* iface,STATSTG* pstatstg,DWORD grfStatFlag)
{
CFileWriterPinImpl_THIS(iface,stream);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IStream_fnClone(IStream* iface,IStream** ppstrm)
{
CFileWriterPinImpl_THIS(iface,stream);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static ICOM_VTABLE(IStream) istream =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IStream_fnQueryInterface,
IStream_fnAddRef,
IStream_fnRelease,
/* IStream fields */
IStream_fnRead,
IStream_fnWrite,
IStream_fnSeek,
IStream_fnSetSize,
IStream_fnCopyTo,
IStream_fnCommit,
IStream_fnRevert,
IStream_fnLockRegion,
IStream_fnUnlockRegion,
IStream_fnStat,
IStream_fnClone,
};
HRESULT CFileWriterPinImpl_InitIStream( CFileWriterPinImpl* This )
{
TRACE("(%p)\n",This);
ICOM_VTBL(&This->stream) = &istream;
return NOERROR;
}
HRESULT CFileWriterPinImpl_UninitIStream( CFileWriterPinImpl* This )
{
TRACE("(%p)\n",This);
return S_OK;
}
/***************************************************************************
*
* CFileWriterImpl::IFileSinkFilter2
*
*/
static HRESULT WINAPI
IFileSinkFilter2_fnQueryInterface(IFileSinkFilter2* iface,REFIID riid,void** ppobj)
{
CFileWriterImpl_THIS(iface,filesink);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IFileSinkFilter2_fnAddRef(IFileSinkFilter2* iface)
{
CFileWriterImpl_THIS(iface,filesink);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IFileSinkFilter2_fnRelease(IFileSinkFilter2* iface)
{
CFileWriterImpl_THIS(iface,filesink);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IFileSinkFilter2_fnSetFileName(IFileSinkFilter2* iface,LPCOLESTR pszFileName,const AM_MEDIA_TYPE* pmt)
{
CFileWriterImpl_THIS(iface,filesink);
HRESULT hr;
TRACE("(%p)->(%s,%p)\n",This,debugstr_w(pszFileName),pmt);
if ( pszFileName == NULL )
return E_POINTER;
if ( This->m_pszFileName != NULL )
return E_UNEXPECTED;
This->m_cbFileName = sizeof(WCHAR)*(lstrlenW(pszFileName)+1);
This->m_pszFileName = (WCHAR*)QUARTZ_AllocMem( This->m_cbFileName );
if ( This->m_pszFileName == NULL )
return E_OUTOFMEMORY;
memcpy( This->m_pszFileName, pszFileName, This->m_cbFileName );
if ( pmt != NULL )
{
hr = QUARTZ_MediaType_Copy( &This->m_mt, pmt );
if ( FAILED(hr) )
goto err;
}
else
{
ZeroMemory( &This->m_mt, sizeof(AM_MEDIA_TYPE) );
memcpy( &This->m_mt.majortype, &MEDIATYPE_Stream, sizeof(GUID) );
memcpy( &This->m_mt.subtype, &MEDIASUBTYPE_NULL, sizeof(GUID) );
This->m_mt.lSampleSize = 1;
memcpy( &This->m_mt.formattype, &FORMAT_None, sizeof(GUID) );
}
This->m_hFile = CreateFileW(
This->m_pszFileName,
GENERIC_WRITE,
0,
NULL,
( This->m_dwMode == AM_FILE_OVERWRITE ) ? CREATE_ALWAYS : OPEN_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
(HANDLE)NULL );
if ( This->m_hFile == INVALID_HANDLE_VALUE )
{
hr = E_FAIL;
goto err;
}
This->pPin->pin.pmtAcceptTypes = &This->m_mt;
This->pPin->pin.cAcceptTypes = 1;
return NOERROR;
err:;
return hr;
}
static HRESULT WINAPI
IFileSinkFilter2_fnGetCurFile(IFileSinkFilter2* iface,LPOLESTR* ppszFileName,AM_MEDIA_TYPE* pmt)
{
CFileWriterImpl_THIS(iface,filesink);
HRESULT hr = E_NOTIMPL;
TRACE("(%p)->(%p,%p)\n",This,ppszFileName,pmt);
if ( ppszFileName == NULL || pmt == NULL )
return E_POINTER;
if ( This->m_pszFileName == NULL )
return E_FAIL;
hr = QUARTZ_MediaType_Copy( pmt, &This->m_mt );
if ( FAILED(hr) )
return hr;
*ppszFileName = (WCHAR*)CoTaskMemAlloc( This->m_cbFileName );
if ( *ppszFileName == NULL )
{
QUARTZ_MediaType_Free(pmt);
ZeroMemory( pmt, sizeof(AM_MEDIA_TYPE) );
return E_OUTOFMEMORY;
}
memcpy( *ppszFileName, This->m_pszFileName, This->m_cbFileName );
return NOERROR;
}
static HRESULT WINAPI
IFileSinkFilter2_fnSetMode(IFileSinkFilter2* iface,DWORD dwFlags)
{
CFileWriterImpl_THIS(iface,filesink);
TRACE("(%p)->(%08lx)\n",This,dwFlags);
if ( dwFlags != 0 && dwFlags != AM_FILE_OVERWRITE )
return E_INVALIDARG;
This->m_dwMode = dwFlags;
return S_OK;
}
static HRESULT WINAPI
IFileSinkFilter2_fnGetMode(IFileSinkFilter2* iface,DWORD* pdwFlags)
{
CFileWriterImpl_THIS(iface,filesink);
TRACE("(%p)->(%p)\n",This,pdwFlags);
if ( pdwFlags == NULL )
return E_POINTER;
*pdwFlags = This->m_dwMode;
return S_OK;
}
static ICOM_VTABLE(IFileSinkFilter2) ifilesink2 =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IFileSinkFilter2_fnQueryInterface,
IFileSinkFilter2_fnAddRef,
IFileSinkFilter2_fnRelease,
/* IFileSinkFilter2 fields */
IFileSinkFilter2_fnSetFileName,
IFileSinkFilter2_fnGetCurFile,
IFileSinkFilter2_fnSetMode,
IFileSinkFilter2_fnGetMode,
};
HRESULT CFileWriterImpl_InitIFileSinkFilter2( CFileWriterImpl* This )
{
TRACE("(%p)\n",This);
ICOM_VTBL(&This->filesink) = &ifilesink2;
return NOERROR;
}
HRESULT CFileWriterImpl_UninitIFileSinkFilter2( CFileWriterImpl* This )
{
TRACE("(%p)\n",This);
return S_OK;
}

View File

@ -1,92 +0,0 @@
/*
* Implements CLSID_FileWriter.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 WINE_DSHOW_FILESINK_H
#define WINE_DSHOW_FILESINK_H
#include "iunk.h"
#include "basefilt.h"
#include "seekpass.h"
typedef struct CFileWriterImpl CFileWriterImpl;
typedef struct CFileWriterPinImpl CFileWriterPinImpl;
typedef struct FileWriterPin_IStreamImpl
{
ICOM_VFIELD(IStream);
} FileWriterPin_IStreamImpl;
typedef struct FileWriter_IFileSinkFilter2Impl
{
ICOM_VFIELD(IFileSinkFilter2);
} FileWriter_IFileSinkFilter2Impl;
struct CFileWriterImpl
{
QUARTZ_IUnkImpl unk;
CBaseFilterImpl basefilter;
FileWriter_IFileSinkFilter2Impl filesink;
QUARTZ_IFDelegation qiext;
CSeekingPassThru* pSeekPass;
CFileWriterPinImpl* pPin;
CRITICAL_SECTION m_csReceive;
BOOL m_fInFlush;
/* for writing */
HANDLE m_hFile;
WCHAR* m_pszFileName;
DWORD m_cbFileName;
DWORD m_dwMode;
AM_MEDIA_TYPE m_mt;
};
struct CFileWriterPinImpl
{
QUARTZ_IUnkImpl unk;
CPinBaseImpl pin;
CMemInputPinBaseImpl meminput;
FileWriterPin_IStreamImpl stream;
CFileWriterImpl* pRender;
};
#define CFileWriterImpl_THIS(iface,member) CFileWriterImpl* This = ((CFileWriterImpl*)(((char*)iface)-offsetof(CFileWriterImpl,member)))
#define CFileWriterPinImpl_THIS(iface,member) CFileWriterPinImpl* This = ((CFileWriterPinImpl*)(((char*)iface)-offsetof(CFileWriterPinImpl,member)))
#define CFileWriterPinImpl_IStream(th) ((IStream*)&((th)->stream))
HRESULT CFileWriterPinImpl_InitIStream( CFileWriterPinImpl* This );
HRESULT CFileWriterPinImpl_UninitIStream( CFileWriterPinImpl* This );
HRESULT CFileWriterImpl_InitIFileSinkFilter2( CFileWriterImpl* This );
HRESULT CFileWriterImpl_UninitIFileSinkFilter2( CFileWriterImpl* This );
HRESULT QUARTZ_CreateFileWriter(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateFileWriterPin(
CFileWriterImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CRITICAL_SECTION* pcsPinReceive,
CFileWriterPinImpl** ppPin);
#endif /* WINE_DSHOW_FILESINK_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,85 +0,0 @@
/*
* Copyright (C) Hidenori TAKESHIMA
*
* 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 WINE_DSHOW_FMAP_H
#define WINE_DSHOW_FMAP_H
/*
implements CLSID_FilterMapper.
- At least, the following interfaces should be implemented:
IUnknown
+ IFilterMapper
*/
#include "iunk.h"
typedef struct FM_IFilterMapperImpl
{
ICOM_VFIELD(IFilterMapper);
} FM_IFilterMapperImpl;
typedef struct CFilterMapper
{
QUARTZ_IUnkImpl unk;
FM_IFilterMapperImpl fmap;
} CFilterMapper;
#define CFilterMapper_THIS(iface,member) CFilterMapper* This = ((CFilterMapper*)(((char*)iface)-offsetof(CFilterMapper,member)))
HRESULT QUARTZ_CreateFilterMapper(IUnknown* punkOuter,void** ppobj);
HRESULT CFilterMapper_InitIFilterMapper( CFilterMapper* pfm );
void CFilterMapper_UninitIFilterMapper( CFilterMapper* pfm );
/*
implements CLSID_FilterMapper2.
- At least, the following interfaces should be implemented:
IUnknown
+ IFilterMapper2
*/
typedef struct FM2_IFilterMapper2Impl
{
ICOM_VFIELD(IFilterMapper2);
} FM2_IFilterMapper2Impl;
typedef struct CFilterMapper2
{
QUARTZ_IUnkImpl unk;
FM2_IFilterMapper2Impl fmap2;
/* IFilterMapper2 fields */
} CFilterMapper2;
#define CFilterMapper2_THIS(iface,member) CFilterMapper2* This = ((CFilterMapper2*)(((char*)iface)-offsetof(CFilterMapper2,member)))
HRESULT QUARTZ_CreateFilterMapper2(IUnknown* punkOuter,void** ppobj);
HRESULT CFilterMapper2_InitIFilterMapper2( CFilterMapper2* psde );
void CFilterMapper2_UninitIFilterMapper2( CFilterMapper2* psde );
#endif /* WINE_DSHOW_FMAP_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,182 +0,0 @@
/*
* A simple wrapper of JPEG decoder.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "ijgdec.h"
#if defined(HAVE_LIBJPEG) && defined(HAVE_JPEGLIB_H)
#include <jpeglib.h>
#include <jerror.h>
#include <setjmp.h>
typedef struct IJGSrcImpl IJGSrcImpl;
typedef struct IJGErrImpl IJGErrImpl;
struct IJGSrcImpl
{
struct jpeg_source_mgr pub; /* must be first */
const char** ppsrcs;
const int* plenofsrcs;
int srccount;
int srcindex;
};
struct IJGErrImpl
{
struct jpeg_error_mgr err;
jmp_buf env;
};
/* for the jpeg decompressor source manager. */
static void IJGDec_init_source(j_decompress_ptr cinfo) {}
static boolean IJGDec_fill_input_buffer(j_decompress_ptr cinfo)
{
IJGSrcImpl* pImpl = (IJGSrcImpl*)cinfo->src;
if ( pImpl->srcindex >= pImpl->srccount )
{
ERREXIT(cinfo, JERR_INPUT_EMPTY);
}
pImpl->pub.next_input_byte = pImpl->ppsrcs[pImpl->srcindex];
pImpl->pub.bytes_in_buffer = pImpl->plenofsrcs[pImpl->srcindex];
pImpl->srcindex ++;
return TRUE;
}
static void IJGDec_skip_input_data(j_decompress_ptr cinfo,long num_bytes)
{
IJGSrcImpl* pImpl = (IJGSrcImpl*)cinfo->src;
if ( num_bytes <= 0 ) return;
while ( num_bytes > pImpl->pub.bytes_in_buffer )
{
num_bytes -= pImpl->pub.bytes_in_buffer;
if ( !IJGDec_fill_input_buffer(cinfo) )
{
ERREXIT(cinfo, JERR_INPUT_EMPTY);
}
}
pImpl->pub.next_input_byte += num_bytes;
pImpl->pub.bytes_in_buffer -= num_bytes;
}
static void IJGDec_term_source(j_decompress_ptr cinfo)
{
}
static void IJGDec_error_exit(j_common_ptr cinfo)
{
IJGErrImpl* pImpl = (IJGErrImpl*)cinfo->err;
longjmp(pImpl->env,1);
}
static void rgb_to_bgr(char* pdata,int width)
{
int x;
char c;
for(x=0;x<width;x++)
{
c = pdata[0];
pdata[0] = pdata[2];
pdata[2] = c;
pdata += 3;
}
}
int IJGDEC_Decode( char* pdst, int dstpitch, int dstwidth, int dstheight, int dstbpp, const char** ppsrcs, const int* plenofsrcs, int srccount )
{
IJGSrcImpl jsrc;
IJGErrImpl jerr;
struct jpeg_decompress_struct jdec;
int ret = -1;
jsrc.ppsrcs = ppsrcs;
jsrc.plenofsrcs = plenofsrcs;
jsrc.srccount = srccount;
jsrc.srcindex = 0;
jsrc.pub.bytes_in_buffer = 0;
jsrc.pub.next_input_byte = NULL;
jsrc.pub.init_source = IJGDec_init_source;
jsrc.pub.fill_input_buffer = IJGDec_fill_input_buffer;
jsrc.pub.skip_input_data = IJGDec_skip_input_data;
jsrc.pub.resync_to_restart = jpeg_resync_to_restart;
jsrc.pub.term_source = IJGDec_term_source;
jdec.err = jpeg_std_error(&jerr.err);
jerr.err.error_exit = IJGDec_error_exit;
if ( setjmp(jerr.env) != 0 )
{
jpeg_destroy_decompress(&jdec);
return -1;
}
jpeg_create_decompress(&jdec);
jdec.src = &jsrc.pub;
ret = jpeg_read_header(&jdec,TRUE);
if ( ret != JPEG_HEADER_OK ) goto err;
jpeg_start_decompress(&jdec);
if ( jdec.output_width != dstwidth ||
jdec.output_height != dstheight ||
(jdec.output_components*8) != dstbpp ) goto err;
while (jdec.output_scanline < jdec.output_height)
{
jpeg_read_scanlines(&jdec,(JSAMPLE**)&pdst,1);
rgb_to_bgr(pdst,dstwidth);
pdst += dstpitch;
}
jpeg_finish_decompress(&jdec);
ret = 0;
err:
jpeg_destroy_decompress(&jdec);
return ret;
}
#else
int IJGDEC_Decode( char* pdst, int dstpitch, int dstwidth, int dstheight, int dstbpp, const char** ppsrcs, const int* plenofsrcs, int srccount )
{
return -1;
}
#endif

View File

@ -1,22 +0,0 @@
/*
* A simple wrapper of JPEG decoder.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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
*/
int IJGDEC_Decode( char* pdst, int dstpitch, int dstwidth, int dstheight, int dstbpp, const char** ppsrcs, const int* plenofsrcs, int srccount );

View File

@ -1,274 +0,0 @@
/*
* Implementation of IMediaControl for FilterGraph.
*
* FIXME - stub.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "oleauto.h"
#include "strmif.h"
#include "control.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "fgraph.h"
static HRESULT WINAPI
IMediaControl_fnQueryInterface(IMediaControl* iface,REFIID riid,void** ppobj)
{
CFilterGraph_THIS(iface,mediacontrol);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IMediaControl_fnAddRef(IMediaControl* iface)
{
CFilterGraph_THIS(iface,mediacontrol);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IMediaControl_fnRelease(IMediaControl* iface)
{
CFilterGraph_THIS(iface,mediacontrol);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IMediaControl_fnGetTypeInfoCount(IMediaControl* iface,UINT* pcTypeInfo)
{
CFilterGraph_THIS(iface,mediacontrol);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaControl_fnGetTypeInfo(IMediaControl* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
{
CFilterGraph_THIS(iface,mediacontrol);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaControl_fnGetIDsOfNames(IMediaControl* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
{
CFilterGraph_THIS(iface,mediacontrol);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaControl_fnInvoke(IMediaControl* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
CFilterGraph_THIS(iface,mediacontrol);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaControl_fnRun(IMediaControl* iface)
{
CFilterGraph_THIS(iface,mediacontrol);
TRACE("(%p)->()\n",This);
return IMediaFilter_Run( CFilterGraph_IMediaFilter(This),
(REFERENCE_TIME)0 );
}
static HRESULT WINAPI
IMediaControl_fnPause(IMediaControl* iface)
{
CFilterGraph_THIS(iface,mediacontrol);
TRACE("(%p)->()\n",This);
return IMediaFilter_Pause( CFilterGraph_IMediaFilter(This) );
}
static HRESULT WINAPI
IMediaControl_fnStop(IMediaControl* iface)
{
CFilterGraph_THIS(iface,mediacontrol);
HRESULT hr;
FILTER_STATE fs;
TRACE("(%p)->()\n",This);
hr = IMediaControl_GetState(iface,INFINITE,(OAFilterState*)&fs);
if ( SUCCEEDED(hr) && fs == State_Running )
{
hr = IMediaControl_Pause(iface);
if ( SUCCEEDED(hr) )
hr = IMediaControl_GetState(iface,INFINITE,(OAFilterState*)&fs);
}
if ( SUCCEEDED(hr) && fs == State_Paused )
{
hr = IMediaFilter_Stop(CFilterGraph_IMediaFilter(This));
if ( SUCCEEDED(hr) )
hr = IMediaControl_GetState(iface,INFINITE,(OAFilterState*)&fs);
}
return hr;
}
static HRESULT WINAPI
IMediaControl_fnGetState(IMediaControl* iface,LONG lTimeOut,OAFilterState* pFilterState)
{
CFilterGraph_THIS(iface,mediacontrol);
TRACE("(%p)->()\n",This);
return IMediaFilter_GetState( CFilterGraph_IMediaFilter(This), (DWORD)lTimeOut, (FILTER_STATE*)pFilterState );
}
static HRESULT WINAPI
IMediaControl_fnRenderFile(IMediaControl* iface,BSTR bstrFileName)
{
CFilterGraph_THIS(iface,mediacontrol);
UINT uLen;
WCHAR* pwszName;
HRESULT hr;
TRACE("(%p)->()\n",This);
uLen = SysStringLen(bstrFileName);
pwszName = (WCHAR*)QUARTZ_AllocMem( sizeof(WCHAR) * (uLen+1) );
if ( pwszName == NULL )
return E_OUTOFMEMORY;
memcpy( pwszName, bstrFileName, sizeof(WCHAR)*uLen );
pwszName[uLen] = (WCHAR)0;
hr = IFilterGraph2_RenderFile(
CFilterGraph_IFilterGraph2(This), pwszName, NULL );
QUARTZ_FreeMem( pwszName );
return hr;
}
static HRESULT WINAPI
IMediaControl_fnAddSourceFilter(IMediaControl* iface,BSTR bstrFileName,IDispatch** ppobj)
{
CFilterGraph_THIS(iface,mediacontrol);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaControl_fnget_FilterCollection(IMediaControl* iface,IDispatch** ppobj)
{
CFilterGraph_THIS(iface,mediacontrol);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaControl_fnget_RegFilterCollection(IMediaControl* iface,IDispatch** ppobj)
{
CFilterGraph_THIS(iface,mediacontrol);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaControl_fnStopWhenReady(IMediaControl* iface)
{
CFilterGraph_THIS(iface,mediacontrol);
TRACE("(%p)->()\n",This);
return IMediaFilter_Stop( CFilterGraph_IMediaFilter(This) );
}
static ICOM_VTABLE(IMediaControl) imediacontrol =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IMediaControl_fnQueryInterface,
IMediaControl_fnAddRef,
IMediaControl_fnRelease,
/* IDispatch fields */
IMediaControl_fnGetTypeInfoCount,
IMediaControl_fnGetTypeInfo,
IMediaControl_fnGetIDsOfNames,
IMediaControl_fnInvoke,
/* IMediaControl fields */
IMediaControl_fnRun,
IMediaControl_fnPause,
IMediaControl_fnStop,
IMediaControl_fnGetState,
IMediaControl_fnRenderFile,
IMediaControl_fnAddSourceFilter,
IMediaControl_fnget_FilterCollection,
IMediaControl_fnget_RegFilterCollection,
IMediaControl_fnStopWhenReady,
};
HRESULT CFilterGraph_InitIMediaControl( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
ICOM_VTBL(&pfg->mediacontrol) = &imediacontrol;
return NOERROR;
}
void CFilterGraph_UninitIMediaControl( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
}

View File

@ -1,487 +0,0 @@
/*
* Implementation of IMediaFilter for FilterGraph.
*
* FIXME - stub.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "strmif.h"
#include "control.h"
#include "uuids.h"
#include "vfwmsgs.h"
#include "evcode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "fgraph.h"
#define WINE_QUARTZ_POLL_INTERVAL 10
/*****************************************************************************/
static
HRESULT CFilterGraph_PollGraphState(
CFilterGraph* This,
FILTER_STATE* pState)
{
HRESULT hr;
DWORD n;
hr = S_OK;
*pState = State_Stopped;
EnterCriticalSection( &This->m_csGraphState );
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
hr = IBaseFilter_GetState( This->m_pActiveFilters[n].pFilter, (DWORD)0, pState );
if ( hr != S_OK )
break;
}
LeaveCriticalSection( &This->m_csFilters );
LeaveCriticalSection( &This->m_csGraphState );
TRACE( "returns %08lx, state %d\n",
hr, *pState );
return hr;
}
static
HRESULT CFilterGraph_StopGraph(
CFilterGraph* This )
{
HRESULT hr;
HRESULT hrFilter;
DWORD n;
hr = S_OK;
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
hrFilter = IBaseFilter_Stop( This->m_pActiveFilters[n].pFilter );
if ( hrFilter != S_OK )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static
HRESULT CFilterGraph_PauseGraph(
CFilterGraph* This )
{
HRESULT hr;
HRESULT hrFilter;
DWORD n;
hr = S_OK;
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
hrFilter = IBaseFilter_Pause( This->m_pActiveFilters[n].pFilter );
if ( hrFilter != S_OK )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static
HRESULT CFilterGraph_RunGraph(
CFilterGraph* This, REFERENCE_TIME rtStart )
{
HRESULT hr;
HRESULT hrFilter;
DWORD n;
hr = S_OK;
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
hrFilter = IBaseFilter_Run( This->m_pActiveFilters[n].pFilter, rtStart );
if ( hrFilter != S_OK )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static
HRESULT CFilterGraph_SetSyncSourceGraph(
CFilterGraph* This, IReferenceClock* pClock )
{
HRESULT hr;
HRESULT hrFilter;
DWORD n;
hr = S_OK;
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
hrFilter = IBaseFilter_SetSyncSource( This->m_pActiveFilters[n].pFilter, pClock );
if ( hrFilter == E_NOTIMPL )
hrFilter = S_OK;
if ( hrFilter != S_OK )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
/*****************************************************************************/
static HRESULT WINAPI
IMediaFilter_fnQueryInterface(IMediaFilter* iface,REFIID riid,void** ppobj)
{
CFilterGraph_THIS(iface,mediafilter);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IMediaFilter_fnAddRef(IMediaFilter* iface)
{
CFilterGraph_THIS(iface,mediafilter);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IMediaFilter_fnRelease(IMediaFilter* iface)
{
CFilterGraph_THIS(iface,mediafilter);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IMediaFilter_fnGetClassID(IMediaFilter* iface,CLSID* pclsid)
{
CFilterGraph_THIS(iface,mediafilter);
TRACE("(%p)->()\n",This);
return IPersist_GetClassID(
CFilterGraph_IPersist(This),pclsid);
}
static HRESULT WINAPI
IMediaFilter_fnStop(IMediaFilter* iface)
{
CFilterGraph_THIS(iface,mediafilter);
HRESULT hr;
TRACE("(%p)->()\n",This);
hr = S_OK;
EnterCriticalSection( &This->m_csGraphState );
if ( This->m_stateGraph != State_Stopped )
{
/* IDistributorNotify_Stop() */
hr = CFilterGraph_StopGraph(This);
This->m_stateGraph = State_Stopped;
}
LeaveCriticalSection( &This->m_csGraphState );
return hr;
}
static HRESULT WINAPI
IMediaFilter_fnPause(IMediaFilter* iface)
{
CFilterGraph_THIS(iface,mediafilter);
HRESULT hr;
TRACE("(%p)->()\n",This);
hr = S_OK;
EnterCriticalSection( &This->m_csGraphState );
if ( This->m_stateGraph != State_Paused )
{
/* IDistributorNotify_Pause() */
hr = CFilterGraph_PauseGraph(This);
if ( SUCCEEDED(hr) )
This->m_stateGraph = State_Paused;
else
(void)CFilterGraph_StopGraph(This);
}
LeaveCriticalSection( &This->m_csGraphState );
return hr;
}
static HRESULT WINAPI
IMediaFilter_fnRun(IMediaFilter* iface,REFERENCE_TIME rtStart)
{
CFilterGraph_THIS(iface,mediafilter);
HRESULT hr;
IReferenceClock* pClock;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csGraphState );
if ( This->m_stateGraph == State_Stopped )
{
hr = IMediaFilter_Pause(iface);
if ( FAILED(hr) )
goto end;
}
/* handle the special time. */
if ( rtStart == (REFERENCE_TIME)0 )
{
hr = IMediaFilter_GetSyncSource(iface,&pClock);
if ( hr == S_OK && pClock != NULL )
{
IReferenceClock_GetTime(pClock,&rtStart);
IReferenceClock_Release(pClock);
}
}
hr = NOERROR;
if ( This->m_stateGraph != State_Running )
{
/* IDistributorNotify_Run() */
hr = CFilterGraph_RunGraph(This,rtStart);
if ( SUCCEEDED(hr) )
This->m_stateGraph = State_Running;
else
(void)CFilterGraph_StopGraph(This);
}
end:
LeaveCriticalSection( &This->m_csGraphState );
return hr;
}
static HRESULT WINAPI
IMediaFilter_fnGetState(IMediaFilter* iface,DWORD dwTimeOut,FILTER_STATE* pState)
{
CFilterGraph_THIS(iface,mediafilter);
HRESULT hr;
DWORD dwTickStart;
DWORD dwTickUsed;
TRACE("(%p)->(%p)\n",This,pState);
if ( pState == NULL )
return E_POINTER;
dwTickStart = GetTickCount();
while ( 1 )
{
hr = CFilterGraph_PollGraphState( This, pState );
if ( hr != VFW_S_STATE_INTERMEDIATE )
break;
if ( dwTimeOut == 0 )
break;
Sleep( (dwTimeOut >= WINE_QUARTZ_POLL_INTERVAL) ?
WINE_QUARTZ_POLL_INTERVAL : dwTimeOut );
dwTickUsed = GetTickCount() - dwTickStart;
dwTickStart += dwTickUsed;
if ( dwTimeOut <= dwTickUsed )
dwTimeOut = 0;
else
dwTimeOut -= dwTickUsed;
}
EnterCriticalSection( &This->m_csGraphState );
*pState = This->m_stateGraph;
LeaveCriticalSection( &This->m_csGraphState );
return hr;
}
static HRESULT WINAPI
IMediaFilter_fnSetSyncSource(IMediaFilter* iface,IReferenceClock* pobjClock)
{
CFilterGraph_THIS(iface,mediafilter);
HRESULT hr = NOERROR;
TRACE("(%p)->(%p)\n",This,pobjClock);
/* IDistributorNotify_SetSyncSource() */
EnterCriticalSection( &This->m_csClock );
hr = CFilterGraph_SetSyncSourceGraph( This, pobjClock );
if ( SUCCEEDED(hr) )
{
if ( This->m_pClock != NULL )
{
IReferenceClock_Release(This->m_pClock);
This->m_pClock = NULL;
}
This->m_pClock = pobjClock;
if ( pobjClock != NULL )
IReferenceClock_AddRef( pobjClock );
IMediaEventSink_Notify(CFilterGraph_IMediaEventSink(This),
EC_CLOCK_CHANGED, 0, 0);
}
else
{
(void)CFilterGraph_SetSyncSourceGraph( This, This->m_pClock );
}
LeaveCriticalSection( &This->m_csClock );
TRACE( "hr = %08lx\n", hr );
return hr;
}
static HRESULT WINAPI
IMediaFilter_fnGetSyncSource(IMediaFilter* iface,IReferenceClock** ppobjClock)
{
CFilterGraph_THIS(iface,mediafilter);
HRESULT hr = VFW_E_NO_CLOCK;
TRACE("(%p)->(%p)\n",This,ppobjClock);
if ( ppobjClock == NULL )
return E_POINTER;
EnterCriticalSection( &This->m_csClock );
*ppobjClock = This->m_pClock;
if ( This->m_pClock != NULL )
{
hr = NOERROR;
IReferenceClock_AddRef( This->m_pClock );
}
LeaveCriticalSection( &This->m_csClock );
TRACE( "hr = %08lx\n", hr );
return hr;
}
static ICOM_VTABLE(IMediaFilter) imediafilter =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IMediaFilter_fnQueryInterface,
IMediaFilter_fnAddRef,
IMediaFilter_fnRelease,
/* IPersist fields */
IMediaFilter_fnGetClassID,
/* IMediaFilter fields */
IMediaFilter_fnStop,
IMediaFilter_fnPause,
IMediaFilter_fnRun,
IMediaFilter_fnGetState,
IMediaFilter_fnSetSyncSource,
IMediaFilter_fnGetSyncSource,
};
HRESULT CFilterGraph_InitIMediaFilter( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
ICOM_VTBL(&pfg->mediafilter) = &imediafilter;
InitializeCriticalSection( &pfg->m_csGraphState );
InitializeCriticalSection( &pfg->m_csClock );
pfg->m_stateGraph = State_Stopped;
pfg->m_pClock = NULL;
return NOERROR;
}
void CFilterGraph_UninitIMediaFilter( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
if ( pfg->m_pClock != NULL )
{
IReferenceClock_Release( pfg->m_pClock );
pfg->m_pClock = NULL;
}
DeleteCriticalSection( &pfg->m_csGraphState );
DeleteCriticalSection( &pfg->m_csClock );
}

View File

@ -1,541 +0,0 @@
/*
* Implementation of IMediaPosition for FilterGraph.
*
* FIXME - stub.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "strmif.h"
#include "control.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "fgraph.h"
static HRESULT WINAPI
IMediaPosition_fnQueryInterface(IMediaPosition* iface,REFIID riid,void** ppobj)
{
CFilterGraph_THIS(iface,mediaposition);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IMediaPosition_fnAddRef(IMediaPosition* iface)
{
CFilterGraph_THIS(iface,mediaposition);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IMediaPosition_fnRelease(IMediaPosition* iface)
{
CFilterGraph_THIS(iface,mediaposition);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IMediaPosition_fnGetTypeInfoCount(IMediaPosition* iface,UINT* pcTypeInfo)
{
CFilterGraph_THIS(iface,mediaposition);
TRACE("(%p)->()\n",This);
return IDispatch_GetTypeInfoCount(
CFilterGraph_IDispatch(This),pcTypeInfo);
}
static HRESULT WINAPI
IMediaPosition_fnGetTypeInfo(IMediaPosition* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
{
CFilterGraph_THIS(iface,mediaposition);
TRACE("(%p)->()\n",This);
return IDispatch_GetTypeInfo(
CFilterGraph_IDispatch(This),iTypeInfo,lcid,ppobj);
}
static HRESULT WINAPI
IMediaPosition_fnGetIDsOfNames(IMediaPosition* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
{
CFilterGraph_THIS(iface,mediaposition);
TRACE("(%p)->()\n",This);
return IDispatch_GetIDsOfNames(
CFilterGraph_IDispatch(This),riid,ppwszName,cNames,lcid,pDispId);
}
static HRESULT WINAPI
IMediaPosition_fnInvoke(IMediaPosition* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
CFilterGraph_THIS(iface,mediaposition);
TRACE("(%p)->()\n",This);
return IDispatch_Invoke(
CFilterGraph_IDispatch(This),
DispId,riid,lcid,wFlags,pDispParams,pVarRes,pExcepInfo,puArgErr);
}
static HRESULT WINAPI
IMediaPosition_fnget_Duration(IMediaPosition* iface,REFTIME* prefTime)
{
CFilterGraph_THIS(iface,mediaposition);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->(%p)\n",This,prefTime);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pPosition != NULL )
{
hrFilter = IMediaPosition_get_Duration( This->m_pActiveFilters[n].pPosition, prefTime );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnput_CurrentPosition(IMediaPosition* iface,REFTIME refTime)
{
CFilterGraph_THIS(iface,mediaposition);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pPosition != NULL )
{
hrFilter = IMediaPosition_put_CurrentPosition( This->m_pActiveFilters[n].pPosition, refTime );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnget_CurrentPosition(IMediaPosition* iface,REFTIME* prefTime)
{
CFilterGraph_THIS(iface,mediaposition);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pPosition != NULL )
{
hrFilter = IMediaPosition_get_CurrentPosition( This->m_pActiveFilters[n].pPosition, prefTime );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnget_StopTime(IMediaPosition* iface,REFTIME* prefTime)
{
CFilterGraph_THIS(iface,mediaposition);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pPosition != NULL )
{
hrFilter = IMediaPosition_get_StopTime( This->m_pActiveFilters[n].pPosition, prefTime );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnput_StopTime(IMediaPosition* iface,REFTIME refTime)
{
CFilterGraph_THIS(iface,mediaposition);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pPosition != NULL )
{
hrFilter = IMediaPosition_put_StopTime( This->m_pActiveFilters[n].pPosition, refTime );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnget_PrerollTime(IMediaPosition* iface,REFTIME* prefTime)
{
CFilterGraph_THIS(iface,mediaposition);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pPosition != NULL )
{
hrFilter = IMediaPosition_get_PrerollTime( This->m_pActiveFilters[n].pPosition, prefTime );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnput_PrerollTime(IMediaPosition* iface,REFTIME refTime)
{
CFilterGraph_THIS(iface,mediaposition);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pPosition != NULL )
{
hrFilter = IMediaPosition_put_PrerollTime( This->m_pActiveFilters[n].pPosition, refTime );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnput_Rate(IMediaPosition* iface,double dblRate)
{
CFilterGraph_THIS(iface,mediaposition);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pPosition != NULL )
{
hrFilter = IMediaPosition_put_Rate( This->m_pActiveFilters[n].pPosition, dblRate );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnget_Rate(IMediaPosition* iface,double* pdblRate)
{
CFilterGraph_THIS(iface,mediaposition);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pPosition != NULL )
{
hrFilter = IMediaPosition_get_Rate( This->m_pActiveFilters[n].pPosition, pdblRate );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnCanSeekForward(IMediaPosition* iface,LONG* pCanSeek)
{
CFilterGraph_THIS(iface,mediaposition);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pPosition != NULL )
{
hrFilter = IMediaPosition_CanSeekForward( This->m_pActiveFilters[n].pPosition, pCanSeek );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnCanSeekBackward(IMediaPosition* iface,LONG* pCanSeek)
{
CFilterGraph_THIS(iface,mediaposition);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pPosition != NULL )
{
hrFilter = IMediaPosition_CanSeekBackward( This->m_pActiveFilters[n].pPosition, pCanSeek );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static ICOM_VTABLE(IMediaPosition) imediaposition =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IMediaPosition_fnQueryInterface,
IMediaPosition_fnAddRef,
IMediaPosition_fnRelease,
/* IDispatch fields */
IMediaPosition_fnGetTypeInfoCount,
IMediaPosition_fnGetTypeInfo,
IMediaPosition_fnGetIDsOfNames,
IMediaPosition_fnInvoke,
/* IMediaPosition fields */
IMediaPosition_fnget_Duration,
IMediaPosition_fnput_CurrentPosition,
IMediaPosition_fnget_CurrentPosition,
IMediaPosition_fnget_StopTime,
IMediaPosition_fnput_StopTime,
IMediaPosition_fnget_PrerollTime,
IMediaPosition_fnput_PrerollTime,
IMediaPosition_fnput_Rate,
IMediaPosition_fnget_Rate,
IMediaPosition_fnCanSeekForward,
IMediaPosition_fnCanSeekBackward,
};
HRESULT CFilterGraph_InitIMediaPosition( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
ICOM_VTBL(&pfg->mediaposition) = &imediaposition;
return NOERROR;
}
void CFilterGraph_UninitIMediaPosition( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
}

View File

@ -1,710 +0,0 @@
/*
* Implementation of IMediaSeeking for FilterGraph.
*
* FIXME - stub.
* FIXME - this interface should be allocated as a plug-in(?)
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "strmif.h"
#include "control.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "fgraph.h"
static HRESULT WINAPI
IMediaSeeking_fnQueryInterface(IMediaSeeking* iface,REFIID riid,void** ppobj)
{
CFilterGraph_THIS(iface,mediaseeking);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IMediaSeeking_fnAddRef(IMediaSeeking* iface)
{
CFilterGraph_THIS(iface,mediaseeking);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IMediaSeeking_fnRelease(IMediaSeeking* iface)
{
CFilterGraph_THIS(iface,mediaseeking);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IMediaSeeking_fnGetCapabilities(IMediaSeeking* iface,DWORD* pdwCaps)
{
CFilterGraph_THIS(iface,mediaseeking);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pSeeking != NULL )
{
hrFilter = IMediaSeeking_GetCapabilities( This->m_pActiveFilters[n].pSeeking, pdwCaps );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnCheckCapabilities(IMediaSeeking* iface,DWORD* pdwCaps)
{
CFilterGraph_THIS(iface,mediaseeking);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pSeeking != NULL )
{
hrFilter = IMediaSeeking_CheckCapabilities( This->m_pActiveFilters[n].pSeeking, pdwCaps );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnIsFormatSupported(IMediaSeeking* iface,const GUID* pidFormat)
{
CFilterGraph_THIS(iface,mediaseeking);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pSeeking != NULL )
{
hrFilter = IMediaSeeking_IsFormatSupported( This->m_pActiveFilters[n].pSeeking, pidFormat );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnQueryPreferredFormat(IMediaSeeking* iface,GUID* pidFormat)
{
CFilterGraph_THIS(iface,mediaseeking);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pSeeking != NULL )
{
hrFilter = IMediaSeeking_QueryPreferredFormat( This->m_pActiveFilters[n].pSeeking, pidFormat );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnGetTimeFormat(IMediaSeeking* iface,GUID* pidFormat)
{
CFilterGraph_THIS(iface,mediaseeking);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pSeeking != NULL )
{
hrFilter = IMediaSeeking_GetTimeFormat( This->m_pActiveFilters[n].pSeeking, pidFormat );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnIsUsingTimeFormat(IMediaSeeking* iface,const GUID* pidFormat)
{
CFilterGraph_THIS(iface,mediaseeking);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pSeeking != NULL )
{
hrFilter = IMediaSeeking_IsUsingTimeFormat( This->m_pActiveFilters[n].pSeeking, pidFormat );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnSetTimeFormat(IMediaSeeking* iface,const GUID* pidFormat)
{
CFilterGraph_THIS(iface,mediaseeking);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pSeeking != NULL )
{
hrFilter = IMediaSeeking_SetTimeFormat( This->m_pActiveFilters[n].pSeeking, pidFormat );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnGetDuration(IMediaSeeking* iface,LONGLONG* pllDuration)
{
CFilterGraph_THIS(iface,mediaseeking);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pSeeking != NULL )
{
hrFilter = IMediaSeeking_GetDuration( This->m_pActiveFilters[n].pSeeking, pllDuration );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnGetStopPosition(IMediaSeeking* iface,LONGLONG* pllPos)
{
CFilterGraph_THIS(iface,mediaseeking);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pSeeking != NULL )
{
hrFilter = IMediaSeeking_GetStopPosition( This->m_pActiveFilters[n].pSeeking, pllPos );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnGetCurrentPosition(IMediaSeeking* iface,LONGLONG* pllPos)
{
CFilterGraph_THIS(iface,mediaseeking);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pSeeking != NULL )
{
hrFilter = IMediaSeeking_GetCurrentPosition( This->m_pActiveFilters[n].pSeeking, pllPos );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnConvertTimeFormat(IMediaSeeking* iface,LONGLONG* pllOut,const GUID* pidFmtOut,LONGLONG llIn,const GUID* pidFmtIn)
{
CFilterGraph_THIS(iface,mediaseeking);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pSeeking != NULL )
{
hrFilter = IMediaSeeking_ConvertTimeFormat( This->m_pActiveFilters[n].pSeeking, pllOut, pidFmtOut, llIn, pidFmtIn );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnSetPositions(IMediaSeeking* iface,LONGLONG* pllCur,DWORD dwCurFlags,LONGLONG* pllStop,DWORD dwStopFlags)
{
CFilterGraph_THIS(iface,mediaseeking);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pSeeking != NULL )
{
hrFilter = IMediaSeeking_SetPositions( This->m_pActiveFilters[n].pSeeking, pllCur, dwCurFlags, pllStop, dwStopFlags );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnGetPositions(IMediaSeeking* iface,LONGLONG* pllCur,LONGLONG* pllStop)
{
CFilterGraph_THIS(iface,mediaseeking);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pSeeking != NULL )
{
hrFilter = IMediaSeeking_GetPositions( This->m_pActiveFilters[n].pSeeking, pllCur, pllStop );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnGetAvailable(IMediaSeeking* iface,LONGLONG* pllFirst,LONGLONG* pllLast)
{
CFilterGraph_THIS(iface,mediaseeking);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pSeeking != NULL )
{
hrFilter = IMediaSeeking_GetAvailable( This->m_pActiveFilters[n].pSeeking, pllFirst, pllLast );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnSetRate(IMediaSeeking* iface,double dblRate)
{
CFilterGraph_THIS(iface,mediaseeking);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pSeeking != NULL )
{
hrFilter = IMediaSeeking_SetRate( This->m_pActiveFilters[n].pSeeking, dblRate );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnGetRate(IMediaSeeking* iface,double* pdblRate)
{
CFilterGraph_THIS(iface,mediaseeking);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pSeeking != NULL )
{
hrFilter = IMediaSeeking_GetRate( This->m_pActiveFilters[n].pSeeking, pdblRate );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnGetPreroll(IMediaSeeking* iface,LONGLONG* pllPreroll)
{
CFilterGraph_THIS(iface,mediaseeking);
HRESULT hr = E_NOTIMPL;
HRESULT hrFilter;
DWORD n;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->m_csFilters );
for ( n = 0; n < This->m_cActiveFilters; n++ )
{
if ( This->m_pActiveFilters[n].pSeeking != NULL )
{
hrFilter = IMediaSeeking_GetPreroll( This->m_pActiveFilters[n].pSeeking, pllPreroll );
if ( hr == E_NOTIMPL )
{
hr = hrFilter;
}
else
if ( hrFilter != E_NOTIMPL )
{
if ( SUCCEEDED(hr) )
hr = hrFilter;
}
}
}
LeaveCriticalSection( &This->m_csFilters );
return hr;
}
static ICOM_VTABLE(IMediaSeeking) imediaseeking =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IMediaSeeking_fnQueryInterface,
IMediaSeeking_fnAddRef,
IMediaSeeking_fnRelease,
/* IMediaSeeking fields */
IMediaSeeking_fnGetCapabilities,
IMediaSeeking_fnCheckCapabilities,
IMediaSeeking_fnIsFormatSupported,
IMediaSeeking_fnQueryPreferredFormat,
IMediaSeeking_fnGetTimeFormat,
IMediaSeeking_fnIsUsingTimeFormat,
IMediaSeeking_fnSetTimeFormat,
IMediaSeeking_fnGetDuration,
IMediaSeeking_fnGetStopPosition,
IMediaSeeking_fnGetCurrentPosition,
IMediaSeeking_fnConvertTimeFormat,
IMediaSeeking_fnSetPositions,
IMediaSeeking_fnGetPositions,
IMediaSeeking_fnGetAvailable,
IMediaSeeking_fnSetRate,
IMediaSeeking_fnGetRate,
IMediaSeeking_fnGetPreroll,
};
HRESULT CFilterGraph_InitIMediaSeeking( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
ICOM_VTBL(&pfg->mediaseeking) = &imediaseeking;
return NOERROR;
}
void CFilterGraph_UninitIMediaSeeking( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
}

View File

@ -1,160 +0,0 @@
/*
* An implementation of IUnknown.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "wine/port.h"
#include "windef.h"
#include "winerror.h"
#include "winbase.h"
#include "wine/obj_base.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "iunk.h"
static HRESULT WINAPI
IUnknown_fnQueryInterface(IUnknown* iface,REFIID riid,LPVOID *ppobj)
{
ICOM_THIS(QUARTZ_IUnkImpl,iface);
size_t ofs;
DWORD dwIndex;
QUARTZ_IFDelegation* pDelegation;
HRESULT hr;
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
if ( ppobj == NULL )
return E_POINTER;
*ppobj = NULL;
ofs = 0;
if ( IsEqualGUID( &IID_IUnknown, riid ) )
{
TRACE("IID_IUnknown - returns inner object.\n");
}
else
{
for ( dwIndex = 0; dwIndex < This->dwEntries; dwIndex++ )
{
if ( IsEqualGUID( This->pEntries[dwIndex].piid, riid ) )
{
ofs = This->pEntries[dwIndex].ofsVTPtr;
break;
}
}
if ( dwIndex == This->dwEntries )
{
hr = E_NOINTERFACE;
/* delegation */
pDelegation = This->pDelegationFirst;
while ( pDelegation != NULL )
{
hr = (*pDelegation->pOnQueryInterface)( iface, riid, ppobj );
if ( hr != E_NOINTERFACE )
break;
pDelegation = pDelegation->pNext;
}
if ( hr == E_NOINTERFACE )
{
WARN("(%p) unknown interface: %s\n",This,debugstr_guid(riid));
}
return hr;
}
}
*ppobj = (LPVOID)(((char*)This) + ofs);
IUnknown_AddRef((IUnknown*)(*ppobj));
return S_OK;
}
static ULONG WINAPI
IUnknown_fnAddRef(IUnknown* iface)
{
ICOM_THIS(QUARTZ_IUnkImpl,iface);
TRACE("(%p)->()\n",This);
return InterlockedExchangeAdd(&(This->ref),1) + 1;
}
static ULONG WINAPI
IUnknown_fnRelease(IUnknown* iface)
{
ICOM_THIS(QUARTZ_IUnkImpl,iface);
LONG ref;
TRACE("(%p)->()\n",This);
ref = InterlockedExchangeAdd(&(This->ref),-1) - 1;
if ( ref > 0 )
return (ULONG)ref;
This->ref ++;
if ( This->pOnFinalRelease != NULL )
(*(This->pOnFinalRelease))(iface);
This->ref --;
QUARTZ_FreeObj(This);
return 0;
}
static ICOM_VTABLE(IUnknown) iunknown =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IUnknown_fnQueryInterface,
IUnknown_fnAddRef,
IUnknown_fnRelease,
};
void QUARTZ_IUnkInit( QUARTZ_IUnkImpl* pImpl, IUnknown* punkOuter )
{
TRACE("(%p)\n",pImpl);
ICOM_VTBL(pImpl) = &iunknown;
pImpl->pEntries = NULL;
pImpl->dwEntries = 0;
pImpl->pDelegationFirst = NULL;
pImpl->pOnFinalRelease = NULL;
pImpl->ref = 1;
pImpl->punkControl = (IUnknown*)pImpl;
/* for implementing aggregation. */
if ( punkOuter != NULL )
pImpl->punkControl = punkOuter;
}
void QUARTZ_IUnkAddDelegation(
QUARTZ_IUnkImpl* pImpl, QUARTZ_IFDelegation* pDelegation )
{
pDelegation->pNext = pImpl->pDelegationFirst;
pImpl->pDelegationFirst = pDelegation;
}

View File

@ -1,83 +0,0 @@
/*
* An implementation of IUnknown.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 WINE_DSHOW_IUNK_H
#define WINE_DSHOW_IUNK_H
/*
To avoid implementing IUnknown for all interfaces,
1) To give a method to get rel-offset of IUnknown.
2) The IUnknown knows all IIDs and offsets of interfaces.
So each implementation must have following two members
with the following order:
typedef struct IDispatchImpl
{
ICOM_VFIELD(IDispatch); <-pointer of the interface.
size_t ofsIUnknown; <-ofs<IDispatchImpl> - ofs<QUARTZ_IUnkImpl>
};
*/
/* for InterlockedExchangeAdd. */
#include <pshpack4.h>
typedef struct QUARTZ_IFEntry
{
const IID* piid; /* interface ID. */
size_t ofsVTPtr; /* offset from IUnknown. */
} QUARTZ_IFEntry;
typedef struct QUARTZ_IFDelegation
{
struct QUARTZ_IFDelegation* pNext;
HRESULT (*pOnQueryInterface)(
IUnknown* punk, const IID* piid, void** ppobj );
} QUARTZ_IFDelegation;
typedef struct QUARTZ_IUnkImpl
{
/* pointer of IUnknown interface. */
ICOM_VFIELD(IUnknown);
/* array of supported IIDs and offsets. */
const QUARTZ_IFEntry* pEntries;
DWORD dwEntries;
/* list of delegation handlers. */
QUARTZ_IFDelegation* pDelegationFirst;
/* called on final release. */
void (*pOnFinalRelease)(IUnknown* punk);
/* IUnknown fields. */
LONG ref;
IUnknown* punkControl;
} QUARTZ_IUnkImpl;
#include <poppack.h>
void QUARTZ_IUnkInit( QUARTZ_IUnkImpl* pImpl, IUnknown* punkOuter );
void QUARTZ_IUnkAddDelegation(
QUARTZ_IUnkImpl* pImpl, QUARTZ_IFDelegation* pDelegation );
#endif /* WINE_DSHOW_IUNK_H */

View File

@ -1,612 +1 @@
/*
* Exported APIs.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winerror.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "mmsystem.h"
#include "ole2.h"
#include "strmif.h"
#include "control.h"
#include "uuids.h"
#include "errors.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "initguid.h"
#include "quartz_private.h"
#include "fgraph.h"
#include "sysclock.h"
#include "memalloc.h"
#include "devenum.h"
#include "fmap.h"
#include "seekpass.h"
#include "audren.h"
#include "vidren.h"
#include "parser.h"
#include "asyncsrc.h"
#include "xform.h"
#include "capgraph.h"
#include "filesink.h"
typedef struct QUARTZ_CLASSENTRY
{
const CLSID* pclsid;
QUARTZ_pCreateIUnknown pCreateIUnk;
} QUARTZ_CLASSENTRY;
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);
LONG ref;
/* IClassFactory fields */
const QUARTZ_CLASSENTRY* pEntry;
} IClassFactoryImpl;
static const QUARTZ_CLASSENTRY QUARTZ_ClassList[] =
{
{ &CLSID_FilterGraph, &QUARTZ_CreateFilterGraph },
{ &CLSID_FilterGraphNoThread, &QUARTZ_CreateFilterGraph }, /* FIXME? */
{ &CLSID_SystemClock, &QUARTZ_CreateSystemClock },
{ &CLSID_MemoryAllocator, &QUARTZ_CreateMemoryAllocator },
{ &CLSID_SystemDeviceEnum, &QUARTZ_CreateSystemDeviceEnum },
{ &CLSID_FilterMapper, &QUARTZ_CreateFilterMapper },
{ &CLSID_FilterMapper2, &QUARTZ_CreateFilterMapper2 },
{ &CLSID_SeekingPassThru, &QUARTZ_CreateSeekingPassThru },
{ &CLSID_CaptureGraphBuilder, &QUARTZ_CreateCaptureGraph },
{ &CLSID_AudioRender, &QUARTZ_CreateAudioRenderer },
{ &CLSID_VideoRenderer, &QUARTZ_CreateVideoRenderer },
{ &CLSID_quartzWaveParser, &QUARTZ_CreateWaveParser },
{ &CLSID_AviSplitter, &QUARTZ_CreateAVISplitter },
{ &CLSID_MPEG1Splitter, &QUARTZ_CreateMPEG1Splitter },
{ &CLSID_AsyncReader, &QUARTZ_CreateAsyncReader },
{ &CLSID_URLReader, &QUARTZ_CreateURLReader },
{ &CLSID_AVIDec, &QUARTZ_CreateAVIDec },
{ &CLSID_Colour, &QUARTZ_CreateColour },
{ &CLSID_ACMWrapper, &QUARTZ_CreateACMWrapper },
{ &CLSID_FileWriter, &QUARTZ_CreateFileWriter },
{ &CLSID_CMpegAudioCodec, &QUARTZ_CreateCMpegAudioCodec },
{ &CLSID_CMpegVideoCodec, &QUARTZ_CreateCMpegVideoCodec },
{ &CLSID_quartzQuickTimeMovieParser, &QUARTZ_CreateQuickTimeMovieParser },
{ &CLSID_quartzMIDIParser, &QUARTZ_CreateMIDIParser },
{ &CLSID_quartzMJPGDecompressor, QUARTZ_CreateMJPGDecompressor },
{ &CLSID_quartzQuickTimeDecompressor, QUARTZ_CreateQuickTimeDecompressor },
{ NULL, NULL },
};
/* per-process variables */
static CRITICAL_SECTION csHeap;
static DWORD dwClassObjRef;
static HANDLE hDLLHeap;
void* QUARTZ_AllocObj( DWORD dwSize )
{
void* pv;
EnterCriticalSection( &csHeap );
dwClassObjRef ++;
pv = HeapAlloc( hDLLHeap, 0, dwSize );
if ( pv == NULL )
dwClassObjRef --;
LeaveCriticalSection( &csHeap );
return pv;
}
void QUARTZ_FreeObj( void* pobj )
{
EnterCriticalSection( &csHeap );
HeapFree( hDLLHeap, 0, pobj );
dwClassObjRef --;
LeaveCriticalSection( &csHeap );
}
void* QUARTZ_AllocMem( DWORD dwSize )
{
return HeapAlloc( hDLLHeap, 0, dwSize );
}
void QUARTZ_FreeMem( void* pMem )
{
HeapFree( hDLLHeap, 0, pMem );
}
void* QUARTZ_ReallocMem( void* pMem, DWORD dwSize )
{
if ( pMem == NULL )
return QUARTZ_AllocMem( dwSize );
return HeapReAlloc( hDLLHeap, 0, pMem, dwSize );
}
static
LPWSTR QUARTZ_strncpyAtoW( LPWSTR lpwstr, LPCSTR lpstr, INT wbuflen )
{
INT len;
len = MultiByteToWideChar( CP_ACP, 0, lpstr, -1, lpwstr, wbuflen );
if ( len == 0 )
*lpwstr = 0;
return lpwstr;
}
/************************************************************************/
static HRESULT WINAPI
IClassFactory_fnQueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
{
ICOM_THIS(IClassFactoryImpl,iface);
TRACE("(%p)->(%p,%p)\n",This,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",This);
return InterlockedExchangeAdd(&(This->ref),1) + 1;
}
static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface)
{
ICOM_THIS(IClassFactoryImpl,iface);
LONG ref;
TRACE("(%p)->()\n",This);
ref = InterlockedExchangeAdd(&(This->ref),-1) - 1;
if ( ref > 0 )
return (ULONG)ref;
QUARTZ_FreeObj(This);
return 0;
}
static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj)
{
ICOM_THIS(IClassFactoryImpl,iface);
HRESULT hr;
IUnknown* punk;
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
if ( ppobj == NULL )
return E_POINTER;
if ( pOuter != NULL && !IsEqualGUID( riid, &IID_IUnknown ) )
return CLASS_E_NOAGGREGATION;
*ppobj = NULL;
hr = (*This->pEntry->pCreateIUnk)(pOuter,(void**)&punk);
if ( hr != S_OK )
return hr;
hr = IUnknown_QueryInterface(punk,riid,ppobj);
IUnknown_Release(punk);
return hr;
}
static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface,BOOL dolock)
{
ICOM_THIS(IClassFactoryImpl,iface);
HRESULT hr;
TRACE("(%p)->(%d)\n",This,dolock);
if (dolock)
hr = IClassFactory_AddRef(iface);
else
hr = IClassFactory_Release(iface);
return hr;
}
static HRESULT IClassFactory_Alloc( const CLSID* pclsid, void** ppobj )
{
const QUARTZ_CLASSENTRY* pEntry;
IClassFactoryImpl* pImpl;
TRACE( "(%s,%p)\n", debugstr_guid(pclsid), ppobj );
pEntry = QUARTZ_ClassList;
while ( pEntry->pclsid != NULL )
{
if ( IsEqualGUID( pclsid, pEntry->pclsid ) )
goto found;
pEntry ++;
}
return CLASS_E_CLASSNOTAVAILABLE;
found:
pImpl = (IClassFactoryImpl*)QUARTZ_AllocObj( sizeof(IClassFactoryImpl) );
if ( pImpl == NULL )
return E_OUTOFMEMORY;
TRACE( "allocated successfully.\n" );
ICOM_VTBL(pImpl) = &iclassfact;
pImpl->ref = 1;
pImpl->pEntry = pEntry;
*ppobj = (void*)pImpl;
return S_OK;
}
/***********************************************************************
* QUARTZ_InitProcess (internal)
*/
static BOOL QUARTZ_InitProcess( void )
{
TRACE("()\n");
dwClassObjRef = 0;
hDLLHeap = (HANDLE)NULL;
InitializeCriticalSection( &csHeap );
hDLLHeap = HeapCreate( 0, 0x10000, 0 );
if ( hDLLHeap == (HANDLE)NULL )
return FALSE;
return TRUE;
}
/***********************************************************************
* QUARTZ_UninitProcess (internal)
*/
static void QUARTZ_UninitProcess( void )
{
TRACE("()\n");
if ( dwClassObjRef != 0 )
ERR( "you must release some objects allocated from quartz.\n" );
if ( hDLLHeap != (HANDLE)NULL )
{
HeapDestroy( hDLLHeap );
hDLLHeap = (HANDLE)NULL;
}
DeleteCriticalSection( &csHeap );
}
/***********************************************************************
* QUARTZ_DllMain
*/
BOOL WINAPI QUARTZ_DllMain(
HINSTANCE hInstDLL,
DWORD fdwReason,
LPVOID lpvReserved )
{
TRACE("(%08x,%08lx,%p)\n",hInstDLL,fdwReason,lpvReserved);
switch ( fdwReason )
{
case DLL_PROCESS_ATTACH:
if ( !QUARTZ_InitProcess() )
return FALSE;
break;
case DLL_PROCESS_DETACH:
QUARTZ_UninitProcess();
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
return TRUE;
}
/***********************************************************************
* DllCanUnloadNow (QUARTZ.@)
*
* RETURNS
* Success: S_OK
* Failure: S_FALSE
*/
HRESULT WINAPI QUARTZ_DllCanUnloadNow(void)
{
HRESULT hr;
EnterCriticalSection( &csHeap );
hr = ( dwClassObjRef == 0 ) ? S_OK : S_FALSE;
LeaveCriticalSection( &csHeap );
return hr;
}
/***********************************************************************
* DllGetClassObject (QUARTZ.@)
*/
HRESULT WINAPI QUARTZ_DllGetClassObject(
const CLSID* pclsid,const IID* piid,void** ppv)
{
*ppv = NULL;
if ( IsEqualCLSID( &IID_IUnknown, piid ) ||
IsEqualCLSID( &IID_IClassFactory, piid ) )
{
return IClassFactory_Alloc( pclsid, ppv );
}
return CLASS_E_CLASSNOTAVAILABLE;
}
/***********************************************************************
* DllRegisterServer (QUARTZ.@)
*/
HRESULT WINAPI QUARTZ_DllRegisterServer( void )
{
FIXME( "(): stub\n" );
return E_FAIL;
}
/***********************************************************************
* DllUnregisterServer (QUARTZ.@)
*/
HRESULT WINAPI QUARTZ_DllUnregisterServer( void )
{
FIXME( "(): stub\n" );
return E_FAIL;
}
/**************************************************************************/
/**************************************************************************/
/* FIXME - all string should be defined in the resource of quartz. */
static LPCSTR hresult_to_string( HRESULT hr )
{
switch ( hr )
{
#define ENTRY(x) case x: return (const char*)#x
/* some known codes */
ENTRY(S_OK);
ENTRY(S_FALSE);
ENTRY(E_FAIL);
ENTRY(E_POINTER);
ENTRY(E_NOTIMPL);
ENTRY(E_NOINTERFACE);
ENTRY(E_OUTOFMEMORY);
ENTRY(CLASS_E_CLASSNOTAVAILABLE);
ENTRY(CLASS_E_NOAGGREGATION);
/* vfwmsgs.h */
ENTRY(VFW_S_NO_MORE_ITEMS);
ENTRY(VFW_E_BAD_KEY);
ENTRY(VFW_E_INVALIDMEDIATYPE);
ENTRY(VFW_E_INVALIDSUBTYPE);
ENTRY(VFW_E_NEED_OWNER);
ENTRY(VFW_E_ENUM_OUT_OF_SYNC);
ENTRY(VFW_E_ALREADY_CONNECTED);
ENTRY(VFW_E_FILTER_ACTIVE);
ENTRY(VFW_E_NO_TYPES);
ENTRY(VFW_E_NO_ACCEPTABLE_TYPES);
ENTRY(VFW_E_INVALID_DIRECTION);
ENTRY(VFW_E_NOT_CONNECTED);
ENTRY(VFW_E_NO_ALLOCATOR);
ENTRY(VFW_E_RUNTIME_ERROR);
ENTRY(VFW_E_BUFFER_NOTSET);
ENTRY(VFW_E_BUFFER_OVERFLOW);
ENTRY(VFW_E_BADALIGN);
ENTRY(VFW_E_ALREADY_COMMITTED);
ENTRY(VFW_E_BUFFERS_OUTSTANDING);
ENTRY(VFW_E_NOT_COMMITTED);
ENTRY(VFW_E_SIZENOTSET);
ENTRY(VFW_E_NO_CLOCK);
ENTRY(VFW_E_NO_SINK);
ENTRY(VFW_E_NO_INTERFACE);
ENTRY(VFW_E_NOT_FOUND);
ENTRY(VFW_E_CANNOT_CONNECT);
ENTRY(VFW_E_CANNOT_RENDER);
ENTRY(VFW_E_CHANGING_FORMAT);
ENTRY(VFW_E_NO_COLOR_KEY_SET);
ENTRY(VFW_E_NOT_OVERLAY_CONNECTION);
ENTRY(VFW_E_NOT_SAMPLE_CONNECTION);
ENTRY(VFW_E_PALETTE_SET);
ENTRY(VFW_E_COLOR_KEY_SET);
ENTRY(VFW_E_NO_COLOR_KEY_FOUND);
ENTRY(VFW_E_NO_PALETTE_AVAILABLE);
ENTRY(VFW_E_NO_DISPLAY_PALETTE);
ENTRY(VFW_E_TOO_MANY_COLORS);
ENTRY(VFW_E_STATE_CHANGED);
ENTRY(VFW_E_NOT_STOPPED);
ENTRY(VFW_E_NOT_PAUSED);
ENTRY(VFW_E_NOT_RUNNING);
ENTRY(VFW_E_WRONG_STATE);
ENTRY(VFW_E_START_TIME_AFTER_END);
ENTRY(VFW_E_INVALID_RECT);
ENTRY(VFW_E_TYPE_NOT_ACCEPTED);
ENTRY(VFW_E_SAMPLE_REJECTED);
ENTRY(VFW_E_SAMPLE_REJECTED_EOS);
ENTRY(VFW_S_DUPLICATE_NAME);
ENTRY(VFW_E_DUPLICATE_NAME);
ENTRY(VFW_E_TIMEOUT);
ENTRY(VFW_E_INVALID_FILE_FORMAT);
ENTRY(VFW_E_ENUM_OUT_OF_RANGE);
ENTRY(VFW_E_CIRCULAR_GRAPH);
ENTRY(VFW_E_NOT_ALLOWED_TO_SAVE);
ENTRY(VFW_E_TIME_ALREADY_PASSED);
ENTRY(VFW_E_ALREADY_CANCELLED);
ENTRY(VFW_E_CORRUPT_GRAPH_FILE);
ENTRY(VFW_E_ADVISE_ALREADY_SET);
ENTRY(VFW_S_STATE_INTERMEDIATE);
ENTRY(VFW_E_NO_MODEX_AVAILABLE);
ENTRY(VFW_E_NO_ADVISE_SET);
ENTRY(VFW_E_NO_FULLSCREEN);
ENTRY(VFW_E_IN_FULLSCREEN_MODE);
ENTRY(VFW_E_UNKNOWN_FILE_TYPE);
ENTRY(VFW_E_CANNOT_LOAD_SOURCE_FILTER);
ENTRY(VFW_S_PARTIAL_RENDER);
ENTRY(VFW_E_FILE_TOO_SHORT);
ENTRY(VFW_E_INVALID_FILE_VERSION);
ENTRY(VFW_S_SOME_DATA_IGNORED);
ENTRY(VFW_S_CONNECTIONS_DEFERRED);
ENTRY(VFW_E_INVALID_CLSID);
ENTRY(VFW_E_INVALID_MEDIA_TYPE);
ENTRY(VFW_E_SAMPLE_TIME_NOT_SET);
ENTRY(VFW_S_RESOURCE_NOT_NEEDED);
ENTRY(VFW_E_MEDIA_TIME_NOT_SET);
ENTRY(VFW_E_NO_TIME_FORMAT_SET);
ENTRY(VFW_E_MONO_AUDIO_HW);
ENTRY(VFW_S_MEDIA_TYPE_IGNORED);
ENTRY(VFW_E_NO_DECOMPRESSOR);
ENTRY(VFW_E_NO_AUDIO_HARDWARE);
ENTRY(VFW_S_VIDEO_NOT_RENDERED);
ENTRY(VFW_S_AUDIO_NOT_RENDERED);
ENTRY(VFW_E_RPZA);
ENTRY(VFW_S_RPZA);
ENTRY(VFW_E_PROCESSOR_NOT_SUITABLE);
ENTRY(VFW_E_UNSUPPORTED_AUDIO);
ENTRY(VFW_E_UNSUPPORTED_VIDEO);
ENTRY(VFW_E_MPEG_NOT_CONSTRAINED);
ENTRY(VFW_E_NOT_IN_GRAPH);
ENTRY(VFW_S_ESTIMATED);
ENTRY(VFW_E_NO_TIME_FORMAT);
ENTRY(VFW_E_READ_ONLY);
ENTRY(VFW_S_RESERVED);
ENTRY(VFW_E_BUFFER_UNDERFLOW);
ENTRY(VFW_E_UNSUPPORTED_STREAM);
ENTRY(VFW_E_NO_TRANSPORT);
ENTRY(VFW_S_STREAM_OFF);
ENTRY(VFW_S_CANT_CUE);
ENTRY(VFW_E_BAD_VIDEOCD);
ENTRY(VFW_S_NO_STOP_TIME);
ENTRY(VFW_E_OUT_OF_VIDEO_MEMORY);
ENTRY(VFW_E_VP_NEGOTIATION_FAILED);
ENTRY(VFW_E_DDRAW_CAPS_NOT_SUITABLE);
ENTRY(VFW_E_NO_VP_HARDWARE);
ENTRY(VFW_E_NO_CAPTURE_HARDWARE);
ENTRY(VFW_E_DVD_OPERATION_INHIBITED);
ENTRY(VFW_E_DVD_INVALIDDOMAIN);
ENTRY(VFW_E_DVD_NO_BUTTON);
ENTRY(VFW_E_DVD_GRAPHNOTREADY);
ENTRY(VFW_E_DVD_RENDERFAIL);
ENTRY(VFW_E_DVD_DECNOTENOUGH);
ENTRY(VFW_E_DDRAW_VERSION_NOT_SUITABLE);
ENTRY(VFW_E_COPYPROT_FAILED);
ENTRY(VFW_S_NOPREVIEWPIN);
ENTRY(VFW_E_TIME_EXPIRED);
ENTRY(VFW_S_DVD_NON_ONE_SEQUENTIAL);
ENTRY(VFW_E_DVD_WRONG_SPEED);
ENTRY(VFW_E_DVD_MENU_DOES_NOT_EXIST);
ENTRY(VFW_E_DVD_CMD_CANCELLED);
ENTRY(VFW_E_DVD_STATE_WRONG_VERSION);
ENTRY(VFW_E_DVD_STATE_CORRUPT);
ENTRY(VFW_E_DVD_STATE_WRONG_DISC);
ENTRY(VFW_E_DVD_INCOMPATIBLE_REGION);
ENTRY(VFW_E_DVD_NO_ATTRIBUTES);
ENTRY(VFW_E_DVD_NO_GOUP_PGC);
ENTRY(VFW_E_DVD_LOW_PARENTAL_LEVEL);
ENTRY(VFW_E_DVD_NOT_IN_KARAOKE_MODE);
ENTRY(VFW_S_DVD_CHANNEL_CONTENTS_NOT_AVAILABLE);
ENTRY(VFW_S_DVD_NOT_ACCURATE);
ENTRY(VFW_E_FRAME_STEP_UNSUPPORTED);
ENTRY(VFW_E_DVD_STREAM_DISABLED);
ENTRY(VFW_E_DVD_TITLE_UNKNOWN);
ENTRY(VFW_E_DVD_INVALID_DISC);
ENTRY(VFW_E_DVD_NO_RESUME_INFORMATION);
ENTRY(VFW_E_PIN_ALREADY_BLOCKED_ON_THIS_THREAD);
ENTRY(VFW_E_PIN_ALREADY_BLOCKED);
ENTRY(VFW_E_CERTIFICATION_FAILURE);
#undef ENTRY
}
return NULL;
}
/***********************************************************************
* AMGetErrorTextA (quartz.@)
*/
DWORD WINAPI AMGetErrorTextA(HRESULT hr, LPSTR pszbuf, DWORD dwBufLen)
{
LPCSTR lpszRes;
DWORD len;
lpszRes = hresult_to_string( hr );
if ( lpszRes == NULL )
return 0;
len = (DWORD)(strlen(lpszRes)+1);
if ( len > dwBufLen )
return 0;
memcpy( pszbuf, lpszRes, len );
return len;
}
/***********************************************************************
* AMGetErrorTextW (quartz.@)
*/
DWORD WINAPI AMGetErrorTextW(HRESULT hr, LPWSTR pwszbuf, DWORD dwBufLen)
{
CHAR szBuf[MAX_ERROR_TEXT_LEN+1];
DWORD dwLen;
dwLen = AMGetErrorTextA(hr,szBuf,MAX_ERROR_TEXT_LEN);
if ( dwLen == 0 )
return 0;
szBuf[dwLen] = 0;
QUARTZ_strncpyAtoW( pwszbuf, szBuf, dwBufLen );
return lstrlenW( pwszbuf );
}
/* all codes are removed by author */

View File

@ -1,464 +0,0 @@
/*
* Implementation of CLSID_MemoryAllocator.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "strmif.h"
#include "uuids.h"
#include "vfwmsgs.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "memalloc.h"
/***************************************************************************
*
* new/delete for CLSID_MemoryAllocator.
*
*/
/* can I use offsetof safely? - FIXME? */
static QUARTZ_IFEntry IFEntries[] =
{
{ &IID_IMemAllocator, offsetof(CMemoryAllocator,memalloc)-offsetof(CMemoryAllocator,unk) },
};
static void QUARTZ_DestroyMemoryAllocator(IUnknown* punk)
{
CMemoryAllocator_THIS(punk,unk);
CMemoryAllocator_UninitIMemAllocator( This );
}
HRESULT QUARTZ_CreateMemoryAllocator(IUnknown* punkOuter,void** ppobj)
{
CMemoryAllocator* pma;
HRESULT hr;
TRACE("(%p,%p)\n",punkOuter,ppobj);
pma = (CMemoryAllocator*)QUARTZ_AllocObj( sizeof(CMemoryAllocator) );
if ( pma == NULL )
return E_OUTOFMEMORY;
QUARTZ_IUnkInit( &pma->unk, punkOuter );
hr = CMemoryAllocator_InitIMemAllocator( pma );
if ( FAILED(hr) )
{
QUARTZ_FreeObj( pma );
return hr;
}
pma->unk.pEntries = IFEntries;
pma->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
pma->unk.pOnFinalRelease = QUARTZ_DestroyMemoryAllocator;
*ppobj = (void*)(&pma->unk);
return S_OK;
}
/***************************************************************************
*
* CMemoryAllocator::IMemAllocator
*
*/
static HRESULT
IMemAllocator_LockUnusedBuffer(CMemoryAllocator* This,IMediaSample** ppSample)
{
HRESULT hr = E_FAIL;
LONG i;
TRACE("(%p) try to enter critical section\n",This);
EnterCriticalSection( &This->csMem );
TRACE("(%p) enter critical section\n",This);
if ( This->pData == NULL || This->ppSamples == NULL ||
This->prop.cBuffers <= 0 )
{
hr = VFW_E_NOT_COMMITTED;
goto end;
}
for ( i = 0; i < This->prop.cBuffers; i++ )
{
if ( This->ppSamples[i] == NULL )
{
hr = VFW_E_NOT_COMMITTED;
goto end;
}
if ( This->ppSamples[i]->ref == 0 )
{
*ppSample = (IMediaSample*)(This->ppSamples[i]);
IMediaSample_AddRef( *ppSample );
hr = NOERROR;
goto end;
}
}
hr = VFW_E_TIMEOUT;
end:
LeaveCriticalSection( &This->csMem );
TRACE("(%p) leave critical section\n",This);
return hr;
}
/* TRUE = all samples are released */
static BOOL
IMemAllocator_ReleaseUnusedBuffer(CMemoryAllocator* This)
{
LONG i;
BOOL bRet = TRUE;
TRACE("(%p) try to enter critical section\n",This);
EnterCriticalSection( &This->csMem );
TRACE("(%p) enter critical section\n",This);
if ( This->pData == NULL || This->ppSamples == NULL ||
This->prop.cBuffers <= 0 )
goto end;
for ( i = 0; i < This->prop.cBuffers; i++ )
{
if ( This->ppSamples[i]->ref == 0 )
{
QUARTZ_DestroyMemMediaSample( This->ppSamples[i] );
This->ppSamples[i] = NULL;
}
else
{
bRet = FALSE;
}
}
if ( bRet )
{
QUARTZ_FreeMem(This->ppSamples);
This->ppSamples = NULL;
QUARTZ_FreeMem(This->pData);
This->pData = NULL;
}
end:
LeaveCriticalSection( &This->csMem );
TRACE("(%p) leave critical section\n",This);
return bRet;
}
static HRESULT WINAPI
IMemAllocator_fnQueryInterface(IMemAllocator* iface,REFIID riid,void** ppobj)
{
CMemoryAllocator_THIS(iface,memalloc);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IMemAllocator_fnAddRef(IMemAllocator* iface)
{
CMemoryAllocator_THIS(iface,memalloc);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IMemAllocator_fnRelease(IMemAllocator* iface)
{
CMemoryAllocator_THIS(iface,memalloc);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IMemAllocator_fnSetProperties(IMemAllocator* iface,ALLOCATOR_PROPERTIES* pPropReq,ALLOCATOR_PROPERTIES* pPropActual)
{
CMemoryAllocator_THIS(iface,memalloc);
long padding;
HRESULT hr;
TRACE( "(%p)->(%p,%p)\n", This, pPropReq, pPropActual );
if ( pPropReq == NULL || pPropActual == NULL )
return E_POINTER;
if ( pPropReq->cBuffers <= 0 ||
pPropReq->cbBuffer <= 0 ||
pPropReq->cbAlign < 0 ||
pPropReq->cbPrefix < 0 )
{
TRACE("pPropReq is invalid\n");
return E_INVALIDARG;
}
if ( pPropReq->cbAlign == 0 ||
( pPropReq->cbAlign & (pPropReq->cbAlign-1) ) != 0 )
{
WARN("cbAlign is invalid - %ld\n",pPropReq->cbAlign);
return VFW_E_BADALIGN;
}
hr = NOERROR;
EnterCriticalSection( &This->csMem );
if ( This->pData != NULL || This->ppSamples != NULL )
{
/* if commited, properties must not be changed. */
TRACE("already commited\n");
hr = E_UNEXPECTED;
goto end;
}
This->prop.cBuffers = pPropReq->cBuffers;
This->prop.cbBuffer = pPropReq->cbBuffer;
This->prop.cbAlign = pPropReq->cbAlign;
This->prop.cbPrefix = pPropReq->cbPrefix;
if ( This->prop.cbAlign == 0 )
This->prop.cbAlign = 1;
padding = This->prop.cbAlign -
( (This->prop.cbBuffer+This->prop.cbPrefix) % This->prop.cbAlign );
This->prop.cbBuffer += padding;
memcpy( pPropActual, &This->prop, sizeof(ALLOCATOR_PROPERTIES) );
end:
LeaveCriticalSection( &This->csMem );
TRACE("returned successfully.\n");
return hr;
}
static HRESULT WINAPI
IMemAllocator_fnGetProperties(IMemAllocator* iface,ALLOCATOR_PROPERTIES* pProp)
{
CMemoryAllocator_THIS(iface,memalloc);
TRACE( "(%p)->(%p)\n", This, pProp );
if ( pProp == NULL )
return E_POINTER;
EnterCriticalSection( &This->csMem );
memcpy( pProp, &This->prop, sizeof(ALLOCATOR_PROPERTIES) );
LeaveCriticalSection( &This->csMem );
return NOERROR;
}
static HRESULT WINAPI
IMemAllocator_fnCommit(IMemAllocator* iface)
{
CMemoryAllocator_THIS(iface,memalloc);
HRESULT hr;
LONG lBufSize;
LONG i;
BYTE* pCur;
TRACE( "(%p)->()\n", This );
EnterCriticalSection( &This->csMem );
hr = NOERROR;
/* FIXME - handle in Decommitting */
if ( This->pData != NULL || This->ppSamples != NULL ||
This->prop.cBuffers <= 0 )
goto end;
lBufSize = This->prop.cBuffers *
(This->prop.cbBuffer + This->prop.cbPrefix) +
This->prop.cbAlign;
if ( lBufSize <= 0 )
lBufSize = 1;
This->pData = (BYTE*)QUARTZ_AllocMem( lBufSize );
if ( This->pData == NULL )
{
hr = E_OUTOFMEMORY;
goto end;
}
This->ppSamples = (CMemMediaSample**)QUARTZ_AllocMem(
sizeof(CMemMediaSample*) * This->prop.cBuffers );
if ( This->ppSamples == NULL )
{
hr = E_OUTOFMEMORY;
goto end;
}
for ( i = 0; i < This->prop.cBuffers; i++ )
This->ppSamples[i] = NULL;
pCur = This->pData + This->prop.cbAlign - ((This->pData-(BYTE*)NULL) & (This->prop.cbAlign-1));
for ( i = 0; i < This->prop.cBuffers; i++ )
{
hr = QUARTZ_CreateMemMediaSample(
pCur, (This->prop.cbBuffer + This->prop.cbPrefix),
iface, &This->ppSamples[i] );
if ( FAILED(hr) )
goto end;
pCur += (This->prop.cbBuffer + This->prop.cbPrefix);
}
hr = NOERROR;
end:
if ( FAILED(hr) )
IMemAllocator_Decommit(iface);
LeaveCriticalSection( &This->csMem );
return hr;
}
static HRESULT WINAPI
IMemAllocator_fnDecommit(IMemAllocator* iface)
{
CMemoryAllocator_THIS(iface,memalloc);
TRACE( "(%p)->()\n", This );
while ( 1 )
{
ResetEvent( This->hEventSample );
/* to avoid deadlock, don't hold critical section while blocking */
if ( IMemAllocator_ReleaseUnusedBuffer(This) )
break;
WaitForSingleObject( This->hEventSample, INFINITE );
}
return NOERROR;
}
static HRESULT WINAPI
IMemAllocator_fnGetBuffer(IMemAllocator* iface,IMediaSample** ppSample,REFERENCE_TIME* prtStart,REFERENCE_TIME* prtEnd,DWORD dwFlags)
{
CMemoryAllocator_THIS(iface,memalloc);
HRESULT hr;
TRACE( "(%p)->(%p,%p,%p,%lu)\n", This, ppSample, prtStart, prtEnd, dwFlags );
if ( ppSample == NULL )
return E_POINTER;
while ( 1 )
{
ResetEvent( This->hEventSample );
/* to avoid deadlock, don't hold critical section while blocking */
hr = IMemAllocator_LockUnusedBuffer(This,ppSample);
if ( ( hr != VFW_E_TIMEOUT ) || ( dwFlags & AM_GBF_NOWAIT ) )
goto end;
WaitForSingleObject( This->hEventSample, INFINITE );
}
end:
return hr;
}
static HRESULT WINAPI
IMemAllocator_fnReleaseBuffer(IMemAllocator* iface,IMediaSample* pSample)
{
CMemoryAllocator_THIS(iface,memalloc);
TRACE( "(%p)->(%p)\n", This, pSample );
SetEvent( This->hEventSample );
return NOERROR;
}
static ICOM_VTABLE(IMemAllocator) imemalloc =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IMemAllocator_fnQueryInterface,
IMemAllocator_fnAddRef,
IMemAllocator_fnRelease,
/* IMemAllocator fields */
IMemAllocator_fnSetProperties,
IMemAllocator_fnGetProperties,
IMemAllocator_fnCommit,
IMemAllocator_fnDecommit,
IMemAllocator_fnGetBuffer,
IMemAllocator_fnReleaseBuffer,
};
HRESULT CMemoryAllocator_InitIMemAllocator( CMemoryAllocator* pma )
{
TRACE("(%p)\n",pma);
ICOM_VTBL(&pma->memalloc) = &imemalloc;
ZeroMemory( &pma->prop, sizeof(pma->prop) );
pma->hEventSample = (HANDLE)NULL;
pma->pData = NULL;
pma->ppSamples = NULL;
pma->hEventSample = CreateEventA( NULL, TRUE, FALSE, NULL );
if ( pma->hEventSample == (HANDLE)NULL )
return E_OUTOFMEMORY;
InitializeCriticalSection( &pma->csMem );
return NOERROR;
}
void CMemoryAllocator_UninitIMemAllocator( CMemoryAllocator* pma )
{
TRACE("(%p)\n",pma);
IMemAllocator_Decommit( (IMemAllocator*)(&pma->memalloc) );
DeleteCriticalSection( &pma->csMem );
if ( pma->hEventSample != (HANDLE)NULL )
CloseHandle( pma->hEventSample );
}

View File

@ -1,61 +0,0 @@
/*
* Copyright (C) Hidenori TAKESHIMA
*
* 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 WINE_DSHOW_MEMALLOC_H
#define WINE_DSHOW_MEMALLOC_H
/*
implements CLSID_MemoryAllocator.
- At least, the following interfaces should be implemented:
IUnknown
+ IMemAllocator
*/
#include "iunk.h"
#include "sample.h"
typedef struct MA_IMemAllocatorImpl
{
ICOM_VFIELD(IMemAllocator);
} MA_IMemAllocatorImpl;
typedef struct CMemoryAllocator
{
QUARTZ_IUnkImpl unk;
MA_IMemAllocatorImpl memalloc;
/* IMemAllocator fields. */
CRITICAL_SECTION csMem;
ALLOCATOR_PROPERTIES prop;
HANDLE hEventSample;
BYTE* pData;
CMemMediaSample** ppSamples;
} CMemoryAllocator;
#define CMemoryAllocator_THIS(iface,member) CMemoryAllocator* This = ((CMemoryAllocator*)(((char*)iface)-offsetof(CMemoryAllocator,member)))
HRESULT QUARTZ_CreateMemoryAllocator(IUnknown* punkOuter,void** ppobj);
HRESULT CMemoryAllocator_InitIMemAllocator( CMemoryAllocator* pma );
void CMemoryAllocator_UninitIMemAllocator( CMemoryAllocator* pma );
#endif /* WINE_DSHOW_MEMALLOC_H */

View File

@ -1,191 +0,0 @@
/*
* Implements MIDI Parser.
*
* FIXME - stub
* FIXME - no seeking
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "mmsystem.h"
#include "vfw.h"
#include "winerror.h"
#include "strmif.h"
#include "control.h"
#include "vfwmsgs.h"
#include "amvideo.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "parser.h"
#include "mtype.h"
static const WCHAR QUARTZ_MIDIParser_Name[] =
{ 'Q','u','i','c','k','T','i','m','e',' ','M','o','v','i','e',' ','P','a','r','s','e','r',0 };
static const WCHAR QUARTZ_MIDIParserInPin_Name[] =
{ 'I','n',0 };
static const WCHAR QUARTZ_MIDIParserOutPin_Name[] =
{ 'O','u','t',0 };
/****************************************************************************
*
* CMIDIParseImpl
*/
typedef struct CMIDIParseImpl CMIDIParseImpl;
struct CMIDIParseImpl
{
};
static HRESULT CMIDIParseImpl_InitParser( CParserImpl* pImpl, ULONG* pcStreams )
{
WARN("(%p,%p) stub\n",pImpl,pcStreams);
return E_NOTIMPL;
}
static HRESULT CMIDIParseImpl_UninitParser( CParserImpl* pImpl )
{
CMIDIParseImpl* This = (CMIDIParseImpl*)pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This == NULL )
return NOERROR;
/* destruct */
QUARTZ_FreeMem( This );
pImpl->m_pUserData = NULL;
return NOERROR;
}
static LPCWSTR CMIDIParseImpl_GetOutPinName( CParserImpl* pImpl, ULONG nStreamIndex )
{
CMIDIParseImpl* This = (CMIDIParseImpl*)pImpl->m_pUserData;
TRACE("(%p,%lu)\n",This,nStreamIndex);
return QUARTZ_MIDIParserOutPin_Name;
}
static HRESULT CMIDIParseImpl_GetStreamType( CParserImpl* pImpl, ULONG nStreamIndex, AM_MEDIA_TYPE* pmt )
{
CMIDIParseImpl* This = (CMIDIParseImpl*)pImpl->m_pUserData;
FIXME("(%p) stub\n",This);
return E_NOTIMPL;
}
static HRESULT CMIDIParseImpl_CheckStreamType( CParserImpl* pImpl, ULONG nStreamIndex, const AM_MEDIA_TYPE* pmt )
{
CMIDIParseImpl* This = (CMIDIParseImpl*)pImpl->m_pUserData;
FIXME("(%p) stub\n",This);
return E_NOTIMPL;
}
static HRESULT CMIDIParseImpl_GetAllocProp( CParserImpl* pImpl, ALLOCATOR_PROPERTIES* pReqProp )
{
CMIDIParseImpl* This = (CMIDIParseImpl*)pImpl->m_pUserData;
FIXME("(%p,%p) stub\n",This,pReqProp);
if ( This == NULL )
return E_UNEXPECTED;
return E_NOTIMPL;
}
static HRESULT CMIDIParseImpl_GetNextRequest( CParserImpl* pImpl, ULONG* pnStreamIndex, LONGLONG* pllStart, LONG* plLength, REFERENCE_TIME* prtStart, REFERENCE_TIME* prtStop, DWORD* pdwSampleFlags )
{
CMIDIParseImpl* This = (CMIDIParseImpl*)pImpl->m_pUserData;
FIXME("(%p) stub\n",This);
if ( This == NULL )
return E_UNEXPECTED;
return E_NOTIMPL;
}
static HRESULT CMIDIParseImpl_ProcessSample( CParserImpl* pImpl, ULONG nStreamIndex, LONGLONG llStart, LONG lLength, IMediaSample* pSample )
{
CMIDIParseImpl* This = (CMIDIParseImpl*)pImpl->m_pUserData;
FIXME("(%p,%lu,%ld,%ld,%p)\n",This,nStreamIndex,(long)llStart,lLength,pSample);
if ( This == NULL )
return E_UNEXPECTED;
return E_NOTIMPL;
}
static const struct ParserHandlers CMIDIParseImpl_Handlers =
{
CMIDIParseImpl_InitParser,
CMIDIParseImpl_UninitParser,
CMIDIParseImpl_GetOutPinName,
CMIDIParseImpl_GetStreamType,
CMIDIParseImpl_CheckStreamType,
CMIDIParseImpl_GetAllocProp,
CMIDIParseImpl_GetNextRequest,
CMIDIParseImpl_ProcessSample,
/* for IQualityControl */
NULL, /* pQualityNotify */
/* for seeking */
NULL, /* pGetSeekingCaps */
NULL, /* pIsTimeFormatSupported */
NULL, /* pGetCurPos */
NULL, /* pSetCurPos */
NULL, /* pGetDuration */
NULL, /* pGetStopPos */
NULL, /* pSetStopPos */
NULL, /* pGetPreroll */
};
HRESULT QUARTZ_CreateMIDIParser(IUnknown* punkOuter,void** ppobj)
{
return QUARTZ_CreateParser(
punkOuter,ppobj,
&CLSID_quartzMIDIParser,
QUARTZ_MIDIParser_Name,
QUARTZ_MIDIParserInPin_Name,
&CMIDIParseImpl_Handlers );
}

View File

@ -1,406 +0,0 @@
/*
* Implements AVI MJPG Decompressor.
*
* FIXME - stub
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "vfw.h"
#include "strmif.h"
#include "control.h"
#include "amvideo.h"
#include "vfwmsgs.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "xform.h"
#include "ijgdec.h"
static const WCHAR MJPGDec_FilterName[] =
{'M','J','P','G',' ','D','e','c','o','m','p','r','e','s','s','o','r',0};
typedef struct CMJPGDecImpl
{
AM_MEDIA_TYPE* m_pmtConv;
DWORD m_cConv;
BITMAPINFOHEADER m_biOut;
} CMJPGDecImpl;
static const BYTE jpeg_standard_dht_data[0x1f+0xb5+0x1f+0xb5+2*4] =
{
0xff, 0xc4, 0x00, 0x1f, 0x00,
0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b,
0xff, 0xc4, 0x00, 0xb5, 0x10,
0x00, 0x02, 0x01, 0x03, 0x03, 0x02, 0x04, 0x03,
0x05, 0x05, 0x04, 0x04, 0x00, 0x00, 0x01, 0x7d,
0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12,
0x21, 0x31, 0x41, 0x06, 0x13, 0x51, 0x61, 0x07,
0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1, 0x08,
0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16,
0x17, 0x18, 0x19, 0x1a, 0x25, 0x26, 0x27, 0x28,
0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49,
0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69,
0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79,
0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89,
0x8a, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98,
0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5,
0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4,
0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea,
0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
0xf9, 0xfa,
0xff, 0xc4, 0x00, 0x1f, 0x01,
0x00, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b,
0xff, 0xc4, 0x00, 0xb5, 0x11,
0x00, 0x02, 0x01, 0x02, 0x04, 0x04, 0x03, 0x04,
0x07, 0x05, 0x04, 0x04, 0x00, 0x01, 0x02, 0x77,
0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21,
0x31, 0x06, 0x12, 0x41, 0x51, 0x07, 0x61, 0x71,
0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0,
0x15, 0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34,
0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19, 0x1a, 0x26,
0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38,
0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48,
0x49, 0x4a, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58,
0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
0x88, 0x89, 0x8a, 0x92, 0x93, 0x94, 0x95, 0x96,
0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4,
0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3,
0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xd2,
0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9,
0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8,
0xf9, 0xfa,
};
/***************************************************************************
*
* CMJPGDecImpl methods
*
*/
static void MJPGDec_FreeOutTypes(CMJPGDecImpl* This)
{
DWORD i;
if ( This->m_pmtConv == NULL )
return;
TRACE("cConv = %lu\n",This->m_cConv);
for ( i = 0; i < This->m_cConv; i++ )
{
QUARTZ_MediaType_Free(&This->m_pmtConv[i]);
}
QUARTZ_FreeMem(This->m_pmtConv);
This->m_pmtConv = NULL;
This->m_cConv = 0;
}
static HRESULT MJPGDec_Init( CTransformBaseImpl* pImpl )
{
CMJPGDecImpl* This = pImpl->m_pUserData;
if ( This != NULL )
return NOERROR;
This = (CMJPGDecImpl*)QUARTZ_AllocMem( sizeof(CMJPGDecImpl) );
if ( This == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This, sizeof(CMJPGDecImpl) );
pImpl->m_pUserData = This;
/* construct */
This->m_pmtConv = NULL;
This->m_cConv = 0;
return NOERROR;
}
static HRESULT MJPGDec_Cleanup( CTransformBaseImpl* pImpl )
{
CMJPGDecImpl* This = pImpl->m_pUserData;
if ( This == NULL )
return NOERROR;
/* destruct */
MJPGDec_FreeOutTypes(This);
QUARTZ_FreeMem( This );
pImpl->m_pUserData = NULL;
return NOERROR;
}
static HRESULT MJPGDec_CheckMediaType( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut )
{
CMJPGDecImpl* This = pImpl->m_pUserData;
const BITMAPINFOHEADER* pbiIn = NULL;
const BITMAPINFOHEADER* pbiOut = NULL;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
if ( !IsEqualGUID( &pmtIn->majortype, &MEDIATYPE_Video ) )
return E_FAIL;
if ( !IsEqualGUID( &pmtIn->formattype, &FORMAT_VideoInfo ) )
return E_FAIL;
pbiIn = (&((const VIDEOINFOHEADER*)pmtIn->pbFormat)->bmiHeader);
if ( pbiIn->biCompression != mmioFOURCC('M','J','P','G') &&
pbiIn->biCompression != mmioFOURCC('m','j','p','g') )
return E_FAIL;
if ( pbiIn->biBitCount != 24 )
return E_FAIL;
if ( pmtOut != NULL )
{
if ( !IsEqualGUID( &pmtOut->majortype, &MEDIATYPE_Video ) )
return E_FAIL;
if ( !IsEqualGUID( &pmtOut->formattype, &FORMAT_VideoInfo ) )
return E_FAIL;
if ( !IsEqualGUID( &pmtOut->subtype, &MEDIASUBTYPE_RGB24 ) )
return E_FAIL;
pbiOut = (&((const VIDEOINFOHEADER*)pmtOut->pbFormat)->bmiHeader);
if ( pbiOut->biCompression != 0 )
return E_FAIL;
if ( pbiIn->biWidth != pbiOut->biWidth ||
pbiIn->biHeight != pbiOut->biHeight ||
pbiIn->biPlanes != 1 || pbiOut->biPlanes != 1 ||
pbiOut->biBitCount != pbiIn->biBitCount )
return E_FAIL;
}
return S_OK;
}
static HRESULT MJPGDec_GetOutputTypes( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE** ppmtAcceptTypes, ULONG* pcAcceptTypes )
{
CMJPGDecImpl* This = pImpl->m_pUserData;
HRESULT hr;
DWORD dwIndex;
const BITMAPINFOHEADER* pbiIn = NULL;
BITMAPINFOHEADER* pbiOut = NULL;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = MJPGDec_CheckMediaType( pImpl, pmtIn, NULL );
if ( FAILED(hr) )
return hr;
pbiIn = (&((const VIDEOINFOHEADER*)pmtIn->pbFormat)->bmiHeader);
MJPGDec_FreeOutTypes(This);
This->m_cConv = 1;
This->m_pmtConv = (AM_MEDIA_TYPE*)QUARTZ_AllocMem( sizeof(AM_MEDIA_TYPE) );
if ( This->m_pmtConv == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This->m_pmtConv, sizeof(AM_MEDIA_TYPE) * 1 );
dwIndex = 0;
memcpy( &This->m_pmtConv[dwIndex].majortype, &MEDIATYPE_Video, sizeof(GUID) );
memcpy( &This->m_pmtConv[dwIndex].subtype, &MEDIASUBTYPE_RGB24, sizeof(GUID) );
This->m_pmtConv[dwIndex].bFixedSizeSamples = 1;
This->m_pmtConv[dwIndex].bTemporalCompression = 0;
This->m_pmtConv[dwIndex].lSampleSize = DIBSIZE(*pbiIn);
memcpy( &This->m_pmtConv[dwIndex].formattype, &FORMAT_VideoInfo, sizeof(GUID) );
This->m_pmtConv[dwIndex].cbFormat = sizeof(VIDEOINFO);
This->m_pmtConv[dwIndex].pbFormat = (BYTE*)CoTaskMemAlloc( This->m_pmtConv[dwIndex].cbFormat );
if ( This->m_pmtConv[dwIndex].pbFormat == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This->m_pmtConv[dwIndex].pbFormat, This->m_pmtConv[dwIndex].cbFormat );
pbiOut = &(((VIDEOINFOHEADER*)(This->m_pmtConv[dwIndex].pbFormat))->bmiHeader);
pbiOut->biSize = sizeof(BITMAPINFOHEADER);
pbiOut->biWidth = pbiIn->biWidth;
pbiOut->biHeight = pbiIn->biHeight;
pbiOut->biPlanes = 1;
pbiOut->biBitCount = pbiIn->biBitCount;
*ppmtAcceptTypes = This->m_pmtConv;
*pcAcceptTypes = This->m_cConv;
return S_OK;
}
static HRESULT MJPGDec_GetAllocProp( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, ALLOCATOR_PROPERTIES* pProp, BOOL* pbTransInPlace, BOOL* pbTryToReuseSample )
{
CMJPGDecImpl* This = pImpl->m_pUserData;
HRESULT hr;
const BITMAPINFOHEADER* pbiOut = NULL;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = MJPGDec_CheckMediaType( pImpl, pmtIn, NULL );
if ( FAILED(hr) )
return hr;
pbiOut = (&((const VIDEOINFOHEADER*)pmtOut->pbFormat)->bmiHeader);
pProp->cBuffers = 1;
pProp->cbBuffer = DIBSIZE(*pbiOut);
return S_OK;
}
static HRESULT MJPGDec_BeginTransform( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, BOOL bReuseSample )
{
CMJPGDecImpl* This = pImpl->m_pUserData;
HRESULT hr;
const BITMAPINFOHEADER* pbiOut = NULL;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = MJPGDec_CheckMediaType( pImpl, pmtIn, NULL );
if ( FAILED(hr) )
return hr;
ZeroMemory( &This->m_biOut, sizeof(BITMAPINFOHEADER) );
pbiOut = (&((const VIDEOINFOHEADER*)pmtOut->pbFormat)->bmiHeader);
memcpy( &This->m_biOut, pbiOut, sizeof(BITMAPINFOHEADER) );
return S_OK;
}
static HRESULT MJPGDec_Transform( CTransformBaseImpl* pImpl, IMediaSample* pSampIn, IMediaSample* pSampOut )
{
CMJPGDecImpl* This = pImpl->m_pUserData;
BYTE* pDataIn = NULL;
BYTE* pDataOut = NULL;
LONG lDataInLen;
LONG outpitch;
HRESULT hr;
const char* psrcs[3];
int lenofsrcs[3];
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = IMediaSample_GetPointer( pSampIn, &pDataIn );
if ( FAILED(hr) )
return hr;
lDataInLen = IMediaSample_GetActualDataLength( pSampIn );
if ( lDataInLen < 4 )
return E_FAIL;
hr = IMediaSample_GetPointer( pSampOut, &pDataOut );
if ( FAILED(hr) )
return hr;
IMediaSample_SetActualDataLength( pSampOut, DIBSIZE(This->m_biOut) );
if ( pDataIn[0] != 0xff || pDataIn[1] != 0xd8 )
return E_FAIL;
psrcs[0] = (const char*)&pDataIn[0];
psrcs[1] = (const char*)jpeg_standard_dht_data;
psrcs[2] = (const char*)&pDataIn[2];
lenofsrcs[0] = 2;
lenofsrcs[1] = sizeof(jpeg_standard_dht_data);
lenofsrcs[2] = lDataInLen - 2;
outpitch = DIBWIDTHBYTES(This->m_biOut);
if ( 0 > IJGDEC_Decode(
pDataOut + (This->m_biOut.biHeight-1) * outpitch, - outpitch,
This->m_biOut.biWidth, This->m_biOut.biHeight,
This->m_biOut.biBitCount,
&psrcs[0], &lenofsrcs[0], 3 ) )
{
return E_FAIL;
}
return S_OK;
}
static HRESULT MJPGDec_EndTransform( CTransformBaseImpl* pImpl )
{
CMJPGDecImpl* This = pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
ZeroMemory( &This->m_biOut, sizeof(BITMAPINFOHEADER) );
return S_OK;
}
static const TransformBaseHandlers transhandlers =
{
MJPGDec_Init,
MJPGDec_Cleanup,
MJPGDec_CheckMediaType,
MJPGDec_GetOutputTypes,
MJPGDec_GetAllocProp,
MJPGDec_BeginTransform,
NULL,
MJPGDec_Transform,
MJPGDec_EndTransform,
};
HRESULT QUARTZ_CreateMJPGDecompressor(IUnknown* punkOuter,void** ppobj)
{
return QUARTZ_CreateTransformBase(
punkOuter,ppobj,
&CLSID_quartzMJPGDecompressor,
MJPGDec_FilterName,
NULL, NULL,
&transhandlers );
}

View File

@ -1,369 +0,0 @@
/*
* Implements MPEG Audio Decoder(CLSID_CMpegAudioCodec)
*
* FIXME - what library can we use? SMPEG??
*
* FIXME - stub
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "mmsystem.h"
#include "mmreg.h"
#include "strmif.h"
#include "control.h"
#include "amvideo.h"
#include "vfwmsgs.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "xform.h"
#include "mtype.h"
static const WCHAR CMPEGAudioDecoderImpl_FilterName[] =
{'M','P','E','G',' ','A','u','d','i','o',' ','D','e','c','o','d','e','r',0};
typedef struct CMPEGAudioDecoderImpl
{
AM_MEDIA_TYPE* pmt;
DWORD cmt;
WAVEFORMATEX wfxOut;
/* codec stuffs */
} CMPEGAudioDecoderImpl;
/*****************************************************************************
*
* codec-dependent stuffs - no codec
*
*/
#define NO_CODEC_IMPL
static void Codec_OnConstruct(CMPEGAudioDecoderImpl* This)
{
}
static void Codec_OnCleanup(CMPEGAudioDecoderImpl* This)
{
}
static HRESULT Codec_BeginTransform(CTransformBaseImpl* pImpl,CMPEGAudioDecoderImpl* This)
{
FIXME("no codec\n");
return E_NOTIMPL;
}
static HRESULT Codec_ProcessReceive(CTransformBaseImpl* pImpl,CMPEGAudioDecoderImpl* This,IMediaSample* pSampIn)
{
FIXME("no codec\n");
return E_NOTIMPL;
}
static HRESULT Codec_EndTransform(CTransformBaseImpl* pImpl,CMPEGAudioDecoderImpl* This)
{
FIXME("no codec\n");
return E_NOTIMPL;
}
/***************************************************************************
*
* CMPEGAudioDecoderImpl methods
*
*/
static void CMPEGAudioDecoderImpl_CleanupOutTypes(CMPEGAudioDecoderImpl* This)
{
DWORD i;
if ( This->pmt != NULL )
{
for ( i = 0; i < This->cmt; i++ )
{
QUARTZ_MediaType_Free(&This->pmt[i]);
}
QUARTZ_FreeMem(This->pmt);
This->pmt = NULL;
}
This->cmt = 0;
}
static HRESULT CMPEGAudioDecoderImpl_Init( CTransformBaseImpl* pImpl )
{
CMPEGAudioDecoderImpl* This = (CMPEGAudioDecoderImpl*)pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This != NULL )
return NOERROR;
This = (CMPEGAudioDecoderImpl*)QUARTZ_AllocMem( sizeof(CMPEGAudioDecoderImpl) );
if ( This == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This, sizeof(CMPEGAudioDecoderImpl) );
pImpl->m_pUserData = This;
/* construct */
This->pmt = NULL;
This->cmt = 0;
Codec_OnConstruct(This);
return S_OK;
}
static HRESULT CMPEGAudioDecoderImpl_Cleanup( CTransformBaseImpl* pImpl )
{
CMPEGAudioDecoderImpl* This = (CMPEGAudioDecoderImpl*)pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This == NULL )
return S_OK;
/* destruct */
Codec_OnCleanup(This);
CMPEGAudioDecoderImpl_CleanupOutTypes(This);
QUARTZ_FreeMem( This );
pImpl->m_pUserData = NULL;
return S_OK;
}
static HRESULT CMPEGAudioDecoderImpl_CheckMediaType( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut )
{
CMPEGAudioDecoderImpl* This = (CMPEGAudioDecoderImpl*)pImpl->m_pUserData;
const WAVEFORMATEX* pwfxIn;
const WAVEFORMATEX* pwfxOut;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
if ( !IsEqualGUID( &pmtIn->majortype, &MEDIATYPE_Audio ) )
return E_FAIL;
if ( !IsEqualGUID( &pmtIn->formattype, &FORMAT_WaveFormatEx ) )
return E_FAIL;
if ( pmtIn->pbFormat == NULL ||
pmtIn->cbFormat < sizeof(WAVEFORMATEX) )
return E_FAIL;
pwfxIn = (const WAVEFORMATEX*)pmtIn->pbFormat;
if ( pwfxIn->wFormatTag != WAVE_FORMAT_MPEG &&
pwfxIn->wFormatTag != WAVE_FORMAT_MPEGLAYER3 )
return E_FAIL;
if ( pwfxIn->nChannels != 1 && pwfxIn->nChannels != 2 )
return E_FAIL;
if ( pwfxIn->nBlockAlign < 1 )
return E_FAIL;
if ( pmtOut != NULL )
{
if ( !IsEqualGUID( &pmtOut->majortype, &MEDIATYPE_Audio ) )
return E_FAIL;
if ( !IsEqualGUID( &pmtOut->formattype, &FORMAT_WaveFormatEx ) )
return E_FAIL;
if ( pmtOut->pbFormat == NULL ||
pmtOut->cbFormat < sizeof(WAVEFORMATEX) )
return E_FAIL;
pwfxOut = (const WAVEFORMATEX*)pmtOut->pbFormat;
if ( pwfxOut->wFormatTag != WAVE_FORMAT_PCM )
return E_FAIL;
if ( pwfxOut->nChannels != pwfxIn->nChannels ||
pwfxOut->nSamplesPerSec != pwfxIn->nSamplesPerSec )
return E_FAIL;
if ( pwfxOut->wBitsPerSample != 16 )
return E_FAIL;
if ( pwfxOut->nBlockAlign != (pwfxOut->nChannels * pwfxOut->wBitsPerSample >> 3 ) )
return E_FAIL;
}
#ifdef NO_CODEC_IMPL
WARN("no codec implementation\n");
return E_NOTIMPL;
#else
return S_OK;
#endif
}
static HRESULT CMPEGAudioDecoderImpl_GetOutputTypes( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE** ppmtAcceptTypes, ULONG* pcAcceptTypes )
{
CMPEGAudioDecoderImpl* This = (CMPEGAudioDecoderImpl*)pImpl->m_pUserData;
HRESULT hr;
const WAVEFORMATEX* pwfxIn;
AM_MEDIA_TYPE* pmtOut;
WAVEFORMATEX* pwfxOut;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = CMPEGAudioDecoderImpl_CheckMediaType( pImpl, pmtIn, NULL );
if ( FAILED(hr) )
return hr;
pwfxIn = (const WAVEFORMATEX*)pmtIn->pbFormat;
CMPEGAudioDecoderImpl_CleanupOutTypes(This);
This->cmt = 1;
This->pmt = (AM_MEDIA_TYPE*)QUARTZ_AllocMem(
sizeof(AM_MEDIA_TYPE) * This->cmt );
if ( This->pmt == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This->pmt, sizeof(AM_MEDIA_TYPE) * This->cmt );
pmtOut = &This->pmt[0];
memcpy( &pmtOut->majortype, &MEDIATYPE_Audio, sizeof(GUID) );
memcpy( &pmtOut->subtype, &MEDIASUBTYPE_PCM, sizeof(GUID) );
memcpy( &pmtOut->formattype, &FORMAT_WaveFormatEx, sizeof(GUID) );
pmtOut->bFixedSizeSamples = 1;
pmtOut->bTemporalCompression = 0;
pmtOut->lSampleSize = pwfxIn->nChannels * 16 >> 3;
pmtOut->pbFormat = (BYTE*)CoTaskMemAlloc( sizeof(WAVEFORMATEX) );
if ( pmtOut->pbFormat == NULL )
return E_OUTOFMEMORY;
pwfxOut = (WAVEFORMATEX*)pmtOut->pbFormat;
pmtOut->cbFormat = sizeof(WAVEFORMATEX);
pwfxOut->wFormatTag = WAVE_FORMAT_PCM;
pwfxOut->nChannels = pwfxIn->nChannels;
pwfxOut->nSamplesPerSec = pwfxIn->nSamplesPerSec;
pwfxOut->nAvgBytesPerSec = pwfxOut->nSamplesPerSec * pmtOut->lSampleSize;
pwfxOut->nBlockAlign = pmtOut->lSampleSize;
pwfxOut->wBitsPerSample = 16;
pwfxOut->cbSize = 0;
*ppmtAcceptTypes = This->pmt;
*pcAcceptTypes = This->cmt;
return S_OK;
}
static HRESULT CMPEGAudioDecoderImpl_GetAllocProp( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, ALLOCATOR_PROPERTIES* pProp, BOOL* pbTransInPlace, BOOL* pbTryToReuseSample )
{
CMPEGAudioDecoderImpl* This = (CMPEGAudioDecoderImpl*)pImpl->m_pUserData;
const WAVEFORMATEX* pwfxIn;
const WAVEFORMATEX* pwfxOut;
HRESULT hr;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = CMPEGAudioDecoderImpl_CheckMediaType( pImpl, pmtIn, pmtOut );
if ( FAILED(hr) )
return hr;
pwfxIn = (const WAVEFORMATEX*)pmtIn->pbFormat;
pwfxOut = (const WAVEFORMATEX*)pmtOut->pbFormat;
pProp->cBuffers = 1;
pProp->cbBuffer = pwfxOut->nAvgBytesPerSec;
TRACE("cbBuffer %ld\n",pProp->cbBuffer);
*pbTransInPlace = FALSE;
*pbTryToReuseSample = FALSE;
return S_OK;
}
static HRESULT CMPEGAudioDecoderImpl_BeginTransform( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, BOOL bReuseSample )
{
CMPEGAudioDecoderImpl* This = (CMPEGAudioDecoderImpl*)pImpl->m_pUserData;
HRESULT hr;
TRACE("(%p,%p,%p,%d)\n",This,pmtIn,pmtOut,bReuseSample);
if ( This == NULL )
return E_UNEXPECTED;
hr = CMPEGAudioDecoderImpl_CheckMediaType( pImpl, pmtIn, pmtOut );
if ( FAILED(hr) )
return hr;
memcpy( &This->wfxOut, (const WAVEFORMATEX*)pmtOut->pbFormat, sizeof(WAVEFORMATEX) );
return Codec_BeginTransform(pImpl,This);
}
static HRESULT CMPEGAudioDecoderImpl_ProcessReceive( CTransformBaseImpl* pImpl, IMediaSample* pSampIn )
{
CMPEGAudioDecoderImpl* This = (CMPEGAudioDecoderImpl*)pImpl->m_pUserData;
TRACE("(%p,%p)\n",This,pSampIn);
if ( This == NULL )
return E_UNEXPECTED;
return Codec_ProcessReceive(pImpl,This,pSampIn);
}
static HRESULT CMPEGAudioDecoderImpl_EndTransform( CTransformBaseImpl* pImpl )
{
CMPEGAudioDecoderImpl* This = (CMPEGAudioDecoderImpl*)pImpl->m_pUserData;
HRESULT hr;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = Codec_EndTransform(pImpl,This);
if ( FAILED(hr) )
return hr;
ZeroMemory( &This->wfxOut, sizeof(WAVEFORMATEX) );
return S_OK;
}
static const TransformBaseHandlers transhandlers =
{
CMPEGAudioDecoderImpl_Init,
CMPEGAudioDecoderImpl_Cleanup,
CMPEGAudioDecoderImpl_CheckMediaType,
CMPEGAudioDecoderImpl_GetOutputTypes,
CMPEGAudioDecoderImpl_GetAllocProp,
CMPEGAudioDecoderImpl_BeginTransform,
CMPEGAudioDecoderImpl_ProcessReceive,
NULL,
CMPEGAudioDecoderImpl_EndTransform,
};
HRESULT QUARTZ_CreateCMpegAudioCodec(IUnknown* punkOuter,void** ppobj)
{
return QUARTZ_CreateTransformBase(
punkOuter,ppobj,
&CLSID_CMpegAudioCodec,
CMPEGAudioDecoderImpl_FilterName,
NULL, NULL,
&transhandlers );
}

View File

@ -1,751 +0,0 @@
/*
* Implements MPEG-1 / MPEG-2 Parser(Splitter).
*
* FIXME - no splitter implementation.
* FIXME - no packet support (implemented payload only)
* FIXME - no seeking
*
* Copyright (C) 2002 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "mmsystem.h"
#include "vfw.h"
#include "winerror.h"
#include "strmif.h"
#include "control.h"
#include "vfwmsgs.h"
#include "amvideo.h"
#include "mmreg.h"
#include "uuids.h"
#include "dvdmedia.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "parser.h"
#include "mtype.h"
static const WCHAR QUARTZ_MPEG1Parser_Name[] =
{ 'M','P','E','G','-','I',' ','S','p','l','i','t','t','e','r',0 };
static const WCHAR QUARTZ_MPEG2Parser_Name[] =
{ 'M','P','E','G','-','2',' ','S','p','l','i','t','t','e','r',0 };
static const WCHAR QUARTZ_MPGParserInPin_Name[] =
{ 'I','n',0 };
static const WCHAR QUARTZ_MPGParserOutPin_VideoPinName[] =
{ 'V','i','d','e','o',0 };
static const WCHAR QUARTZ_MPGParserOutPin_AudioPinName[] =
{ 'A','u','d','i','o',0 };
/* FIXME */
static const WCHAR QUARTZ_MPGParserOutPin_UnknownTypePinName[] =
{ 'O','u','t',0 };
static DWORD bitratesl1[16] =
{ 0, 32, 64, 96,128,160,192,224,256,288,320,352,384,416,448, 0};
static DWORD bitratesl2[16] =
{ 0, 32, 48, 56, 64, 80, 96,112,128,160,192,224,256,320,384, 0};
static DWORD bitratesl3[16] =
{ 0, 32, 40, 48, 56, 64, 80, 96,112,128,160,192,224,256,320, 0};
/****************************************************************************
*
* CMPGParseImpl
*/
typedef struct CMPGParseImpl CMPGParseImpl;
typedef struct CMPGParsePayload CMPGParsePayload;
enum MPGPayloadType
{
MPGPayload_Video = 0xe0,
MPGPayload_Audio = 0xc0,
};
struct CMPGParseImpl
{
LONGLONG llPosNext;
BOOL bRawPayload;
DWORD dwPayloadBlockSizeMax;
DWORD cPayloads;
CMPGParsePayload* pPayloads;
};
struct CMPGParsePayload
{
enum MPGPayloadType payloadtype;
BOOL bDataDiscontinuity;
};
static HRESULT CMPGParseImpl_GetStreamType( CParserImpl* pImpl, ULONG nStreamIndex, AM_MEDIA_TYPE* pmt );
static HRESULT CMPGParseImpl_SyncReadPayload(
CParserImpl* pImpl, CMPGParseImpl* This,
enum MPGPayloadType payloadtype,
LONGLONG llPosStart, LONG lLength, BYTE* pbBuf )
{
if ( This == NULL || This->pPayloads == NULL )
return E_UNEXPECTED;
if ( This->bRawPayload )
{
if ( payloadtype != This->pPayloads[0].payloadtype )
return E_UNEXPECTED;
return IAsyncReader_SyncRead( pImpl->m_pReader, llPosStart, lLength, pbBuf );
}
else
{
FIXME( "not implemented\n" );
}
return E_NOTIMPL;
}
static HRESULT CMPGParseImpl_InitParser( CParserImpl* pImpl, ULONG* pcStreams )
{
CMPGParseImpl* This = NULL;
HRESULT hr;
DWORD n;
AM_MEDIA_TYPE mt;
BYTE hdrbuf[8];
TRACE("(%p,%p)\n",pImpl,pcStreams);
This = (CMPGParseImpl*)QUARTZ_AllocMem( sizeof(CMPGParseImpl) );
if ( This == NULL )
return E_OUTOFMEMORY;
pImpl->m_pUserData = This;
ZeroMemory( This, sizeof(CMPGParseImpl) );
hr = IAsyncReader_SyncRead( pImpl->m_pReader, 0, 8, hdrbuf );
if ( FAILED(hr) )
return hr;
if ( hr != S_OK )
return E_FAIL;
if ( hdrbuf[0] == 0x00 && hdrbuf[1] == 0x00 &&
hdrbuf[2] == 0x01 && hdrbuf[3] == 0xba )
{
This->bRawPayload = FALSE;
This->dwPayloadBlockSizeMax = 0;
FIXME( "no mpeg/system support\n" );
return E_FAIL;
}
else
if ( hdrbuf[0] == 0x00 && hdrbuf[1] == 0x00 &&
hdrbuf[2] == 0x01 && hdrbuf[3] == 0xb3 )
{
TRACE( "mpeg/video payload\n" );
This->llPosNext = 0;
This->bRawPayload = TRUE;
This->dwPayloadBlockSizeMax = 0x4000;
This->cPayloads = 1;
This->pPayloads = (CMPGParsePayload*)QUARTZ_AllocMem( sizeof(CMPGParsePayload) );
if ( This->pPayloads == NULL )
return E_OUTOFMEMORY;
*pcStreams = 1;
This->pPayloads[0].payloadtype = MPGPayload_Video;
This->pPayloads[0].bDataDiscontinuity = TRUE;
}
else
if ( hdrbuf[0] == 0xff && (hdrbuf[1]&0xf0) == 0xf0 )
{
TRACE( "mpeg/audio payload\n" );
This->llPosNext = 0;
This->bRawPayload = TRUE;
This->dwPayloadBlockSizeMax = 0;
This->cPayloads = 1;
This->pPayloads = (CMPGParsePayload*)QUARTZ_AllocMem( sizeof(CMPGParsePayload) );
if ( This->pPayloads == NULL )
return E_OUTOFMEMORY;
*pcStreams = 1;
This->pPayloads[0].payloadtype = MPGPayload_Audio;
This->pPayloads[0].bDataDiscontinuity = TRUE;
}
else
{
return E_FAIL;
}
/* To determine block size, scan all payloads. */
ZeroMemory( &mt, sizeof(mt) );
for ( n = 0; n < This->cPayloads; n++ )
{
CMPGParseImpl_GetStreamType(pImpl,n,&mt);
QUARTZ_MediaType_Free(&mt);
}
return S_OK;
}
static HRESULT CMPGParseImpl_UninitParser( CParserImpl* pImpl )
{
CMPGParseImpl* This = (CMPGParseImpl*)pImpl->m_pUserData;
ULONG nIndex;
TRACE("(%p)\n",This);
if ( This == NULL )
return NOERROR;
/* destruct */
if ( This->pPayloads != NULL )
{
for ( nIndex = 0; nIndex < This->cPayloads; nIndex++ )
{
/* release this stream */
}
QUARTZ_FreeMem( This->pPayloads );
This->pPayloads = NULL;
}
QUARTZ_FreeMem( This );
pImpl->m_pUserData = NULL;
return NOERROR;
}
static LPCWSTR CMPGParseImpl_GetOutPinName( CParserImpl* pImpl, ULONG nStreamIndex )
{
CMPGParseImpl* This = (CMPGParseImpl*)pImpl->m_pUserData;
TRACE("(%p,%lu)\n",This,nStreamIndex);
if ( This == NULL || nStreamIndex >= This->cPayloads )
return NULL;
switch ( This->pPayloads[nStreamIndex].payloadtype )
{
case MPGPayload_Video:
return QUARTZ_MPGParserOutPin_VideoPinName;
case MPGPayload_Audio:
return QUARTZ_MPGParserOutPin_AudioPinName;
default:
FIXME("mpeg - unknown stream type %02x\n",This->pPayloads[nStreamIndex].payloadtype);
}
/* FIXME */
return QUARTZ_MPGParserOutPin_UnknownTypePinName;
}
static HRESULT CMPGParseImpl_GetStreamType( CParserImpl* pImpl, ULONG nStreamIndex, AM_MEDIA_TYPE* pmt )
{
CMPGParseImpl* This = (CMPGParseImpl*)pImpl->m_pUserData;
HRESULT hr;
BYTE hdrbuf[140+10];
UINT seqhdrlen;
MPEG1VIDEOINFO* pmpg1vi;
MPEG2VIDEOINFO* pmpg2vi;
MPEG1WAVEFORMAT* pmpg1wav;
enum MPGPayloadType payloadtype;
DWORD dwPayloadBlockSize;
TRACE("(%p,%lu,%p)\n",This,nStreamIndex,pmt);
if ( This == NULL )
return E_UNEXPECTED;
if ( nStreamIndex >= This->cPayloads )
return E_INVALIDARG;
ZeroMemory( pmt, sizeof(AM_MEDIA_TYPE) );
payloadtype = This->pPayloads[nStreamIndex].payloadtype;
switch ( payloadtype )
{
case MPGPayload_Video:
hr = CMPGParseImpl_SyncReadPayload(
pImpl, This, payloadtype, 0, 140+10, hdrbuf );
if ( FAILED(hr) )
return hr;
if ( hr != S_OK )
return E_FAIL;
memcpy( &pmt->majortype, &MEDIATYPE_Video, sizeof(GUID) );
seqhdrlen = 12;
if ( hdrbuf[seqhdrlen-1] & 0x2 )
seqhdrlen += 64;
if ( hdrbuf[seqhdrlen-1] & 0x1 )
seqhdrlen += 64;
if ( hdrbuf[seqhdrlen ] == 0x00 && hdrbuf[seqhdrlen+1] == 0x00 &&
hdrbuf[seqhdrlen+2] == 0x01 && hdrbuf[seqhdrlen+3] == 0xb5 )
{
/* video MPEG-2 */
FIXME("video MPEG-2\n");
if ( (hdrbuf[seqhdrlen+4]&0xf0) != 0x1 )
return E_FAIL;
memcpy( &pmt->subtype, &MEDIASUBTYPE_MPEG2_VIDEO, sizeof(GUID) );
memcpy( &pmt->formattype, &FORMAT_MPEG2_VIDEO, sizeof(GUID) );
pmt->bFixedSizeSamples = 0;
pmt->bTemporalCompression = 1;
pmt->lSampleSize = 0;
pmt->cbFormat = sizeof(MPEG2VIDEOINFO);
pmt->pbFormat = (BYTE*)CoTaskMemAlloc( sizeof(MPEG2VIDEOINFO) );
if ( pmt->pbFormat == NULL )
return E_OUTOFMEMORY;
ZeroMemory( pmt->pbFormat, sizeof(MPEG2VIDEOINFO) );
pmpg2vi = (MPEG2VIDEOINFO*)pmt->pbFormat;
pmpg2vi->hdr.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
pmpg2vi->hdr.bmiHeader.biWidth = ((UINT)hdrbuf[4] << 4) | ((UINT)hdrbuf[5] >> 4); /* FIXME! */
pmpg2vi->hdr.bmiHeader.biHeight = (((UINT)hdrbuf[5] & 0xf) << 8) | ((UINT)hdrbuf[6]); /* FIXME! */
pmpg2vi->hdr.dwInterlaceFlags = AMINTERLACE_FieldPatBothRegular; /* FIXME? */
pmpg2vi->hdr.dwCopyProtectFlags = AMCOPYPROTECT_RestrictDuplication; /* FIXME? */
pmpg2vi->hdr.dwPictAspectRatioX = 1; /* FIXME? */
pmpg2vi->hdr.dwPictAspectRatioY = 1; /* FIXME? */
pmpg2vi->dwStartTimeCode = 0;
pmpg2vi->cbSequenceHeader = seqhdrlen + 10;
switch ( hdrbuf[seqhdrlen+4] & 0xf )
{
case 5: pmpg2vi->dwProfile = AM_MPEG2Profile_Simple; break;
case 4: pmpg2vi->dwProfile = AM_MPEG2Profile_Main; break;
case 3: pmpg2vi->dwProfile = AM_MPEG2Profile_SNRScalable; break;
case 2: pmpg2vi->dwProfile = AM_MPEG2Profile_SpatiallyScalable; break;
case 1: pmpg2vi->dwProfile = AM_MPEG2Profile_High; break;
default: return E_FAIL;
}
switch ( hdrbuf[seqhdrlen+5] >> 4 )
{
case 10: pmpg2vi->dwLevel = AM_MPEG2Level_Low; break;
case 8: pmpg2vi->dwLevel = AM_MPEG2Level_Main; break;
case 6: pmpg2vi->dwLevel = AM_MPEG2Level_High1440; break;
case 4: pmpg2vi->dwLevel = AM_MPEG2Level_High; break;
default: return E_FAIL;
}
pmpg2vi->dwFlags = 0; /* FIXME? */
memcpy( pmpg2vi->dwSequenceHeader, hdrbuf, seqhdrlen + 10 );
return S_OK;
}
else
{
/* MPEG-1 */
memcpy( &pmt->subtype, &MEDIASUBTYPE_MPEG1Payload, sizeof(GUID) );
memcpy( &pmt->formattype, &FORMAT_MPEGVideo, sizeof(GUID) );
pmt->bFixedSizeSamples = 0;
pmt->bTemporalCompression = 1;
pmt->lSampleSize = 0;
pmt->cbFormat = sizeof(MPEG1VIDEOINFO);
pmt->pbFormat = (BYTE*)CoTaskMemAlloc( sizeof(MPEG1VIDEOINFO) );
if ( pmt->pbFormat == NULL )
return E_OUTOFMEMORY;
ZeroMemory( pmt->pbFormat, sizeof(MPEG1VIDEOINFO) );
pmpg1vi = (MPEG1VIDEOINFO*)pmt->pbFormat;
pmpg1vi->hdr.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
pmpg1vi->hdr.bmiHeader.biWidth = ((UINT)hdrbuf[4] << 4) | ((UINT)hdrbuf[5] >> 4);
pmpg1vi->hdr.bmiHeader.biHeight = (((UINT)hdrbuf[5] & 0xf) << 8) | ((UINT)hdrbuf[6]);
pmpg1vi->hdr.bmiHeader.biPlanes = 1;
pmpg1vi->dwStartTimeCode = 0;
pmpg1vi->cbSequenceHeader = seqhdrlen;
memcpy( pmpg1vi->bSequenceHeader, hdrbuf, seqhdrlen );
}
return S_OK;
case MPGPayload_Audio:
hr = CMPGParseImpl_SyncReadPayload(
pImpl, This, payloadtype, 0, 4, hdrbuf );
if ( FAILED(hr) )
return hr;
if ( hr != S_OK )
return E_FAIL;
memcpy( &pmt->majortype, &MEDIATYPE_Audio, sizeof(GUID) );
memcpy( &pmt->formattype, &FORMAT_WaveFormatEx, sizeof(GUID) );
if ( !( hdrbuf[1] & 0x8 ) )
{
/* FIXME!!! */
FIXME("audio not MPEG-1\n");
return E_FAIL;
}
else
{
/* MPEG-1 */
memcpy( &pmt->subtype, &MEDIASUBTYPE_MPEG1AudioPayload, sizeof(GUID) );
pmt->bFixedSizeSamples = 0;
pmt->bTemporalCompression = 1;
pmt->lSampleSize = 0;
pmt->cbFormat = sizeof(MPEG1WAVEFORMAT);
pmt->pbFormat = (BYTE*)CoTaskMemAlloc( sizeof(MPEG1WAVEFORMAT) );
if ( pmt->pbFormat == NULL )
return E_OUTOFMEMORY;
ZeroMemory( pmt->pbFormat, sizeof(MPEG1WAVEFORMAT) );
pmpg1wav = (MPEG1WAVEFORMAT*)pmt->pbFormat;
switch ( hdrbuf[1] & 0x6 )
{
case 0x6:
TRACE("layer 1\n");
pmpg1wav->fwHeadLayer = ACM_MPEG_LAYER1;
break;
case 0x4:
TRACE("layer 2\n");
pmpg1wav->fwHeadLayer = ACM_MPEG_LAYER2;
break;
case 0x2:
TRACE("layer 3\n");
pmpg1wav->fwHeadLayer = ACM_MPEG_LAYER3;
break;
default: return E_FAIL;
}
switch ( pmpg1wav->fwHeadLayer )
{
case ACM_MPEG_LAYER1:
pmpg1wav->dwHeadBitrate = bitratesl1[hdrbuf[2]>>4]*1000;
break;
case ACM_MPEG_LAYER2:
pmpg1wav->dwHeadBitrate = bitratesl2[hdrbuf[2]>>4]*1000;
break;
case ACM_MPEG_LAYER3:
pmpg1wav->dwHeadBitrate = bitratesl3[hdrbuf[2]>>4]*1000;
break;
}
if ( pmpg1wav->dwHeadBitrate == 0 )
return E_FAIL;
switch ( hdrbuf[3] & 0xc0 )
{
case 0x00:
TRACE("STEREO\n");
pmpg1wav->fwHeadMode = ACM_MPEG_STEREO;
break;
case 0x40:
TRACE("JOINTSTEREO\n");
pmpg1wav->fwHeadMode = ACM_MPEG_JOINTSTEREO;
break;
case 0x80:
TRACE("DUALCHANNEL\n");
pmpg1wav->fwHeadMode = ACM_MPEG_DUALCHANNEL;
break;
case 0xc0:
TRACE("SINGLECHANNEL\n");
pmpg1wav->fwHeadMode = ACM_MPEG_SINGLECHANNEL;
break;
}
pmpg1wav->fwHeadModeExt = (hdrbuf[3] & 0x30) >> 4; /* FIXME?? */
pmpg1wav->wHeadEmphasis = (hdrbuf[3] & 0x03); /* FIXME?? */
pmpg1wav->fwHeadFlags = ACM_MPEG_ID_MPEG1;
if ( hdrbuf[1] & 0x1 )
pmpg1wav->fwHeadFlags |= ACM_MPEG_PROTECTIONBIT;
if ( hdrbuf[2] & 0x1 )
pmpg1wav->fwHeadFlags |= ACM_MPEG_PRIVATEBIT;
if ( hdrbuf[3] & 0x8 )
pmpg1wav->fwHeadFlags |= ACM_MPEG_COPYRIGHT;
if ( hdrbuf[3] & 0x4 )
pmpg1wav->fwHeadFlags |= ACM_MPEG_ORIGINALHOME;
pmpg1wav->dwPTSLow = 0;
pmpg1wav->dwPTSHigh = 0;
pmpg1wav->wfx.wFormatTag = WAVE_FORMAT_MPEG;
pmpg1wav->wfx.nChannels = (pmpg1wav->fwHeadMode != ACM_MPEG_SINGLECHANNEL) ? 2 : 1;
switch ( hdrbuf[2] & 0x0c )
{
case 0x00:
TRACE("44100Hz\n");
pmpg1wav->wfx.nSamplesPerSec = 44100;
break;
case 0x01:
TRACE("48000Hz\n");
pmpg1wav->wfx.nSamplesPerSec = 48000;
break;
case 0x02:
TRACE("32000Hz\n");
pmpg1wav->wfx.nSamplesPerSec = 32000;
break;
default: return E_FAIL;
}
pmpg1wav->wfx.nAvgBytesPerSec = pmpg1wav->dwHeadBitrate >> 3;
switch ( pmpg1wav->fwHeadLayer )
{
case ACM_MPEG_LAYER1:
pmpg1wav->wfx.nBlockAlign = (384>>3) * pmpg1wav->dwHeadBitrate / pmpg1wav->wfx.nSamplesPerSec;
break;
case ACM_MPEG_LAYER2:
pmpg1wav->wfx.nBlockAlign = (1152>>3) * pmpg1wav->dwHeadBitrate / pmpg1wav->wfx.nSamplesPerSec;
break;
case ACM_MPEG_LAYER3:
pmpg1wav->wfx.nBlockAlign = 1;
break;
}
pmpg1wav->wfx.wBitsPerSample = 0;
pmpg1wav->wfx.cbSize = sizeof(MPEG1WAVEFORMAT) - sizeof(WAVEFORMATEX);
if ( pmpg1wav->fwHeadLayer != ACM_MPEG_LAYER3 )
{
pmt->bFixedSizeSamples = 1;
pmt->lSampleSize = pmpg1wav->wfx.nBlockAlign;
}
dwPayloadBlockSize = (pmpg1wav->wfx.nAvgBytesPerSec + pmpg1wav->wfx.nBlockAlign - 1) / pmpg1wav->wfx.nBlockAlign;
if ( dwPayloadBlockSize > This->dwPayloadBlockSizeMax )
This->dwPayloadBlockSizeMax = dwPayloadBlockSize;
TRACE("payload block size = %lu\n",dwPayloadBlockSize);
}
return S_OK;
default:
FIXME("mpeg - unknown stream type %02x\n",This->pPayloads[nStreamIndex].payloadtype);
break;
}
FIXME("stub\n");
return E_NOTIMPL;
}
static HRESULT CMPGParseImpl_CheckStreamType( CParserImpl* pImpl, ULONG nStreamIndex, const AM_MEDIA_TYPE* pmt )
{
CMPGParseImpl* This = (CMPGParseImpl*)pImpl->m_pUserData;
HRESULT hr;
AM_MEDIA_TYPE mt;
MPEG1VIDEOINFO* pmpg1vi;
MPEG1VIDEOINFO* pmpg1viCheck;
MPEG2VIDEOINFO* pmpg2vi;
MPEG2VIDEOINFO* pmpg2viCheck;
WAVEFORMATEX* pwfx;
WAVEFORMATEX* pwfxCheck;
enum MPGPayloadType payloadtype;
TRACE("(%p,%lu,%p)\n",This,nStreamIndex,pmt);
if ( This == NULL )
return E_UNEXPECTED;
if ( nStreamIndex >= This->cPayloads )
return E_INVALIDARG;
hr = CMPGParseImpl_GetStreamType( pImpl, nStreamIndex, &mt );
if ( FAILED(hr) )
return hr;
if ( !IsEqualGUID( &pmt->majortype, &mt.majortype ) ||
!IsEqualGUID( &pmt->subtype, &mt.subtype ) ||
!IsEqualGUID( &pmt->formattype, &mt.formattype ) )
{
hr = E_FAIL;
goto end;
}
TRACE("check format\n");
hr = S_OK;
payloadtype = This->pPayloads[nStreamIndex].payloadtype;
switch ( payloadtype )
{
case MPGPayload_Video:
if ( IsEqualGUID( &mt.formattype, &FORMAT_MPEGVideo ) )
{
/* MPEG-1 Video */
if ( pmt->cbFormat != mt.cbFormat ||
pmt->pbFormat == NULL )
{
hr = E_FAIL;
goto end;
}
pmpg1vi = (MPEG1VIDEOINFO*)mt.pbFormat;
pmpg1viCheck = (MPEG1VIDEOINFO*)pmt->pbFormat;
if ( memcmp( pmpg1vi, pmpg1viCheck, sizeof(MPEG1VIDEOINFO) ) != 0 )
{
hr = E_FAIL;
goto end;
}
}
else
if ( IsEqualGUID( &mt.formattype, &FORMAT_MPEG2_VIDEO ) )
{
/* MPEG-2 Video */
if ( pmt->cbFormat != mt.cbFormat ||
pmt->pbFormat == NULL )
{
hr = E_FAIL;
goto end;
}
pmpg2vi = (MPEG2VIDEOINFO*)mt.pbFormat;
pmpg2viCheck = (MPEG2VIDEOINFO*)pmt->pbFormat;
if ( memcmp( pmpg2vi, pmpg2viCheck, sizeof(MPEG2VIDEOINFO) ) != 0 )
{
hr = E_FAIL;
goto end;
}
}
else
{
hr = E_FAIL;
goto end;
}
break;
case MPGPayload_Audio:
if ( IsEqualGUID( &mt.formattype, &FORMAT_WaveFormatEx ) )
{
if ( mt.cbFormat != pmt->cbFormat ||
pmt->pbFormat == NULL )
{
hr = E_FAIL;
goto end;
}
pwfx = (WAVEFORMATEX*)mt.pbFormat;
pwfxCheck = (WAVEFORMATEX*)pmt->pbFormat;
if ( memcmp( pwfx, pwfxCheck, sizeof(WAVEFORMATEX) ) != 0 )
{
hr = E_FAIL;
goto end;
}
}
else
{
hr = E_FAIL;
goto end;
}
break;
default:
FIXME( "unsupported payload type\n" );
hr = E_FAIL;
goto end;
}
hr = S_OK;
end:
QUARTZ_MediaType_Free( &mt );
TRACE("%08lx\n",hr);
return hr;
}
static HRESULT CMPGParseImpl_GetAllocProp( CParserImpl* pImpl, ALLOCATOR_PROPERTIES* pReqProp )
{
CMPGParseImpl* This = (CMPGParseImpl*)pImpl->m_pUserData;
TRACE("(%p,%p)\n",This,pReqProp);
if ( This == NULL )
return E_UNEXPECTED;
ZeroMemory( pReqProp, sizeof(ALLOCATOR_PROPERTIES) );
pReqProp->cBuffers = This->cPayloads;
pReqProp->cbBuffer = This->dwPayloadBlockSizeMax;
TRACE("buf %d size %d\n",
(int)This->cPayloads,
(int)This->dwPayloadBlockSizeMax);
return S_OK;
}
static HRESULT CMPGParseImpl_GetNextRequest( CParserImpl* pImpl, ULONG* pnStreamIndex, LONGLONG* pllStart, LONG* plLength, REFERENCE_TIME* prtStart, REFERENCE_TIME* prtStop, DWORD* pdwSampleFlags )
{
CMPGParseImpl* This = (CMPGParseImpl*)pImpl->m_pUserData;
if ( This == NULL )
return E_UNEXPECTED;
*pdwSampleFlags = AM_SAMPLE_SPLICEPOINT;
TRACE("(%p)\n",This);
if ( This->bRawPayload )
{
if ( This->dwPayloadBlockSizeMax == 0 ||
This->cPayloads != 1 || This->pPayloads == NULL )
return E_UNEXPECTED;
*pnStreamIndex = 0;
*pllStart = This->llPosNext;
*plLength = This->dwPayloadBlockSizeMax;
*prtStart = 0;
*prtStop = 0;
if ( This->pPayloads[0].bDataDiscontinuity )
{
*pdwSampleFlags |= AM_SAMPLE_DATADISCONTINUITY;
This->pPayloads[0].bDataDiscontinuity = FALSE;
}
}
else
{
FIXME("stub\n");
return E_NOTIMPL;
}
return S_OK;
}
static HRESULT CMPGParseImpl_ProcessSample( CParserImpl* pImpl, ULONG nStreamIndex, LONGLONG llStart, LONG lLength, IMediaSample* pSample )
{
CMPGParseImpl* This = (CMPGParseImpl*)pImpl->m_pUserData;
HRESULT hr;
TRACE("(%p,%lu,%ld,%ld,%p)\n",This,nStreamIndex,(long)llStart,lLength,pSample);
if ( This == NULL )
return E_UNEXPECTED;
if ( This->bRawPayload )
{
hr = IMediaSample_SetTime(pSample,NULL,NULL);
if ( FAILED(hr) )
return hr;
}
return NOERROR;
}
static const struct ParserHandlers CMPGParseImpl_Handlers =
{
CMPGParseImpl_InitParser,
CMPGParseImpl_UninitParser,
CMPGParseImpl_GetOutPinName,
CMPGParseImpl_GetStreamType,
CMPGParseImpl_CheckStreamType,
CMPGParseImpl_GetAllocProp,
CMPGParseImpl_GetNextRequest,
CMPGParseImpl_ProcessSample,
/* for IQualityControl */
NULL, /* pQualityNotify */
/* for seeking */
NULL, /* pGetSeekingCaps */
NULL, /* pIsTimeFormatSupported */
NULL, /* pGetCurPos */
NULL, /* pSetCurPos */
NULL, /* pGetDuration */
NULL, /* pGetStopPos */
NULL, /* pSetStopPos */
NULL, /* pGetPreroll */
};
HRESULT QUARTZ_CreateMPEG1Splitter(IUnknown* punkOuter,void** ppobj)
{
return QUARTZ_CreateParser(
punkOuter,ppobj,
&CLSID_MPEG1Splitter,
QUARTZ_MPEG1Parser_Name,
QUARTZ_MPGParserInPin_Name,
&CMPGParseImpl_Handlers );
}

View File

@ -1,276 +0,0 @@
/*
* Implements MPEG Video Decoder(CLSID_CMpegVideoCodec)
*
* FIXME - what library can we use? SMPEG??
*
* FIXME - stub
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "strmif.h"
#include "control.h"
#include "amvideo.h"
#include "vfwmsgs.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "xform.h"
#include "mtype.h"
static const WCHAR CMPEGVideoDecoderImpl_FilterName[] =
{'M','P','E','G',' ','V','i','d','e','o',' ','D','e','c','o','d','e','r',0};
typedef struct CMPEGVideoDecoderImpl
{
AM_MEDIA_TYPE* pmt;
DWORD cmt;
} CMPEGVideoDecoderImpl;
/*****************************************************************************
*
* codec-dependent stuffs - no codec
*
*/
#define NO_CODEC_IMPL
static void Codec_OnConstruct(CMPEGVideoDecoderImpl* This)
{
}
static void Codec_OnCleanup(CMPEGVideoDecoderImpl* This)
{
}
static HRESULT Codec_BeginTransform(CTransformBaseImpl* pImpl,CMPEGVideoDecoderImpl* This)
{
FIXME("no codec\n");
return E_NOTIMPL;
}
static HRESULT Codec_ProcessReceive(CTransformBaseImpl* pImpl,CMPEGVideoDecoderImpl* This,IMediaSample* pSampIn)
{
FIXME("no codec\n");
return E_NOTIMPL;
}
static HRESULT Codec_EndTransform(CTransformBaseImpl* pImpl,CMPEGVideoDecoderImpl* This)
{
FIXME("no codec\n");
return E_NOTIMPL;
}
/***************************************************************************
*
* CMPEGVideoDecoderImpl methods
*
*/
static void CMPEGVideoDecoderImpl_CleanupOutTypes(CMPEGVideoDecoderImpl* This)
{
DWORD i;
if ( This->pmt != NULL )
{
for ( i = 0; i < This->cmt; i++ )
{
QUARTZ_MediaType_Free(&This->pmt[i]);
}
QUARTZ_FreeMem(This->pmt);
This->pmt = NULL;
}
This->cmt = 0;
}
static HRESULT CMPEGVideoDecoderImpl_Init( CTransformBaseImpl* pImpl )
{
CMPEGVideoDecoderImpl* This = pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This != NULL )
return NOERROR;
This = (CMPEGVideoDecoderImpl*)QUARTZ_AllocMem( sizeof(CMPEGVideoDecoderImpl) );
if ( This == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This, sizeof(CMPEGVideoDecoderImpl) );
pImpl->m_pUserData = This;
/* construct */
This->pmt = NULL;
This->cmt = 0;
Codec_OnConstruct(This);
return S_OK;
}
static HRESULT CMPEGVideoDecoderImpl_Cleanup( CTransformBaseImpl* pImpl )
{
CMPEGVideoDecoderImpl* This = pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This == NULL )
return S_OK;
/* destruct */
Codec_OnCleanup(This);
CMPEGVideoDecoderImpl_CleanupOutTypes(This);
QUARTZ_FreeMem( This );
pImpl->m_pUserData = NULL;
return S_OK;
}
static HRESULT CMPEGVideoDecoderImpl_CheckMediaType( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut )
{
CMPEGVideoDecoderImpl* This = pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
#ifdef NO_CODEC_IMPL
WARN("no codec implementation\n");
return E_NOTIMPL;
#else
return S_OK;
#endif
}
static HRESULT CMPEGVideoDecoderImpl_GetOutputTypes( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE** ppmtAcceptTypes, ULONG* pcAcceptTypes )
{
CMPEGVideoDecoderImpl* This = pImpl->m_pUserData;
HRESULT hr;
FIXME("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = CMPEGVideoDecoderImpl_CheckMediaType( pImpl, pmtIn, NULL );
if ( FAILED(hr) )
return hr;
CMPEGVideoDecoderImpl_CleanupOutTypes(This);
return E_NOTIMPL;
}
static HRESULT CMPEGVideoDecoderImpl_GetAllocProp( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, ALLOCATOR_PROPERTIES* pProp, BOOL* pbTransInPlace, BOOL* pbTryToReuseSample )
{
CMPEGVideoDecoderImpl* This = pImpl->m_pUserData;
HRESULT hr;
FIXME("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = CMPEGVideoDecoderImpl_CheckMediaType( pImpl, pmtIn, pmtOut );
if ( FAILED(hr) )
return hr;
return E_NOTIMPL;
}
static HRESULT CMPEGVideoDecoderImpl_BeginTransform( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, BOOL bReuseSample )
{
CMPEGVideoDecoderImpl* This = pImpl->m_pUserData;
HRESULT hr;
FIXME("(%p,%p,%p,%d)\n",This,pmtIn,pmtOut,bReuseSample);
if ( This == NULL )
return E_UNEXPECTED;
hr = CMPEGVideoDecoderImpl_CheckMediaType( pImpl, pmtIn, pmtOut );
if ( FAILED(hr) )
return hr;
return Codec_BeginTransform(pImpl,This);
}
static HRESULT CMPEGVideoDecoderImpl_ProcessReceive( CTransformBaseImpl* pImpl, IMediaSample* pSampIn )
{
CMPEGVideoDecoderImpl* This = pImpl->m_pUserData;
FIXME("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
return Codec_ProcessReceive(pImpl,This,pSampIn);
}
static HRESULT CMPEGVideoDecoderImpl_EndTransform( CTransformBaseImpl* pImpl )
{
CMPEGVideoDecoderImpl* This = pImpl->m_pUserData;
HRESULT hr;
FIXME("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = Codec_EndTransform(pImpl,This);
if ( FAILED(hr) )
return hr;
return S_OK;
}
static const TransformBaseHandlers transhandlers =
{
CMPEGVideoDecoderImpl_Init,
CMPEGVideoDecoderImpl_Cleanup,
CMPEGVideoDecoderImpl_CheckMediaType,
CMPEGVideoDecoderImpl_GetOutputTypes,
CMPEGVideoDecoderImpl_GetAllocProp,
CMPEGVideoDecoderImpl_BeginTransform,
CMPEGVideoDecoderImpl_ProcessReceive,
NULL,
CMPEGVideoDecoderImpl_EndTransform,
};
HRESULT QUARTZ_CreateCMpegVideoCodec(IUnknown* punkOuter,void** ppobj)
{
return QUARTZ_CreateTransformBase(
punkOuter,ppobj,
&CLSID_CMpegVideoCodec,
CMPEGVideoDecoderImpl_FilterName,
NULL, NULL,
&transhandlers );
}

View File

@ -1,552 +0,0 @@
/*
* Implements IEnumMediaTypes and helper functions. (internal)
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "mmsystem.h"
#include "strmif.h"
#include "vfwmsgs.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "mtype.h"
#include "iunk.h"
/****************************************************************************/
HRESULT QUARTZ_MediaType_Copy(
AM_MEDIA_TYPE* pmtDst,
const AM_MEDIA_TYPE* pmtSrc )
{
memcpy( &pmtDst->majortype, &pmtSrc->majortype, sizeof(GUID) );
memcpy( &pmtDst->subtype, &pmtSrc->subtype, sizeof(GUID) );
pmtDst->bFixedSizeSamples = pmtSrc->bFixedSizeSamples;
pmtDst->bTemporalCompression = pmtSrc->bTemporalCompression;
pmtDst->lSampleSize = pmtSrc->lSampleSize;
memcpy( &pmtDst->formattype, &pmtSrc->formattype, sizeof(GUID) );
pmtDst->pUnk = NULL;
pmtDst->cbFormat = pmtSrc->cbFormat;
pmtDst->pbFormat = NULL;
if ( pmtSrc->pbFormat != NULL && pmtSrc->cbFormat != 0 )
{
pmtDst->pbFormat = (BYTE*)CoTaskMemAlloc( pmtSrc->cbFormat );
if ( pmtDst->pbFormat == NULL )
{
return E_OUTOFMEMORY;
}
memcpy( pmtDst->pbFormat, pmtSrc->pbFormat, pmtSrc->cbFormat );
}
if ( pmtSrc->pUnk != NULL )
{
pmtDst->pUnk = pmtSrc->pUnk;
IUnknown_AddRef( pmtSrc->pUnk );
}
return S_OK;
}
void QUARTZ_MediaType_Free(
AM_MEDIA_TYPE* pmt )
{
if ( pmt->pUnk != NULL )
{
IUnknown_Release( pmt->pUnk );
pmt->pUnk = NULL;
}
if ( pmt->pbFormat != NULL )
{
CoTaskMemFree( pmt->pbFormat );
pmt->cbFormat = 0;
pmt->pbFormat = NULL;
}
}
AM_MEDIA_TYPE* QUARTZ_MediaType_Duplicate(
const AM_MEDIA_TYPE* pmtSrc )
{
AM_MEDIA_TYPE* pmtDup;
pmtDup = (AM_MEDIA_TYPE*)CoTaskMemAlloc( sizeof(AM_MEDIA_TYPE) );
if ( pmtDup == NULL )
return NULL;
if ( QUARTZ_MediaType_Copy( pmtDup, pmtSrc ) != S_OK )
{
CoTaskMemFree( pmtDup );
return NULL;
}
return pmtDup;
}
void QUARTZ_MediaType_Destroy(
AM_MEDIA_TYPE* pmt )
{
QUARTZ_MediaType_Free( pmt );
CoTaskMemFree( pmt );
}
void QUARTZ_MediaSubType_FromFourCC(
GUID* psubtype, DWORD dwFourCC )
{
TRACE( "FourCC %c%c%c%c\n",
(int)(dwFourCC>> 0)&0xff,
(int)(dwFourCC>> 8)&0xff,
(int)(dwFourCC>>16)&0xff,
(int)(dwFourCC>>24)&0xff );
memcpy( psubtype, &MEDIASUBTYPE_PCM, sizeof(GUID) );
psubtype->Data1 = dwFourCC;
}
BOOL QUARTZ_MediaSubType_IsFourCC(
const GUID* psubtype )
{
GUID guidTemp;
QUARTZ_MediaSubType_FromFourCC(
&guidTemp, psubtype->Data1 );
return IsEqualGUID( psubtype, &guidTemp );
}
HRESULT QUARTZ_MediaSubType_FromBitmap(
GUID* psubtype, const BITMAPINFOHEADER* pbi )
{
HRESULT hr;
DWORD* pdwBitf;
if ( (pbi->biCompression & 0xffff0000) != 0 )
return S_FALSE;
if ( pbi->biWidth <= 0 || pbi->biHeight == 0 )
return E_FAIL;
hr = E_FAIL;
switch ( pbi->biCompression )
{
case 0:
if ( pbi->biPlanes != 1 )
break;
switch ( pbi->biBitCount )
{
case 1:
memcpy( psubtype, &MEDIASUBTYPE_RGB1, sizeof(GUID) );
hr = S_OK;
break;
case 4:
memcpy( psubtype, &MEDIASUBTYPE_RGB4, sizeof(GUID) );
hr = S_OK;
break;
case 8:
memcpy( psubtype, &MEDIASUBTYPE_RGB8, sizeof(GUID) );
hr = S_OK;
break;
case 16:
memcpy( psubtype, &MEDIASUBTYPE_RGB555, sizeof(GUID) );
hr = S_OK;
break;
case 24:
memcpy( psubtype, &MEDIASUBTYPE_RGB24, sizeof(GUID) );
hr = S_OK;
break;
case 32:
memcpy( psubtype, &MEDIASUBTYPE_RGB32, sizeof(GUID) );
hr = S_OK;
break;
}
break;
case 1:
if ( pbi->biPlanes == 1 && pbi->biHeight > 0 &&
pbi->biBitCount == 8 )
{
QUARTZ_MediaSubType_FromFourCC( psubtype, 1 );
hr = S_OK;
}
break;
case 2:
if ( pbi->biPlanes == 1 && pbi->biHeight > 0 &&
pbi->biBitCount == 4 )
{
QUARTZ_MediaSubType_FromFourCC( psubtype, 2 );
hr = S_OK;
}
break;
case 3:
if ( pbi->biPlanes != 1 )
break;
pdwBitf = (DWORD*)( (BYTE*)pbi + sizeof(BITMAPINFOHEADER) );
switch ( pbi->biBitCount )
{
case 16:
if ( pdwBitf[0] == 0x7c00 &&
pdwBitf[1] == 0x03e0 &&
pdwBitf[2] == 0x001f )
{
memcpy( psubtype, &MEDIASUBTYPE_RGB555, sizeof(GUID) );
hr = S_OK;
}
if ( pdwBitf[0] == 0xf800 &&
pdwBitf[1] == 0x07e0 &&
pdwBitf[2] == 0x001f )
{
memcpy( psubtype, &MEDIASUBTYPE_RGB565, sizeof(GUID) );
hr = S_OK;
}
break;
case 32:
if ( pdwBitf[0] == 0x00ff0000 &&
pdwBitf[1] == 0x0000ff00 &&
pdwBitf[2] == 0x000000ff )
{
memcpy( psubtype, &MEDIASUBTYPE_RGB32, sizeof(GUID) );
hr = S_OK;
}
break;
}
break;
}
return hr;
}
void QUARTZ_PatchBitmapInfoHeader( BITMAPINFOHEADER* pbi )
{
switch ( pbi->biCompression )
{
case mmioFOURCC('R','G','B',' '):
pbi->biCompression = 0;
break;
case mmioFOURCC('R','L','E',' '):
case mmioFOURCC('M','R','L','E'):
case mmioFOURCC('R','L','E','8'):
case mmioFOURCC('R','L','E','4'):
if ( pbi->biBitCount == 4 )
pbi->biCompression = 2;
else
pbi->biCompression = 1;
break;
}
}
BOOL QUARTZ_BitmapHasFixedSample( const BITMAPINFOHEADER* pbi )
{
switch ( pbi->biCompression )
{
case 0:
case 3:
case mmioFOURCC('I','4','2','0'):
case mmioFOURCC('I','Y','U','V'):
case mmioFOURCC('Y','U','Y','V'):
case mmioFOURCC('Y','V','U','9'):
case mmioFOURCC('Y','4','1','1'):
case mmioFOURCC('Y','4','1','P'):
case mmioFOURCC('Y','U','Y','2'):
case mmioFOURCC('Y','V','Y','U'):
case mmioFOURCC('U','Y','V','Y'):
case mmioFOURCC('Y','2','1','1'):
case mmioFOURCC('Y','V','1','2'):
return TRUE;
}
return FALSE;
}
/****************************************************************************/
typedef struct IEnumMediaTypesImpl
{
ICOM_VFIELD(IEnumMediaTypes);
} IEnumMediaTypesImpl;
typedef struct
{
QUARTZ_IUnkImpl unk;
IEnumMediaTypesImpl enummtype;
struct QUARTZ_IFEntry IFEntries[1];
CRITICAL_SECTION cs;
AM_MEDIA_TYPE* pTypes;
ULONG cTypes;
ULONG cCur;
} CEnumMediaTypes;
#define CEnumMediaTypes_THIS(iface,member) CEnumMediaTypes* This = ((CEnumMediaTypes*)(((char*)iface)-offsetof(CEnumMediaTypes,member)))
static HRESULT WINAPI
IEnumMediaTypes_fnQueryInterface(IEnumMediaTypes* iface,REFIID riid,void** ppobj)
{
CEnumMediaTypes_THIS(iface,enummtype);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IEnumMediaTypes_fnAddRef(IEnumMediaTypes* iface)
{
CEnumMediaTypes_THIS(iface,enummtype);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IEnumMediaTypes_fnRelease(IEnumMediaTypes* iface)
{
CEnumMediaTypes_THIS(iface,enummtype);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IEnumMediaTypes_fnNext(IEnumMediaTypes* iface,ULONG cReq,AM_MEDIA_TYPE** ppmtype,ULONG* pcFetched)
{
CEnumMediaTypes_THIS(iface,enummtype);
HRESULT hr;
ULONG cFetched;
TRACE("(%p)->(%lu,%p,%p)\n",This,cReq,ppmtype,pcFetched);
if ( pcFetched == NULL && cReq > 1 )
return E_INVALIDARG;
if ( ppmtype == NULL )
return E_POINTER;
EnterCriticalSection( &This->cs );
hr = NOERROR;
cFetched = 0;
while ( cReq > 0 )
{
if ( This->cCur >= This->cTypes )
{
hr = S_FALSE;
break;
}
ppmtype[ cFetched ] =
QUARTZ_MediaType_Duplicate( &This->pTypes[ This->cCur ] );
if ( ppmtype[ cFetched ] == NULL )
{
hr = E_OUTOFMEMORY;
while ( cFetched > 0 )
{
cFetched --;
QUARTZ_MediaType_Destroy( ppmtype[ cFetched ] );
}
break;
}
cFetched ++;
This->cCur ++;
cReq --;
}
LeaveCriticalSection( &This->cs );
if ( pcFetched != NULL )
*pcFetched = cFetched;
return hr;
}
static HRESULT WINAPI
IEnumMediaTypes_fnSkip(IEnumMediaTypes* iface,ULONG cSkip)
{
CEnumMediaTypes_THIS(iface,enummtype);
HRESULT hr;
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->cs );
hr = NOERROR;
while ( cSkip > 0 )
{
if ( This->cCur >= This->cTypes )
{
hr = S_FALSE;
break;
}
This->cCur ++;
cSkip --;
}
LeaveCriticalSection( &This->cs );
return hr;
}
static HRESULT WINAPI
IEnumMediaTypes_fnReset(IEnumMediaTypes* iface)
{
CEnumMediaTypes_THIS(iface,enummtype);
TRACE("(%p)->()\n",This);
EnterCriticalSection( &This->cs );
This->cCur = 0;
LeaveCriticalSection( &This->cs );
return NOERROR;
}
static HRESULT WINAPI
IEnumMediaTypes_fnClone(IEnumMediaTypes* iface,IEnumMediaTypes** ppobj)
{
CEnumMediaTypes_THIS(iface,enummtype);
HRESULT hr;
TRACE("(%p)->()\n",This);
if ( ppobj == NULL )
return E_POINTER;
EnterCriticalSection( &This->cs );
hr = QUARTZ_CreateEnumMediaTypes(
ppobj,
This->pTypes, This->cTypes );
if ( SUCCEEDED(hr) )
IEnumMediaTypes_Skip( *ppobj, This->cCur );
LeaveCriticalSection( &This->cs );
return hr;
}
static ICOM_VTABLE(IEnumMediaTypes) ienummtype =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IEnumMediaTypes_fnQueryInterface,
IEnumMediaTypes_fnAddRef,
IEnumMediaTypes_fnRelease,
/* IEnumMediaTypes fields */
IEnumMediaTypes_fnNext,
IEnumMediaTypes_fnSkip,
IEnumMediaTypes_fnReset,
IEnumMediaTypes_fnClone,
};
/* can I use offsetof safely? - FIXME? */
static QUARTZ_IFEntry IFEntries[] =
{
{ &IID_IEnumMediaTypes, offsetof(CEnumMediaTypes,enummtype)-offsetof(CEnumMediaTypes,unk) },
};
void QUARTZ_DestroyEnumMediaTypes(IUnknown* punk)
{
CEnumMediaTypes_THIS(punk,unk);
ULONG i;
if ( This->pTypes != NULL )
{
for ( i = 0; i < This->cTypes; i++ )
QUARTZ_MediaType_Free( &This->pTypes[i] );
QUARTZ_FreeMem( This->pTypes );
}
DeleteCriticalSection( &This->cs );
}
HRESULT QUARTZ_CreateEnumMediaTypes(
IEnumMediaTypes** ppobj,
const AM_MEDIA_TYPE* pTypes, ULONG cTypes )
{
CEnumMediaTypes* penum;
AM_MEDIA_TYPE* pTypesDup = NULL;
ULONG i;
HRESULT hr;
TRACE("(%p,%p,%lu)\n",ppobj,pTypes,cTypes);
if ( cTypes > 0 )
{
pTypesDup = (AM_MEDIA_TYPE*)QUARTZ_AllocMem(
sizeof( AM_MEDIA_TYPE ) * cTypes );
if ( pTypesDup == NULL )
return E_OUTOFMEMORY;
i = 0;
while ( i < cTypes )
{
hr = QUARTZ_MediaType_Copy( &pTypesDup[i], &pTypes[i] );
if ( FAILED(hr) )
{
while ( i > 0 )
{
i --;
QUARTZ_MediaType_Free( &pTypesDup[i] );
}
QUARTZ_FreeMem( pTypesDup );
return hr;
}
i ++;
}
}
penum = (CEnumMediaTypes*)QUARTZ_AllocObj( sizeof(CEnumMediaTypes) );
if ( penum == NULL )
{
return E_OUTOFMEMORY;
}
penum->pTypes = pTypesDup;
penum->cTypes = cTypes;
penum->cCur = 0;
QUARTZ_IUnkInit( &penum->unk, NULL );
ICOM_VTBL(&penum->enummtype) = &ienummtype;
penum->unk.pEntries = IFEntries;
penum->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
penum->unk.pOnFinalRelease = QUARTZ_DestroyEnumMediaTypes;
InitializeCriticalSection( &penum->cs );
*ppobj = (IEnumMediaTypes*)(&penum->enummtype);
return S_OK;
}

View File

@ -1,51 +0,0 @@
/*
* Implements IEnumMediaTypes and helper functions. (internal)
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 WINE_DSHOW_MTYPE_H
#define WINE_DSHOW_MTYPE_H
HRESULT QUARTZ_MediaType_Copy(
AM_MEDIA_TYPE* pmtDst,
const AM_MEDIA_TYPE* pmtSrc );
void QUARTZ_MediaType_Free(
AM_MEDIA_TYPE* pmt );
AM_MEDIA_TYPE* QUARTZ_MediaType_Duplicate(
const AM_MEDIA_TYPE* pmtSrc );
void QUARTZ_MediaType_Destroy(
AM_MEDIA_TYPE* pmt );
void QUARTZ_MediaSubType_FromFourCC(
GUID* psubtype, DWORD dwFourCC );
BOOL QUARTZ_MediaSubType_IsFourCC(
const GUID* psubtype );
HRESULT QUARTZ_MediaSubType_FromBitmap(
GUID* psubtype, const BITMAPINFOHEADER* pbi );
void QUARTZ_PatchBitmapInfoHeader( BITMAPINFOHEADER* pbi );
BOOL QUARTZ_BitmapHasFixedSample( const BITMAPINFOHEADER* pbi );
HRESULT QUARTZ_CreateEnumMediaTypes(
IEnumMediaTypes** ppobj,
const AM_MEDIA_TYPE* pTypes, ULONG cTypes );
#endif /* WINE_DSHOW_MTYPE_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,215 +0,0 @@
/*
* Implements Parser.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 WINE_DSHOW_PARSER_H
#define WINE_DSHOW_PARSER_H
#include "iunk.h"
#include "basefilt.h"
typedef struct CParserImpl CParserImpl;
typedef struct CParserInPinImpl CParserInPinImpl;
typedef struct CParserOutPinImpl CParserOutPinImpl;
typedef struct ParserHandlers ParserHandlers;
/* {D51BD5A0-7548-11CF-A520-0080C77EF58A} */
DEFINE_GUID(CLSID_quartzQuickTimeMovieParser,
0xD51BD5A0,0x7548,0x11CF,0xA5,0x20,0x00,0x80,0xC7,0x7E,0xF5,0x8A);
/* {D51BD5A1-7548-11CF-A520-0080C77EF58A} */
DEFINE_GUID(CLSID_quartzWaveParser,
0xD51BD5A1,0x7548,0x11CF,0xA5,0x20,0x00,0x80,0xC7,0x7E,0xF5,0x8A);
/* {D51BD5A2-7548-11CF-A520-0080C77EF58A} */
DEFINE_GUID(CLSID_quartzMIDIParser,
0xD51BD5A2,0x7548,0x11CF,0xA5,0x20,0x00,0x80,0xC7,0x7E,0xF5,0x8A);
/* {D51BD5A3-7548-11CF-A520-0080C77EF58A} */
DEFINE_GUID(CLSID_quartzMultifileParser,
0xD51BD5A3,0x7548,0x11CF,0xA5,0x20,0x00,0x80,0xC7,0x7E,0xF5,0x8A);
struct CParserImpl
{
QUARTZ_IUnkImpl unk;
CBaseFilterImpl basefilter;
CParserInPinImpl* m_pInPin;
ULONG m_cOutStreams;
CParserOutPinImpl** m_ppOutPins;
GUID m_guidTimeFormat;
CRITICAL_SECTION m_csParser;
IAsyncReader* m_pReader;
IMemAllocator* m_pAllocator;
ALLOCATOR_PROPERTIES m_propAlloc;
HANDLE m_hEventInit;
BOOL m_bIsRunning;
DWORD m_dwThreadId;
HANDLE m_hThread;
BOOL m_bSendEOS;
const ParserHandlers* m_pHandler;
void* m_pUserData;
};
struct CParserInPinImpl
{
QUARTZ_IUnkImpl unk;
CPinBaseImpl pin;
CMemInputPinBaseImpl meminput;
CParserImpl* pParser;
};
struct CParserOutPinImpl
{
QUARTZ_IUnkImpl unk;
CPinBaseImpl pin;
CQualityControlPassThruImpl qcontrol;
struct { ICOM_VFIELD(IMediaSeeking); } mediaseeking;
struct { ICOM_VFIELD(IMediaPosition); } mediaposition;
CParserImpl* pParser;
ULONG nStreamIndex;
AM_MEDIA_TYPE m_mtOut;
IMemAllocator* m_pOutPinAllocator;
void* m_pUserData;
/* for parser */
BOOL m_bReqUsed;
IMediaSample* m_pReqSample;
LONGLONG m_llReqStart;
LONG m_lReqLength;
REFERENCE_TIME m_rtReqStart;
REFERENCE_TIME m_rtReqStop;
DWORD m_dwSampleFlags;
};
struct ParserHandlers
{
HRESULT (*pInitParser)( CParserImpl* pImpl, ULONG* pcStreams );
HRESULT (*pUninitParser)( CParserImpl* pImpl );
LPCWSTR (*pGetOutPinName)( CParserImpl* pImpl, ULONG nStreamIndex );
HRESULT (*pGetStreamType)( CParserImpl* pImpl, ULONG nStreamIndex, AM_MEDIA_TYPE* pmt );
HRESULT (*pCheckStreamType)( CParserImpl* pImpl, ULONG nStreamIndex, const AM_MEDIA_TYPE* pmt );
HRESULT (*pGetAllocProp)( CParserImpl* pImpl, ALLOCATOR_PROPERTIES* pReqProp );
/* S_OK - ok, S_FALSE - end of stream */
HRESULT (*pGetNextRequest)( CParserImpl* pImpl, ULONG* pnStreamIndex, LONGLONG* pllStart, LONG* plLength, REFERENCE_TIME* prtStart, REFERENCE_TIME* prtStop, DWORD* pdwSampleFlags );
HRESULT (*pProcessSample)( CParserImpl* pImpl, ULONG nStreamIndex, LONGLONG llStart, LONG lLength, IMediaSample* pSample );
/* for IQualityControl */
HRESULT (*pQualityNotify)( CParserImpl* pImpl, ULONG nStreamIndex, Quality q );
/* for seeking */
HRESULT (*pGetSeekingCaps)( CParserImpl* pImpl, DWORD* pdwCaps );
HRESULT (*pIsTimeFormatSupported)( CParserImpl* pImpl, const GUID* pTimeFormat );
HRESULT (*pGetCurPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPos );
HRESULT (*pSetCurPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG llPos );
HRESULT (*pGetDuration)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllDuration );
HRESULT (*pGetStopPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPos );
HRESULT (*pSetStopPos)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG llPos );
HRESULT (*pGetPreroll)( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPreroll );
};
#define CParserImpl_THIS(iface,member) CParserImpl* This = ((CParserImpl*)(((char*)iface)-offsetof(CParserImpl,member)))
#define CParserInPinImpl_THIS(iface,member) CParserInPinImpl* This = ((CParserInPinImpl*)(((char*)iface)-offsetof(CParserInPinImpl,member)))
#define CParserOutPinImpl_THIS(iface,member) CParserOutPinImpl* This = ((CParserOutPinImpl*)(((char*)iface)-offsetof(CParserOutPinImpl,member)))
#define CParserOutPinImpl_IMediaSeeking(th) ((IMediaSeeking*)&((th)->mediaseeking))
#define CParserOutPinImpl_IMediaPosition(th) ((IMediaPosition*)&((th)->mediaposition))
HRESULT QUARTZ_CreateParser(
IUnknown* punkOuter,void** ppobj,
const CLSID* pclsidParser,
LPCWSTR pwszParserName,
LPCWSTR pwszInPinName,
const ParserHandlers* pHandler );
HRESULT QUARTZ_CreateParserInPin(
CParserImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CParserInPinImpl** ppPin,
LPCWSTR pwszPinName );
HRESULT QUARTZ_CreateParserOutPin(
CParserImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CParserOutPinImpl** ppPin,
ULONG nStreamIndex,
LPCWSTR pwszPinName );
#define PARSER_POLL_INTERVAL 100
#define PARSER_RIFF_OfsFirst 12
#define PARSER_WAVE mmioFOURCC('W','A','V','E')
#define PARSER_AVI mmioFOURCC('A','V','I',' ')
#define PARSER_AVIX mmioFOURCC('A','V','I','X')
#define PARSER_fmt mmioFOURCC('f','m','t',' ')
#define PARSER_fact mmioFOURCC('f','a','c','t')
#define PARSER_data mmioFOURCC('d','a','t','a')
#define PARSER_LIST mmioFOURCC('L','I','S','T')
#define PARSER_hdrl mmioFOURCC('h','d','r','l')
#define PARSER_avih mmioFOURCC('a','v','i','h')
#define PARSER_strl mmioFOURCC('s','t','r','l')
#define PARSER_strh mmioFOURCC('s','t','r','h')
#define PARSER_strf mmioFOURCC('s','t','r','f')
#define PARSER_idx1 mmioFOURCC('i','d','x','1')
#define PARSER_indx mmioFOURCC('i','n','d','x')
#define PARSER_movi mmioFOURCC('m','o','v','i')
#define PARSER_JUNK mmioFOURCC('J','U','N','K')
#define PARSER_vids mmioFOURCC('v','i','d','s')
#define PARSER_auds mmioFOURCC('a','u','d','s')
#define PARSER_mids mmioFOURCC('m','i','d','s')
#define PARSER_txts mmioFOURCC('t','x','t','s')
#define PARSER_LE_UINT16(ptr) (((DWORD)(ptr)[0])|((DWORD)(ptr)[1]<<8))
#define PARSER_LE_UINT32(ptr) (((DWORD)(ptr)[0])|((DWORD)(ptr)[1]<<8)|((DWORD)(ptr)[2]<<16)|((DWORD)(ptr)[3]<<24))
#define PARSER_BE_UINT16(ptr) (((DWORD)(ptr)[0]<<8)|((DWORD)(ptr)[1]))
#define PARSER_BE_UINT32(ptr) (((DWORD)(ptr)[0]<<24)|((DWORD)(ptr)[1]<<16)|((DWORD)(ptr)[2]<<8)|((DWORD)(ptr)[3]))
HRESULT QUARTZ_CreateWaveParser(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateAVISplitter(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateMPEG1Splitter(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateQuickTimeMovieParser(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateMIDIParser(IUnknown* punkOuter,void** ppobj);
HRESULT RIFF_GetNext(
CParserImpl* pImpl, LONGLONG llOfs,
DWORD* pdwCode, DWORD* pdwLength );
HRESULT RIFF_SearchChunk(
CParserImpl* pImpl,
DWORD dwSearchLengthMax,
LONGLONG llOfs, DWORD dwChunk,
LONGLONG* pllOfs, DWORD* pdwChunkLength );
HRESULT RIFF_SearchList(
CParserImpl* pImpl,
DWORD dwSearchLengthMax,
LONGLONG llOfs, DWORD dwListChunk,
LONGLONG* pllOfs, DWORD* pdwChunkLength );
#endif /* WINE_DSHOW_PARSER_H */

View File

@ -1,234 +0,0 @@
/*
* Implements QuickTime Video Decompressor.
*
* FIXME - stub
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "vfw.h"
#include "strmif.h"
#include "control.h"
#include "amvideo.h"
#include "vfwmsgs.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "xform.h"
static const WCHAR QTDec_FilterName[] =
{'Q','u','i','c','k','T','i','m','e',' ','D','e','c','o','m','p','r','e','s','s','o','r',0};
typedef struct CQTDecImpl
{
AM_MEDIA_TYPE* m_pmtConv;
DWORD m_cConv;
} CQTDecImpl;
/***************************************************************************
*
* CQTDecImpl methods
*
*/
static void QTDec_FreeOutTypes(CQTDecImpl* This)
{
DWORD i;
if ( This->m_pmtConv == NULL )
return;
TRACE("cConv = %lu\n",This->m_cConv);
for ( i = 0; i < This->m_cConv; i++ )
{
QUARTZ_MediaType_Free(&This->m_pmtConv[i]);
}
QUARTZ_FreeMem(This->m_pmtConv);
This->m_pmtConv = NULL;
This->m_cConv = 0;
}
static HRESULT QTDec_Init( CTransformBaseImpl* pImpl )
{
CQTDecImpl* This = pImpl->m_pUserData;
if ( This != NULL )
return NOERROR;
This = (CQTDecImpl*)QUARTZ_AllocMem( sizeof(CQTDecImpl) );
if ( This == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This, sizeof(CQTDecImpl) );
pImpl->m_pUserData = This;
/* construct */
This->m_pmtConv = NULL;
This->m_cConv = 0;
return NOERROR;
}
static HRESULT QTDec_Cleanup( CTransformBaseImpl* pImpl )
{
CQTDecImpl* This = pImpl->m_pUserData;
if ( This == NULL )
return NOERROR;
/* destruct */
QTDec_FreeOutTypes(This);
QUARTZ_FreeMem( This );
pImpl->m_pUserData = NULL;
return NOERROR;
}
static HRESULT QTDec_CheckMediaType( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut )
{
CQTDecImpl* This = pImpl->m_pUserData;
WARN("(%p) stub\n",This);
if ( This == NULL )
return E_UNEXPECTED;
return E_NOTIMPL;
}
static HRESULT QTDec_GetOutputTypes( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE** ppmtAcceptTypes, ULONG* pcAcceptTypes )
{
CQTDecImpl* This = pImpl->m_pUserData;
HRESULT hr;
FIXME("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = QTDec_CheckMediaType( pImpl, pmtIn, NULL );
if ( FAILED(hr) )
return hr;
QTDec_FreeOutTypes(This);
*ppmtAcceptTypes = This->m_pmtConv;
*pcAcceptTypes = This->m_cConv;
return E_NOTIMPL;
}
static HRESULT QTDec_GetAllocProp( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, ALLOCATOR_PROPERTIES* pProp, BOOL* pbTransInPlace, BOOL* pbTryToReuseSample )
{
CQTDecImpl* This = pImpl->m_pUserData;
HRESULT hr;
FIXME("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = QTDec_CheckMediaType( pImpl, pmtIn, NULL );
if ( FAILED(hr) )
return hr;
return E_NOTIMPL;
}
static HRESULT QTDec_BeginTransform( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, BOOL bReuseSample )
{
CQTDecImpl* This = pImpl->m_pUserData;
HRESULT hr;
FIXME("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = QTDec_CheckMediaType( pImpl, pmtIn, NULL );
if ( FAILED(hr) )
return hr;
return E_NOTIMPL;
}
static HRESULT QTDec_Transform( CTransformBaseImpl* pImpl, IMediaSample* pSampIn, IMediaSample* pSampOut )
{
CQTDecImpl* This = pImpl->m_pUserData;
BYTE* pDataIn = NULL;
BYTE* pDataOut = NULL;
HRESULT hr;
FIXME("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = IMediaSample_GetPointer( pSampIn, &pDataIn );
if ( FAILED(hr) )
return hr;
hr = IMediaSample_GetPointer( pSampOut, &pDataOut );
if ( FAILED(hr) )
return hr;
return E_NOTIMPL;
}
static HRESULT QTDec_EndTransform( CTransformBaseImpl* pImpl )
{
CQTDecImpl* This = pImpl->m_pUserData;
if ( This == NULL )
return E_UNEXPECTED;
return E_NOTIMPL;
}
static const TransformBaseHandlers transhandlers =
{
QTDec_Init,
QTDec_Cleanup,
QTDec_CheckMediaType,
QTDec_GetOutputTypes,
QTDec_GetAllocProp,
QTDec_BeginTransform,
NULL,
QTDec_Transform,
QTDec_EndTransform,
};
HRESULT QUARTZ_CreateQuickTimeDecompressor(IUnknown* punkOuter,void** ppobj)
{
return QUARTZ_CreateTransformBase(
punkOuter,ppobj,
&CLSID_quartzQuickTimeDecompressor,
QTDec_FilterName,
NULL, NULL,
&transhandlers );
}

View File

@ -1,211 +0,0 @@
/*
* Implements QuickTime Parser(Splitter).
*
* FIXME - stub
* FIXME - no seeking
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "mmsystem.h"
#include "vfw.h"
#include "winerror.h"
#include "strmif.h"
#include "control.h"
#include "vfwmsgs.h"
#include "amvideo.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "parser.h"
#include "mtype.h"
static const WCHAR QUARTZ_QTParser_Name[] =
{ 'Q','u','i','c','k','T','i','m','e',' ','M','o','v','i','e',' ','P','a','r','s','e','r',0 };
static const WCHAR QUARTZ_QTParserInPin_Name[] =
{ 'I','n',0 };
static const WCHAR QUARTZ_QTParserOutPin_Basename[] =
{ 'S','t','r','e','a','m',0 };
#define WINE_QUARTZ_QTPINNAME_MAX 64
/****************************************************************************
*
* CQTParseImpl
*/
typedef struct CQTParseImpl CQTParseImpl;
typedef struct CQTParseStream CQTParseStream;
struct CQTParseImpl
{
CQTParseStream* pStreamsBuf;
DWORD cIndexEntries;
WCHAR wchWork[ WINE_QUARTZ_QTPINNAME_MAX ];
};
struct CQTParseStream
{
int dummy;
};
static HRESULT CQTParseImpl_InitParser( CParserImpl* pImpl, ULONG* pcStreams )
{
WARN("(%p,%p) stub\n",pImpl,pcStreams);
return E_NOTIMPL;
}
static HRESULT CQTParseImpl_UninitParser( CParserImpl* pImpl )
{
CQTParseImpl* This = (CQTParseImpl*)pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This == NULL )
return NOERROR;
/* destruct */
QUARTZ_FreeMem( This );
pImpl->m_pUserData = NULL;
return NOERROR;
}
static LPCWSTR CQTParseImpl_GetOutPinName( CParserImpl* pImpl, ULONG nStreamIndex )
{
CQTParseImpl* This = (CQTParseImpl*)pImpl->m_pUserData;
int wlen;
TRACE("(%p,%lu)\n",This,nStreamIndex);
if ( This == NULL /*|| nStreamIndex >= This->avih.dwStreams*/ )
return NULL;
wlen = lstrlenW(QUARTZ_QTParserOutPin_Basename);
memcpy( This->wchWork, QUARTZ_QTParserOutPin_Basename, sizeof(WCHAR)*wlen );
This->wchWork[ wlen ] = (nStreamIndex/10) + '0';
This->wchWork[ wlen+1 ] = (nStreamIndex%10) + '0';
This->wchWork[ wlen+2 ] = 0;
return This->wchWork;
}
static HRESULT CQTParseImpl_GetStreamType( CParserImpl* pImpl, ULONG nStreamIndex, AM_MEDIA_TYPE* pmt )
{
CQTParseImpl* This = (CQTParseImpl*)pImpl->m_pUserData;
FIXME("(%p) stub\n",This);
return E_NOTIMPL;
}
static HRESULT CQTParseImpl_CheckStreamType( CParserImpl* pImpl, ULONG nStreamIndex, const AM_MEDIA_TYPE* pmt )
{
CQTParseImpl* This = (CQTParseImpl*)pImpl->m_pUserData;
FIXME("(%p) stub\n",This);
return E_NOTIMPL;
}
static HRESULT CQTParseImpl_GetAllocProp( CParserImpl* pImpl, ALLOCATOR_PROPERTIES* pReqProp )
{
CQTParseImpl* This = (CQTParseImpl*)pImpl->m_pUserData;
FIXME("(%p,%p) stub\n",This,pReqProp);
if ( This == NULL )
return E_UNEXPECTED;
return E_NOTIMPL;
}
static HRESULT CQTParseImpl_GetNextRequest( CParserImpl* pImpl, ULONG* pnStreamIndex, LONGLONG* pllStart, LONG* plLength, REFERENCE_TIME* prtStart, REFERENCE_TIME* prtStop, DWORD* pdwSampleFlags )
{
CQTParseImpl* This = (CQTParseImpl*)pImpl->m_pUserData;
FIXME("(%p) stub\n",This);
if ( This == NULL )
return E_UNEXPECTED;
return E_NOTIMPL;
}
static HRESULT CQTParseImpl_ProcessSample( CParserImpl* pImpl, ULONG nStreamIndex, LONGLONG llStart, LONG lLength, IMediaSample* pSample )
{
CQTParseImpl* This = (CQTParseImpl*)pImpl->m_pUserData;
FIXME("(%p,%lu,%ld,%ld,%p)\n",This,nStreamIndex,(long)llStart,lLength,pSample);
if ( This == NULL )
return E_UNEXPECTED;
return E_NOTIMPL;
}
static const struct ParserHandlers CQTParseImpl_Handlers =
{
CQTParseImpl_InitParser,
CQTParseImpl_UninitParser,
CQTParseImpl_GetOutPinName,
CQTParseImpl_GetStreamType,
CQTParseImpl_CheckStreamType,
CQTParseImpl_GetAllocProp,
CQTParseImpl_GetNextRequest,
CQTParseImpl_ProcessSample,
/* for IQualityControl */
NULL, /* pQualityNotify */
/* for seeking */
NULL, /* pGetSeekingCaps */
NULL, /* pIsTimeFormatSupported */
NULL, /* pGetCurPos */
NULL, /* pSetCurPos */
NULL, /* pGetDuration */
NULL, /* pGetStopPos */
NULL, /* pSetStopPos */
NULL, /* pGetPreroll */
};
HRESULT QUARTZ_CreateQuickTimeMovieParser(IUnknown* punkOuter,void** ppobj)
{
return QUARTZ_CreateParser(
punkOuter,ppobj,
&CLSID_quartzQuickTimeMovieParser,
QUARTZ_QTParser_Name,
QUARTZ_QTParserInPin_Name,
&CQTParseImpl_Handlers );
}

View File

@ -1,26 +1,16 @@
name quartz
type win32
init QUARTZ_DllMain
import oleaut32.dll
import ole32.dll
import msvfw32.dll
import msacm32.dll
import winmm.dll
import user32.dll
import gdi32.dll
import advapi32.dll
import kernel32.dll
import ntdll.dll
debug_channels (quartz)
@ stdcall AMGetErrorTextA(long ptr long) AMGetErrorTextA
@ stdcall AMGetErrorTextW(long ptr long) AMGetErrorTextW
@ stdcall AmpFactorToDB(long) QUARTZ_AmpFactorToDB
@ stdcall DBToAmpFactor(long) QUARTZ_DBToAmpFactor
@ stdcall DllCanUnloadNow() QUARTZ_DllCanUnloadNow
@ stdcall DllGetClassObject(ptr ptr ptr) QUARTZ_DllGetClassObject
@ stdcall DllRegisterServer() QUARTZ_DllRegisterServer
@ stdcall DllUnregisterServer() QUARTZ_DllUnregisterServer
@ stub AMGetErrorTextA
@ stub AMGetErrorTextW
@ stub AmpFactorToDB
@ stub DBToAmpFactor
@ stub DllCanUnloadNow
@ stub DllGetClassObject
@ stub DllRegisterServer
@ stub DllUnregisterServer

View File

@ -1,38 +0,0 @@
/*
* Copyright (C) Hidenori TAKESHIMA
*
* 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 QUARTZ_PRIVATE_H
#define QUARTZ_PRIVATE_H
typedef HRESULT (*QUARTZ_pCreateIUnknown)(IUnknown* punkOuter,void** ppobj);
void* QUARTZ_AllocObj( DWORD dwSize );
void QUARTZ_FreeObj( void* pobj );
void* QUARTZ_AllocMem( DWORD dwSize );
void QUARTZ_FreeMem( void* pMem );
void* QUARTZ_ReallocMem( void* pMem, DWORD dwSize );
#define QUARTZ_TIMEUNITS ((LONGLONG)10000000)
/* undocument APIs. */
LONG WINAPI QUARTZ_AmpFactorToDB( LONG amp );
LONG WINAPI QUARTZ_DBToAmpFactor( LONG dB );
#endif /* QUARTZ_PRIVATE_H */

View File

@ -1,389 +0,0 @@
/*
* Regster/Unregister servers. (for internal use)
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "winreg.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "regsvr.h"
#ifndef NUMELEMS
#define NUMELEMS(elem) (sizeof(elem)/sizeof((elem)[0]))
#endif /* NUMELEMS */
const WCHAR QUARTZ_wszREG_SZ[7] =
{'R','E','G','_','S','Z',0};
const WCHAR QUARTZ_wszInprocServer32[] =
{'I','n','p','r','o','c','S','e','r','v','e','r','3','2',0};
const WCHAR QUARTZ_wszThreadingModel[] =
{'T','h','r','e','a','d','i','n','g','M','o','d','e','l',0};
const WCHAR QUARTZ_wszBoth[] =
{'B','o','t','h',0};
const WCHAR QUARTZ_wszCLSID[] =
{'C','L','S','I','D',0};
const WCHAR QUARTZ_wszFilterData[] =
{'F','i','l','t','e','r','D','a','t','a',0};
const WCHAR QUARTZ_wszFriendlyName[] =
{'F','r','i','e','n','d','l','y','N','a','m','e',0};
const WCHAR QUARTZ_wszInstance[] =
{'I','n','s','t','a','n','c','e',0};
const WCHAR QUARTZ_wszMerit[] =
{'M','e','r','i','t',0};
const WCHAR QUARTZ_wszMediaType[] =
{'M','e','d','i','a',' ','T','y','p','e',0};
const WCHAR QUARTZ_wszSubType[] =
{'S','u','b','T','y','p','e',0};
const WCHAR QUARTZ_wszExtensions[] =
{'E','x','t','e','n','s','i','o','n','s',0};
const WCHAR QUARTZ_wszSourceFilter[] =
{'S','o','u','r','c','e',' ','F','i','l','t','e','r',0};
void QUARTZ_CatPathSepW( WCHAR* pBuf )
{
int len = lstrlenW(pBuf);
pBuf[len] = '\\';
pBuf[len+1] = 0;
}
void QUARTZ_GUIDtoString( WCHAR* pBuf, const GUID* pguid )
{
/* W"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}" */
static const WCHAR wszFmt[] =
{'{','%','0','8','X','-','%','0','4','X','-','%','0','4','X',
'-','%','0','2','X','%','0','2','X','-','%','0','2','X','%',
'0','2','X','%','0','2','X','%','0','2','X','%','0','2','X',
'%','0','2','X','}',0};
wsprintfW( pBuf, wszFmt,
pguid->Data1, pguid->Data2, pguid->Data3,
pguid->Data4[0], pguid->Data4[1],
pguid->Data4[2], pguid->Data4[3],
pguid->Data4[4], pguid->Data4[5],
pguid->Data4[6], pguid->Data4[7] );
}
static
LONG QUARTZ_RegOpenKeyW(
HKEY hkRoot, LPCWSTR lpszPath,
REGSAM rsAccess, HKEY* phKey,
BOOL fCreateKey )
{
DWORD dwDisp;
WCHAR wszREG_SZ[ NUMELEMS(QUARTZ_wszREG_SZ) ];
memcpy(wszREG_SZ,QUARTZ_wszREG_SZ,sizeof(QUARTZ_wszREG_SZ) );
if ( fCreateKey )
return RegCreateKeyExW(
hkRoot, lpszPath, 0, wszREG_SZ,
REG_OPTION_NON_VOLATILE, rsAccess, NULL, phKey, &dwDisp );
else
return RegOpenKeyExW(
hkRoot, lpszPath, 0, rsAccess, phKey );
}
static
LONG QUARTZ_RegSetValueString(
HKEY hKey, LPCWSTR lpszName, LPCWSTR lpValue )
{
return RegSetValueExW(
hKey, lpszName, 0, REG_SZ,
(const BYTE*)lpValue,
sizeof(lpValue[0]) * (lstrlenW(lpValue)+1) );
}
static
LONG QUARTZ_RegSetValueDWord(
HKEY hKey, LPCWSTR lpszName, DWORD dwValue )
{
return RegSetValueExW(
hKey, lpszName, 0, REG_DWORD,
(const BYTE*)(&dwValue), sizeof(DWORD) );
}
static
LONG QUARTZ_RegSetValueBinary(
HKEY hKey, LPCWSTR lpszName,
const BYTE* pData, int iLenOfData )
{
return RegSetValueExW(
hKey, lpszName, 0, REG_BINARY, pData, iLenOfData );
}
HRESULT QUARTZ_CreateCLSIDPath(
WCHAR* pwszBuf, DWORD dwBufLen,
const CLSID* pclsid,
LPCWSTR lpszPathFromCLSID )
{
int avail;
lstrcpyW( pwszBuf, QUARTZ_wszCLSID );
QUARTZ_CatPathSepW( pwszBuf+5 );
QUARTZ_GUIDtoString( pwszBuf+6, pclsid );
if ( lpszPathFromCLSID != NULL )
{
avail = (int)dwBufLen - lstrlenW(pwszBuf) - 8;
if ( avail <= lstrlenW(lpszPathFromCLSID) )
return E_FAIL;
QUARTZ_CatPathSepW( pwszBuf );
lstrcatW( pwszBuf, lpszPathFromCLSID );
}
return NOERROR;
}
HRESULT QUARTZ_OpenCLSIDKey(
HKEY* phKey, /* [OUT] hKey */
REGSAM rsAccess, /* [IN] access */
BOOL fCreate, /* TRUE = RegCreateKey, FALSE = RegOpenKey */
const CLSID* pclsid, /* CLSID */
LPCWSTR lpszPathFromCLSID ) /* related path from CLSID */
{
WCHAR szKey[ 1024 ];
HRESULT hr;
LONG lr;
hr = QUARTZ_CreateCLSIDPath(
szKey, NUMELEMS(szKey),
pclsid, lpszPathFromCLSID );
if ( FAILED(hr) )
return hr;
lr = QUARTZ_RegOpenKeyW(
HKEY_CLASSES_ROOT, szKey, rsAccess, phKey, fCreate );
if ( lr != ERROR_SUCCESS )
return E_FAIL;
return S_OK;
}
HRESULT QUARTZ_RegisterAMovieDLLServer(
const CLSID* pclsid, /* [IN] CLSID */
LPCWSTR lpFriendlyName, /* [IN] Friendly name */
LPCWSTR lpNameOfDLL, /* [IN] name of the registered DLL */
BOOL fRegister ) /* [IN] TRUE = register, FALSE = unregister */
{
HRESULT hr;
HKEY hKey;
if ( fRegister )
{
hr = QUARTZ_OpenCLSIDKey(
&hKey, KEY_ALL_ACCESS, TRUE,
pclsid, NULL );
if ( FAILED(hr) )
return hr;
if ( lpFriendlyName != NULL && QUARTZ_RegSetValueString(
hKey, NULL, lpFriendlyName ) != ERROR_SUCCESS )
hr = E_FAIL;
RegCloseKey( hKey );
if ( FAILED(hr) )
return hr;
hr = QUARTZ_OpenCLSIDKey(
&hKey, KEY_ALL_ACCESS, TRUE,
pclsid, QUARTZ_wszInprocServer32 );
if ( FAILED(hr) )
return hr;
if ( QUARTZ_RegSetValueString(
hKey, NULL, lpNameOfDLL ) != ERROR_SUCCESS )
hr = E_FAIL;
if ( QUARTZ_RegSetValueString(
hKey, QUARTZ_wszThreadingModel,
QUARTZ_wszBoth ) != ERROR_SUCCESS )
hr = E_FAIL;
RegCloseKey( hKey );
if ( FAILED(hr) )
return hr;
}
else
{
hr = QUARTZ_OpenCLSIDKey(
&hKey, KEY_ALL_ACCESS, FALSE,
pclsid, NULL );
if ( FAILED(hr) )
return NOERROR;
RegDeleteValueW( hKey, NULL );
RegDeleteValueW( hKey, QUARTZ_wszThreadingModel );
RegCloseKey( hKey );
if ( FAILED(hr) )
return hr;
/* I think key should be deleted only if no subkey exists. */
FIXME( "unregister %s - key should be removed!\n",
debugstr_guid(pclsid) );
}
return NOERROR;
}
HRESULT QUARTZ_RegisterCategory(
const CLSID* pguidFilterCategory, /* [IN] Category */
LPCWSTR lpFriendlyName, /* [IN] friendly name */
DWORD dwMerit, /* [IN] merit */
BOOL fRegister ) /* [IN] TRUE = register, FALSE = unregister */
{
HRESULT hr;
HKEY hKey;
WCHAR szFilterPath[ 256 ];
WCHAR szCLSID[ 256 ];
QUARTZ_GUIDtoString( szCLSID, pguidFilterCategory );
lstrcpyW( szFilterPath, QUARTZ_wszInstance );
QUARTZ_CatPathSepW( szFilterPath );
lstrcatW( szFilterPath, szCLSID );
if ( fRegister )
{
hr = QUARTZ_OpenCLSIDKey(
&hKey, KEY_ALL_ACCESS, TRUE,
&CLSID_ActiveMovieCategories, szFilterPath );
if ( FAILED(hr) )
return hr;
if ( QUARTZ_RegSetValueString(
hKey, QUARTZ_wszCLSID, szCLSID ) != ERROR_SUCCESS )
hr = E_FAIL;
if ( lpFriendlyName != NULL && QUARTZ_RegSetValueString(
hKey, QUARTZ_wszFriendlyName,
lpFriendlyName ) != ERROR_SUCCESS )
hr = E_FAIL;
if ( dwMerit != 0 &&
QUARTZ_RegSetValueDWord(
hKey, QUARTZ_wszMerit, dwMerit ) != ERROR_SUCCESS )
hr = E_FAIL;
RegCloseKey( hKey );
if ( FAILED(hr) )
return hr;
}
else
{
hr = QUARTZ_OpenCLSIDKey(
&hKey, KEY_ALL_ACCESS, FALSE,
&CLSID_ActiveMovieCategories, szFilterPath );
if ( FAILED(hr) )
return NOERROR;
RegDeleteValueW( hKey, QUARTZ_wszCLSID );
RegDeleteValueW( hKey, QUARTZ_wszFriendlyName );
RegDeleteValueW( hKey, QUARTZ_wszMerit );
RegCloseKey( hKey );
if ( FAILED(hr) )
return hr;
/* I think key should be deleted only if no subkey exists. */
FIXME( "unregister category %s - key should be removed!\n",
debugstr_guid(pguidFilterCategory) );
}
return NOERROR;
}
HRESULT QUARTZ_RegisterAMovieFilter(
const CLSID* pguidFilterCategory, /* [IN] Category */
const CLSID* pclsid, /* [IN] CLSID of this filter */
const BYTE* pbFilterData, /* [IN] filter data(no spec) */
DWORD cbFilterData, /* [IN] size of the filter data */
LPCWSTR lpFriendlyName, /* [IN] friendly name */
LPCWSTR lpInstance, /* [IN] instance */
BOOL fRegister ) /* [IN] TRUE = register, FALSE = unregister */
{
HRESULT hr;
HKEY hKey;
WCHAR szFilterPath[ 256 ];
WCHAR szCLSID[ 256 ];
QUARTZ_GUIDtoString( szCLSID, pclsid );
lstrcpyW( szFilterPath, QUARTZ_wszInstance );
QUARTZ_CatPathSepW( szFilterPath );
lstrcatW( szFilterPath, ( lpInstance != NULL ) ? lpInstance : szCLSID );
if ( fRegister )
{
hr = QUARTZ_OpenCLSIDKey(
&hKey, KEY_ALL_ACCESS, TRUE,
pguidFilterCategory, szFilterPath );
if ( FAILED(hr) )
return hr;
if ( QUARTZ_RegSetValueString(
hKey, QUARTZ_wszCLSID, szCLSID ) != ERROR_SUCCESS )
hr = E_FAIL;
if ( pbFilterData != NULL && cbFilterData > 0 &&
QUARTZ_RegSetValueBinary(
hKey, QUARTZ_wszFilterData,
pbFilterData, cbFilterData ) != ERROR_SUCCESS )
hr = E_FAIL;
if ( lpFriendlyName != NULL && QUARTZ_RegSetValueString(
hKey, QUARTZ_wszFriendlyName,
lpFriendlyName ) != ERROR_SUCCESS )
hr = E_FAIL;
RegCloseKey( hKey );
if ( FAILED(hr) )
return hr;
}
else
{
hr = QUARTZ_OpenCLSIDKey(
&hKey, KEY_ALL_ACCESS, FALSE,
pguidFilterCategory, szFilterPath );
if ( FAILED(hr) )
return NOERROR;
RegDeleteValueW( hKey, QUARTZ_wszCLSID );
RegDeleteValueW( hKey, QUARTZ_wszFilterData );
RegDeleteValueW( hKey, QUARTZ_wszFriendlyName );
RegCloseKey( hKey );
if ( FAILED(hr) )
return hr;
/* I think key should be deleted only if no subkey exists. */
FIXME( "unregister category %s filter %s - key should be removed!\n",
debugstr_guid(pguidFilterCategory),
debugstr_guid(pclsid) );
}
return NOERROR;
}

View File

@ -1,76 +0,0 @@
/*
* Regster/Unregister servers. (for internal use)
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 QUARTZ_REGSVR_H
#define QUARTZ_REGSVR_H
extern const WCHAR QUARTZ_wszREG_SZ[7];
extern const WCHAR QUARTZ_wszInprocServer32[];
extern const WCHAR QUARTZ_wszThreadingModel[];
extern const WCHAR QUARTZ_wszBoth[];
extern const WCHAR QUARTZ_wszCLSID[];
extern const WCHAR QUARTZ_wszFilterData[];
extern const WCHAR QUARTZ_wszFriendlyName[];
extern const WCHAR QUARTZ_wszInstance[];
extern const WCHAR QUARTZ_wszMerit[];
extern const WCHAR QUARTZ_wszMediaType[];
extern const WCHAR QUARTZ_wszSubType[];
extern const WCHAR QUARTZ_wszExtensions[];
extern const WCHAR QUARTZ_wszSourceFilter[];
void QUARTZ_CatPathSepW( WCHAR* pBuf );
void QUARTZ_GUIDtoString( WCHAR* pBuf, const GUID* pguid );
HRESULT QUARTZ_CreateCLSIDPath(
WCHAR* pwszBuf, DWORD dwBufLen,
const CLSID* pclsid,
LPCWSTR lpszPathFromCLSID );
HRESULT QUARTZ_OpenCLSIDKey(
HKEY* phkey, /* [OUT] hKey */
REGSAM rsAccess, /* [IN] access */
BOOL fCreate, /* TRUE = RegCreateKey, FALSE = RegOpenKey */
const CLSID* pclsid, /* CLSID */
LPCWSTR lpszPathFromCLSID ); /* related path from CLSID */
HRESULT QUARTZ_RegisterAMovieDLLServer(
const CLSID* pclsid, /* [IN] CLSID */
LPCWSTR lpFriendlyName, /* [IN] Friendly name */
LPCWSTR lpNameOfDLL, /* [IN] name of the registered DLL */
BOOL fRegister ); /* [IN] TRUE = register, FALSE = unregister */
HRESULT QUARTZ_RegisterCategory(
const CLSID* pguidFilterCategory, /* [IN] Category */
LPCWSTR lpFriendlyName, /* [IN] friendly name */
DWORD dwMerit, /* [IN] merit */
BOOL fRegister ); /* [IN] TRUE = register, FALSE = unregister */
HRESULT QUARTZ_RegisterAMovieFilter(
const CLSID* pguidFilterCategory, /* [IN] Category */
const CLSID* pclsid, /* [IN] CLSID of this filter */
const BYTE* pbFilterData, /* [IN] filter data(no spec) */
DWORD cbFilterData, /* [IN] size of the filter data */
LPCWSTR lpFriendlyName, /* [IN] friendly name */
LPCWSTR lpInstance, /* [IN] instance */
BOOL fRegister ); /* [IN] TRUE = register, FALSE = unregister */
#endif /* QUARTZ_REGSVR_H */

View File

@ -1,677 +0,0 @@
/*
* Implements IMediaSample2 for CMemMediaSample.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "strmif.h"
#include "vfwmsgs.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "sample.h"
#include "mtype.h"
/***************************************************************************
*
* Helper functions
*
*/
HRESULT QUARTZ_IMediaSample_GetProperties(
IMediaSample* pSample,
AM_SAMPLE2_PROPERTIES* pProp )
{
#if 0 /* not yet */
HRESULT hr;
AM_SAMPLE2_PROPERTIES prop;
IMediaSample2* pSample2 = NULL;
ZeroMemory( &prop, sizeof(AM_SAMPLE2_PROPERTIES) );
hr = IMediaSample_QueryInterface( pSample, &IID_IMediaSample2, (void**)&pSample2 );
if ( hr == S_OK )
{
hr = IMediaSample2_GetProperties(pSample2,sizeof(AM_SAMPLE2_PROPERTIES),&prop);
IMediaSample2_Release(pSample2);
if ( hr == S_OK )
{
memcpy( pProp, &prop, sizeof(AM_SAMPLE2_PROPERTIES) );
pProp->pMediaType =
QUARTZ_MediaType_Duplicate( &prop.pMediaType );
return NOERROR;
}
}
#endif
pProp->cbData = sizeof(AM_SAMPLE2_PROPERTIES);
pProp->dwTypeSpecificFlags = 0;
pProp->dwSampleFlags = 0;
if ( IMediaSample_IsSyncPoint(pSample) == S_OK )
pProp->dwSampleFlags |= AM_SAMPLE_SPLICEPOINT;
if ( IMediaSample_IsPreroll(pSample) == S_OK )
pProp->dwSampleFlags |= AM_SAMPLE_PREROLL;
if ( IMediaSample_IsDiscontinuity(pSample) == S_OK )
pProp->dwSampleFlags |= AM_SAMPLE_DATADISCONTINUITY;
pProp->lActual = (LONG)IMediaSample_GetActualDataLength(pSample);
if ( IMediaSample_GetTime(pSample,&pProp->tStart,&pProp->tStop) == S_OK )
pProp->dwSampleFlags |= AM_SAMPLE_TIMEVALID | AM_SAMPLE_STOPVALID;
pProp->dwStreamId = 0;
if ( IMediaSample_GetMediaType(pSample,&(pProp->pMediaType)) == S_OK )
pProp->dwSampleFlags |= AM_SAMPLE_TYPECHANGED;
IMediaSample_GetPointer(pSample,&(pProp->pbBuffer));
pProp->cbBuffer = (LONG)IMediaSample_GetSize(pSample);
return NOERROR;
}
HRESULT QUARTZ_IMediaSample_SetProperties(
IMediaSample* pSample,
const AM_SAMPLE2_PROPERTIES* pProp )
{
HRESULT hr;
AM_SAMPLE2_PROPERTIES prop;
#if 0 /* not yet */
IMediaSample2* pSample2 = NULL;
#endif
memcpy( &prop, pProp, sizeof(AM_SAMPLE2_PROPERTIES) );
prop.cbData = sizeof(AM_SAMPLE2_PROPERTIES);
prop.pbBuffer = NULL;
prop.cbBuffer = 0;
#if 0 /* not yet */
hr = IMediaSample_QueryInterface( pSample, &IID_IMediaSample2, (void**)&pSample2 );
if ( hr == S_OK )
{
hr = IMediaSample2_SetProperties(pSample2,sizeof(AM_SAMPLE2_PROPERTIES),&prop);
IMediaSample2_Release(pSample2);
if ( hr == S_OK )
return NOERROR;
}
#endif
hr = S_OK;
if ( SUCCEEDED(hr) )
hr = IMediaSample_SetSyncPoint(pSample,
(prop.dwSampleFlags & AM_SAMPLE_SPLICEPOINT) ? TRUE : FALSE);
if ( SUCCEEDED(hr) )
hr = IMediaSample_SetPreroll(pSample,
(prop.dwSampleFlags & AM_SAMPLE_PREROLL) ? TRUE : FALSE);
if ( SUCCEEDED(hr) )
hr = IMediaSample_SetDiscontinuity(pSample,
(prop.dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY) ? TRUE : FALSE);
if ( SUCCEEDED(hr) )
{
TRACE("length = %ld/%ld\n",prop.lActual,pProp->cbBuffer);
hr = IMediaSample_SetActualDataLength(pSample,prop.lActual);
}
if ( SUCCEEDED(hr) )
{
if ( ( prop.dwSampleFlags & AM_SAMPLE_TIMEVALID) &&
( prop.dwSampleFlags & AM_SAMPLE_STOPVALID) )
hr = IMediaSample_SetTime(pSample,&prop.tStart,&prop.tStop);
else
hr = IMediaSample_SetTime(pSample,NULL,NULL);
}
if ( SUCCEEDED(hr) )
hr = IMediaSample_SetMediaType(pSample,
(prop.dwSampleFlags & AM_SAMPLE_TYPECHANGED) ?
prop.pMediaType : NULL);
return hr;
}
HRESULT QUARTZ_IMediaSample_Copy(
IMediaSample* pDstSample,
IMediaSample* pSrcSample,
BOOL bCopyData )
{
HRESULT hr;
AM_SAMPLE2_PROPERTIES prop;
BYTE* pDataSrc = NULL;
BYTE* pDataDst = NULL;
hr = QUARTZ_IMediaSample_GetProperties( pSrcSample, &prop );
if ( FAILED(hr) )
return hr;
if ( !bCopyData )
prop.lActual = 0;
hr = QUARTZ_IMediaSample_SetProperties( pDstSample, &prop );
if ( prop.pMediaType != NULL )
QUARTZ_MediaType_Destroy( prop.pMediaType );
if ( SUCCEEDED(hr) && bCopyData )
{
hr = IMediaSample_GetPointer(pSrcSample,&pDataSrc);
if ( SUCCEEDED(hr) )
hr = IMediaSample_GetPointer(pDstSample,&pDataDst);
if ( SUCCEEDED(hr) )
{
if ( pDataSrc != NULL && pDataDst != NULL )
memcpy( pDataDst, pDataSrc, prop.lActual );
else
hr = E_FAIL;
}
}
return hr;
}
/***************************************************************************
*
* CMemMediaSample::IMediaSample2
*
*/
static HRESULT WINAPI
IMediaSample2_fnQueryInterface(IMediaSample2* iface,REFIID riid,void** ppobj)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
if ( ppobj == NULL )
return E_POINTER;
if ( IsEqualGUID( riid, &IID_IUnknown ) ||
IsEqualGUID( riid, &IID_IMediaSample ) ||
IsEqualGUID( riid, &IID_IMediaSample2 ) )
{
*ppobj = iface;
IMediaSample2_AddRef(iface);
return NOERROR;
}
return E_NOINTERFACE;
}
static ULONG WINAPI
IMediaSample2_fnAddRef(IMediaSample2* iface)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->()\n",This);
return InterlockedExchangeAdd(&(This->ref),1) + 1;
}
static ULONG WINAPI
IMediaSample2_fnRelease(IMediaSample2* iface)
{
ICOM_THIS(CMemMediaSample,iface);
LONG ref;
TRACE("(%p)->()\n",This);
if ( This->ref == 0 )
{
ERR("(%p) - released sample!\n",This);
return 0;
}
ref = InterlockedExchangeAdd(&(This->ref),-1) - 1;
if ( ref > 0 )
return (ULONG)ref;
/* this class would be reused.. */
if ( This->prop.pMediaType != NULL )
{
QUARTZ_MediaType_Destroy( This->prop.pMediaType );
This->prop.pMediaType = NULL;
}
This->prop.dwTypeSpecificFlags = 0;
This->prop.dwSampleFlags = 0;
This->prop.lActual = This->prop.cbBuffer;
IMemAllocator_ReleaseBuffer(This->pOwner,(IMediaSample*)iface);
return 0;
}
static HRESULT WINAPI
IMediaSample2_fnGetPointer(IMediaSample2* iface,BYTE** ppData)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->()\n",This);
if ( This->ref == 0 )
{
ERR("(%p) - released sample!\n",This);
return E_UNEXPECTED;
}
if ( ppData == NULL )
return E_POINTER;
*ppData = This->prop.pbBuffer;
return NOERROR;
}
static long WINAPI
IMediaSample2_fnGetSize(IMediaSample2* iface)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->()\n",This);
return This->prop.cbBuffer;
}
static HRESULT WINAPI
IMediaSample2_fnGetTime(IMediaSample2* iface,REFERENCE_TIME* prtStart,REFERENCE_TIME* prtEnd)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->(%p,%p)\n",This,prtStart,prtEnd);
if ( This->ref == 0 )
{
ERR("(%p) - released sample!\n",This);
return E_UNEXPECTED;
}
if ( prtStart == NULL || prtEnd == NULL )
return E_POINTER;
if ( ( This->prop.dwSampleFlags & AM_SAMPLE_TIMEVALID ) &&
( This->prop.dwSampleFlags & AM_SAMPLE_STOPVALID ) )
{
*prtStart = This->prop.tStart;
*prtEnd = This->prop.tStop;
return NOERROR;
}
return VFW_E_MEDIA_TIME_NOT_SET;
}
static HRESULT WINAPI
IMediaSample2_fnSetTime(IMediaSample2* iface,REFERENCE_TIME* prtStart,REFERENCE_TIME* prtEnd)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->(%p,%p) stub!\n",This,prtStart,prtEnd);
This->prop.dwSampleFlags &= ~(AM_SAMPLE_TIMEVALID|AM_SAMPLE_STOPVALID);
if ( prtStart != NULL )
{
This->prop.dwSampleFlags |= AM_SAMPLE_TIMEVALID;
This->prop.tStart = *prtStart;
}
if ( prtEnd != NULL )
{
This->prop.dwSampleFlags |= AM_SAMPLE_STOPVALID;
This->prop.tStop = *prtEnd;
}
return NOERROR;
}
static HRESULT WINAPI
IMediaSample2_fnIsSyncPoint(IMediaSample2* iface)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->()\n",This);
return ( This->prop.dwSampleFlags & AM_SAMPLE_SPLICEPOINT ) ?
S_OK : S_FALSE;
}
static HRESULT WINAPI
IMediaSample2_fnSetSyncPoint(IMediaSample2* iface,BOOL bSync)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->(%d)\n",This,bSync);
if ( bSync )
This->prop.dwSampleFlags |= AM_SAMPLE_SPLICEPOINT;
else
This->prop.dwSampleFlags &= ~AM_SAMPLE_SPLICEPOINT;
return NOERROR;
}
static HRESULT WINAPI
IMediaSample2_fnIsPreroll(IMediaSample2* iface)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->()\n",This);
return ( This->prop.dwSampleFlags & AM_SAMPLE_PREROLL ) ?
S_OK : S_FALSE;
}
static HRESULT WINAPI
IMediaSample2_fnSetPreroll(IMediaSample2* iface,BOOL bPreroll)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->(%d)\n",This,bPreroll);
if ( bPreroll )
This->prop.dwSampleFlags |= AM_SAMPLE_PREROLL;
else
This->prop.dwSampleFlags &= ~AM_SAMPLE_PREROLL;
return NOERROR;
}
static long WINAPI
IMediaSample2_fnGetActualDataLength(IMediaSample2* iface)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->()\n",This);
return This->prop.lActual;
}
static HRESULT WINAPI
IMediaSample2_fnSetActualDataLength(IMediaSample2* iface,long lLength)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->(%ld)\n",This,lLength);
if ( This->prop.cbBuffer < lLength )
return E_INVALIDARG;
This->prop.lActual = lLength;
return NOERROR;
}
static HRESULT WINAPI
IMediaSample2_fnGetMediaType(IMediaSample2* iface,AM_MEDIA_TYPE** ppmt)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->(%p)\n",This,ppmt);
if ( ppmt == NULL )
return E_POINTER;
*ppmt = NULL;
if ( !(This->prop.dwSampleFlags & AM_SAMPLE_TYPECHANGED) )
return S_FALSE;
*ppmt = QUARTZ_MediaType_Duplicate( This->prop.pMediaType );
if ( *ppmt == NULL )
return E_OUTOFMEMORY;
return NOERROR;
}
static HRESULT WINAPI
IMediaSample2_fnSetMediaType(IMediaSample2* iface,AM_MEDIA_TYPE* pmt)
{
ICOM_THIS(CMemMediaSample,iface);
AM_MEDIA_TYPE* pmtDup;
TRACE("(%p)->(%p)\n",This,pmt);
if ( pmt == NULL )
{
/* FIXME? */
if ( This->prop.pMediaType != NULL )
{
QUARTZ_MediaType_Destroy( This->prop.pMediaType );
This->prop.pMediaType = NULL;
}
This->prop.dwSampleFlags &= ~AM_SAMPLE_TYPECHANGED;
return NOERROR;
}
pmtDup = QUARTZ_MediaType_Duplicate( pmt );
if ( pmtDup == NULL )
return E_OUTOFMEMORY;
if ( This->prop.pMediaType != NULL )
QUARTZ_MediaType_Destroy( This->prop.pMediaType );
This->prop.dwSampleFlags |= AM_SAMPLE_TYPECHANGED;
This->prop.pMediaType = pmtDup;
return NOERROR;
}
static HRESULT WINAPI
IMediaSample2_fnIsDiscontinuity(IMediaSample2* iface)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->()\n",This);
return ( This->prop.dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY ) ?
S_OK : S_FALSE;
}
static HRESULT WINAPI
IMediaSample2_fnSetDiscontinuity(IMediaSample2* iface,BOOL bDiscontinuity)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->(%d)\n",This,bDiscontinuity);
if ( bDiscontinuity )
This->prop.dwSampleFlags |= AM_SAMPLE_DATADISCONTINUITY;
else
This->prop.dwSampleFlags &= ~AM_SAMPLE_DATADISCONTINUITY;
return NOERROR;
}
static HRESULT WINAPI
IMediaSample2_fnGetMediaTime(IMediaSample2* iface,LONGLONG* pTimeStart,LONGLONG* pTimeEnd)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->(%p,%p)\n",This,pTimeStart,pTimeEnd);
if ( pTimeStart == NULL || pTimeEnd == NULL )
return E_POINTER;
if ( !This->fMediaTimeIsValid )
return VFW_E_MEDIA_TIME_NOT_SET;
*pTimeStart = This->llMediaTimeStart;
*pTimeEnd = This->llMediaTimeEnd;
return NOERROR;
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaSample2_fnSetMediaTime(IMediaSample2* iface,LONGLONG* pTimeStart,LONGLONG* pTimeEnd)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->()\n",This);
if ( pTimeStart == NULL || pTimeEnd == NULL )
{
This->fMediaTimeIsValid = FALSE;
}
else
{
This->fMediaTimeIsValid = TRUE;
This->llMediaTimeStart = *pTimeStart;
This->llMediaTimeEnd = *pTimeEnd;
}
return NOERROR;
}
static HRESULT WINAPI
IMediaSample2_fnGetProperties(IMediaSample2* iface,DWORD cbProp,BYTE* pbProp)
{
ICOM_THIS(CMemMediaSample,iface);
TRACE("(%p)->(%lu,%p)\n",This,cbProp,pbProp);
if ( cbProp < 0 || cbProp > sizeof(AM_SAMPLE2_PROPERTIES) )
return E_FAIL;
memcpy( pbProp, &This->prop, cbProp );
return NOERROR;
}
static HRESULT WINAPI
IMediaSample2_fnSetProperties(IMediaSample2* iface,DWORD cbProp,const BYTE* pbProp)
{
ICOM_THIS(CMemMediaSample,iface);
const AM_SAMPLE2_PROPERTIES* pProp;
AM_SAMPLE2_PROPERTIES propNew;
AM_MEDIA_TYPE* pmtDup = NULL;
HRESULT hr = E_INVALIDARG;
TRACE("(%p)->(%lu,%p)\n",This,cbProp,pbProp);
if ( pbProp == NULL )
return E_POINTER;
pProp = (const AM_SAMPLE2_PROPERTIES*)pbProp;
if ( cbProp != sizeof(AM_SAMPLE2_PROPERTIES) )
goto err;
CopyMemory( &propNew, pProp, sizeof(AM_SAMPLE2_PROPERTIES) );
if ( propNew.cbData != sizeof(AM_SAMPLE2_PROPERTIES) )
goto err;
if ( This->prop.cbBuffer < propNew.lActual )
goto err;
if ( propNew.dwSampleFlags & AM_SAMPLE_TYPECHANGED )
{
pmtDup = QUARTZ_MediaType_Duplicate( propNew.pMediaType );
if ( pmtDup == NULL )
{
hr = E_OUTOFMEMORY;
goto err;
}
}
if ( propNew.pbBuffer != NULL && propNew.pbBuffer != This->prop.pbBuffer )
goto err;
if ( propNew.cbBuffer != 0 && propNew.cbBuffer != This->prop.cbBuffer )
goto err;
if ( This->prop.pMediaType != NULL )
QUARTZ_MediaType_Destroy( This->prop.pMediaType );
CopyMemory( &This->prop, &propNew, sizeof(AM_SAMPLE2_PROPERTIES) );
This->prop.pMediaType = pmtDup;
pmtDup = NULL;
hr= NOERROR;
err:
if ( pmtDup != NULL )
QUARTZ_MediaType_Destroy( pmtDup );
return hr;
}
static ICOM_VTABLE(IMediaSample2) imediasample2 =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IMediaSample2_fnQueryInterface,
IMediaSample2_fnAddRef,
IMediaSample2_fnRelease,
/* IMediaSample fields */
IMediaSample2_fnGetPointer,
IMediaSample2_fnGetSize,
IMediaSample2_fnGetTime,
IMediaSample2_fnSetTime,
IMediaSample2_fnIsSyncPoint,
IMediaSample2_fnSetSyncPoint,
IMediaSample2_fnIsPreroll,
IMediaSample2_fnSetPreroll,
IMediaSample2_fnGetActualDataLength,
IMediaSample2_fnSetActualDataLength,
IMediaSample2_fnGetMediaType,
IMediaSample2_fnSetMediaType,
IMediaSample2_fnIsDiscontinuity,
IMediaSample2_fnSetDiscontinuity,
IMediaSample2_fnGetMediaTime,
IMediaSample2_fnSetMediaTime,
/* IMediaSample2 fields */
IMediaSample2_fnGetProperties,
IMediaSample2_fnSetProperties,
};
/***************************************************************************
*
* new/delete for CMemMediaSample
*
*/
HRESULT QUARTZ_CreateMemMediaSample(
BYTE* pbData, DWORD dwDataLength,
IMemAllocator* pOwner,
CMemMediaSample** ppSample )
{
CMemMediaSample* pms;
TRACE("(%p,%08lx,%p,%p)\n",pbData,dwDataLength,pOwner,ppSample);
pms = (CMemMediaSample*)QUARTZ_AllocObj( sizeof(CMemMediaSample) );
if ( pms == NULL )
return E_OUTOFMEMORY;
ICOM_VTBL(pms) = &imediasample2;
pms->ref = 0;
pms->pOwner = pOwner;
pms->fMediaTimeIsValid = FALSE;
pms->llMediaTimeStart = 0;
pms->llMediaTimeEnd = 0;
ZeroMemory( &(pms->prop), sizeof(pms->prop) );
pms->prop.cbData = sizeof(pms->prop);
pms->prop.dwTypeSpecificFlags = 0;
pms->prop.dwSampleFlags = 0;
pms->prop.pbBuffer = pbData;
pms->prop.cbBuffer = (LONG)dwDataLength;
pms->prop.lActual = (LONG)dwDataLength;
*ppSample = pms;
return S_OK;
}
void QUARTZ_DestroyMemMediaSample(
CMemMediaSample* pSample )
{
TRACE("(%p)\n",pSample);
QUARTZ_FreeObj( pSample );
}

View File

@ -1,66 +0,0 @@
/*
* Copyright (C) Hidenori TAKESHIMA
*
* 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 WINE_DSHOW_SAMPLE_H
#define WINE_DSHOW_SAMPLE_H
/*
implements CMemMediaSample.
- At least, the following interfaces should be implemented:
IUnknown - IMediaSample - IMediaSample2
*/
typedef struct CMemMediaSample
{
ICOM_VFIELD(IMediaSample2);
/* IUnknown fields */
ULONG ref;
/* IMediaSample2 fields */
IMemAllocator* pOwner; /* not addref-ed. */
BOOL fMediaTimeIsValid;
LONGLONG llMediaTimeStart;
LONGLONG llMediaTimeEnd;
AM_SAMPLE2_PROPERTIES prop;
} CMemMediaSample;
HRESULT QUARTZ_CreateMemMediaSample(
BYTE* pbData, DWORD dwDataLength,
IMemAllocator* pOwner,
CMemMediaSample** ppSample );
void QUARTZ_DestroyMemMediaSample(
CMemMediaSample* pSample );
HRESULT QUARTZ_IMediaSample_GetProperties(
IMediaSample* pSample,
AM_SAMPLE2_PROPERTIES* pProp );
HRESULT QUARTZ_IMediaSample_SetProperties(
IMediaSample* pSample,
const AM_SAMPLE2_PROPERTIES* pProp );
HRESULT QUARTZ_IMediaSample_Copy(
IMediaSample* pDstSample,
IMediaSample* pSrcSample,
BOOL bCopyData );
#endif /* WINE_DSHOW_SAMPLE_H */

View File

@ -1,862 +0,0 @@
/*
* Implementation of CLSID_SeekingPassThru
*
* FIXME - not tested yet.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "strmif.h"
#include "control.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "seekpass.h"
/***************************************************************************
*
* CSeekingPassThru::ISeekingPassThru
*
*/
static HRESULT WINAPI
ISeekingPassThru_fnQueryInterface(ISeekingPassThru* iface,REFIID riid,void** ppobj)
{
CSeekingPassThru_THIS(iface,seekpass);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
ISeekingPassThru_fnAddRef(ISeekingPassThru* iface)
{
CSeekingPassThru_THIS(iface,seekpass);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
ISeekingPassThru_fnRelease(ISeekingPassThru* iface)
{
CSeekingPassThru_THIS(iface,seekpass);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
ISeekingPassThru_fnInit(ISeekingPassThru* iface,BOOL bRendering,IPin* pPin)
{
CSeekingPassThru_THIS(iface,seekpass);
TRACE("(%p)->(%d,%p)\n",This,bRendering,pPin);
if ( pPin == NULL )
return E_POINTER;
if ( bRendering )
{
WARN("bRendering != FALSE\n");
}
/* Why is 'bRendering' given as an argument?? */
EnterCriticalSection( &This->cs );
if ( This->passthru.pPin != NULL )
IPin_Release( This->passthru.pPin );
This->passthru.pPin = pPin; IPin_AddRef( pPin );
LeaveCriticalSection( &This->cs );
return NOERROR;
}
static ICOM_VTABLE(ISeekingPassThru) iseekingpassthru =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
ISeekingPassThru_fnQueryInterface,
ISeekingPassThru_fnAddRef,
ISeekingPassThru_fnRelease,
/* ISeekingPassThru fields */
ISeekingPassThru_fnInit,
};
static
HRESULT CSeekingPassThru_InitISeekingPassThru(CSeekingPassThru* This)
{
TRACE("(%p)\n",This);
ICOM_VTBL(&This->seekpass) = &iseekingpassthru;
This->passthru.punk = This->unk.punkControl;
This->passthru.pPin = NULL;
InitializeCriticalSection( &This->cs );
return NOERROR;
}
static
void CSeekingPassThru_UninitISeekingPassThru(CSeekingPassThru* This)
{
TRACE("(%p)\n",This);
if ( This->passthru.pPin != NULL )
{
IPin_Release( This->passthru.pPin );
This->passthru.pPin = NULL;
}
DeleteCriticalSection( &This->cs );
}
/***************************************************************************
*
* new/delete for CLSID_SeekingPassThru.
*
*/
/* can I use offsetof safely? - FIXME? */
static QUARTZ_IFEntry IFEntries[] =
{
{ &IID_ISeekingPassThru, offsetof(CSeekingPassThru,seekpass)-offsetof(CSeekingPassThru,unk) },
{ &IID_IMediaPosition, offsetof(CSeekingPassThru,passthru.mpos)-offsetof(CSeekingPassThru,unk) },
{ &IID_IMediaSeeking, offsetof(CSeekingPassThru,passthru.mseek)-offsetof(CSeekingPassThru,unk) },
};
static void QUARTZ_DestroySeekingPassThru(IUnknown* punk)
{
CSeekingPassThru_THIS(punk,unk);
TRACE("(%p)\n",This);
CPassThruImpl_UninitIMediaSeeking( &This->passthru );
CPassThruImpl_UninitIMediaPosition( &This->passthru );
CSeekingPassThru_UninitISeekingPassThru(This);
}
HRESULT QUARTZ_CreateSeekingPassThru(IUnknown* punkOuter,void** ppobj)
{
HRESULT hr;
CSeekingPassThru* This;
TRACE("(%p,%p)\n",punkOuter,ppobj);
hr = QUARTZ_CreateSeekingPassThruInternal(punkOuter,&This,FALSE,NULL);
if ( hr != S_OK )
return hr;
ppobj = (void*)(&This->unk);
return NOERROR;
}
HRESULT QUARTZ_CreateSeekingPassThruInternal(IUnknown* punkOuter,CSeekingPassThru** ppobj,BOOL bRendering,IPin* pPin)
{
CSeekingPassThru* This;
HRESULT hr;
TRACE("(%p,%p,%d,%p)\n",punkOuter,ppobj,(int)bRendering,pPin);
This = (CSeekingPassThru*)QUARTZ_AllocObj( sizeof(CSeekingPassThru) );
if ( This == NULL )
return E_OUTOFMEMORY;
QUARTZ_IUnkInit( &This->unk, punkOuter );
hr = CSeekingPassThru_InitISeekingPassThru(This);
if ( SUCCEEDED(hr) )
{
hr = CPassThruImpl_InitIMediaPosition( &This->passthru );
if ( SUCCEEDED(hr) )
{
hr = CPassThruImpl_InitIMediaSeeking( &This->passthru );
if ( FAILED(hr) )
{
CPassThruImpl_UninitIMediaPosition( &This->passthru );
}
}
else
{
CSeekingPassThru_UninitISeekingPassThru(This);
}
}
if ( FAILED(hr) )
{
QUARTZ_FreeObj( This );
return hr;
}
This->unk.pEntries = IFEntries;
This->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
This->unk.pOnFinalRelease = QUARTZ_DestroySeekingPassThru;
*ppobj = This;
if ( pPin != NULL )
{
hr = ISeekingPassThru_Init((ISeekingPassThru*)(&This->seekpass),bRendering,pPin);
if ( FAILED(hr) )
{
IUnknown_Release(This->unk.punkControl);
return hr;
}
}
return S_OK;
}
/***************************************************************************
*
* CPassThruImpl Helper methods.
*
*/
static
HRESULT CPassThruImpl_GetConnected( CPassThruImpl* pImpl, IPin** ppPin )
{
return IPin_ConnectedTo( pImpl->pPin, ppPin );
}
HRESULT CPassThruImpl_QueryPosPass(
CPassThruImpl* pImpl, IMediaPosition** ppPosition )
{
IPin* pPin;
HRESULT hr;
hr = CPassThruImpl_GetConnected( pImpl, &pPin );
if ( FAILED(hr) )
return hr;
hr = IPin_QueryInterface(pPin,&IID_IMediaPosition,(void**)ppPosition);
IPin_Release(pPin);
return hr;
}
HRESULT CPassThruImpl_QuerySeekPass(
CPassThruImpl* pImpl, IMediaSeeking** ppSeeking )
{
IPin* pPin;
HRESULT hr;
hr = CPassThruImpl_GetConnected( pImpl, &pPin );
if ( FAILED(hr) )
return hr;
hr = IPin_QueryInterface(pPin,&IID_IMediaSeeking,(void**)ppSeeking);
IPin_Release(pPin);
return hr;
}
/***************************************************************************
*
* An implementation for CPassThruImpl::IMediaPosition.
*
*/
#define QUERYPOSPASS \
IMediaPosition* pPos = NULL; \
HRESULT hr; \
hr = CPassThruImpl_QueryPosPass( This, &pPos ); \
if ( FAILED(hr) ) return hr;
static HRESULT WINAPI
IMediaPosition_fnQueryInterface(IMediaPosition* iface,REFIID riid,void** ppobj)
{
CPassThruImpl_THIS(iface,mpos);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->punk,riid,ppobj);
}
static ULONG WINAPI
IMediaPosition_fnAddRef(IMediaPosition* iface)
{
CPassThruImpl_THIS(iface,mpos);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->punk);
}
static ULONG WINAPI
IMediaPosition_fnRelease(IMediaPosition* iface)
{
CPassThruImpl_THIS(iface,mpos);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->punk);
}
static HRESULT WINAPI
IMediaPosition_fnGetTypeInfoCount(IMediaPosition* iface,UINT* pcTypeInfo)
{
CPassThruImpl_THIS(iface,mpos);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaPosition_fnGetTypeInfo(IMediaPosition* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
{
CPassThruImpl_THIS(iface,mpos);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaPosition_fnGetIDsOfNames(IMediaPosition* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
{
CPassThruImpl_THIS(iface,mpos);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaPosition_fnInvoke(IMediaPosition* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
CPassThruImpl_THIS(iface,mpos);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaPosition_fnget_Duration(IMediaPosition* iface,REFTIME* prefTime)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
hr = IMediaPosition_get_Duration(pPos,prefTime);
IMediaPosition_Release(pPos);
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnput_CurrentPosition(IMediaPosition* iface,REFTIME refTime)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
hr = IMediaPosition_put_CurrentPosition(pPos,refTime);
IMediaPosition_Release(pPos);
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnget_CurrentPosition(IMediaPosition* iface,REFTIME* prefTime)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
hr = IMediaPosition_get_CurrentPosition(pPos,prefTime);
IMediaPosition_Release(pPos);
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnget_StopTime(IMediaPosition* iface,REFTIME* prefTime)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
hr = IMediaPosition_get_StopTime(pPos,prefTime);
IMediaPosition_Release(pPos);
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnput_StopTime(IMediaPosition* iface,REFTIME refTime)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
hr = IMediaPosition_put_StopTime(pPos,refTime);
IMediaPosition_Release(pPos);
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnget_PrerollTime(IMediaPosition* iface,REFTIME* prefTime)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
hr = IMediaPosition_get_PrerollTime(pPos,prefTime);
IMediaPosition_Release(pPos);
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnput_PrerollTime(IMediaPosition* iface,REFTIME refTime)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
hr = IMediaPosition_put_PrerollTime(pPos,refTime);
IMediaPosition_Release(pPos);
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnput_Rate(IMediaPosition* iface,double dblRate)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
hr = IMediaPosition_put_Rate(pPos,dblRate);
IMediaPosition_Release(pPos);
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnget_Rate(IMediaPosition* iface,double* pdblRate)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
hr = IMediaPosition_get_Rate(pPos,pdblRate);
IMediaPosition_Release(pPos);
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnCanSeekForward(IMediaPosition* iface,LONG* pCanSeek)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
hr = IMediaPosition_CanSeekForward(pPos,pCanSeek);
IMediaPosition_Release(pPos);
return hr;
}
static HRESULT WINAPI
IMediaPosition_fnCanSeekBackward(IMediaPosition* iface,LONG* pCanSeek)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
hr = IMediaPosition_CanSeekBackward(pPos,pCanSeek);
IMediaPosition_Release(pPos);
return hr;
}
static ICOM_VTABLE(IMediaPosition) impos =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IMediaPosition_fnQueryInterface,
IMediaPosition_fnAddRef,
IMediaPosition_fnRelease,
/* IDispatch fields */
IMediaPosition_fnGetTypeInfoCount,
IMediaPosition_fnGetTypeInfo,
IMediaPosition_fnGetIDsOfNames,
IMediaPosition_fnInvoke,
/* IMediaPosition fields */
IMediaPosition_fnget_Duration,
IMediaPosition_fnput_CurrentPosition,
IMediaPosition_fnget_CurrentPosition,
IMediaPosition_fnget_StopTime,
IMediaPosition_fnput_StopTime,
IMediaPosition_fnget_PrerollTime,
IMediaPosition_fnput_PrerollTime,
IMediaPosition_fnput_Rate,
IMediaPosition_fnget_Rate,
IMediaPosition_fnCanSeekForward,
IMediaPosition_fnCanSeekBackward,
};
HRESULT CPassThruImpl_InitIMediaPosition( CPassThruImpl* pImpl )
{
TRACE("(%p)\n",pImpl);
ICOM_VTBL(&pImpl->mpos) = &impos;
return NOERROR;
}
void CPassThruImpl_UninitIMediaPosition( CPassThruImpl* pImpl )
{
TRACE("(%p)\n",pImpl);
}
#undef QUERYPOSPASS
/***************************************************************************
*
* An implementation for CPassThruImpl::IMediaSeeking.
*
*/
#define QUERYSEEKPASS \
IMediaSeeking* pSeek = NULL; \
HRESULT hr; \
hr = CPassThruImpl_QuerySeekPass( This, &pSeek ); \
if ( FAILED(hr) ) return hr;
static HRESULT WINAPI
IMediaSeeking_fnQueryInterface(IMediaSeeking* iface,REFIID riid,void** ppobj)
{
CPassThruImpl_THIS(iface,mseek);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->punk,riid,ppobj);
}
static ULONG WINAPI
IMediaSeeking_fnAddRef(IMediaSeeking* iface)
{
CPassThruImpl_THIS(iface,mseek);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->punk);
}
static ULONG WINAPI
IMediaSeeking_fnRelease(IMediaSeeking* iface)
{
CPassThruImpl_THIS(iface,mseek);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->punk);
}
static HRESULT WINAPI
IMediaSeeking_fnGetCapabilities(IMediaSeeking* iface,DWORD* pdwCaps)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
hr = IMediaSeeking_GetCapabilities(pSeek,pdwCaps);
IMediaSeeking_Release(pSeek);
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnCheckCapabilities(IMediaSeeking* iface,DWORD* pdwCaps)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
hr = IMediaSeeking_CheckCapabilities(pSeek,pdwCaps);
IMediaSeeking_Release(pSeek);
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnIsFormatSupported(IMediaSeeking* iface,const GUID* pidFormat)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
hr = IMediaSeeking_IsFormatSupported(pSeek,pidFormat);
IMediaSeeking_Release(pSeek);
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnQueryPreferredFormat(IMediaSeeking* iface,GUID* pidFormat)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
hr = IMediaSeeking_QueryPreferredFormat(pSeek,pidFormat);
IMediaSeeking_Release(pSeek);
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnGetTimeFormat(IMediaSeeking* iface,GUID* pidFormat)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
hr = IMediaSeeking_GetTimeFormat(pSeek,pidFormat);
IMediaSeeking_Release(pSeek);
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnIsUsingTimeFormat(IMediaSeeking* iface,const GUID* pidFormat)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
hr = IMediaSeeking_IsUsingTimeFormat(pSeek,pidFormat);
IMediaSeeking_Release(pSeek);
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnSetTimeFormat(IMediaSeeking* iface,const GUID* pidFormat)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
hr = IMediaSeeking_SetTimeFormat(pSeek,pidFormat);
IMediaSeeking_Release(pSeek);
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnGetDuration(IMediaSeeking* iface,LONGLONG* pllDuration)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
hr = IMediaSeeking_GetDuration(pSeek,pllDuration);
IMediaSeeking_Release(pSeek);
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnGetStopPosition(IMediaSeeking* iface,LONGLONG* pllPos)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
hr = IMediaSeeking_GetStopPosition(pSeek,pllPos);
IMediaSeeking_Release(pSeek);
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnGetCurrentPosition(IMediaSeeking* iface,LONGLONG* pllPos)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
hr = IMediaSeeking_GetCurrentPosition(pSeek,pllPos);
IMediaSeeking_Release(pSeek);
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnConvertTimeFormat(IMediaSeeking* iface,LONGLONG* pllOut,const GUID* pidFmtOut,LONGLONG llIn,const GUID* pidFmtIn)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
hr = IMediaSeeking_ConvertTimeFormat(pSeek,pllOut,pidFmtOut,llIn,pidFmtIn);
IMediaSeeking_Release(pSeek);
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnSetPositions(IMediaSeeking* iface,LONGLONG* pllCur,DWORD dwCurFlags,LONGLONG* pllStop,DWORD dwStopFlags)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
hr = IMediaSeeking_SetPositions(pSeek,pllCur,dwCurFlags,pllStop,dwStopFlags);
IMediaSeeking_Release(pSeek);
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnGetPositions(IMediaSeeking* iface,LONGLONG* pllCur,LONGLONG* pllStop)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
hr = IMediaSeeking_GetPositions(pSeek,pllCur,pllStop);
IMediaSeeking_Release(pSeek);
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnGetAvailable(IMediaSeeking* iface,LONGLONG* pllFirst,LONGLONG* pllLast)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
hr = IMediaSeeking_GetAvailable(pSeek,pllFirst,pllLast);
IMediaSeeking_Release(pSeek);
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnSetRate(IMediaSeeking* iface,double dblRate)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
hr = IMediaSeeking_SetRate(pSeek,dblRate);
IMediaSeeking_Release(pSeek);
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnGetRate(IMediaSeeking* iface,double* pdblRate)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
hr = IMediaSeeking_GetRate(pSeek,pdblRate);
IMediaSeeking_Release(pSeek);
return hr;
}
static HRESULT WINAPI
IMediaSeeking_fnGetPreroll(IMediaSeeking* iface,LONGLONG* pllPreroll)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
hr = IMediaSeeking_GetPreroll(pSeek,pllPreroll);
IMediaSeeking_Release(pSeek);
return hr;
}
static ICOM_VTABLE(IMediaSeeking) imseek =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IMediaSeeking_fnQueryInterface,
IMediaSeeking_fnAddRef,
IMediaSeeking_fnRelease,
/* IMediaSeeking fields */
IMediaSeeking_fnGetCapabilities,
IMediaSeeking_fnCheckCapabilities,
IMediaSeeking_fnIsFormatSupported,
IMediaSeeking_fnQueryPreferredFormat,
IMediaSeeking_fnGetTimeFormat,
IMediaSeeking_fnIsUsingTimeFormat,
IMediaSeeking_fnSetTimeFormat,
IMediaSeeking_fnGetDuration,
IMediaSeeking_fnGetStopPosition,
IMediaSeeking_fnGetCurrentPosition,
IMediaSeeking_fnConvertTimeFormat,
IMediaSeeking_fnSetPositions,
IMediaSeeking_fnGetPositions,
IMediaSeeking_fnGetAvailable,
IMediaSeeking_fnSetRate,
IMediaSeeking_fnGetRate,
IMediaSeeking_fnGetPreroll,
};
HRESULT CPassThruImpl_InitIMediaSeeking( CPassThruImpl* pImpl )
{
TRACE("(%p)\n",pImpl);
ICOM_VTBL(&pImpl->mseek) = &imseek;
return NOERROR;
}
void CPassThruImpl_UninitIMediaSeeking( CPassThruImpl* pImpl )
{
TRACE("(%p)\n",pImpl);
}
#undef QUERYSEEKPASS

View File

@ -1,81 +0,0 @@
/*
* Copyright (C) Hidenori TAKESHIMA
*
* 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 WINE_DSHOW_SEEKPASS_H
#define WINE_DSHOW_SEEKPASS_H
/*
implements CLSID_SeekingPassThru.
- At least, the following interfaces should be implemented:
IUnknown
+ ISeekingPassThru
*/
#include "iunk.h"
/****************************************************************************/
typedef struct CPassThruImpl
{
struct { ICOM_VFIELD(IMediaPosition); } mpos;
struct { ICOM_VFIELD(IMediaSeeking); } mseek;
IUnknown* punk;
IPin* pPin;
} CPassThruImpl;
#define CPassThruImpl_THIS(iface,member) CPassThruImpl* This = ((CPassThruImpl*)(((char*)iface)-offsetof(CPassThruImpl,member)))
HRESULT CPassThruImpl_InitIMediaPosition( CPassThruImpl* pImpl );
void CPassThruImpl_UninitIMediaPosition( CPassThruImpl* pImpl );
HRESULT CPassThruImpl_InitIMediaSeeking( CPassThruImpl* pImpl );
void CPassThruImpl_UninitIMediaSeeking( CPassThruImpl* pImpl );
HRESULT CPassThruImpl_QueryPosPass(
CPassThruImpl* pImpl, IMediaPosition** ppPosition );
HRESULT CPassThruImpl_QuerySeekPass(
CPassThruImpl* pImpl, IMediaSeeking** ppSeeking );
/****************************************************************************/
typedef struct QUARTZ_ISeekingPassThruImpl
{
ICOM_VFIELD(ISeekingPassThru);
} QUARTZ_ISeekingPassThruImpl;
typedef struct CSeekingPassThru
{
QUARTZ_IUnkImpl unk;
QUARTZ_ISeekingPassThruImpl seekpass;
/* ISeekingPassThru fields. */
CRITICAL_SECTION cs;
CPassThruImpl passthru;
} CSeekingPassThru;
#define CSeekingPassThru_THIS(iface,member) CSeekingPassThru* This = ((CSeekingPassThru*)(((char*)iface)-offsetof(CSeekingPassThru,member)))
HRESULT QUARTZ_CreateSeekingPassThru(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateSeekingPassThruInternal(IUnknown* punkOuter,CSeekingPassThru** ppobj,BOOL bRendering,IPin* pPin);
#endif /* WINE_DSHOW_SEEKPASS_H */

View File

@ -1,530 +0,0 @@
/*
* Implementation of CLSID_SystemClock.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "strmif.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "sysclock.h"
/***************************************************************************
*
* new/delete for CLSID_SystemClock
*
*/
/* can I use offsetof safely? - FIXME? */
static QUARTZ_IFEntry IFEntries[] =
{
{ &IID_IReferenceClock, offsetof(CSystemClock,refclk)-offsetof(CSystemClock,unk) },
};
static void QUARTZ_DestroySystemClock(IUnknown* punk)
{
CSystemClock_THIS(punk,unk);
CSystemClock_UninitIReferenceClock( This );
}
HRESULT QUARTZ_CreateSystemClock(IUnknown* punkOuter,void** ppobj)
{
CSystemClock* psc;
HRESULT hr;
TRACE("(%p,%p)\n",punkOuter,ppobj);
psc = (CSystemClock*)QUARTZ_AllocObj( sizeof(CSystemClock) );
if ( psc == NULL )
return E_OUTOFMEMORY;
QUARTZ_IUnkInit( &psc->unk, punkOuter );
hr = CSystemClock_InitIReferenceClock( psc );
if ( FAILED(hr) )
{
QUARTZ_FreeObj( psc );
return hr;
}
psc->unk.pEntries = IFEntries;
psc->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
psc->unk.pOnFinalRelease = QUARTZ_DestroySystemClock;
*ppobj = (void*)(&psc->unk);
return S_OK;
}
/***************************************************************************
*
* CLSID_SystemClock::IReferenceClock
*
*/
#define QUARTZ_MSG_ADDTIMER (WM_APP+0)
#define QUARTZ_MSG_REMOVETIMER (WM_APP+1)
#define QUARTZ_MSG_EXITTHREAD (WM_APP+2)
/****************************************************************************/
static QUARTZ_TimerEntry* IReferenceClock_AllocTimerEntry(CSystemClock* This)
{
QUARTZ_TimerEntry* pEntry;
DWORD dw;
pEntry = &This->m_timerEntries[0];
for ( dw = 0; dw < WINE_QUARTZ_SYSCLOCK_TIMER_MAX; dw++ )
{
if ( pEntry->hEvent == (HANDLE)NULL )
return pEntry;
pEntry ++;
}
return NULL;
}
static QUARTZ_TimerEntry* IReferenceClock_SearchTimer(CSystemClock* This, DWORD dwAdvCookie)
{
QUARTZ_TimerEntry* pEntry;
DWORD dw;
pEntry = &This->m_timerEntries[0];
for ( dw = 0; dw < WINE_QUARTZ_SYSCLOCK_TIMER_MAX; dw++ )
{
if ( pEntry->hEvent != (HANDLE)NULL &&
pEntry->dwAdvCookie == dwAdvCookie )
return pEntry;
pEntry ++;
}
return NULL;
}
static DWORD IReferenceClock_OnTimerUpdated(CSystemClock* This)
{
QUARTZ_TimerEntry* pEntry;
REFERENCE_TIME rtCur;
REFERENCE_TIME rtSignal;
REFERENCE_TIME rtCount;
HRESULT hr;
LONG lCount;
DWORD dw;
DWORD dwTimeout = INFINITE;
DWORD dwTimeoutCur;
hr = IReferenceClock_GetTime((IReferenceClock*)(&This->refclk),&rtCur);
if ( hr != NOERROR )
return INFINITE;
pEntry = &This->m_timerEntries[0];
for ( dw = 0; dw < WINE_QUARTZ_SYSCLOCK_TIMER_MAX; dw++ )
{
if ( pEntry->hEvent != (HANDLE)NULL )
{
rtSignal = pEntry->rtStart + pEntry->rtInterval;
if ( rtCur >= rtSignal )
{
if ( pEntry->fPeriodic )
{
rtCount = ((rtCur - pEntry->rtStart) / pEntry->rtInterval);
lCount = ( rtCount > (REFERENCE_TIME)0x7fffffff ) ?
(LONG)0x7fffffff : (LONG)rtCount;
if ( !ReleaseSemaphore( pEntry->hEvent, lCount, NULL ) )
{
while ( lCount > 0 )
{
if ( !ReleaseSemaphore( pEntry->hEvent, 1, NULL ) )
break;
}
}
dwTimeout = 0;
}
else
{
TRACE( "signal an event\n" );
SetEvent( pEntry->hEvent );
pEntry->hEvent = (HANDLE)NULL;
}
}
else
{
rtCount = rtSignal - rtCur;
/* [100ns] -> [ms] */
rtCount = (rtCount+(REFERENCE_TIME)9999)/(REFERENCE_TIME)10000;
dwTimeoutCur = (rtCount >= 0xfffffffe) ? (DWORD)0xfffffffe : (DWORD)rtCount;
if ( dwTimeout > dwTimeoutCur )
dwTimeout = dwTimeoutCur;
}
}
pEntry ++;
}
return dwTimeout;
}
static
DWORD WINAPI IReferenceClock_TimerEntry( LPVOID lpvParam )
{
CSystemClock* This = (CSystemClock*)lpvParam;
MSG msg;
DWORD dwRes;
DWORD dwTimeout;
/* initialize the message queue. */
PeekMessageA( &msg, (HWND)NULL, 0, 0, PM_NOREMOVE );
/* resume the owner thread. */
SetEvent( This->m_hEventInit );
TRACE( "Enter message loop.\n" );
/* message loop. */
dwTimeout = INFINITE;
while ( 1 )
{
if ( dwTimeout > 0 )
{
dwRes = MsgWaitForMultipleObjects(
0, NULL, FALSE,
dwTimeout,
QS_ALLEVENTS );
}
EnterCriticalSection( &This->m_csClock );
dwTimeout = IReferenceClock_OnTimerUpdated(This);
LeaveCriticalSection( &This->m_csClock );
TRACE( "catch an event / timeout %lu\n", dwTimeout );
while ( PeekMessageA( &msg, (HWND)NULL, 0, 0, PM_REMOVE ) )
{
if ( msg.message == WM_QUIT )
goto quitthread;
if ( msg.hwnd != (HWND)NULL )
{
TranslateMessage( &msg );
DispatchMessageA( &msg );
}
else
{
switch ( msg.message )
{
case QUARTZ_MSG_ADDTIMER:
case QUARTZ_MSG_REMOVETIMER:
dwTimeout = 0;
break;
case QUARTZ_MSG_EXITTHREAD:
PostQuitMessage(0);
break;
default:
FIXME( "invalid message %04u\n", (unsigned)msg.message );
break;
}
}
}
}
quitthread:
TRACE( "quit thread\n" );
return 0;
}
/****************************************************************************/
static HRESULT WINAPI
IReferenceClock_fnQueryInterface(IReferenceClock* iface,REFIID riid,void** ppobj)
{
CSystemClock_THIS(iface,refclk);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IReferenceClock_fnAddRef(IReferenceClock* iface)
{
CSystemClock_THIS(iface,refclk);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IReferenceClock_fnRelease(IReferenceClock* iface)
{
CSystemClock_THIS(iface,refclk);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IReferenceClock_fnGetTime(IReferenceClock* iface,REFERENCE_TIME* prtTime)
{
CSystemClock_THIS(iface,refclk);
DWORD dwTimeCur;
TRACE( "(%p)->(%p)\n", This, prtTime );
if ( prtTime == NULL )
return E_POINTER;
EnterCriticalSection( &This->m_csClock );
dwTimeCur = GetTickCount();
This->m_rtLast += (REFERENCE_TIME)(DWORD)(dwTimeCur - This->m_dwTimeLast) * (REFERENCE_TIME)10000;
This->m_dwTimeLast = dwTimeCur;
*prtTime = This->m_rtLast;
LeaveCriticalSection( &This->m_csClock );
return NOERROR;
}
static HRESULT WINAPI
IReferenceClock_fnAdviseTime(IReferenceClock* iface,REFERENCE_TIME rtBase,REFERENCE_TIME rtStream,HEVENT hEvent,DWORD_PTR* pdwAdvCookie)
{
CSystemClock_THIS(iface,refclk);
QUARTZ_TimerEntry* pEntry;
HRESULT hr;
REFERENCE_TIME rtCur;
TRACE( "(%p)->()\n", This );
if ( pdwAdvCookie == NULL )
return E_POINTER;
if ( hEvent == (HANDLE)NULL )
return E_INVALIDARG;
EnterCriticalSection( &This->m_csClock );
*pdwAdvCookie = (DWORD_PTR)(This->m_dwAdvCookieNext ++);
hr = IReferenceClock_GetTime(iface,&rtCur);
if ( hr != NOERROR )
goto err;
if ( rtCur >= (rtBase+rtStream) )
{
SetEvent(hEvent);
hr = NOERROR;
goto err;
}
pEntry = IReferenceClock_AllocTimerEntry(This);
if ( pEntry == NULL )
{
hr = E_FAIL;
goto err;
}
pEntry->dwAdvCookie = *pdwAdvCookie;
pEntry->fPeriodic = FALSE;
pEntry->hEvent = hEvent;
pEntry->rtStart = rtBase;
pEntry->rtInterval = rtStream;
if ( !PostThreadMessageA(
This->m_idThreadTimer,
QUARTZ_MSG_ADDTIMER,
0, 0 ) )
{
pEntry->hEvent = (HANDLE)NULL;
hr = E_FAIL;
goto err;
}
hr = NOERROR;
err:
LeaveCriticalSection( &This->m_csClock );
return hr;
}
static HRESULT WINAPI
IReferenceClock_fnAdvisePeriodic(IReferenceClock* iface,REFERENCE_TIME rtStart,REFERENCE_TIME rtPeriod,HSEMAPHORE hSemaphore,DWORD_PTR* pdwAdvCookie)
{
CSystemClock_THIS(iface,refclk);
QUARTZ_TimerEntry* pEntry;
HRESULT hr;
TRACE( "(%p)->()\n", This );
if ( pdwAdvCookie == NULL )
return E_POINTER;
if ( hSemaphore == (HSEMAPHORE)NULL )
return E_INVALIDARG;
EnterCriticalSection( &This->m_csClock );
*pdwAdvCookie = (DWORD_PTR)(This->m_dwAdvCookieNext ++);
pEntry = IReferenceClock_AllocTimerEntry(This);
if ( pEntry == NULL )
{
hr = E_FAIL;
goto err;
}
pEntry->dwAdvCookie = *pdwAdvCookie;
pEntry->fPeriodic = TRUE;
pEntry->hEvent = (HANDLE)hSemaphore;
pEntry->rtStart = rtStart;
pEntry->rtInterval = rtPeriod;
if ( !PostThreadMessageA(
This->m_idThreadTimer,
QUARTZ_MSG_ADDTIMER,
0, 0 ) )
{
pEntry->hEvent = (HANDLE)NULL;
hr = E_FAIL;
goto err;
}
hr = NOERROR;
err:
LeaveCriticalSection( &This->m_csClock );
return hr;
}
static HRESULT WINAPI
IReferenceClock_fnUnadvise(IReferenceClock* iface,DWORD_PTR dwAdvCookie)
{
CSystemClock_THIS(iface,refclk);
QUARTZ_TimerEntry* pEntry;
TRACE( "(%p)->(%lu)\n", This, (DWORD)dwAdvCookie );
EnterCriticalSection( &This->m_csClock );
pEntry = IReferenceClock_SearchTimer(This,(DWORD)dwAdvCookie);
if ( pEntry != NULL )
{
pEntry->hEvent = (HANDLE)NULL;
}
LeaveCriticalSection( &This->m_csClock );
return NOERROR;
}
static ICOM_VTABLE(IReferenceClock) irefclk =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IReferenceClock_fnQueryInterface,
IReferenceClock_fnAddRef,
IReferenceClock_fnRelease,
/* IReferenceClock fields */
IReferenceClock_fnGetTime,
IReferenceClock_fnAdviseTime,
IReferenceClock_fnAdvisePeriodic,
IReferenceClock_fnUnadvise,
};
HRESULT CSystemClock_InitIReferenceClock( CSystemClock* psc )
{
HANDLE hEvents[2];
TRACE("(%p)\n",psc);
ICOM_VTBL(&psc->refclk) = &irefclk;
InitializeCriticalSection( &psc->m_csClock );
psc->m_dwTimeLast = GetTickCount();
psc->m_rtLast = (REFERENCE_TIME)0;
psc->m_hThreadTimer = (HANDLE)NULL;
psc->m_hEventInit = (HANDLE)NULL;
psc->m_idThreadTimer = 0;
psc->m_dwAdvCookieNext = 1;
ZeroMemory( psc->m_timerEntries, sizeof(psc->m_timerEntries) );
psc->m_hEventInit = CreateEventA( NULL, TRUE, FALSE, NULL );
if ( psc->m_hEventInit == (HANDLE)NULL )
goto err;
psc->m_hThreadTimer = CreateThread(
NULL, 0,
IReferenceClock_TimerEntry,
psc, 0, &psc->m_idThreadTimer );
if ( psc->m_hThreadTimer == (HANDLE)NULL )
{
CloseHandle( psc->m_hEventInit );
psc->m_hEventInit = (HANDLE)NULL;
goto err;
}
hEvents[0] = psc->m_hEventInit;
hEvents[1] = psc->m_hThreadTimer;
if ( WaitForMultipleObjects( 2, hEvents, FALSE, INFINITE )
!= WAIT_OBJECT_0 )
{
CloseHandle( psc->m_hEventInit );
psc->m_hEventInit = (HANDLE)NULL;
CloseHandle( psc->m_hThreadTimer );
psc->m_hThreadTimer = (HANDLE)NULL;
goto err;
}
return NOERROR;
err:
DeleteCriticalSection( &psc->m_csClock );
return E_FAIL;
}
void CSystemClock_UninitIReferenceClock( CSystemClock* psc )
{
TRACE("(%p)\n",psc);
if ( psc->m_hThreadTimer != (HANDLE)NULL )
{
if ( PostThreadMessageA(
psc->m_idThreadTimer,
QUARTZ_MSG_EXITTHREAD,
0, 0 ) )
{
WaitForSingleObject( psc->m_hThreadTimer, INFINITE );
}
CloseHandle( psc->m_hThreadTimer );
psc->m_hThreadTimer = (HANDLE)NULL;
}
DeleteCriticalSection( &psc->m_csClock );
}

View File

@ -1,77 +0,0 @@
/*
* Copyright (C) Hidenori TAKESHIMA
*
* 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 WINE_DSHOW_SYSCLOCK_H
#define WINE_DSHOW_SYSCLOCK_H
/*
implements CLSID_SystemClock.
- At least, the following interfaces should be implemented:
IUnknown
+ IReferenceClock
*/
#include "iunk.h"
typedef struct SC_IReferenceClockImpl
{
ICOM_VFIELD(IReferenceClock);
} SC_IReferenceClockImpl;
/* implementation limit */
#define WINE_QUARTZ_SYSCLOCK_TIMER_MAX 64
typedef struct QUARTZ_TimerEntry
{
DWORD dwAdvCookie;
BOOL fPeriodic;
HANDLE hEvent;
REFERENCE_TIME rtStart;
REFERENCE_TIME rtInterval;
} QUARTZ_TimerEntry;
typedef struct CSystemClock
{
QUARTZ_IUnkImpl unk;
SC_IReferenceClockImpl refclk;
/* IReferenceClock fields. */
CRITICAL_SECTION m_csClock;
DWORD m_dwTimeLast;
REFERENCE_TIME m_rtLast;
HANDLE m_hThreadTimer;
HANDLE m_hEventInit;
DWORD m_idThreadTimer;
DWORD m_dwAdvCookieNext;
QUARTZ_TimerEntry m_timerEntries[WINE_QUARTZ_SYSCLOCK_TIMER_MAX];
} CSystemClock;
#define CSystemClock_THIS(iface,member) CSystemClock* This = ((CSystemClock*)(((char*)iface)-offsetof(CSystemClock,member)))
HRESULT QUARTZ_CreateSystemClock(IUnknown* punkOuter,void** ppobj);
HRESULT CSystemClock_InitIReferenceClock( CSystemClock* psc );
void CSystemClock_UninitIReferenceClock( CSystemClock* psc );
#endif /* WINE_DSHOW_SYSCLOCK_H */

View File

@ -1,126 +0,0 @@
/*
* Copyright (C) Hidenori TAKESHIMA
*
* 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 "config.h"
#include "windef.h"
#include "wingdi.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "videoblt.h"
#define QUARTZ_LOBYTE(pix) ((BYTE)((pix)&0xff))
#define QUARTZ_HIBYTE(pix) ((BYTE)((pix)>>8))
void VIDEOBLT_Blt_888_to_332(
BYTE* pDst, LONG pitchDst,
const BYTE* pSrc, LONG pitchSrc,
LONG width, LONG height,
const RGBQUAD* prgbSrc, LONG nClrUsed )
{
LONG x,y;
for ( y = 0; y < height; y++ )
{
for ( x = 0; x < width; x++ )
{
*pDst++ = ((pSrc[2]&0xe0) ) |
((pSrc[1]&0xe0)>>3) |
((pSrc[0]&0xc0)>>6);
pSrc += 3;
}
pDst += pitchDst - width;
pSrc += pitchSrc - width*3;
}
}
void VIDEOBLT_Blt_888_to_555(
BYTE* pDst, LONG pitchDst,
const BYTE* pSrc, LONG pitchSrc,
LONG width, LONG height,
const RGBQUAD* prgbSrc, LONG nClrUsed )
{
LONG x,y;
unsigned pix;
for ( y = 0; y < height; y++ )
{
for ( x = 0; x < width; x++ )
{
pix = ((unsigned)(pSrc[2]&0xf8)<<7) |
((unsigned)(pSrc[1]&0xf8)<<2) |
((unsigned)(pSrc[0]&0xf8)>>3);
*pDst++ = QUARTZ_LOBYTE(pix);
*pDst++ = QUARTZ_HIBYTE(pix);
pSrc += 3;
}
pDst += pitchDst - width*2;
pSrc += pitchSrc - width*3;
}
}
void VIDEOBLT_Blt_888_to_565(
BYTE* pDst, LONG pitchDst,
const BYTE* pSrc, LONG pitchSrc,
LONG width, LONG height,
const RGBQUAD* prgbSrc, LONG nClrUsed )
{
LONG x,y;
unsigned pix;
for ( y = 0; y < height; y++ )
{
for ( x = 0; x < width; x++ )
{
pix = ((unsigned)(pSrc[2]&0xf8)<<8) |
((unsigned)(pSrc[1]&0xfc)<<3) |
((unsigned)(pSrc[0]&0xf8)>>3);
*pDst++ = QUARTZ_LOBYTE(pix);
*pDst++ = QUARTZ_HIBYTE(pix);
pSrc += 3;
}
pDst += pitchDst - width*2;
pSrc += pitchSrc - width*3;
}
}
void VIDEOBLT_Blt_888_to_8888(
BYTE* pDst, LONG pitchDst,
const BYTE* pSrc, LONG pitchSrc,
LONG width, LONG height,
const RGBQUAD* prgbSrc, LONG nClrUsed )
{
LONG x,y;
for ( y = 0; y < height; y++ )
{
for ( x = 0; x < width; x++ )
{
*pDst++ = *pSrc++;
*pDst++ = *pSrc++;
*pDst++ = *pSrc++;
*pDst++ = (BYTE)0xff;
}
pDst += pitchDst - width*4;
pSrc += pitchSrc - width*3;
}
}

View File

@ -1,51 +0,0 @@
/*
* Copyright (C) Hidenori TAKESHIMA
*
* 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 QUARTZ_VIDEOBLT_H
#define QUARTZ_VIDEOBLT_H
typedef void (*pVIDEOBLT_Blt)(
BYTE* pDst, LONG pitchDst,
const BYTE* pSrc, LONG pitchSrc,
LONG width, LONG height,
const RGBQUAD* prgbSrc, LONG nClrUsed );
void VIDEOBLT_Blt_888_to_332(
BYTE* pDst, LONG pitchDst,
const BYTE* pSrc, LONG pitchSrc,
LONG width, LONG height,
const RGBQUAD* prgbSrc, LONG nClrUsed );
void VIDEOBLT_Blt_888_to_555(
BYTE* pDst, LONG pitchDst,
const BYTE* pSrc, LONG pitchSrc,
LONG width, LONG height,
const RGBQUAD* prgbSrc, LONG nClrUsed );
void VIDEOBLT_Blt_888_to_565(
BYTE* pDst, LONG pitchDst,
const BYTE* pSrc, LONG pitchSrc,
LONG width, LONG height,
const RGBQUAD* prgbSrc, LONG nClrUsed );
void VIDEOBLT_Blt_888_to_8888(
BYTE* pDst, LONG pitchDst,
const BYTE* pSrc, LONG pitchSrc,
LONG width, LONG height,
const RGBQUAD* prgbSrc, LONG nClrUsed );
#endif /* QUARTZ_VIDEOBLT_H */

File diff suppressed because it is too large Load Diff

View File

@ -1,92 +0,0 @@
/*
* Implements CLSID_VideoRenderer.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 WINE_DSHOW_VIDREN_H
#define WINE_DSHOW_VIDREN_H
#include "iunk.h"
#include "basefilt.h"
#include "seekpass.h"
typedef struct CVideoRendererImpl CVideoRendererImpl;
typedef struct CVideoRendererPinImpl CVideoRendererPinImpl;
typedef struct VidRen_IBasicVideo
{
ICOM_VFIELD(IBasicVideo);
} VidRen_IBasicVideo;
typedef struct VidRen_IVideoWindow
{
ICOM_VFIELD(IVideoWindow);
} VidRen_IVideoWindow;
struct CVideoRendererImpl
{
QUARTZ_IUnkImpl unk;
CBaseFilterImpl basefilter;
VidRen_IBasicVideo basvid;
VidRen_IVideoWindow vidwin;
QUARTZ_IFDelegation qiext;
CSeekingPassThru* pSeekPass;
CVideoRendererPinImpl* pPin;
BOOL m_fInFlush;
/* for rendering */
HANDLE m_hEventInit;
HANDLE m_hThread;
HWND m_hwnd;
CRITICAL_SECTION m_csReceive;
BOOL m_bSampleIsValid;
BYTE* m_pSampleData;
DWORD m_cbSampleData;
};
struct CVideoRendererPinImpl
{
QUARTZ_IUnkImpl unk;
CPinBaseImpl pin;
CMemInputPinBaseImpl meminput;
CVideoRendererImpl* pRender;
};
#define CVideoRendererImpl_THIS(iface,member) CVideoRendererImpl* This = ((CVideoRendererImpl*)(((char*)iface)-offsetof(CVideoRendererImpl,member)))
#define CVideoRendererPinImpl_THIS(iface,member) CVideoRendererPinImpl* This = ((CVideoRendererPinImpl*)(((char*)iface)-offsetof(CVideoRendererPinImpl,member)))
HRESULT CVideoRendererImpl_InitIBasicVideo( CVideoRendererImpl* This );
void CVideoRendererImpl_UninitIBasicVideo( CVideoRendererImpl* This );
HRESULT CVideoRendererImpl_InitIVideoWindow( CVideoRendererImpl* This );
void CVideoRendererImpl_UninitIVideoWindow( CVideoRendererImpl* This );
HRESULT QUARTZ_CreateVideoRenderer(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateVideoRendererPin(
CVideoRendererImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CRITICAL_SECTION* pcsPinReceive,
CVideoRendererPinImpl** ppPin);
#endif /* WINE_DSHOW_VIDREN_H */

View File

@ -1,746 +0,0 @@
/*
* Implements WAVE/AU/AIFF Parser.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "mmsystem.h"
#include "mmreg.h"
#include "winerror.h"
#include "strmif.h"
#include "control.h"
#include "vfwmsgs.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "audioutl.h"
#include "parser.h"
static const WCHAR QUARTZ_WaveParser_Name[] =
{ 'W','a','v','e',' ','P','a','r','s','e','r',0 };
static const WCHAR QUARTZ_WaveParserInPin_Name[] =
{ 'I','n',0 };
static const WCHAR QUARTZ_WaveParserOutPin_Name[] =
{ 'O','u','t',0 };
/****************************************************************************/
/* S_OK = found, S_FALSE = not found */
HRESULT RIFF_GetNext(
CParserImpl* pImpl, LONGLONG llOfs,
DWORD* pdwCode, DWORD* pdwLength )
{
BYTE bTemp[8];
HRESULT hr;
hr = IAsyncReader_SyncRead( pImpl->m_pReader, llOfs, 8, bTemp );
if ( hr == S_OK )
{
*pdwCode = mmioFOURCC(bTemp[0],bTemp[1],bTemp[2],bTemp[3]);
*pdwLength = PARSER_LE_UINT32(&bTemp[4]);
}
else
{
*pdwCode = 0;
*pdwLength = 0;
}
return hr;
}
/* S_OK = found, S_FALSE = not found */
HRESULT RIFF_SearchChunk(
CParserImpl* pImpl,
DWORD dwSearchLengthMax,
LONGLONG llOfs, DWORD dwChunk,
LONGLONG* pllOfs, DWORD* pdwChunkLength )
{
HRESULT hr;
DWORD dwCurCode;
DWORD dwCurLen;
LONGLONG llCurLen;
while ( 1 )
{
hr = RIFF_GetNext( pImpl, llOfs, &dwCurCode, &dwCurLen );
if ( hr != S_OK )
break;
TRACE("%c%c%c%c len %lu\n",
(int)(dwCurCode>> 0)&0xff,
(int)(dwCurCode>> 8)&0xff,
(int)(dwCurCode>>16)&0xff,
(int)(dwCurCode>>24)&0xff,
(unsigned long)dwCurLen);
if ( dwChunk == dwCurCode )
break;
llCurLen = 8 + (LONGLONG)((dwCurLen+1)&(~1));
llOfs += llCurLen;
if ( (LONGLONG)dwSearchLengthMax <= llCurLen )
return S_FALSE;
if ( dwSearchLengthMax != (DWORD)0xffffffff )
dwSearchLengthMax -= (DWORD)llCurLen;
}
*pllOfs = llOfs + 8;
*pdwChunkLength = dwCurLen;
return hr;
}
/* S_OK = found, S_FALSE = not found */
HRESULT RIFF_SearchList(
CParserImpl* pImpl,
DWORD dwSearchLengthMax,
LONGLONG llOfs, DWORD dwListChunk,
LONGLONG* pllOfs, DWORD* pdwChunkLength )
{
HRESULT hr;
DWORD dwCurLen;
LONGLONG llCurLen;
BYTE bTemp[4];
while ( 1 )
{
hr = RIFF_SearchChunk(
pImpl, dwSearchLengthMax,
llOfs, PARSER_LIST,
&llOfs, &dwCurLen );
if ( hr != S_OK )
break;
hr = IAsyncReader_SyncRead( pImpl->m_pReader, llOfs, 4, bTemp );
if ( hr != S_OK )
break;
if ( mmioFOURCC(bTemp[0],bTemp[1],bTemp[2],bTemp[3]) == dwListChunk )
break;
llCurLen = (LONGLONG)((dwCurLen+1)&(~1));
llOfs += llCurLen;
if ( (LONGLONG)dwSearchLengthMax <= (llCurLen+8) )
return S_FALSE;
if ( dwSearchLengthMax != (DWORD)0xffffffff )
dwSearchLengthMax -= (DWORD)(llCurLen+8);
}
if ( dwCurLen < 12 )
return E_FAIL;
*pllOfs = llOfs+4;
*pdwChunkLength = dwCurLen-4;
return hr;
}
/****************************************************************************
*
* CWavParseImpl
*/
typedef enum WavParseFmtType
{
WaveParse_Native,
WaveParse_Signed8,
WaveParse_Signed16BE,
WaveParse_Unsigned16LE,
WaveParse_Unsigned16BE,
} WavParseFmtType;
typedef struct CWavParseImpl
{
DWORD cbFmt;
WAVEFORMATEX* pFmt;
DWORD dwBlockSize;
LONGLONG llDataStart;
LONGLONG llBytesStop;
LONGLONG llBytesTotal;
LONGLONG llBytesProcessed;
BOOL bDataDiscontinuity;
WavParseFmtType iFmtType;
} CWavParseImpl;
static HRESULT CWavParseImpl_InitWAV( CParserImpl* pImpl, CWavParseImpl* This )
{
HRESULT hr;
LONGLONG llOfs;
DWORD dwChunkLength;
hr = RIFF_SearchChunk(
pImpl, (DWORD)0xffffffff,
PARSER_RIFF_OfsFirst, PARSER_fmt,
&llOfs, &dwChunkLength );
if ( FAILED(hr) )
return hr;
if ( hr != S_OK || ( dwChunkLength < (sizeof(WAVEFORMATEX)-2) ) )
return E_FAIL;
This->cbFmt = dwChunkLength;
if ( dwChunkLength < sizeof(WAVEFORMATEX) )
This->cbFmt = sizeof(WAVEFORMATEX);
This->pFmt = (WAVEFORMATEX*)QUARTZ_AllocMem( dwChunkLength );
if ( This->pFmt == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This->pFmt, This->cbFmt );
hr = IAsyncReader_SyncRead(
pImpl->m_pReader, llOfs, dwChunkLength, (BYTE*)This->pFmt );
if ( hr != S_OK )
{
if ( SUCCEEDED(hr) )
hr = E_FAIL;
return hr;
}
hr = RIFF_SearchChunk(
pImpl, (DWORD)0xffffffff,
PARSER_RIFF_OfsFirst, PARSER_data,
&llOfs, &dwChunkLength );
if ( FAILED(hr) )
return hr;
if ( hr != S_OK || dwChunkLength == 0 )
return E_FAIL;
This->llDataStart = llOfs;
This->llBytesTotal = (LONGLONG)dwChunkLength;
return NOERROR;
}
static HRESULT CWavParseImpl_InitAU( CParserImpl* pImpl, CWavParseImpl* This )
{
BYTE au_hdr[24];
DWORD dataofs;
DWORD datalen;
DWORD datafmt;
DWORD datarate;
DWORD datachannels;
HRESULT hr;
WAVEFORMATEX wfx;
hr = IAsyncReader_SyncRead( pImpl->m_pReader, 0, 24, au_hdr );
if ( FAILED(hr) )
return hr;
dataofs = PARSER_BE_UINT32(&au_hdr[4]);
datalen = PARSER_BE_UINT32(&au_hdr[8]);
datafmt = PARSER_BE_UINT32(&au_hdr[12]);
datarate = PARSER_BE_UINT32(&au_hdr[16]);
datachannels = PARSER_BE_UINT32(&au_hdr[20]);
if ( dataofs < 24U || datalen == 0U )
return E_FAIL;
if ( datachannels != 1 && datachannels != 2 )
return E_FAIL;
ZeroMemory( &wfx, sizeof(WAVEFORMATEX) );
wfx.nChannels = datachannels;
wfx.nSamplesPerSec = datarate;
switch ( datafmt )
{
case 1:
wfx.wFormatTag = WAVE_FORMAT_MULAW;
wfx.nBlockAlign = datachannels;
wfx.wBitsPerSample = 8;
break;
case 2:
wfx.wFormatTag = WAVE_FORMAT_PCM;
wfx.nBlockAlign = datachannels;
wfx.wBitsPerSample = 8;
This->iFmtType = WaveParse_Signed8;
break;
case 3:
wfx.wFormatTag = WAVE_FORMAT_PCM;
wfx.nBlockAlign = datachannels;
wfx.wBitsPerSample = 16;
This->iFmtType = WaveParse_Signed16BE;
break;
default:
FIXME("audio/basic - unknown format %lu\n", datafmt );
return E_FAIL;
}
wfx.nAvgBytesPerSec = (datarate * datachannels * (DWORD)wfx.wBitsPerSample) >> 3;
This->cbFmt = sizeof(WAVEFORMATEX);
This->pFmt = (WAVEFORMATEX*)QUARTZ_AllocMem( sizeof(WAVEFORMATEX) );
if ( This->pFmt == NULL )
return E_OUTOFMEMORY;
memcpy( This->pFmt, &wfx, sizeof(WAVEFORMATEX) );
This->llDataStart = dataofs;
This->llBytesTotal = datalen;
TRACE("offset %lu, length %lu\n",dataofs,datalen);
return NOERROR;
}
static HRESULT CWavParseImpl_InitAIFF( CParserImpl* pImpl, CWavParseImpl* This )
{
FIXME( "AIFF is not supported now.\n" );
return E_FAIL;
}
static HRESULT CWavParseImpl_InitParser( CParserImpl* pImpl, ULONG* pcStreams )
{
CWavParseImpl* This = NULL;
HRESULT hr;
BYTE header[12];
TRACE("(%p,%p)\n",pImpl,pcStreams);
if ( pImpl->m_pReader == NULL )
return E_UNEXPECTED;
This = (CWavParseImpl*)QUARTZ_AllocMem( sizeof(CWavParseImpl) );
if ( This == NULL )
return E_OUTOFMEMORY;
pImpl->m_pUserData = This;
/* construct */
This->cbFmt = 0;
This->pFmt = NULL;
This->dwBlockSize = 0;
This->llDataStart = 0;
This->llBytesStop = 0;
This->llBytesTotal = 0;
This->llBytesProcessed = 0;
This->bDataDiscontinuity = TRUE;
This->iFmtType = WaveParse_Native;
hr = IAsyncReader_SyncRead( pImpl->m_pReader, 0, 12, header );
if ( FAILED(hr) )
return hr;
if ( hr != S_OK )
return E_FAIL;
if ( !memcmp( &header[0], "RIFF", 4 ) &&
!memcmp( &header[8], "WAVE", 4 ) )
{
TRACE( "(%p) - it's audio/wav.\n", pImpl );
hr = CWavParseImpl_InitWAV( pImpl, This );
}
else
if ( !memcmp( &header[0], ".snd", 4 ) )
{
TRACE( "(%p) - it's audio/basic.\n", pImpl );
hr = CWavParseImpl_InitAU( pImpl, This );
}
else
if ( !memcmp( &header[0], "FORM", 4 ) &&
!memcmp( &header[8], "AIFF", 4 ) )
{
TRACE( "(%p) - it's audio/aiff.\n", pImpl );
hr = CWavParseImpl_InitAIFF( pImpl, This );
}
else
{
FIXME( "(%p) - unknown format.\n", pImpl );
hr = E_FAIL;
}
if ( FAILED(hr) )
{
return hr;
}
This->llBytesStop = This->llBytesTotal;
/* initialized successfully. */
*pcStreams = 1;
This->dwBlockSize = (This->pFmt->nAvgBytesPerSec + (DWORD)This->pFmt->nBlockAlign - 1U) / (DWORD)This->pFmt->nBlockAlign;
TRACE( "(%p) returned successfully.\n", pImpl );
return NOERROR;
}
static HRESULT CWavParseImpl_UninitParser( CParserImpl* pImpl )
{
CWavParseImpl* This = (CWavParseImpl*)pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This == NULL )
return NOERROR;
/* destruct */
if ( This->pFmt != NULL ) QUARTZ_FreeMem(This->pFmt);
QUARTZ_FreeMem( This );
pImpl->m_pUserData = NULL;
return NOERROR;
}
static LPCWSTR CWavParseImpl_GetOutPinName( CParserImpl* pImpl, ULONG nStreamIndex )
{
CWavParseImpl* This = (CWavParseImpl*)pImpl->m_pUserData;
TRACE("(%p)\n",This);
return QUARTZ_WaveParserOutPin_Name;
}
static HRESULT CWavParseImpl_GetStreamType( CParserImpl* pImpl, ULONG nStreamIndex, AM_MEDIA_TYPE* pmt )
{
CWavParseImpl* This = (CWavParseImpl*)pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This == NULL || This->pFmt == NULL )
return E_UNEXPECTED;
ZeroMemory( pmt, sizeof(AM_MEDIA_TYPE) );
memcpy( &pmt->majortype, &MEDIATYPE_Audio, sizeof(GUID) );
QUARTZ_MediaSubType_FromFourCC( &pmt->subtype, (DWORD)This->pFmt->wFormatTag );
pmt->bFixedSizeSamples = 1;
pmt->bTemporalCompression = 0;
pmt->lSampleSize = This->pFmt->nBlockAlign;
memcpy( &pmt->formattype, &FORMAT_WaveFormatEx, sizeof(GUID) );
pmt->pUnk = NULL;
pmt->pbFormat = (BYTE*)CoTaskMemAlloc( This->cbFmt );
if ( pmt->pbFormat == NULL )
return E_OUTOFMEMORY;
pmt->cbFormat = This->cbFmt;
memcpy( pmt->pbFormat, This->pFmt, This->cbFmt );
return NOERROR;
}
static HRESULT CWavParseImpl_CheckStreamType( CParserImpl* pImpl, ULONG nStreamIndex, const AM_MEDIA_TYPE* pmt )
{
if ( !IsEqualGUID( &pmt->majortype, &MEDIATYPE_Audio ) ||
!IsEqualGUID( &pmt->formattype, &FORMAT_WaveFormatEx ) )
return E_FAIL;
if ( pmt->pbFormat == NULL || pmt->cbFormat < sizeof(WAVEFORMATEX) )
return E_FAIL;
return NOERROR;
}
static HRESULT CWavParseImpl_GetAllocProp( CParserImpl* pImpl, ALLOCATOR_PROPERTIES* pReqProp )
{
CWavParseImpl* This = (CWavParseImpl*)pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This == NULL || This->pFmt == NULL )
return E_UNEXPECTED;
ZeroMemory( pReqProp, sizeof(ALLOCATOR_PROPERTIES) );
pReqProp->cBuffers = 1;
pReqProp->cbBuffer = This->dwBlockSize;
return NOERROR;
}
static HRESULT CWavParseImpl_GetNextRequest( CParserImpl* pImpl, ULONG* pnStreamIndex, LONGLONG* pllStart, LONG* plLength, REFERENCE_TIME* prtStart, REFERENCE_TIME* prtStop, DWORD* pdwSampleFlags )
{
CWavParseImpl* This = (CWavParseImpl*)pImpl->m_pUserData;
LONGLONG llAvail;
LONGLONG llStart;
LONGLONG llEnd;
TRACE("(%p)\n",This);
if ( This == NULL || This->pFmt == NULL )
return E_UNEXPECTED;
*pdwSampleFlags = AM_SAMPLE_SPLICEPOINT;
if ( This->bDataDiscontinuity )
{
*pdwSampleFlags |= AM_SAMPLE_DATADISCONTINUITY;
This->bDataDiscontinuity = FALSE;
}
llAvail = This->llBytesStop - This->llBytesProcessed;
if ( llAvail > (LONGLONG)This->dwBlockSize )
llAvail = (LONGLONG)This->dwBlockSize;
llStart = This->llDataStart + This->llBytesProcessed;
llEnd = llStart + llAvail;
This->llBytesProcessed = llEnd;
*pllStart = This->llBytesProcessed;
*plLength = (LONG)llAvail;
*prtStart = llStart * QUARTZ_TIMEUNITS / (LONGLONG)This->pFmt->nAvgBytesPerSec;
*prtStop = llEnd * QUARTZ_TIMEUNITS / (LONGLONG)This->pFmt->nAvgBytesPerSec;
return NOERROR;
}
static HRESULT CWavParseImpl_ProcessSample( CParserImpl* pImpl, ULONG nStreamIndex, LONGLONG llStart, LONG lLength, IMediaSample* pSample )
{
CWavParseImpl* This = (CWavParseImpl*)pImpl->m_pUserData;
BYTE* pData;
LONG lActLen;
HRESULT hr;
TRACE("(%p)\n",This);
hr = IMediaSample_GetPointer(pSample,&pData);
if ( FAILED(hr) )
return hr;
lActLen = (LONG)IMediaSample_GetActualDataLength(pSample);
if ( lActLen != lLength )
return E_FAIL;
switch ( This->iFmtType )
{
case WaveParse_Native:
break;
case WaveParse_Signed8:
AUDIOUTL_ChangeSign8(pData,lActLen);
break;
case WaveParse_Signed16BE:
AUDIOUTL_ByteSwap(pData,lActLen);
break;
case WaveParse_Unsigned16LE:
AUDIOUTL_ChangeSign16LE(pData,lActLen);
break;
case WaveParse_Unsigned16BE:
AUDIOUTL_ChangeSign16BE(pData,lActLen);
AUDIOUTL_ByteSwap(pData,lActLen);
break;
default:
FIXME("(%p) - %d not implemented\n", This, This->iFmtType );
return E_FAIL;
}
return NOERROR;
}
/***************************************************************************/
static HRESULT CWavParseImpl_GetSeekingCaps( CParserImpl* pImpl, DWORD* pdwCaps )
{
CWavParseImpl* This = (CWavParseImpl*)pImpl->m_pUserData;
TRACE("(%p,%p)\n",This,pdwCaps);
*pdwCaps =
AM_SEEKING_CanSeekAbsolute |
AM_SEEKING_CanSeekForwards |
AM_SEEKING_CanSeekBackwards |
AM_SEEKING_CanGetCurrentPos |
AM_SEEKING_CanGetStopPos |
AM_SEEKING_CanGetDuration;
return S_OK;
}
static HRESULT CWavParseImpl_IsTimeFormatSupported( CParserImpl* pImpl, const GUID* pTimeFormat )
{
CWavParseImpl* This = (CWavParseImpl*)pImpl->m_pUserData;
TRACE("(%p,%s)\n",This,debugstr_guid(pTimeFormat));
if ( IsEqualGUID(pTimeFormat,&TIME_FORMAT_MEDIA_TIME) )
return S_OK;
return S_FALSE;
}
static HRESULT CWavParseImpl_GetCurPos( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPos )
{
CWavParseImpl* This = (CWavParseImpl*)pImpl->m_pUserData;
TRACE("(%p,%s,%lu,...)\n",This,debugstr_guid(pTimeFormat),nStreamIndex);
if ( This == NULL || This->pFmt == NULL )
return E_UNEXPECTED;
if ( IsEqualGUID(pTimeFormat,&TIME_FORMAT_MEDIA_TIME) )
{
if ( This->pFmt->nAvgBytesPerSec == 0 )
return E_FAIL;
*pllPos = This->llBytesProcessed * QUARTZ_TIMEUNITS / (LONGLONG)This->pFmt->nAvgBytesPerSec;
TRACE("curpos %f\n",(double)(*pllPos/QUARTZ_TIMEUNITS));
return S_OK;
}
return E_NOTIMPL;
}
static HRESULT CWavParseImpl_SetCurPos( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG llPos )
{
CWavParseImpl* This = (CWavParseImpl*)pImpl->m_pUserData;
LONGLONG llBytesCur;
TRACE("(%p,%s,%lu,...)\n",This,debugstr_guid(pTimeFormat),nStreamIndex);
if ( This == NULL || This->pFmt == NULL )
return E_UNEXPECTED;
if ( IsEqualGUID(pTimeFormat,&TIME_FORMAT_MEDIA_TIME) )
{
if ( This->pFmt->nAvgBytesPerSec == 0 )
return E_FAIL;
llBytesCur = llPos * This->pFmt->nAvgBytesPerSec / QUARTZ_TIMEUNITS;
if ( llBytesCur > This->llBytesTotal )
llBytesCur = This->llBytesTotal;
This->llBytesProcessed = llBytesCur;
This->bDataDiscontinuity = TRUE;
return S_OK;
}
return E_NOTIMPL;
}
static HRESULT CWavParseImpl_GetDuration( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllDuration )
{
CWavParseImpl* This = (CWavParseImpl*)pImpl->m_pUserData;
TRACE("(%p,%s,%lu,...)\n",This,debugstr_guid(pTimeFormat),nStreamIndex);
if ( This == NULL || This->pFmt == NULL )
return E_UNEXPECTED;
if ( IsEqualGUID(pTimeFormat,&TIME_FORMAT_MEDIA_TIME) )
{
if ( This->pFmt->nAvgBytesPerSec == 0 )
return E_FAIL;
*pllDuration = This->llBytesTotal * QUARTZ_TIMEUNITS / (LONGLONG)This->pFmt->nAvgBytesPerSec;
TRACE("duration %f\n",(double)(*pllDuration/QUARTZ_TIMEUNITS));
return S_OK;
}
return E_NOTIMPL;
}
static HRESULT CWavParseImpl_GetStopPos( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPos )
{
CWavParseImpl* This = (CWavParseImpl*)pImpl->m_pUserData;
TRACE("(%p,%s,%lu,...)\n",This,debugstr_guid(pTimeFormat),nStreamIndex);
if ( This == NULL || This->pFmt == NULL )
return E_UNEXPECTED;
if ( IsEqualGUID(pTimeFormat,&TIME_FORMAT_MEDIA_TIME) )
{
if ( This->pFmt->nAvgBytesPerSec == 0 )
return E_FAIL;
*pllPos = This->llBytesStop * QUARTZ_TIMEUNITS / (LONGLONG)This->pFmt->nAvgBytesPerSec;
return S_OK;
}
return E_NOTIMPL;
}
static HRESULT CWavParseImpl_SetStopPos( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG llPos )
{
CWavParseImpl* This = (CWavParseImpl*)pImpl->m_pUserData;
LONGLONG llBytesStop;
TRACE("(%p,%s,%lu,...)\n",This,debugstr_guid(pTimeFormat),nStreamIndex);
if ( This == NULL || This->pFmt == NULL )
return E_UNEXPECTED;
if ( IsEqualGUID(pTimeFormat,&TIME_FORMAT_MEDIA_TIME) )
{
if ( This->pFmt->nAvgBytesPerSec == 0 )
return E_FAIL;
llBytesStop = llPos * This->pFmt->nAvgBytesPerSec / QUARTZ_TIMEUNITS;
if ( llBytesStop > This->llBytesTotal )
llBytesStop = This->llBytesTotal;
This->llBytesStop = llBytesStop;
return S_OK;
}
return E_NOTIMPL;
}
static HRESULT CWavParseImpl_GetPreroll( CParserImpl* pImpl, const GUID* pTimeFormat, DWORD nStreamIndex, LONGLONG* pllPreroll )
{
CWavParseImpl* This = (CWavParseImpl*)pImpl->m_pUserData;
TRACE("(%p,%s,%lu,...)\n",This,debugstr_guid(pTimeFormat),nStreamIndex);
if ( This == NULL || This->pFmt == NULL )
return E_UNEXPECTED;
if ( IsEqualGUID(pTimeFormat,&TIME_FORMAT_MEDIA_TIME) )
{
*pllPreroll = 0;
return S_OK;
}
return E_NOTIMPL;
}
/***************************************************************************/
static const struct ParserHandlers CWavParseImpl_Handlers =
{
CWavParseImpl_InitParser,
CWavParseImpl_UninitParser,
CWavParseImpl_GetOutPinName,
CWavParseImpl_GetStreamType,
CWavParseImpl_CheckStreamType,
CWavParseImpl_GetAllocProp,
CWavParseImpl_GetNextRequest,
CWavParseImpl_ProcessSample,
/* for IQualityControl */
NULL, /* pQualityNotify */
/* for seeking */
CWavParseImpl_GetSeekingCaps,
CWavParseImpl_IsTimeFormatSupported,
CWavParseImpl_GetCurPos,
CWavParseImpl_SetCurPos,
CWavParseImpl_GetDuration,
CWavParseImpl_GetStopPos,
CWavParseImpl_SetStopPos,
CWavParseImpl_GetPreroll,
};
HRESULT QUARTZ_CreateWaveParser(IUnknown* punkOuter,void** ppobj)
{
return QUARTZ_CreateParser(
punkOuter,ppobj,
&CLSID_quartzWaveParser,
QUARTZ_WaveParser_Name,
QUARTZ_WaveParserInPin_Name,
&CWavParseImpl_Handlers );
}

View File

@ -1,823 +0,0 @@
/*
* Implements IBaseFilter for transform filters. (internal)
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "strmif.h"
#include "control.h"
#include "vfwmsgs.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "xform.h"
#include "sample.h"
static const WCHAR XFORM_DefInName[] =
{'X','F','o','r','m',' ','I','n',0};
static const WCHAR XFORM_DefOutName[] =
{'X','F','o','r','m',' ','O','u','t',0};
/***************************************************************************
*
* CTransformBaseImpl methods
*
*/
static HRESULT CTransformBaseImpl_OnActive( CBaseFilterImpl* pImpl )
{
CTransformBaseImpl_THIS(pImpl,basefilter);
TRACE( "(%p)\n", This );
return NOERROR;
}
static HRESULT CTransformBaseImpl_OnInactive( CBaseFilterImpl* pImpl )
{
CTransformBaseImpl_THIS(pImpl,basefilter);
HRESULT hr;
IMemAllocator* pAllocator;
TRACE( "(%p)\n", This );
if ( This->pInPin->pin.pPinConnectedTo == NULL ||
This->pOutPin->pin.pPinConnectedTo == NULL )
return NOERROR;
EnterCriticalSection( &This->basefilter.csFilter );
pAllocator = This->m_pOutPinAllocator;
if ( pAllocator != NULL &&
This->pInPin->meminput.pAllocator != pAllocator )
{
hr = IMemAllocator_Commit( pAllocator );
if ( FAILED(hr) )
goto end;
}
if ( !This->m_bFiltering )
{
hr = This->m_pHandler->pBeginTransform( This, This->pInPin->pin.pmtConn, This->pOutPin->pin.pmtConn, This->m_bReuseSample );
if ( FAILED(hr) )
goto end;
This->m_bFiltering = TRUE;
}
hr = NOERROR;
end:
LeaveCriticalSection( &This->basefilter.csFilter );
return hr;
}
static HRESULT CTransformBaseImpl_OnStop( CBaseFilterImpl* pImpl )
{
CTransformBaseImpl_THIS(pImpl,basefilter);
IMemAllocator* pAllocator;
TRACE( "(%p)\n", This );
EnterCriticalSection( &This->basefilter.csFilter );
if ( This->m_bFiltering )
{
This->m_pHandler->pEndTransform( This );
This->m_bFiltering = FALSE;
}
if ( This->m_pSample != NULL )
{
IMediaSample_Release( This->m_pSample );
This->m_pSample = NULL;
}
pAllocator = This->m_pOutPinAllocator;
if ( pAllocator != NULL &&
This->pInPin->meminput.pAllocator != pAllocator )
{
IMemAllocator_Decommit( pAllocator );
}
LeaveCriticalSection( &This->basefilter.csFilter );
return NOERROR;
}
static const CBaseFilterHandlers filterhandlers =
{
CTransformBaseImpl_OnActive, /* pOnActive */
CTransformBaseImpl_OnInactive, /* pOnInactive */
CTransformBaseImpl_OnStop, /* pOnStop */
};
/***************************************************************************
*
* CTransformBaseInPinImpl methods
*
*/
static HRESULT CTransformBaseInPinImpl_OnPostConnect( CPinBaseImpl* pImpl, IPin* pPin )
{
CTransformBaseInPinImpl_THIS(pImpl,pin);
HRESULT hr;
TRACE( "(%p,%p)\n", This, pPin );
EnterCriticalSection( &This->pFilter->basefilter.csFilter );
hr = This->pFilter->m_pHandler->pGetOutputTypes( This->pFilter, This->pFilter->pInPin->pin.pmtConn, &This->pFilter->pOutPin->pin.pmtAcceptTypes, &This->pFilter->pOutPin->pin.cAcceptTypes );
if ( FAILED(hr) )
goto end;
hr = NOERROR;
end:
LeaveCriticalSection( &This->pFilter->basefilter.csFilter );
return hr;
}
static HRESULT CTransformBaseInPinImpl_OnDisconnect( CPinBaseImpl* pImpl )
{
CTransformBaseInPinImpl_THIS(pImpl,pin);
TRACE( "(%p)\n", This );
if ( This->meminput.pAllocator != NULL )
{
IMemAllocator_Decommit(This->meminput.pAllocator);
IMemAllocator_Release(This->meminput.pAllocator);
This->meminput.pAllocator = NULL;
}
return NOERROR;
}
static HRESULT CTransformBaseInPinImpl_CheckMediaType( CPinBaseImpl* pImpl, const AM_MEDIA_TYPE* pmt )
{
CTransformBaseInPinImpl_THIS(pImpl,pin);
HRESULT hr;
TRACE( "(%p,%p)\n", This, pmt );
EnterCriticalSection( &This->pFilter->basefilter.csFilter );
hr = This->pFilter->m_pHandler->pCheckMediaType( This->pFilter, pmt, (This->pFilter->pOutPin->pin.pPinConnectedTo != NULL) ? This->pFilter->pOutPin->pin.pmtConn : NULL );
LeaveCriticalSection( &This->pFilter->basefilter.csFilter );
return hr;
}
static HRESULT CTransformBaseInPinImpl_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample )
{
CTransformBaseInPinImpl_THIS(pImpl,pin);
HRESULT hr;
TRACE( "(%p,%p)\n", This, pSample );
if ( This->pin.pPinConnectedTo == NULL ||
This->pFilter->pOutPin->pin.pPinConnectedTo == NULL )
return NOERROR;
if ( !This->pFilter->m_bFiltering )
return E_UNEXPECTED;
if ( This->pFilter->m_bInFlush )
return S_FALSE;
if ( This->pFilter->m_pHandler->pProcessReceive != NULL )
{
hr = This->pFilter->m_pHandler->pProcessReceive( This->pFilter, pSample );
}
else
{
if ( This->meminput.pAllocator != This->pFilter->m_pOutPinAllocator )
{
if ( This->pFilter->m_pSample == NULL )
{
hr = IMemAllocator_GetBuffer( This->pFilter->m_pOutPinAllocator, &This->pFilter->m_pSample, NULL, NULL, 0 );
if ( FAILED(hr) )
goto end;
}
hr = QUARTZ_IMediaSample_Copy(
This->pFilter->m_pSample, pSample, This->pFilter->m_bPreCopy );
if ( FAILED(hr) )
goto end;
}
if ( This->pFilter->m_bPreCopy )
hr = This->pFilter->m_pHandler->pTransform( This->pFilter, This->pFilter->m_pSample, NULL );
else
hr = This->pFilter->m_pHandler->pTransform( This->pFilter, pSample, This->pFilter->m_pSample );
if ( FAILED(hr) )
goto end;
if ( hr == NOERROR )
{
hr = CPinBaseImpl_SendSample(&This->pFilter->pOutPin->pin,This->pFilter->m_pSample);
if ( FAILED(hr) )
goto end;
}
hr = NOERROR;
end:
if ( !This->pFilter->m_bReuseSample )
{
if ( This->pFilter->m_pSample != NULL )
{
IMediaSample_Release( This->pFilter->m_pSample );
This->pFilter->m_pSample = NULL;
}
}
if ( FAILED(hr) )
{
/* Notify(ABORT) */
}
}
return hr;
}
static HRESULT CTransformBaseInPinImpl_ReceiveCanBlock( CPinBaseImpl* pImpl )
{
CTransformBaseInPinImpl_THIS(pImpl,pin);
TRACE( "(%p)\n", This );
if ( This->pin.pPinConnectedTo == NULL ||
This->pFilter->pOutPin->pin.pPinConnectedTo == NULL )
return S_FALSE;
return CPinBaseImpl_SendReceiveCanBlock( &This->pFilter->pOutPin->pin );
}
static HRESULT CTransformBaseInPinImpl_EndOfStream( CPinBaseImpl* pImpl )
{
CTransformBaseInPinImpl_THIS(pImpl,pin);
TRACE( "(%p)\n", This );
if ( This->pin.pPinConnectedTo == NULL ||
This->pFilter->pOutPin->pin.pPinConnectedTo == NULL )
return NOERROR;
return CPinBaseImpl_SendEndOfStream( &This->pFilter->pOutPin->pin );
}
static HRESULT CTransformBaseInPinImpl_BeginFlush( CPinBaseImpl* pImpl )
{
CTransformBaseInPinImpl_THIS(pImpl,pin);
TRACE( "(%p)\n", This );
if ( This->pin.pPinConnectedTo == NULL ||
This->pFilter->pOutPin->pin.pPinConnectedTo == NULL )
return NOERROR;
This->pFilter->m_bInFlush = TRUE;
return CPinBaseImpl_SendBeginFlush( &This->pFilter->pOutPin->pin );
}
static HRESULT CTransformBaseInPinImpl_EndFlush( CPinBaseImpl* pImpl )
{
CTransformBaseInPinImpl_THIS(pImpl,pin);
TRACE( "(%p)\n", This );
if ( This->pin.pPinConnectedTo == NULL ||
This->pFilter->pOutPin->pin.pPinConnectedTo == NULL )
return NOERROR;
This->pFilter->m_bInFlush = FALSE;
return CPinBaseImpl_SendEndFlush( &This->pFilter->pOutPin->pin );
}
static HRESULT CTransformBaseInPinImpl_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate )
{
CTransformBaseInPinImpl_THIS(pImpl,pin);
FIXME( "(%p)\n", This );
if ( This->pin.pPinConnectedTo == NULL ||
This->pFilter->pOutPin->pin.pPinConnectedTo == NULL )
return NOERROR;
return CPinBaseImpl_SendNewSegment( &This->pFilter->pOutPin->pin,
rtStart, rtStop, rate );
}
static const CBasePinHandlers inputpinhandlers =
{
NULL, /* pOnPreConnect */
CTransformBaseInPinImpl_OnPostConnect, /* pOnPostConnect */
CTransformBaseInPinImpl_OnDisconnect, /* pOnDisconnect */
CTransformBaseInPinImpl_CheckMediaType, /* pCheckMediaType */
NULL, /* pQualityNotify */
CTransformBaseInPinImpl_Receive, /* pReceive */
CTransformBaseInPinImpl_ReceiveCanBlock, /* pReceiveCanBlock */
CTransformBaseInPinImpl_EndOfStream, /* pEndOfStream */
CTransformBaseInPinImpl_BeginFlush, /* pBeginFlush */
CTransformBaseInPinImpl_EndFlush, /* pEndFlush */
CTransformBaseInPinImpl_NewSegment, /* pNewSegment */
};
/***************************************************************************
*
* CTransformBaseOutPinImpl methods
*
*/
static HRESULT CTransformBaseOutPinImpl_OnPostConnect( CPinBaseImpl* pImpl, IPin* pPin )
{
CTransformBaseOutPinImpl_THIS(pImpl,pin);
HRESULT hr;
ALLOCATOR_PROPERTIES propReqThis;
ALLOCATOR_PROPERTIES propReqPeer;
ALLOCATOR_PROPERTIES propActual;
BOOL bTransInPlace = FALSE;
BOOL bTryToReUseSample = FALSE;
BOOL bOutReadonly = FALSE;
IMemAllocator* pAllocator;
FIXME( "(%p,%p)\n", This, pPin );
if ( This->pFilter->pInPin->pin.pPinConnectedTo == NULL )
return E_FAIL;
if ( This->pin.pMemInputPinConnectedTo == NULL )
return E_UNEXPECTED;
ZeroMemory( &propReqThis, sizeof(ALLOCATOR_PROPERTIES) );
ZeroMemory( &propReqPeer, sizeof(ALLOCATOR_PROPERTIES) );
ZeroMemory( &propActual, sizeof(ALLOCATOR_PROPERTIES) );
hr = This->pFilter->m_pHandler->pGetAllocProp( This->pFilter, This->pFilter->pInPin->pin.pmtConn, This->pin.pmtConn, &propReqThis, &bTransInPlace, &bTryToReUseSample );
if ( FAILED(hr) )
goto end;
if ( propReqThis.cbAlign == 0 )
propReqThis.cbAlign = 1;
if ( bTransInPlace )
{
ZeroMemory( &propReqPeer, sizeof(ALLOCATOR_PROPERTIES) );
hr = IMemInputPin_GetAllocatorRequirements(
This->pin.pMemInputPinConnectedTo, &propReqPeer );
if ( propReqPeer.cbAlign != 0 && propReqPeer.cbAlign != 1 )
bTransInPlace = FALSE;
if ( propReqPeer.cbPrefix != 0 )
bTransInPlace = FALSE;
bOutReadonly = FALSE;
if ( bTransInPlace && This->pFilter->pInPin->meminput.bReadonly )
bOutReadonly = TRUE;
pAllocator = This->pFilter->pInPin->meminput.pAllocator;
hr = IMemInputPin_NotifyAllocator(
This->pin.pMemInputPinConnectedTo,
pAllocator, bOutReadonly );
if ( hr == NOERROR )
{
This->pFilter->m_pOutPinAllocator = pAllocator;
IMemAllocator_AddRef(pAllocator);
bTryToReUseSample = FALSE;
goto end;
}
}
hr = IMemInputPin_GetAllocator(
This->pin.pMemInputPinConnectedTo, &pAllocator );
if ( FAILED(hr) )
goto end;
hr = IMemAllocator_SetProperties( pAllocator, &propReqThis, &propActual );
if ( SUCCEEDED(hr) )
{
TRACE("cBuffers = %ld / cbBuffer = %ld\n",propActual.cBuffers,propActual.cbBuffer);
hr = IMemInputPin_NotifyAllocator(
This->pin.pMemInputPinConnectedTo, pAllocator,
bTryToReUseSample );
}
if ( FAILED(hr) )
{
IMemAllocator_Release(pAllocator);
goto end;
}
This->pFilter->m_pOutPinAllocator = pAllocator;
hr = NOERROR;
end:
This->pFilter->m_bPreCopy = FALSE;
This->pFilter->m_bReuseSample = FALSE;
if ( hr == NOERROR )
{
This->pFilter->m_bPreCopy = bTransInPlace && (This->pFilter->pInPin->meminput.pAllocator != This->pFilter->m_pOutPinAllocator);
This->pFilter->m_bReuseSample = bTryToReUseSample;
}
return hr;
}
static HRESULT CTransformBaseOutPinImpl_OnDisconnect( CPinBaseImpl* pImpl )
{
CTransformBaseOutPinImpl_THIS(pImpl,pin);
TRACE( "(%p)\n", This );
if ( This->pFilter->m_pOutPinAllocator != NULL )
{
IMemAllocator_Decommit(This->pFilter->m_pOutPinAllocator);
IMemAllocator_Release(This->pFilter->m_pOutPinAllocator);
This->pFilter->m_pOutPinAllocator = NULL;
}
return NOERROR;
}
static HRESULT CTransformBaseOutPinImpl_CheckMediaType( CPinBaseImpl* pImpl, const AM_MEDIA_TYPE* pmt )
{
CTransformBaseOutPinImpl_THIS(pImpl,pin);
HRESULT hr;
TRACE( "(%p,%p)\n", This, pmt );
if ( This->pFilter->pInPin->pin.pPinConnectedTo == NULL )
return E_FAIL;
EnterCriticalSection( &This->pFilter->basefilter.csFilter );
hr = This->pFilter->m_pHandler->pCheckMediaType( This->pFilter, This->pFilter->pInPin->pin.pmtConn, pmt );
LeaveCriticalSection( &This->pFilter->basefilter.csFilter );
return hr;
}
static const CBasePinHandlers outputpinhandlers =
{
NULL, /* pOnPreConnect */
CTransformBaseOutPinImpl_OnPostConnect, /* pOnPostConnect */
CTransformBaseOutPinImpl_OnDisconnect, /* pOnDisconnect */
CTransformBaseOutPinImpl_CheckMediaType, /* pCheckMediaType */
NULL, /* pQualityNotify */
OutputPinSync_Receive, /* pReceive */
OutputPinSync_ReceiveCanBlock, /* pReceiveCanBlock */
OutputPinSync_EndOfStream, /* pEndOfStream */
OutputPinSync_BeginFlush, /* pBeginFlush */
OutputPinSync_EndFlush, /* pEndFlush */
OutputPinSync_NewSegment, /* pNewSegment */
};
/***************************************************************************
*
* new/delete CTransformBaseImpl
*
*/
/* can I use offsetof safely? - FIXME? */
static QUARTZ_IFEntry FilterIFEntries[] =
{
{ &IID_IPersist, offsetof(CTransformBaseImpl,basefilter)-offsetof(CTransformBaseImpl,unk) },
{ &IID_IMediaFilter, offsetof(CTransformBaseImpl,basefilter)-offsetof(CTransformBaseImpl,unk) },
{ &IID_IBaseFilter, offsetof(CTransformBaseImpl,basefilter)-offsetof(CTransformBaseImpl,unk) },
};
static void QUARTZ_DestroyTransformBase(IUnknown* punk)
{
CTransformBaseImpl_THIS(punk,unk);
TRACE( "(%p)\n", This );
This->m_pHandler->pCleanup(This);
if ( This->pInPin != NULL )
{
IUnknown_Release(This->pInPin->unk.punkControl);
This->pInPin = NULL;
}
if ( This->pOutPin != NULL )
{
IUnknown_Release(This->pOutPin->unk.punkControl);
This->pOutPin = NULL;
}
if ( This->pSeekPass != NULL )
{
IUnknown_Release((IUnknown*)&This->pSeekPass->unk);
This->pSeekPass = NULL;
}
CBaseFilterImpl_UninitIBaseFilter(&This->basefilter);
DeleteCriticalSection( &This->csReceive );
}
HRESULT QUARTZ_CreateTransformBase(
IUnknown* punkOuter,void** ppobj,
const CLSID* pclsidTransformBase,
LPCWSTR pwszTransformBaseName,
LPCWSTR pwszInPinName,
LPCWSTR pwszOutPinName,
const TransformBaseHandlers* pHandler )
{
CTransformBaseImpl* This = NULL;
HRESULT hr;
TRACE("(%p,%p)\n",punkOuter,ppobj);
if ( pwszInPinName == NULL )
pwszInPinName = XFORM_DefInName;
if ( pwszOutPinName == NULL )
pwszOutPinName = XFORM_DefOutName;
This = (CTransformBaseImpl*)
QUARTZ_AllocObj( sizeof(CTransformBaseImpl) );
if ( This == NULL )
return E_OUTOFMEMORY;
This->pInPin = NULL;
This->pOutPin = NULL;
This->pSeekPass = NULL;
This->m_pOutPinAllocator = NULL;
This->m_bPreCopy = FALSE; /* sample must be copied */
This->m_bReuseSample = FALSE; /* sample must be reused */
This->m_bInFlush = FALSE;
This->m_pSample = NULL;
This->m_bFiltering = FALSE;
This->m_pHandler = pHandler;
This->m_pUserData = NULL;
QUARTZ_IUnkInit( &This->unk, punkOuter );
hr = CBaseFilterImpl_InitIBaseFilter(
&This->basefilter,
This->unk.punkControl,
pclsidTransformBase,
pwszTransformBaseName,
&filterhandlers );
if ( SUCCEEDED(hr) )
{
/* construct this class. */
hr = This->m_pHandler->pInit( This );
if ( FAILED(hr) )
{
CBaseFilterImpl_UninitIBaseFilter(&This->basefilter);
}
}
if ( FAILED(hr) )
{
QUARTZ_FreeObj(This);
return hr;
}
This->unk.pEntries = FilterIFEntries;
This->unk.dwEntries = sizeof(FilterIFEntries)/sizeof(FilterIFEntries[0]);
This->unk.pOnFinalRelease = QUARTZ_DestroyTransformBase;
InitializeCriticalSection( &This->csReceive );
/* create pins. */
hr = QUARTZ_CreateTransformBaseInPin(
This, &This->basefilter.csFilter, &This->csReceive,
&This->pInPin, pwszInPinName );
if ( SUCCEEDED(hr) )
hr = QUARTZ_CompList_AddComp(
This->basefilter.pInPins,
(IUnknown*)&(This->pInPin->pin),
NULL, 0 );
if ( SUCCEEDED(hr) )
hr = QUARTZ_CreateTransformBaseOutPin(
This, &This->basefilter.csFilter,
&This->pOutPin, pwszOutPinName );
if ( SUCCEEDED(hr) )
hr = QUARTZ_CompList_AddComp(
This->basefilter.pOutPins,
(IUnknown*)&(This->pOutPin->pin),
NULL, 0 );
if ( SUCCEEDED(hr) )
{
hr = QUARTZ_CreateSeekingPassThruInternal(
(IUnknown*)&(This->pOutPin->unk), &This->pSeekPass,
FALSE, (IPin*)&(This->pInPin->pin) );
}
if ( FAILED(hr) )
{
IUnknown_Release( This->unk.punkControl );
return hr;
}
*ppobj = (void*)&(This->unk);
return S_OK;
}
/***************************************************************************
*
* new/delete CTransformBaseInPinImpl
*
*/
/* can I use offsetof safely? - FIXME? */
static QUARTZ_IFEntry InPinIFEntries[] =
{
{ &IID_IPin, offsetof(CTransformBaseInPinImpl,pin)-offsetof(CTransformBaseInPinImpl,unk) },
{ &IID_IMemInputPin, offsetof(CTransformBaseInPinImpl,meminput)-offsetof(CTransformBaseInPinImpl,unk) },
};
static void QUARTZ_DestroyTransformBaseInPin(IUnknown* punk)
{
CTransformBaseInPinImpl_THIS(punk,unk);
TRACE( "(%p)\n", This );
CPinBaseImpl_UninitIPin( &This->pin );
CMemInputPinBaseImpl_UninitIMemInputPin( &This->meminput );
}
HRESULT QUARTZ_CreateTransformBaseInPin(
CTransformBaseImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CRITICAL_SECTION* pcsPinReceive,
CTransformBaseInPinImpl** ppPin,
LPCWSTR pwszPinName )
{
CTransformBaseInPinImpl* This = NULL;
HRESULT hr;
TRACE("(%p,%p,%p)\n",pFilter,pcsPin,ppPin);
This = (CTransformBaseInPinImpl*)
QUARTZ_AllocObj( sizeof(CTransformBaseInPinImpl) );
if ( This == NULL )
return E_OUTOFMEMORY;
QUARTZ_IUnkInit( &This->unk, NULL );
This->pFilter = pFilter;
hr = CPinBaseImpl_InitIPin(
&This->pin,
This->unk.punkControl,
pcsPin, pcsPinReceive,
&pFilter->basefilter,
pwszPinName,
FALSE,
&inputpinhandlers );
if ( SUCCEEDED(hr) )
{
hr = CMemInputPinBaseImpl_InitIMemInputPin(
&This->meminput,
This->unk.punkControl,
&This->pin );
if ( FAILED(hr) )
{
CPinBaseImpl_UninitIPin( &This->pin );
}
}
if ( FAILED(hr) )
{
QUARTZ_FreeObj(This);
return hr;
}
This->unk.pEntries = InPinIFEntries;
This->unk.dwEntries = sizeof(InPinIFEntries)/sizeof(InPinIFEntries[0]);
This->unk.pOnFinalRelease = QUARTZ_DestroyTransformBaseInPin;
*ppPin = This;
TRACE("returned successfully.\n");
return S_OK;
}
/***************************************************************************
*
* new/delete CTransformBaseOutPinImpl
*
*/
/* can I use offsetof safely? - FIXME? */
static QUARTZ_IFEntry OutPinIFEntries[] =
{
{ &IID_IPin, offsetof(CTransformBaseOutPinImpl,pin)-offsetof(CTransformBaseOutPinImpl,unk) },
{ &IID_IQualityControl, offsetof(CTransformBaseOutPinImpl,qcontrol)-offsetof(CTransformBaseOutPinImpl,unk) },
};
static HRESULT CTransformBaseOutPinImpl_OnQueryInterface(
IUnknown* punk, const IID* piid, void** ppobj )
{
CTransformBaseOutPinImpl_THIS(punk,unk);
if ( This->pFilter == NULL || This->pFilter->pSeekPass == NULL )
return E_NOINTERFACE;
if ( IsEqualGUID( &IID_IMediaPosition, piid ) ||
IsEqualGUID( &IID_IMediaSeeking, piid ) )
{
TRACE( "IMediaSeeking(or IMediaPosition) is queried\n" );
return IUnknown_QueryInterface( (IUnknown*)(&This->pFilter->pSeekPass->unk), piid, ppobj );
}
return E_NOINTERFACE;
}
static void QUARTZ_DestroyTransformBaseOutPin(IUnknown* punk)
{
CTransformBaseOutPinImpl_THIS(punk,unk);
TRACE( "(%p)\n", This );
CPinBaseImpl_UninitIPin( &This->pin );
CQualityControlPassThruImpl_UninitIQualityControl( &This->qcontrol );
}
HRESULT QUARTZ_CreateTransformBaseOutPin(
CTransformBaseImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CTransformBaseOutPinImpl** ppPin,
LPCWSTR pwszPinName )
{
CTransformBaseOutPinImpl* This = NULL;
HRESULT hr;
TRACE("(%p,%p,%p)\n",pFilter,pcsPin,ppPin);
This = (CTransformBaseOutPinImpl*)
QUARTZ_AllocObj( sizeof(CTransformBaseOutPinImpl) );
if ( This == NULL )
return E_OUTOFMEMORY;
QUARTZ_IUnkInit( &This->unk, NULL );
This->qiext.pNext = NULL;
This->qiext.pOnQueryInterface = &CTransformBaseOutPinImpl_OnQueryInterface;
QUARTZ_IUnkAddDelegation( &This->unk, &This->qiext );
This->pFilter = pFilter;
hr = CPinBaseImpl_InitIPin(
&This->pin,
This->unk.punkControl,
pcsPin, NULL,
&pFilter->basefilter,
pwszPinName,
TRUE,
&outputpinhandlers );
if ( SUCCEEDED(hr) )
{
hr = CQualityControlPassThruImpl_InitIQualityControl(
&This->qcontrol,
This->unk.punkControl,
&This->pin );
if ( FAILED(hr) )
{
CPinBaseImpl_UninitIPin( &This->pin );
}
}
if ( FAILED(hr) )
{
QUARTZ_FreeObj(This);
return hr;
}
This->unk.pEntries = OutPinIFEntries;
This->unk.dwEntries = sizeof(OutPinIFEntries)/sizeof(OutPinIFEntries[0]);
This->unk.pOnFinalRelease = QUARTZ_DestroyTransformBaseOutPin;
*ppPin = This;
TRACE("returned successfully.\n");
return S_OK;
}

View File

@ -1,139 +0,0 @@
/*
* Implements IBaseFilter for transform filters. (internal)
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* 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 WINE_DSHOW_XFORM_H
#define WINE_DSHOW_XFORM_H
#include "iunk.h"
#include "basefilt.h"
#include "seekpass.h"
typedef struct CTransformBaseImpl CTransformBaseImpl;
typedef struct CTransformBaseInPinImpl CTransformBaseInPinImpl;
typedef struct CTransformBaseOutPinImpl CTransformBaseOutPinImpl;
typedef struct TransformBaseHandlers TransformBaseHandlers;
/* {301056D0-6DFF-11D2-9EEB-006008039E37} */
DEFINE_GUID(CLSID_quartzMJPGDecompressor,
0x301056D0,0x6DFF,0x11D2,0x9E,0xEB,0x00,0x60,0x08,0x03,0x9E,0x37);
/* {FDFE9681-74A3-11D0-AFA7-00AA00B67A42} */
DEFINE_GUID(CLSID_quartzQuickTimeDecompressor,
0xFDFE9681,0x74A3,0x11D0,0xAF,0xA7,0x00,0xAA,0x00,0xB6,0x7A,0x42);
struct CTransformBaseImpl
{
QUARTZ_IUnkImpl unk;
CBaseFilterImpl basefilter;
CTransformBaseInPinImpl* pInPin;
CTransformBaseOutPinImpl* pOutPin;
CSeekingPassThru* pSeekPass;
CRITICAL_SECTION csReceive;
IMemAllocator* m_pOutPinAllocator;
BOOL m_bPreCopy; /* sample must be copied */
BOOL m_bReuseSample; /* sample must be reused */
BOOL m_bInFlush;
IMediaSample* m_pSample;
BOOL m_bFiltering;
const TransformBaseHandlers* m_pHandler;
void* m_pUserData;
};
struct CTransformBaseInPinImpl
{
QUARTZ_IUnkImpl unk;
CPinBaseImpl pin;
CMemInputPinBaseImpl meminput;
CTransformBaseImpl* pFilter;
};
struct CTransformBaseOutPinImpl
{
QUARTZ_IUnkImpl unk;
CPinBaseImpl pin;
CQualityControlPassThruImpl qcontrol;
QUARTZ_IFDelegation qiext;
CTransformBaseImpl* pFilter;
};
struct TransformBaseHandlers
{
/* all methods must be implemented */
HRESULT (*pInit)( CTransformBaseImpl* pImpl );
HRESULT (*pCleanup)( CTransformBaseImpl* pImpl );
/* pmtOut may be NULL */
HRESULT (*pCheckMediaType)( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut );
/* get output types */
HRESULT (*pGetOutputTypes)( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE** ppmtAcceptTypes, ULONG* pcAcceptTypes );
/* get allocator properties */
HRESULT (*pGetAllocProp)( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, ALLOCATOR_PROPERTIES* pProp, BOOL* pbTransInPlace, BOOL* pbTryToReuseSample );
/* prepare the filter */
HRESULT (*pBeginTransform)( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, BOOL bReuseSample );
/* process a sample */
HRESULT (*pProcessReceive)( CTransformBaseImpl* pImpl, IMediaSample* pSampIn ); /* override Transform */
HRESULT (*pTransform)( CTransformBaseImpl* pImpl, IMediaSample* pSampIn, IMediaSample* pSampOut );
/* unprepare the filter */
HRESULT (*pEndTransform)( CTransformBaseImpl* pImpl );
};
#define CTransformBaseImpl_THIS(iface,member) CTransformBaseImpl* This = ((CTransformBaseImpl*)(((char*)iface)-offsetof(CTransformBaseImpl,member)))
#define CTransformBaseInPinImpl_THIS(iface,member) CTransformBaseInPinImpl* This = ((CTransformBaseInPinImpl*)(((char*)iface)-offsetof(CTransformBaseInPinImpl,member)))
#define CTransformBaseOutPinImpl_THIS(iface,member) CTransformBaseOutPinImpl* This = ((CTransformBaseOutPinImpl*)(((char*)iface)-offsetof(CTransformBaseOutPinImpl,member)))
HRESULT QUARTZ_CreateTransformBase(
IUnknown* punkOuter,void** ppobj,
const CLSID* pclsidTransformBase,
LPCWSTR pwszTransformBaseName,
LPCWSTR pwszInPinName,
LPCWSTR pwszOutPinName,
const TransformBaseHandlers* pHandler );
HRESULT QUARTZ_CreateTransformBaseInPin(
CTransformBaseImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CRITICAL_SECTION* pcsPinReceive,
CTransformBaseInPinImpl** ppPin,
LPCWSTR pwszPinName );
HRESULT QUARTZ_CreateTransformBaseOutPin(
CTransformBaseImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CTransformBaseOutPinImpl** ppPin,
LPCWSTR pwszPinName );
HRESULT QUARTZ_CreateAVIDec(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateColour(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateACMWrapper(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateCMpegAudioCodec(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateCMpegVideoCodec(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateMJPGDecompressor(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateQuickTimeDecompressor(IUnknown* punkOuter,void** ppobj);
#endif /* WINE_DSHOW_XFORM_H */

View File

@ -5,8 +5,6 @@ VPATH = @srcdir@
MODULE = none
INSTALLED_INCLUDES = \
amaudio.h \
amvideo.h \
audevcod.h \
basetsd.h \
cderr.h \
@ -15,7 +13,6 @@ INSTALLED_INCLUDES = \
commctrl.h \
commdlg.h \
compobj.h \
control.h \
cpl.h \
d3d.h \
d3dcaps.h \
@ -37,8 +34,6 @@ INSTALLED_INCLUDES = \
dshow.h \
dsound.h \
dvdmedia.h \
errors.h \
evcode.h \
guiddef.h \
imagehlp.h \
imm.h \
@ -126,7 +121,6 @@ INSTALLED_INCLUDES = \
sqlext.h \
sqltypes.h \
storage.h \
strmif.h \
tapi.h \
tlhelp32.h \
unknwn.h \

View File

@ -1,67 +0,0 @@
/*
* Copyright (C) 2001 Hidenori Takeshima
*
* 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 __WINE_AMAUDIO_H_
#define __WINE_AMAUDIO_H_
#include "ole2.h"
#include "mmsystem.h"
#include "dsound.h"
typedef struct IAMDirectSound IAMDirectSound;
/**************************************************************************
*
* IAMDirectSound interface
*
*/
#define ICOM_INTERFACE IAMDirectSound
#define IAMDirectSound_METHODS \
ICOM_METHOD1(HRESULT,GetDirectSoundInterface,LPDIRECTSOUND*,a1) \
ICOM_METHOD1(HRESULT,GetPrimaryBufferInterface,LPDIRECTSOUNDBUFFER*,a1) \
ICOM_METHOD1(HRESULT,GetSecondaryBufferInterface,LPDIRECTSOUNDBUFFER*,a1) \
ICOM_METHOD1(HRESULT,ReleaseDirectSoundInterface,LPDIRECTSOUND,a1) \
ICOM_METHOD1(HRESULT,ReleasePrimaryBufferInterface,LPDIRECTSOUNDBUFFER,a1) \
ICOM_METHOD1(HRESULT,ReleaseSecondaryBufferInterface,LPDIRECTSOUNDBUFFER,a1) \
ICOM_METHOD2(HRESULT,SetFocusWindow,HWND,a1,BOOL,a2) \
ICOM_METHOD2(HRESULT,GetFocusWindow,HWND*,a1,BOOL*,a2)
#define IAMDirectSound_IMETHODS \
IUnknown_IMETHODS \
IAMDirectSound_METHODS
ICOM_DEFINE(IAMDirectSound,IUnknown)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IAMDirectSound_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IAMDirectSound_AddRef(p) ICOM_CALL (AddRef,p)
#define IAMDirectSound_Release(p) ICOM_CALL (Release,p)
/*** IAMDirectSound methods ***/
#define IAMDirectSound_GetDirectSoundInterface(p,a1) ICOM_CALL1(GetDirectSoundInterface,p,a1)
#define IAMDirectSound_GetPrimaryBufferInterface(p,a1) ICOM_CALL1(GetPrimaryBufferInterface,p,a1)
#define IAMDirectSound_GetSecondaryBufferInterface(p,a1) ICOM_CALL1(GetSecondaryBufferInterface,p,a1)
#define IAMDirectSound_ReleaseDirectSoundInterface(p,a1) ICOM_CALL1(ReleaseDirectSoundInterface,p,a1)
#define IAMDirectSound_ReleasePrimaryBufferInterface(p,a1) ICOM_CALL1(ReleasePrimaryBufferInterface,p,a1)
#define IAMDirectSound_ReleaseSecondaryBufferInterface(p,a1) ICOM_CALL1(ReleaseSecondaryBufferInterface,p,a1)
#define IAMDirectSound_SetFocusWindow(p,a1,a2) ICOM_CALL2(SetFocusWindow,p,a1,a2)
#define IAMDirectSound_GetFocusWindow(p,a1,a2) ICOM_CALL2(GetFocusWindow,p,a1,a2)
#endif /* __WINE_AMAUDIO_H_ */

View File

@ -1,323 +0,0 @@
/*
* Copyright (C) 2001 Hidenori Takeshima
*
* 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 __WINE_AMVIDEO_H_
#define __WINE_AMVIDEO_H_
#include "ddraw.h"
typedef struct IBaseVideoMixer IBaseVideoMixer;
typedef struct IDirectDrawVideo IDirectDrawVideo;
typedef struct IFullScreenVideo IFullScreenVideo;
typedef struct IFullScreenVideoEx IFullScreenVideoEx;
typedef struct IQualProp IQualProp;
#define iEGA_COLORS 16
#define iPALETTE_COLORS 256
#define iMASK_COLORS 3
#define iRED 0
#define iGREEN 1
#define iBLUE 2
#define WIDTHBYTES(bits) ((DWORD)((((DWORD)(bits)+31U)&(~31U))>>3))
#define DIBWIDTHBYTES(bi) ((DWORD)WIDTHBYTES((bi).biWidth*(bi).biBitCount))
#define DIBSIZE(bi) (DIBWIDTHBYTES(bi)*(DWORD)abs((bi).biHeight))
typedef struct
{
DWORD dwBitMasks[iMASK_COLORS];
RGBQUAD bmiColors[iPALETTE_COLORS];
} TRUECOLORINFO;
typedef struct
{
RECT rcSource;
RECT rcTarget;
DWORD dwBitRate;
DWORD dwBitErrorRate;
REFERENCE_TIME AvgTimePerFrame;
BITMAPINFOHEADER bmiHeader;
} VIDEOINFOHEADER;
typedef struct
{
RECT rcSource;
RECT rcTarget;
DWORD dwBitRate;
DWORD dwBitErrorRate;
REFERENCE_TIME AvgTimePerFrame;
BITMAPINFOHEADER bmiHeader;
union {
RGBQUAD bmiColors[iPALETTE_COLORS];
DWORD dwBitMasks[iMASK_COLORS];
TRUECOLORINFO TrueColorInfo;
} DUMMYUNIONNAME;
} VIDEOINFO;
typedef struct
{
VIDEOINFOHEADER hdr;
DWORD dwStartTimeCode;
DWORD cbSequenceHeader;
BYTE bSequenceHeader[1];
} MPEG1VIDEOINFO;
typedef struct
{
RECT rcSource;
RECT rcTarget;
DWORD dwActiveWidth;
DWORD dwActiveHeight;
REFERENCE_TIME AvgTimePerFrame;
} ANALOGVIDEOINFO;
/**************************************************************************
*
* IBaseVideoMixer interface
*
*/
#define ICOM_INTERFACE IBaseVideoMixer
#define IBaseVideoMixer_METHODS \
ICOM_METHOD1(HRESULT,SetLeadPin,int,a1) \
ICOM_METHOD1(HRESULT,GetLeadPin,int*,a1) \
ICOM_METHOD1(HRESULT,GetInputPinCount,int*,a1) \
ICOM_METHOD1(HRESULT,IsUsingClock,int*,a1) \
ICOM_METHOD1(HRESULT,SetUsingClock,int,a1) \
ICOM_METHOD1(HRESULT,GetClockPeriod,int*,a1) \
ICOM_METHOD1(HRESULT,SetClockPeriod,int,a1)
#define IBaseVideoMixer_IMETHODS \
IUnknown_IMETHODS \
IBaseVideoMixer_METHODS
ICOM_DEFINE(IBaseVideoMixer,IUnknown)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IBaseVideoMixer_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IBaseVideoMixer_AddRef(p) ICOM_CALL (AddRef,p)
#define IBaseVideoMixer_Release(p) ICOM_CALL (Release,p)
/*** IBaseVideoMixer methods ***/
#define IBaseVideoMixer_SetLeadPin(p,a1) ICOM_CALL1(SetLeadPin,p,a1)
#define IBaseVideoMixer_GetLeadPin(p,a1) ICOM_CALL1(GetLeadPin,p,a1)
#define IBaseVideoMixer_GetInputPinCount(p,a1) ICOM_CALL1(GetInputPinCount,p,a1)
#define IBaseVideoMixer_IsUsingClock(p,a1) ICOM_CALL1(IsUsingClock,p,a1)
#define IBaseVideoMixer_SetUsingClock(p,a1) ICOM_CALL1(SetUsingClock,p,a1)
#define IBaseVideoMixer_GetClockPeriod(p,a1) ICOM_CALL1(GetClockPeriod,p,a1)
#define IBaseVideoMixer_SetClockPeriod(p,a1) ICOM_CALL1(SetClockPeriod,p,a1)
/**************************************************************************
*
* IDirectDrawVideo interface
*
*/
#define ICOM_INTERFACE IDirectDrawVideo
#define IDirectDrawVideo_METHODS \
ICOM_METHOD1(HRESULT,GetSwitches,DWORD*,a1) \
ICOM_METHOD1(HRESULT,SetSwitches,DWORD,a1) \
ICOM_METHOD1(HRESULT,GetCaps,DDCAPS*,a1) \
ICOM_METHOD1(HRESULT,GetEmulatedCaps,DDCAPS*,a1) \
ICOM_METHOD1(HRESULT,GetSurfaceDesc,DDSURFACEDESC*,a1) \
ICOM_METHOD2(HRESULT,GetFourCCCodes,DWORD*,a1,DWORD*,a2) \
ICOM_METHOD1(HRESULT,SetDirectDraw,LPDIRECTDRAW,a1) \
ICOM_METHOD1(HRESULT,GetDirectDraw,LPDIRECTDRAW*,a1) \
ICOM_METHOD1(HRESULT,GetSurfaceType,DWORD*,a1) \
ICOM_METHOD(HRESULT,SetDefault) \
ICOM_METHOD1(HRESULT,UseScanLine,long,a1) \
ICOM_METHOD1(HRESULT,CanUseScanLine,long*,a1) \
ICOM_METHOD1(HRESULT,UseOverlayStretch,long,a1) \
ICOM_METHOD1(HRESULT,CanUseOverlayStretch,long*,a1) \
ICOM_METHOD1(HRESULT,UseWhenFullScreen,long,a1) \
ICOM_METHOD1(HRESULT,WillUseFullScreen,long*,a1)
#define IDirectDrawVideo_IMETHODS \
IUnknown_IMETHODS \
IDirectDrawVideo_METHODS
ICOM_DEFINE(IDirectDrawVideo,IUnknown)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IDirectDrawVideo_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IDirectDrawVideo_AddRef(p) ICOM_CALL (AddRef,p)
#define IDirectDrawVideo_Release(p) ICOM_CALL (Release,p)
/*** IDirectDrawVideo methods ***/
#define IDirectDrawVideo_GetSwitches(p,a1) ICOM_CALL1(GetSwitches,p,a1)
#define IDirectDrawVideo_SetSwitches(p,a1) ICOM_CALL1(SetSwitches,p,a1)
#define IDirectDrawVideo_GetCaps(p,a1) ICOM_CALL1(GetCaps,p,a1)
#define IDirectDrawVideo_GetEmulatedCaps(p,a1) ICOM_CALL1(GetEmulatedCaps,p,a1)
#define IDirectDrawVideo_GetSurfaceDesc(p,a1) ICOM_CALL1(GetSurfaceDesc,p,a1)
#define IDirectDrawVideo_GetFourCCCodes(p,a1,a2) ICOM_CALL2(GetFourCCCodes,p,a1,a2)
#define IDirectDrawVideo_SetDirectDraw(p,a1) ICOM_CALL1(SetDirectDraw,p,a1)
#define IDirectDrawVideo_GetDirectDraw(p,a1) ICOM_CALL1(GetDirectDraw,p,a1)
#define IDirectDrawVideo_GetSurfaceType(p,a1) ICOM_CALL1(GetSurfaceType,p,a1)
#define IDirectDrawVideo_SetDefault(p) ICOM_CALL (SetDefault,p)
#define IDirectDrawVideo_UseScanLine(p,a1) ICOM_CALL1(UseScanLine,p,a1)
#define IDirectDrawVideo_CanUseScanLine(p,a1) ICOM_CALL1(CanUseScanLine,p,a1)
#define IDirectDrawVideo_UseOverlayStretch(p,a1) ICOM_CALL1(UseOverlayStretch,p,a1)
#define IDirectDrawVideo_CanUseOverlayStretch(p,a1) ICOM_CALL1(CanUseOverlayStretch,p,a1)
#define IDirectDrawVideo_UseWhenFullScreen(p,a1) ICOM_CALL1(UseWhenFullScreen,p,a1)
#define IDirectDrawVideo_WillUseFullScreen(p,a1) ICOM_CALL1(WillUseFullScreen,p,a1)
/**************************************************************************
*
* IFullScreenVideo interface
*
*/
#define ICOM_INTERFACE IFullScreenVideo
#define IFullScreenVideo_METHODS \
ICOM_METHOD1(HRESULT,CountModes,long*,a1) \
ICOM_METHOD4(HRESULT,GetModeInfo,long,a1,long*,a2,long*,a3,long*,a4) \
ICOM_METHOD1(HRESULT,GetCurrentMode,long*,a1) \
ICOM_METHOD1(HRESULT,IsModeAvailable,long,a1) \
ICOM_METHOD1(HRESULT,IsModeEnabled,long,a1) \
ICOM_METHOD2(HRESULT,SetEnabled,long,a1,long,a2) \
ICOM_METHOD1(HRESULT,GetClipFactor,long*,a1) \
ICOM_METHOD1(HRESULT,SetClipFactor,long,a1) \
ICOM_METHOD1(HRESULT,SetMessageDrain,HWND,a1) \
ICOM_METHOD1(HRESULT,GetMessageDrain,HWND*,a1) \
ICOM_METHOD1(HRESULT,SetMonitor,long,a1) \
ICOM_METHOD1(HRESULT,GetMonitor,long*,a1) \
ICOM_METHOD1(HRESULT,HideOnDeactivate,long,a1) \
ICOM_METHOD(HRESULT,IsHideOnDeactivate) \
ICOM_METHOD1(HRESULT,SetCaption,BSTR,a1) \
ICOM_METHOD1(HRESULT,GetCaption,BSTR*,a1) \
ICOM_METHOD(HRESULT,SetDefault)
#define IFullScreenVideo_IMETHODS \
IUnknown_IMETHODS \
IFullScreenVideo_METHODS
ICOM_DEFINE(IFullScreenVideo,IUnknown)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IFullScreenVideo_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IFullScreenVideo_AddRef(p) ICOM_CALL (AddRef,p)
#define IFullScreenVideo_Release(p) ICOM_CALL (Release,p)
/*** IFullScreenVideo methods ***/
#define IFullScreenVideo_CountModes(p,a1) ICOM_CALL1(CountModes,p,a1)
#define IFullScreenVideo_GetModeInfo(p,a1,a2,a3,a4) ICOM_CALL4(GetModeInfo,p,a1,a2,a3,a4)
#define IFullScreenVideo_GetCurrentMode(p,a1) ICOM_CALL1(GetCurrentMode,p,a1)
#define IFullScreenVideo_IsModeAvailable(p,a1) ICOM_CALL1(IsModeAvailable,p,a1)
#define IFullScreenVideo_IsModeEnabled(p,a1) ICOM_CALL1(IsModeEnabled,p,a1)
#define IFullScreenVideo_SetEnabled(p,a1,a2) ICOM_CALL2(SetEnabled,p,a1,a2)
#define IFullScreenVideo_GetClipFactor(p,a1) ICOM_CALL1(GetClipFactor,p,a1)
#define IFullScreenVideo_SetClipFactor(p,a1) ICOM_CALL1(SetClipFactor,p,a1)
#define IFullScreenVideo_SetMessageDrain(p,a1) ICOM_CALL1(SetMessageDrain,p,a1)
#define IFullScreenVideo_GetMessageDrain(p,a1) ICOM_CALL1(GetMessageDrain,p,a1)
#define IFullScreenVideo_SetMonitor(p,a1) ICOM_CALL1(SetMonitor,p,a1)
#define IFullScreenVideo_GetMonitor(p,a1) ICOM_CALL1(GetMonitor,p,a1)
#define IFullScreenVideo_HideOnDeactivate(p,a1) ICOM_CALL1(HideOnDeactivate,p,a1)
#define IFullScreenVideo_IsHideOnDeactivate(p) ICOM_CALL (IsHideOnDeactivate,p)
#define IFullScreenVideo_SetCaption(p,a1) ICOM_CALL1(SetCaption,p,a1)
#define IFullScreenVideo_GetCaption(p,a1) ICOM_CALL1(GetCaption,p,a1)
#define IFullScreenVideo_SetDefault(p) ICOM_CALL (SetDefault,p)
/**************************************************************************
*
* IFullScreenVideoEx interface
*
*/
#define ICOM_INTERFACE IFullScreenVideoEx
#define IFullScreenVideoEx_METHODS \
ICOM_METHOD2(HRESULT,SetAcceleratorTable,HWND,a1,HACCEL,a2) \
ICOM_METHOD2(HRESULT,GetAcceleratorTable,HWND*,a1,HACCEL*,a2) \
ICOM_METHOD1(HRESULT,KeepPixelAspectRatio,long,a1) \
ICOM_METHOD1(HRESULT,IsKeepPixelAspectRatio,long*,a1)
#define IFullScreenVideoEx_IMETHODS \
IFullScreenVideo_IMETHODS \
IFullScreenVideoEx_METHODS
ICOM_DEFINE(IFullScreenVideoEx,IFullScreenVideo)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IFullScreenVideoEx_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IFullScreenVideoEx_AddRef(p) ICOM_CALL (AddRef,p)
#define IFullScreenVideoEx_Release(p) ICOM_CALL (Release,p)
/*** IFullScreenVideo methods ***/
#define IFullScreenVideoEx_CountModes(p,a1) ICOM_CALL1(CountModes,p,a1)
#define IFullScreenVideoEx_GetModeInfo(p,a1,a2,a3,a4) ICOM_CALL4(GetModeInfo,p,a1,a2,a3,a4)
#define IFullScreenVideoEx_GetCurrentMode(p,a1) ICOM_CALL1(GetCurrentMode,p,a1)
#define IFullScreenVideoEx_IsModeAvailable(p,a1) ICOM_CALL1(IsModeAvailable,p,a1)
#define IFullScreenVideoEx_IsModeEnabled(p,a1) ICOM_CALL1(IsModeEnabled,p,a1)
#define IFullScreenVideoEx_SetEnabled(p,a1,a2) ICOM_CALL2(SetEnabled,p,a1,a2)
#define IFullScreenVideoEx_GetClipFactor(p,a1) ICOM_CALL1(GetClipFactor,p,a1)
#define IFullScreenVideoEx_SetClipFactor(p,a1) ICOM_CALL1(SetClipFactor,p,a1)
#define IFullScreenVideoEx_SetMessageDrain(p,a1) ICOM_CALL1(SetMessageDrain,p,a1)
#define IFullScreenVideoEx_GetMessageDrain(p,a1) ICOM_CALL1(GetMessageDrain,p,a1)
#define IFullScreenVideoEx_SetMonitor(p,a1) ICOM_CALL1(SetMonitor,p,a1)
#define IFullScreenVideoEx_GetMonitor(p,a1) ICOM_CALL1(GetMonitor,p,a1)
#define IFullScreenVideoEx_HideOnDeactivate(p,a1) ICOM_CALL1(HideOnDeactivate,p,a1)
#define IFullScreenVideoEx_IsHideOnDeactivate(p) ICOM_CALL (IsHideOnDeactivate,p)
#define IFullScreenVideoEx_SetCaption(p,a1) ICOM_CALL1(SetCaption,p,a1)
#define IFullScreenVideoEx_GetCaption(p,a1) ICOM_CALL1(GetCaption,p,a1)
#define IFullScreenVideoEx_SetDefault(p) ICOM_CALL (SetDefault,p)
/*** IFullScreenVideoEx methods ***/
#define IFullScreenVideoEx_SetAcceleratorTable(p,a1,a2) ICOM_CALL2(SetAcceleratorTable,p,a1,a2)
#define IFullScreenVideoEx_GetAcceleratorTable(p,a1,a2) ICOM_CALL2(GetAcceleratorTable,p,a1,a2)
#define IFullScreenVideoEx_KeepPixelAspectRatio(p,a1) ICOM_CALL1(KeepPixelAspectRatio,p,a1)
#define IFullScreenVideoEx_IsKeepPixelAspectRatio(p,a1) ICOM_CALL1(IsKeepPixelAspectRatio,p,a1)
/**************************************************************************
*
* IQualProp interface
*
*/
#define ICOM_INTERFACE IQualProp
#define IQualProp_METHODS \
ICOM_METHOD1(HRESULT,get_FramesDroppedInRenderer,int*,a1) \
ICOM_METHOD1(HRESULT,get_FramesDrawn,int*,a1) \
ICOM_METHOD1(HRESULT,get_AvgFrameRate,int*,a1) \
ICOM_METHOD1(HRESULT,get_Jitter,int*,a1) \
ICOM_METHOD1(HRESULT,get_AvgSyncOffset,int*,a1) \
ICOM_METHOD1(HRESULT,get_DevSyncOffset,int*,a1)
#define IQualProp_IMETHODS \
IUnknown_IMETHODS \
IQualProp_METHODS
ICOM_DEFINE(IQualProp,IUnknown)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IQualProp_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IQualProp_AddRef(p) ICOM_CALL (AddRef,p)
#define IQualProp_Release(p) ICOM_CALL (Release,p)
/*** IQualProp methods ***/
#define IQualProp_get_FramesDroppedInRenderer(p,a1) ICOM_CALL1(get_FramesDroppedInRenderer,p,a1)
#define IQualProp_get_FramesDrawn(p,a1) ICOM_CALL1(get_FramesDrawn,p,a1)
#define IQualProp_get_AvgFrameRate(p,a1) ICOM_CALL1(get_AvgFrameRate,p,a1)
#define IQualProp_get_Jitter(p,a1) ICOM_CALL1(get_Jitter,p,a1)
#define IQualProp_get_AvgSyncOffset(p,a1) ICOM_CALL1(get_AvgSyncOffset,p,a1)
#define IQualProp_get_DevSyncOffset(p,a1) ICOM_CALL1(get_DevSyncOffset,p,a1)
#endif /* __WINE_AMVIDEO_H_ */

View File

@ -1,718 +0,0 @@
/*
* Copyright (C) 2001 Hidenori Takeshima
*
* 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 __WINE_CONTROL_H_
#define __WINE_CONTROL_H_
/* forward decls. */
typedef struct IAMCollection IAMCollection;
typedef struct IBasicAudio IBasicAudio;
typedef struct IBasicVideo IBasicVideo;
typedef struct IDeferredCommand IDeferredCommand;
typedef struct IFilterInfo IFilterInfo;
typedef struct IMediaControl IMediaControl;
typedef struct IMediaEvent IMediaEvent;
typedef struct IMediaEventEx IMediaEventEx;
typedef struct IMediaPosition IMediaPosition;
typedef struct IMediaTypeInfo IMediaTypeInfo;
typedef struct IPinInfo IPinInfo;
typedef struct IQueueCommand IQueueCommand;
typedef struct IRegFilterInfo IRegFilterInfo;
typedef struct IVideoWindow IVideoWindow;
/* GUIDs */
DEFINE_GUID(IID_IAMCollection,0x56A868B9,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70);
DEFINE_GUID(IID_IBasicAudio,0x56A868B3,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70);
DEFINE_GUID(IID_IBasicVideo,0x56A868B5,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70);
DEFINE_GUID(IID_IDeferredCommand,0x56A868B8,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70);
DEFINE_GUID(IID_IFilterInfo,0x56A868BA,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70);
DEFINE_GUID(IID_IMediaControl,0x56A868B1,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70);
DEFINE_GUID(IID_IMediaEvent,0x56A868B6,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70);
DEFINE_GUID(IID_IMediaEventEx,0x56A868C0,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70);
DEFINE_GUID(IID_IMediaPosition,0x56A868B2,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70);
DEFINE_GUID(IID_IMediaTypeInfo,0x56A868BC,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70);
DEFINE_GUID(IID_IPinInfo,0x56A868BD,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70);
DEFINE_GUID(IID_IQueueCommand,0x56A868B7,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70);
DEFINE_GUID(IID_IRegFilterInfo,0x56A868BB,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70);
DEFINE_GUID(IID_IVideoWindow,0x56A868B4,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70);
#ifndef __WINE_REFTIME_DEFINED_
#define __WINE_REFTIME_DEFINED_
typedef double REFTIME;
#endif /* __WINE_REFTIME_DEFINED_ */
typedef LONG_PTR OAEVENT;
typedef LONG_PTR OAHWND;
typedef long OAFilterState;
/**************************************************************************
*
* IAMCollection interface
*
*/
#define ICOM_INTERFACE IAMCollection
#define IAMCollection_METHODS \
ICOM_METHOD1(HRESULT,get_Count,LONG*,a1) \
ICOM_METHOD2(HRESULT,Item,long,a1,IUnknown**,a2) \
ICOM_METHOD1(HRESULT,get__NewEnum,IUnknown**,a1)
#define IAMCollection_IMETHODS \
IDispatch_IMETHODS \
IAMCollection_METHODS
ICOM_DEFINE(IAMCollection,IDispatch)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IAMCollection_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IAMCollection_AddRef(p) ICOM_CALL (AddRef,p)
#define IAMCollection_Release(p) ICOM_CALL (Release,p)
/*** IDispatch methods ***/
#define IAMCollection_GetTypeInfoCount(p,a1) ICOM_CALL1(GetTypeInfoCount,p,a1)
#define IAMCollection_GetTypeInfo(p,a1,a2,a3) ICOM_CALL3(GetTypeInfo,p,a1,a2,a3)
#define IAMCollection_GetIDsOfNames(p,a1,a2,a3,a4,a5) ICOM_CALL5(GetIDsOfNames,p,a1,a2,a3,a4,a5)
#define IAMCollection_Invoke(p,a1,a2,a3,a4,a5,a6,a7,a8) ICOM_CALL8(Invoke,p,a1,a2,a3,a4,a5,a6,a7,a8)
/*** IAMCollection methods ***/
#define IAMCollection_get_Count(p,a1) ICOM_CALL1(get_Count,p,a1)
#define IAMCollection_Item(p,a1,a2) ICOM_CALL2(Item,p,a1,a2)
#define IAMCollection_get__NewEnum(p,a1) ICOM_CALL1(get__NewEnum,p,a1)
/**************************************************************************
*
* IBasicAudio interface
*
*/
#define ICOM_INTERFACE IBasicAudio
#define IBasicAudio_METHODS \
ICOM_METHOD1(HRESULT,put_Volume,long,a1) \
ICOM_METHOD1(HRESULT,get_Volume,long*,a1) \
ICOM_METHOD1(HRESULT,put_Balance,long,a1) \
ICOM_METHOD1(HRESULT,get_Balance,long*,a1)
#define IBasicAudio_IMETHODS \
IDispatch_IMETHODS \
IBasicAudio_METHODS
ICOM_DEFINE(IBasicAudio,IDispatch)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IBasicAudio_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IBasicAudio_AddRef(p) ICOM_CALL (AddRef,p)
#define IBasicAudio_Release(p) ICOM_CALL (Release,p)
/*** IDispatch methods ***/
#define IBasicAudio_GetTypeInfoCount(p,a1) ICOM_CALL1(GetTypeInfoCount,p,a1)
#define IBasicAudio_GetTypeInfo(p,a1,a2,a3) ICOM_CALL3(GetTypeInfo,p,a1,a2,a3)
#define IBasicAudio_GetIDsOfNames(p,a1,a2,a3,a4,a5) ICOM_CALL5(GetIDsOfNames,p,a1,a2,a3,a4,a5)
#define IBasicAudio_Invoke(p,a1,a2,a3,a4,a5,a6,a7,a8) ICOM_CALL8(Invoke,p,a1,a2,a3,a4,a5,a6,a7,a8)
/*** IBasicAudio methods ***/
#define IBasicAudio_put_Volume(p,a1) ICOM_CALL1(put_Volume,p,a1)
#define IBasicAudio_get_Volume(p,a1) ICOM_CALL1(get_Volume,p,a1)
#define IBasicAudio_put_Balance(p,a1) ICOM_CALL1(put_Balance,p,a1)
#define IBasicAudio_get_Balance(p,a1) ICOM_CALL1(get_Balance,p,a1)
/**************************************************************************
*
* IBasicVideo interface
*
*/
#define ICOM_INTERFACE IBasicVideo
#define IBasicVideo_METHODS \
ICOM_METHOD1(HRESULT,get_AvgTimePerFrame,REFTIME*,a1) \
ICOM_METHOD1(HRESULT,get_BitRate,long*,a1) \
ICOM_METHOD1(HRESULT,get_BitErrorRate,long*,a1) \
ICOM_METHOD1(HRESULT,get_VideoWidth,long*,a1) \
ICOM_METHOD1(HRESULT,get_VideoHeight,long*,a1) \
ICOM_METHOD1(HRESULT,put_SourceLeft,long,a1) \
ICOM_METHOD1(HRESULT,get_SourceLeft,long*,a1) \
ICOM_METHOD1(HRESULT,put_SourceWidth,long,a1) \
ICOM_METHOD1(HRESULT,get_SourceWidth,long*,a1) \
ICOM_METHOD1(HRESULT,put_SourceTop,long,a1) \
ICOM_METHOD1(HRESULT,get_SourceTop,long*,a1) \
ICOM_METHOD1(HRESULT,put_SourceHeight,long,a1) \
ICOM_METHOD1(HRESULT,get_SourceHeight,long*,a1) \
ICOM_METHOD1(HRESULT,put_DestinationLeft,long,a1) \
ICOM_METHOD1(HRESULT,get_DestinationLeft,long*,a1) \
ICOM_METHOD1(HRESULT,put_DestinationWidth,long,a1) \
ICOM_METHOD1(HRESULT,get_DestinationWidth,long*,a1) \
ICOM_METHOD1(HRESULT,put_DestinationTop,long,a1) \
ICOM_METHOD1(HRESULT,get_DestinationTop,long*,a1) \
ICOM_METHOD1(HRESULT,put_DestinationHeight,long,a1) \
ICOM_METHOD1(HRESULT,get_DestinationHeight,long*,a1) \
ICOM_METHOD4(HRESULT,SetSourcePosition,long,a1,long,a2,long,a3,long,a4) \
ICOM_METHOD4(HRESULT,GetSourcePosition,long*,a1,long*,a2,long*,a3,long*,a4) \
ICOM_METHOD (HRESULT,SetDefaultSourcePosition) \
ICOM_METHOD4(HRESULT,SetDestinationPosition,long,a1,long,a2,long,a3,long,a4) \
ICOM_METHOD4(HRESULT,GetDestinationPosition,long*,a1,long*,a2,long*,a3,long*,a4) \
ICOM_METHOD (HRESULT,SetDefaultDestinationPosition) \
ICOM_METHOD2(HRESULT,GetVideoSize,long*,a1,long*,a2) \
ICOM_METHOD4(HRESULT,GetVideoPaletteEntries,long,a1,long,a2,long*,a3,long*,a4) \
ICOM_METHOD2(HRESULT,GetCurrentImage,long*,a1,long*,a2) \
ICOM_METHOD (HRESULT,IsUsingDefaultSource) \
ICOM_METHOD (HRESULT,IsUsingDefaultDestination)
#define IBasicVideo_IMETHODS \
IDispatch_IMETHODS \
IBasicVideo_METHODS
ICOM_DEFINE(IBasicVideo,IDispatch)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IBasicVideo_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IBasicVideo_AddRef(p) ICOM_CALL (AddRef,p)
#define IBasicVideo_Release(p) ICOM_CALL (Release,p)
/*** IDispatch methods ***/
#define IBasicVideo_GetTypeInfoCount(p,a1) ICOM_CALL1(GetTypeInfoCount,p,a1)
#define IBasicVideo_GetTypeInfo(p,a1,a2,a3) ICOM_CALL3(GetTypeInfo,p,a1,a2,a3)
#define IBasicVideo_GetIDsOfNames(p,a1,a2,a3,a4,a5) ICOM_CALL5(GetIDsOfNames,p,a1,a2,a3,a4,a5)
#define IBasicVideo_Invoke(p,a1,a2,a3,a4,a5,a6,a7,a8) ICOM_CALL8(Invoke,p,a1,a2,a3,a4,a5,a6,a7,a8)
/*** IBasicVideo methods ***/
#define IBasicVideo_get_AvgTimePerFrame(p,a1) ICOM_CALL1(get_AvgTimePerFrame,p,a1)
#define IBasicVideo_get_BitRate(p,a1) ICOM_CALL1(get_BitRate,p,a1)
#define IBasicVideo_get_BitErrorRate(p,a1) ICOM_CALL1(get_BitErrorRate,p,a1)
#define IBasicVideo_get_VideoWidth(p,a1) ICOM_CALL1(get_VideoWidth,p,a1)
#define IBasicVideo_get_VideoHeight(p,a1) ICOM_CALL1(get_VideoHeight,p,a1)
#define IBasicVideo_put_SourceLeft(p,a1) ICOM_CALL1(put_SourceLeft,p,a1)
#define IBasicVideo_get_SourceLeft(p,a1) ICOM_CALL1(get_SourceLeft,p,a1)
#define IBasicVideo_put_SourceWidth(p,a1) ICOM_CALL1(put_SourceWidth,p,a1)
#define IBasicVideo_get_SourceWidth(p,a1) ICOM_CALL1(get_SourceWidth,p,a1)
#define IBasicVideo_put_SourceTop(p,a1) ICOM_CALL1(put_SourceTop,p,a1)
#define IBasicVideo_get_SourceTop(p,a1) ICOM_CALL1(get_SourceTop,p,a1)
#define IBasicVideo_put_SourceHeight(p,a1) ICOM_CALL1(put_SourceHeight,p,a1)
#define IBasicVideo_get_SourceHeight(p,a1) ICOM_CALL1(get_SourceHeight,p,a1)
#define IBasicVideo_put_DestinationLeft(p,a1) ICOM_CALL1(put_DestinationLeft,p,a1)
#define IBasicVideo_get_DestinationLeft(p,a1) ICOM_CALL1(get_DestinationLeft,p,a1)
#define IBasicVideo_put_DestinationWidth(p,a1) ICOM_CALL1(put_DestinationWidth,p,a1)
#define IBasicVideo_get_DestinationWidth(p,a1) ICOM_CALL1(get_DestinationWidth,p,a1)
#define IBasicVideo_put_DestinationTop(p,a1) ICOM_CALL1(put_DestinationTop,p,a1)
#define IBasicVideo_get_DestinationTop(p,a1) ICOM_CALL1(get_DestinationTop,p,a1)
#define IBasicVideo_put_DestinationHeight(p,a1) ICOM_CALL1(put_DestinationHeight,p,a1)
#define IBasicVideo_get_DestinationHeight(p,a1) ICOM_CALL1(get_DestinationHeight,p,a1)
#define IBasicVideo_SetSourcePosition(p,a1,a2,a3,a4) ICOM_CALL4(SetSourcePosition,p,a1,a2,a3,a4)
#define IBasicVideo_GetSourcePosition(p,a1,a2,a3,a4) ICOM_CALL4(GetSourcePosition,p,a1,a2,a3,a4)
#define IBasicVideo_SetDefaultSourcePosition(p) ICOM_CALL (SetDefaultSourcePosition,p)
#define IBasicVideo_SetDestinationPosition(p,a1,a2,a3,a4) ICOM_CALL4(SetDestinationPosition,p,a1,a2,a3,a4)
#define IBasicVideo_GetDestinationPosition(p,a1,a2,a3,a4) ICOM_CALL4(GetDestinationPosition,p,a1,a2,a3,a4)
#define IBasicVideo_SetDefaultDestinationPosition(p) ICOM_CALL (SetDefaultDestinationPosition,p)
#define IBasicVideo_GetVideoSize(p,a1,a2) ICOM_CALL2(GetVideoSize,p,a1,a2)
#define IBasicVideo_GetVideoPaletteEntries(p,a1,a2,a3,a4) ICOM_CALL4(GetVideoPaletteEntries,p,a1,a2,a3,a4)
#define IBasicVideo_GetCurrentImage(p,a1,a2) ICOM_CALL2(GetCurrentImage,p,a1,a2)
#define IBasicVideo_IsUsingDefaultSource(p) ICOM_CALL (IsUsingDefaultSource,p)
#define IBasicVideo_IsUsingDefaultDestination(p) ICOM_CALL (IsUsingDefaultDestination,p)
/**************************************************************************
*
* IDeferredCommand interface
*
*/
#define ICOM_INTERFACE IDeferredCommand
#define IDeferredCommand_METHODS \
ICOM_METHOD (HRESULT,Cancel) \
ICOM_METHOD1(HRESULT,Confidence,LONG*,a1) \
ICOM_METHOD1(HRESULT,Postpone,REFTIME,a1) \
ICOM_METHOD1(HRESULT,GetHResult,HRESULT*,a1)
#define IDeferredCommand_IMETHODS \
IUnknown_IMETHODS \
IDeferredCommand_METHODS
ICOM_DEFINE(IDeferredCommand,IUnknown)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IDeferredCommand_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IDeferredCommand_AddRef(p) ICOM_CALL (AddRef,p)
#define IDeferredCommand_Release(p) ICOM_CALL (Release,p)
/*** IDeferredCommand methods ***/
#define IDeferredCommand_Cancel(p) ICOM_CALL1(Cancel,p)
#define IDeferredCommand_Confidence(p,a1) ICOM_CALL1(Confidence,p,a1)
#define IDeferredCommand_Postpone(p,a1) ICOM_CALL1(Postpone,p,a1)
#define IDeferredCommand_GetHResult(p,a1) ICOM_CALL1(GetHResult,p,a1)
/**************************************************************************
*
* IFilterInfo interface
*
*/
#define ICOM_INTERFACE IFilterInfo
#define IFilterInfo_METHODS \
ICOM_METHOD2(HRESULT,FindPin,BSTR,a1,IDispatch**,a2) \
ICOM_METHOD1(HRESULT,get_Name,BSTR*,a1) \
ICOM_METHOD1(HRESULT,get_VendorInfo,BSTR*,a1) \
ICOM_METHOD1(HRESULT,get_Filter,IUnknown**,a1) \
ICOM_METHOD1(HRESULT,get_Pins,IDispatch**,a1) \
ICOM_METHOD1(HRESULT,get_IsFileSource,LONG*,a1) \
ICOM_METHOD1(HRESULT,get_Filename,BSTR*,a1) \
ICOM_METHOD1(HRESULT,put_Filename,BSTR,a1)
#define IFilterInfo_IMETHODS \
IDispatch_IMETHODS \
IFilterInfo_METHODS
ICOM_DEFINE(IFilterInfo,IDispatch)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IFilterInfo_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IFilterInfo_AddRef(p) ICOM_CALL (AddRef,p)
#define IFilterInfo_Release(p) ICOM_CALL (Release,p)
/*** IDispatch methods ***/
#define IFilterInfo_GetTypeInfoCount(p,a1) ICOM_CALL1(GetTypeInfoCount,p,a1)
#define IFilterInfo_GetTypeInfo(p,a1,a2,a3) ICOM_CALL3(GetTypeInfo,p,a1,a2,a3)
#define IFilterInfo_GetIDsOfNames(p,a1,a2,a3,a4,a5) ICOM_CALL5(GetIDsOfNames,p,a1,a2,a3,a4,a5)
#define IFilterInfo_Invoke(p,a1,a2,a3,a4,a5,a6,a7,a8) ICOM_CALL8(Invoke,p,a1,a2,a3,a4,a5,a6,a7,a8)
/*** IFilterInfo methods ***/
#define IFilterInfo_FindPin(p,a1,a2) ICOM_CALL2(FindPin,p,a1,a2)
#define IFilterInfo_get_Name(p,a1) ICOM_CALL1(get_Name,p,a1)
#define IFilterInfo_get_VendorInfo(p,a1) ICOM_CALL1(get_VendorInfo,p,a1)
#define IFilterInfo_get_Filter(p,a1) ICOM_CALL1(get_Filter,p,a1)
#define IFilterInfo_get_Pins(p,a1) ICOM_CALL1(get_Pins,p,a1)
#define IFilterInfo_get_IsFileSource(p,a1) ICOM_CALL1(get_IsFileSource,p,a1)
#define IFilterInfo_get_Filename(p,a1) ICOM_CALL1(get_Filename,p,a1)
#define IFilterInfo_put_Filename(p,a1) ICOM_CALL1(put_Filename,p,a1)
/**************************************************************************
*
* IMediaControl interface
*
*/
#define ICOM_INTERFACE IMediaControl
#define IMediaControl_METHODS \
ICOM_METHOD (HRESULT,Run) \
ICOM_METHOD (HRESULT,Pause) \
ICOM_METHOD (HRESULT,Stop) \
ICOM_METHOD2(HRESULT,GetState,LONG,a1,OAFilterState*,a2) \
ICOM_METHOD1(HRESULT,RenderFile,BSTR,a1) \
ICOM_METHOD2(HRESULT,AddSourceFilter,BSTR,a1,IDispatch**,a2) \
ICOM_METHOD1(HRESULT,get_FilterCollection,IDispatch**,a1) \
ICOM_METHOD1(HRESULT,get_RegFilterCollection,IDispatch**,a1) \
ICOM_METHOD (HRESULT,StopWhenReady)
#define IMediaControl_IMETHODS \
IDispatch_IMETHODS \
IMediaControl_METHODS
ICOM_DEFINE(IMediaControl,IDispatch)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IMediaControl_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IMediaControl_AddRef(p) ICOM_CALL (AddRef,p)
#define IMediaControl_Release(p) ICOM_CALL (Release,p)
/*** IDispatch methods ***/
#define IMediaControl_GetTypeInfoCount(p,a1) ICOM_CALL1(GetTypeInfoCount,p,a1)
#define IMediaControl_GetTypeInfo(p,a1,a2,a3) ICOM_CALL3(GetTypeInfo,p,a1,a2,a3)
#define IMediaControl_GetIDsOfNames(p,a1,a2,a3,a4,a5) ICOM_CALL5(GetIDsOfNames,p,a1,a2,a3,a4,a5)
#define IMediaControl_Invoke(p,a1,a2,a3,a4,a5,a6,a7,a8) ICOM_CALL8(Invoke,p,a1,a2,a3,a4,a5,a6,a7,a8)
/*** IMediaControl methods ***/
#define IMediaControl_Run(p) ICOM_CALL (Run,p)
#define IMediaControl_Pause(p) ICOM_CALL (Pause,p)
#define IMediaControl_Stop(p) ICOM_CALL (Stop,p)
#define IMediaControl_GetState(p,a1,a2) ICOM_CALL2(GetState,p,a1,a2)
#define IMediaControl_RenderFile(p,a1) ICOM_CALL1(RenderFile,p,a1)
#define IMediaControl_AddSourceFilter(p,a1,a2) ICOM_CALL2(AddSourceFilter,p,a1,a2)
#define IMediaControl_get_FilterCollection(p,a1) ICOM_CALL1(get_FilterCollection,p,a1)
#define IMediaControl_get_RegFilterCollection(p,a1) ICOM_CALL1(get_RegFilterCollection,p,a1)
#define IMediaControl_StopWhenReady(p) ICOM_CALL (StopWhenReady,p)
/**************************************************************************
*
* IMediaEvent interface
*
*/
#define ICOM_INTERFACE IMediaEvent
#define IMediaEvent_METHODS \
ICOM_METHOD1(HRESULT,GetEventHandle,OAEVENT*,a1) \
ICOM_METHOD4(HRESULT,GetEvent,long*,a1,LONG_PTR*,a2,LONG_PTR*,a3,long,a4) \
ICOM_METHOD2(HRESULT,WaitForCompletion,long,a1,long*,a2) \
ICOM_METHOD1(HRESULT,CancelDefaultHandling,long,a1) \
ICOM_METHOD1(HRESULT,RestoreDefaultHandling,long,a1) \
ICOM_METHOD3(HRESULT,FreeEventParams,long,a1,LONG_PTR,a2,LONG_PTR,a3)
#define IMediaEvent_IMETHODS \
IDispatch_IMETHODS \
IMediaEvent_METHODS
ICOM_DEFINE(IMediaEvent,IDispatch)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IMediaEvent_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IMediaEvent_AddRef(p) ICOM_CALL (AddRef,p)
#define IMediaEvent_Release(p) ICOM_CALL (Release,p)
/*** IDispatch methods ***/
#define IMediaEvent_GetTypeInfoCount(p,a1) ICOM_CALL1(GetTypeInfoCount,p,a1)
#define IMediaEvent_GetTypeInfo(p,a1,a2,a3) ICOM_CALL3(GetTypeInfo,p,a1,a2,a3)
#define IMediaEvent_GetIDsOfNames(p,a1,a2,a3,a4,a5) ICOM_CALL5(GetIDsOfNames,p,a1,a2,a3,a4,a5)
#define IMediaEvent_Invoke(p,a1,a2,a3,a4,a5,a6,a7,a8) ICOM_CALL8(Invoke,p,a1,a2,a3,a4,a5,a6,a7,a8)
/*** IMediaEvent methods ***/
#define IMediaEvent_GetEventHandle(p,a1) ICOM_CALL1(GetEventHandle,p,a1)
#define IMediaEvent_GetEvent(p,a1,a2,a3,a4) ICOM_CALL4(GetEvent,p,a1,a2,a3,a4)
#define IMediaEvent_WaitForCompletion(p,a1,a2) ICOM_CALL2(WaitForCompletion,p,a1,a2)
#define IMediaEvent_CancelDefaultHandling(p,a1) ICOM_CALL1(CancelDefaultHandling,p,a1)
#define IMediaEvent_RestoreDefaultHandling(p,a1) ICOM_CALL1(RestoreDefaultHandling,p,a1)
#define IMediaEvent_FreeEventParams(p,a1,a2,a3) ICOM_CALL3(FreeEventParams,p,a1,a2,a3)
/**************************************************************************
*
* IMediaEventEx interface
*
*/
#define ICOM_INTERFACE IMediaEventEx
#define IMediaEventEx_METHODS \
ICOM_METHOD3(HRESULT,SetNotifyWindow,OAHWND,a1,long,a2,LONG_PTR,a3) \
ICOM_METHOD1(HRESULT,SetNotifyFlags,long,a1) \
ICOM_METHOD1(HRESULT,GetNotifyFlags,long*,a1)
#define IMediaEventEx_IMETHODS \
IMediaEvent_IMETHODS \
IMediaEventEx_METHODS
ICOM_DEFINE(IMediaEventEx,IMediaEvent)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IMediaEventEx_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IMediaEventEx_AddRef(p) ICOM_CALL (AddRef,p)
#define IMediaEventEx_Release(p) ICOM_CALL (Release,p)
/*** IDispatch methods ***/
#define IMediaEventEx_GetTypeInfoCount(p,a1) ICOM_CALL1(GetTypeInfoCount,p,a1)
#define IMediaEventEx_GetTypeInfo(p,a1,a2,a3) ICOM_CALL3(GetTypeInfo,p,a1,a2,a3)
#define IMediaEventEx_GetIDsOfNames(p,a1,a2,a3,a4,a5) ICOM_CALL5(GetIDsOfNames,p,a1,a2,a3,a4,a5)
#define IMediaEventEx_Invoke(p,a1,a2,a3,a4,a5,a6,a7,a8) ICOM_CALL8(Invoke,p,a1,a2,a3,a4,a5,a6,a7,a8)
/*** IMediaEvent methods ***/
#define IMediaEventEx_GetEventHandle(p,a1) ICOM_CALL1(GetEventHandle,p,a1)
#define IMediaEventEx_GetEvent(p,a1,a2,a3,a4) ICOM_CALL4(GetEvent,p,a1,a2,a3,a4)
#define IMediaEventEx_WaitForCompletion(p,a1,a2) ICOM_CALL2(WaitForCompletion,p,a1,a2)
#define IMediaEventEx_CancelDefaultHandling(p,a1) ICOM_CALL1(CancelDefaultHandling,p,a1)
#define IMediaEventEx_RestoreDefaultHandling(p,a1) ICOM_CALL1(RestoreDefaultHandling,p,a1)
#define IMediaEventEx_FreeEventParams(p,a1,a2,a3) ICOM_CALL3(FreeEventParams,p,a1,a2,a3)
/*** IMediaEventEx methods ***/
#define IMediaEventEx_SetNotifyWindow(p,a1,a2,a3) ICOM_CALL3(SetNotifyWindow,p,a1,a2,a3)
#define IMediaEventEx_SetNotifyFlags(p,a1) ICOM_CALL1(SetNotifyFlags,p,a1)
#define IMediaEventEx_GetNotifyFlags(p,a1) ICOM_CALL1(GetNotifyFlags,p,a1)
/**************************************************************************
*
* IMediaPosition interface
*
*/
#define ICOM_INTERFACE IMediaPosition
#define IMediaPosition_METHODS \
ICOM_METHOD1(HRESULT,get_Duration,REFTIME*,a1) \
ICOM_METHOD1(HRESULT,put_CurrentPosition,REFTIME,a1) \
ICOM_METHOD1(HRESULT,get_CurrentPosition,REFTIME*,a1) \
ICOM_METHOD1(HRESULT,get_StopTime,REFTIME*,a1) \
ICOM_METHOD1(HRESULT,put_StopTime,REFTIME,a1) \
ICOM_METHOD1(HRESULT,get_PrerollTime,REFTIME*,a1) \
ICOM_METHOD1(HRESULT,put_PrerollTime,REFTIME,a1) \
ICOM_METHOD1(HRESULT,put_Rate,double,a1) \
ICOM_METHOD1(HRESULT,get_Rate,double*,a1) \
ICOM_METHOD1(HRESULT,CanSeekForward,LONG*,a1) \
ICOM_METHOD1(HRESULT,CanSeekBackward,LONG*,a1)
#define IMediaPosition_IMETHODS \
IDispatch_IMETHODS \
IMediaPosition_METHODS
ICOM_DEFINE(IMediaPosition,IDispatch)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IMediaPosition_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IMediaPosition_AddRef(p) ICOM_CALL (AddRef,p)
#define IMediaPosition_Release(p) ICOM_CALL (Release,p)
/*** IDispatch methods ***/
#define IMediaPosition_GetTypeInfoCount(p,a1) ICOM_CALL1(GetTypeInfoCount,p,a1)
#define IMediaPosition_GetTypeInfo(p,a1,a2,a3) ICOM_CALL3(GetTypeInfo,p,a1,a2,a3)
#define IMediaPosition_GetIDsOfNames(p,a1,a2,a3,a4,a5) ICOM_CALL5(GetIDsOfNames,p,a1,a2,a3,a4,a5)
#define IMediaPosition_Invoke(p,a1,a2,a3,a4,a5,a6,a7,a8) ICOM_CALL8(Invoke,p,a1,a2,a3,a4,a5,a6,a7,a8)
/*** IMediaPosition methods ***/
#define IMediaPosition_get_Duration(p,a1) ICOM_CALL1(get_Duration,p,a1)
#define IMediaPosition_put_CurrentPosition(p,a1) ICOM_CALL1(put_CurrentPosition,p,a1)
#define IMediaPosition_get_CurrentPosition(p,a1) ICOM_CALL1(get_CurrentPosition,p,a1)
#define IMediaPosition_get_StopTime(p,a1) ICOM_CALL1(get_StopTime,p,a1)
#define IMediaPosition_put_StopTime(p,a1) ICOM_CALL1(put_StopTime,p,a1)
#define IMediaPosition_get_PrerollTime(p,a1) ICOM_CALL1(get_PrerollTime,p,a1)
#define IMediaPosition_put_PrerollTime(p,a1) ICOM_CALL1(put_PrerollTime,p,a1)
#define IMediaPosition_put_Rate(p,a1) ICOM_CALL1(put_Rate,p,a1)
#define IMediaPosition_get_Rate(p,a1) ICOM_CALL1(get_Rate,p,a1)
#define IMediaPosition_CanSeekForward(p,a1) ICOM_CALL1(CanSeekForward,p,a1)
#define IMediaPosition_CanSeekBackward(p,a1) ICOM_CALL1(CanSeekBackward,p,a1)
/**************************************************************************
*
* IMediaTypeInfo interface
*
*/
#define ICOM_INTERFACE IMediaTypeInfo
#define IMediaTypeInfo_METHODS \
ICOM_METHOD1(HRESULT,get_Type,BSTR*,a1) \
ICOM_METHOD1(HRESULT,get_Subtype,BSTR*,a1)
#define IMediaTypeInfo_IMETHODS \
IDispatch_IMETHODS \
IMediaTypeInfo_METHODS
ICOM_DEFINE(IMediaTypeInfo,IDispatch)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IMediaTypeInfo_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IMediaTypeInfo_AddRef(p) ICOM_CALL (AddRef,p)
#define IMediaTypeInfo_Release(p) ICOM_CALL (Release,p)
/*** IDispatch methods ***/
#define IMediaTypeInfo_GetTypeInfoCount(p,a1) ICOM_CALL1(GetTypeInfoCount,p,a1)
#define IMediaTypeInfo_GetTypeInfo(p,a1,a2,a3) ICOM_CALL3(GetTypeInfo,p,a1,a2,a3)
#define IMediaTypeInfo_GetIDsOfNames(p,a1,a2,a3,a4,a5) ICOM_CALL5(GetIDsOfNames,p,a1,a2,a3,a4,a5)
#define IMediaTypeInfo_Invoke(p,a1,a2,a3,a4,a5,a6,a7,a8) ICOM_CALL8(Invoke,p,a1,a2,a3,a4,a5,a6,a7,a8)
/*** IMediaTypeInfo methods ***/
#define IMediaTypeInfo_get_Type(p,a1) ICOM_CALL1(get_Type,p,a1)
#define IMediaTypeInfo_get_Subtype(p,a1) ICOM_CALL1(get_Subtype,p,a1)
/**************************************************************************
*
* IPinInfo interface
*
*/
#define ICOM_INTERFACE IPinInfo
#define IPinInfo_METHODS \
ICOM_METHOD1(HRESULT,get_Pin,IUnknown**,a1) \
ICOM_METHOD1(HRESULT,get_ConnectedTo,IDispatch**,a1) \
ICOM_METHOD1(HRESULT,get_ConnectionMediaType,IDispatch**,a1) \
ICOM_METHOD1(HRESULT,get_FilterInfo,IDispatch**,a1) \
ICOM_METHOD1(HRESULT,get_Name,BSTR*,a1) \
ICOM_METHOD1(HRESULT,get_Direction,LONG*,a1) \
ICOM_METHOD1(HRESULT,get_PinID,BSTR*,a1) \
ICOM_METHOD1(HRESULT,get_MediaTypes,IDispatch**,a1) \
ICOM_METHOD1(HRESULT,Connect,IUnknown*,a1) \
ICOM_METHOD1(HRESULT,ConnectDirect,IUnknown*,a1) \
ICOM_METHOD2(HRESULT,ConnectWithType,IUnknown*,a1,IDispatch*,a2) \
ICOM_METHOD (HRESULT,Disconnect) \
ICOM_METHOD (HRESULT,Render)
#define IPinInfo_IMETHODS \
IDispatch_IMETHODS \
IPinInfo_METHODS
ICOM_DEFINE(IPinInfo,IDispatch)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IPinInfo_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IPinInfo_AddRef(p) ICOM_CALL (AddRef,p)
#define IPinInfo_Release(p) ICOM_CALL (Release,p)
/*** IDispatch methods ***/
#define IPinInfo_GetTypeInfoCount(p,a1) ICOM_CALL1(GetTypeInfoCount,p,a1)
#define IPinInfo_GetTypeInfo(p,a1,a2,a3) ICOM_CALL3(GetTypeInfo,p,a1,a2,a3)
#define IPinInfo_GetIDsOfNames(p,a1,a2,a3,a4,a5) ICOM_CALL5(GetIDsOfNames,p,a1,a2,a3,a4,a5)
#define IPinInfo_Invoke(p,a1,a2,a3,a4,a5,a6,a7,a8) ICOM_CALL8(Invoke,p,a1,a2,a3,a4,a5,a6,a7,a8)
/*** IPinInfo methods ***/
#define IPinInfo_get_Pin(p,a1) ICOM_CALL1(get_Pin,p,a1)
#define IPinInfo_get_ConnectedTo(p,a1) ICOM_CALL1(get_ConnectedTo,p,a1)
#define IPinInfo_get_ConnectionMediaType(p,a1) ICOM_CALL1(get_ConnectionMediaType,p,a1)
#define IPinInfo_get_FilterInfo(p,a1) ICOM_CALL1(get_FilterInfo,p,a1)
#define IPinInfo_get_Name(p,a1) ICOM_CALL1(get_Name,p,a1)
#define IPinInfo_get_Direction(p,a1) ICOM_CALL1(get_Direction,p,a1)
#define IPinInfo_get_PinID(p,a1) ICOM_CALL1(get_PinID,p,a1)
#define IPinInfo_get_MediaTypes(p,a1) ICOM_CALL1(get_MediaTypes,p,a1)
#define IPinInfo_Connect(p,a1) ICOM_CALL1(Connect,p,a1)
#define IPinInfo_ConnectDirect(p,a1) ICOM_CALL1(ConnectDirect,p,a1)
#define IPinInfo_ConnectWithType(p,a1,a2) ICOM_CALL2(ConnectWithType,p,a1,a2)
#define IPinInfo_Disconnect(p) ICOM_CALL (Disconnect,p)
#define IPinInfo_Render(p) ICOM_CALL (Render,p)
/**************************************************************************
*
* IQueueCommand interface
*
*/
#define ICOM_INTERFACE IQueueCommand
#define IQueueCommand_METHODS \
ICOM_METHOD9(HRESULT,InvokeAtStreamTime,IDeferredCommand**,a1,REFTIME,a2,GUID*,a3,long,a4,short,a5,long,a6,VARIANT*,a7,VARIANT*,a8,short*,a9) \
ICOM_METHOD9(HRESULT,InvokeAtPresentationTime,IDeferredCommand**,a1,REFTIME,a2,GUID*,a3,long,a4,short,a5,long,a6,VARIANT*,a7,VARIANT*,a8,short*,a9)
#define IQueueCommand_IMETHODS \
IUnknown_IMETHODS \
IQueueCommand_METHODS
ICOM_DEFINE(IQueueCommand,IUnknown)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IQueueCommand_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IQueueCommand_AddRef(p) ICOM_CALL (AddRef,p)
#define IQueueCommand_Release(p) ICOM_CALL (Release,p)
/*** IQueueCommand methods ***/
#define IQueueCommand_InvokeAtStreamTime(p,a1,a2,a3,a4,a5,a6,a7,a8,a9) ICOM_CALL9(InvokeAtStreamTime,p,a1,a2,a3,a4,a5,a6,a7,a8,a9)
#define IQueueCommand_InvokeAtPresentationTime(p,a1,a2,a3,a4,a5,a6,a7,a8,a9) ICOM_CALL9(InvokeAtPresentationTime,p,a1,a2,a3,a4,a5,a6,a7,a8,a9)
/**************************************************************************
*
* IRegFilterInfo interface
*
*/
#define ICOM_INTERFACE IRegFilterInfo
#define IRegFilterInfo_METHODS \
ICOM_METHOD1(HRESULT,get_Name,BSTR*,a1) \
ICOM_METHOD1(HRESULT,Filter,IDispatch**,a1)
#define IRegFilterInfo_IMETHODS \
IDispatch_IMETHODS \
IRegFilterInfo_METHODS
ICOM_DEFINE(IRegFilterInfo,IDispatch)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IRegFilterInfo_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IRegFilterInfo_AddRef(p) ICOM_CALL (AddRef,p)
#define IRegFilterInfo_Release(p) ICOM_CALL (Release,p)
/*** IDispatch methods ***/
#define IRegFilterInfo_GetTypeInfoCount(p,a1) ICOM_CALL1(GetTypeInfoCount,p,a1)
#define IRegFilterInfo_GetTypeInfo(p,a1,a2,a3) ICOM_CALL3(GetTypeInfo,p,a1,a2,a3)
#define IRegFilterInfo_GetIDsOfNames(p,a1,a2,a3,a4,a5) ICOM_CALL5(GetIDsOfNames,p,a1,a2,a3,a4,a5)
#define IRegFilterInfo_Invoke(p,a1,a2,a3,a4,a5,a6,a7,a8) ICOM_CALL8(Invoke,p,a1,a2,a3,a4,a5,a6,a7,a8)
/*** IRegFilterInfo methods ***/
#define IRegFilterInfo_get_Name(p,a1) ICOM_CALL1(get_Name,p,a1)
#define IRegFilterInfo_Filter(p,a1) ICOM_CALL1(Filter,p,a1)
/**************************************************************************
*
* IVideoWindow interface
*
*/
#define ICOM_INTERFACE IVideoWindow
#define IVideoWindow_METHODS \
ICOM_METHOD1(HRESULT,put_Caption,BSTR,a1) \
ICOM_METHOD1(HRESULT,get_Caption,BSTR*,a1) \
ICOM_METHOD1(HRESULT,put_WindowStyle,long,a1) \
ICOM_METHOD1(HRESULT,get_WindowStyle,long*,a1) \
ICOM_METHOD1(HRESULT,put_WindowStyleEx,long,a1) \
ICOM_METHOD1(HRESULT,get_WindowStyleEx,long*,a1) \
ICOM_METHOD1(HRESULT,put_AutoShow,long,a1) \
ICOM_METHOD1(HRESULT,get_AutoShow,long*,a1) \
ICOM_METHOD1(HRESULT,put_WindowState,long,a1) \
ICOM_METHOD1(HRESULT,get_WindowState,long*,a1) \
ICOM_METHOD1(HRESULT,put_BackgroundPalette,long,a1) \
ICOM_METHOD1(HRESULT,get_BackgroundPalette,long*,a1) \
ICOM_METHOD1(HRESULT,put_Visible,long,a1) \
ICOM_METHOD1(HRESULT,get_Visible,long*,a1) \
ICOM_METHOD1(HRESULT,put_Left,long,a1) \
ICOM_METHOD1(HRESULT,get_Left,long*,a1) \
ICOM_METHOD1(HRESULT,put_Width,long,a1) \
ICOM_METHOD1(HRESULT,get_Width,long*,a1) \
ICOM_METHOD1(HRESULT,put_Top,long,a1) \
ICOM_METHOD1(HRESULT,get_Top,long*,a1) \
ICOM_METHOD1(HRESULT,put_Height,long,a1) \
ICOM_METHOD1(HRESULT,get_Height,long*,a1) \
ICOM_METHOD1(HRESULT,put_Owner,OAHWND,a1) \
ICOM_METHOD1(HRESULT,get_Owner,OAHWND*,a1) \
ICOM_METHOD1(HRESULT,put_MessageDrain,OAHWND,a1) \
ICOM_METHOD1(HRESULT,get_MessageDrain,OAHWND*,a1) \
ICOM_METHOD1(HRESULT,get_BorderColor,long*,a1) \
ICOM_METHOD1(HRESULT,put_BorderColor,long,a1) \
ICOM_METHOD1(HRESULT,get_FullScreenMode,long*,a1) \
ICOM_METHOD1(HRESULT,put_FullScreenMode,long,a1) \
ICOM_METHOD1(HRESULT,SetWindowForeground,long,a1) \
ICOM_METHOD4(HRESULT,NotifyOwnerMessage,OAHWND,a1,long,a2,LONG_PTR,a3,LONG_PTR,a4) \
ICOM_METHOD4(HRESULT,SetWindowPosition,long,a1,long,a2,long,a3,long,a4) \
ICOM_METHOD4(HRESULT,GetWindowPosition,long*,a1,long*,a2,long*,a3,long*,a4) \
ICOM_METHOD2(HRESULT,GetMinIdealImageSize,long*,a1,long*,a2) \
ICOM_METHOD2(HRESULT,GetMaxIdealImageSize,long*,a1,long*,a2) \
ICOM_METHOD4(HRESULT,GetRestorePosition,long*,a1,long*,a2,long*,a3,long*,a4) \
ICOM_METHOD1(HRESULT,HideCursor,long,a1) \
ICOM_METHOD1(HRESULT,IsCursorHidden,long*,a1)
#define IVideoWindow_IMETHODS \
IDispatch_IMETHODS \
IVideoWindow_METHODS
ICOM_DEFINE(IVideoWindow,IDispatch)
#undef ICOM_INTERFACE
/*** IUnknown methods ***/
#define IVideoWindow_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2)
#define IVideoWindow_AddRef(p) ICOM_CALL (AddRef,p)
#define IVideoWindow_Release(p) ICOM_CALL (Release,p)
/*** IDispatch methods ***/
#define IVideoWindow_GetTypeInfoCount(p,a1) ICOM_CALL1(GetTypeInfoCount,p,a1)
#define IVideoWindow_GetTypeInfo(p,a1,a2,a3) ICOM_CALL3(GetTypeInfo,p,a1,a2,a3)
#define IVideoWindow_GetIDsOfNames(p,a1,a2,a3,a4,a5) ICOM_CALL5(GetIDsOfNames,p,a1,a2,a3,a4,a5)
#define IVideoWindow_Invoke(p,a1,a2,a3,a4,a5,a6,a7,a8) ICOM_CALL8(Invoke,p,a1,a2,a3,a4,a5,a6,a7,a8)
/*** IVideoWindow methods ***/
#define IVideoWindow_put_Caption(p,a1) ICOM_CALL1(put_Caption,p,a1)
#define IVideoWindow_get_Caption(p,a1) ICOM_CALL1(get_Caption,p,a1)
#define IVideoWindow_put_WindowStyle(p,a1) ICOM_CALL1(put_WindowStyle,p,a1)
#define IVideoWindow_get_WindowStyle(p,a1) ICOM_CALL1(get_WindowStyle,p,a1)
#define IVideoWindow_put_WindowStyleEx(p,a1) ICOM_CALL1(put_WindowStyleEx,p,a1)
#define IVideoWindow_get_WindowStyleEx(p,a1) ICOM_CALL1(get_WindowStyleEx,p,a1)
#define IVideoWindow_put_AutoShow(p,a1) ICOM_CALL1(put_AutoShow,p,a1)
#define IVideoWindow_get_AutoShow(p,a1) ICOM_CALL1(get_AutoShow,p,a1)
#define IVideoWindow_put_WindowState(p,a1) ICOM_CALL1(put_WindowState,p,a1)
#define IVideoWindow_get_WindowState(p,a1) ICOM_CALL1(get_WindowState,p,a1)
#define IVideoWindow_put_BackgroundPalette(p,a1) ICOM_CALL1(put_BackgroundPalette,p,a1)
#define IVideoWindow_get_BackgroundPalette(p,a1) ICOM_CALL1(get_BackgroundPalette,p,a1)
#define IVideoWindow_put_Visible(p,a1) ICOM_CALL1(put_Visible,p,a1)
#define IVideoWindow_get_Visible(p,a1) ICOM_CALL1(get_Visible,p,a1)
#define IVideoWindow_put_Left(p,a1) ICOM_CALL1(put_Left,p,a1)
#define IVideoWindow_get_Left(p,a1) ICOM_CALL1(get_Left,p,a1)
#define IVideoWindow_put_Width(p,a1) ICOM_CALL1(put_Width,p,a1)
#define IVideoWindow_get_Width(p,a1) ICOM_CALL1(get_Width,p,a1)
#define IVideoWindow_put_Top(p,a1) ICOM_CALL1(put_Top,p,a1)
#define IVideoWindow_get_Top(p,a1) ICOM_CALL1(get_Top,p,a1)
#define IVideoWindow_put_Height(p,a1) ICOM_CALL1(put_Height,p,a1)
#define IVideoWindow_get_Height(p,a1) ICOM_CALL1(get_Height,p,a1)
#define IVideoWindow_put_Owner(p,a1) ICOM_CALL1(put_Owner,p,a1)
#define IVideoWindow_get_Owner(p,a1) ICOM_CALL1(get_Owner,p,a1)
#define IVideoWindow_put_MessageDrain(p,a1) ICOM_CALL1(put_MessageDrain,p,a1)
#define IVideoWindow_get_MessageDrain(p,a1) ICOM_CALL1(get_MessageDrain,p,a1)
#define IVideoWindow_get_BorderColor(p,a1) ICOM_CALL1(get_BorderColor,p,a1)
#define IVideoWindow_put_BorderColor(p,a1) ICOM_CALL1(put_BorderColor,p,a1)
#define IVideoWindow_get_FullScreenMode(p,a1) ICOM_CALL1(get_FullScreenMode,p,a1)
#define IVideoWindow_put_FullScreenMode(p,a1) ICOM_CALL1(put_FullScreenMode,p,a1)
#define IVideoWindow_SetWindowForeground(p,a1) ICOM_CALL1(SetWindowForeground,p,a1)
#define IVideoWindow_NotifyOwnerMessage(p,a1,a2,a3,a4) ICOM_CALL4(NotifyOwnerMessage,p,a1,a2,a3,a4)
#define IVideoWindow_SetWindowPosition(p,a1,a2,a3,a4) ICOM_CALL4(SetWindowPosition,p,a1,a2,a3,a4)
#define IVideoWindow_GetWindowPosition(p,a1,a2,a3,a4) ICOM_CALL4(GetWindowPosition,p,a1,a2,a3,a4)
#define IVideoWindow_GetMinIdealImageSize(p,a1,a2) ICOM_CALL2(GetMinIdealImageSize,p,a1,a2)
#define IVideoWindow_GetMaxIdealImageSize(p,a1,a2) ICOM_CALL2(GetMaxIdealImageSize,p,a1,a2)
#define IVideoWindow_GetRestorePosition(p,a1,a2,a3,a4) ICOM_CALL4(GetRestorePosition,p,a1,a2,a3,a4)
#define IVideoWindow_HideCursor(p,a1) ICOM_CALL1(HideCursor,p,a1)
#define IVideoWindow_IsCursorHidden(p,a1) ICOM_CALL1(IsCursorHidden,p,a1)
#endif /* __WINE_CONTROL_H_ */

View File

@ -1,38 +0,0 @@
/*
* Copyright (C) 2001 Hidenori Takeshima
*
* 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 WINE_DSHOW_ERRORS_H
#define WINE_DSHOW_ERRORS_H
#include "vfwmsgs.h"
#define MAX_ERROR_TEXT_LEN 160
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
DWORD WINAPI AMGetErrorTextA(HRESULT hr, LPSTR pszbuf, DWORD dwBufLen);
DWORD WINAPI AMGetErrorTextW(HRESULT hr, LPWSTR pwszbuf, DWORD dwBufLen);
#define AMGetErrorText WINELIB_NAME_AW(AMGetErrorText)
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* WINE_DSHOW_ERRORS_H */

View File

@ -1,56 +0,0 @@
/*
* Copyright (C) 2001 Hidenori Takeshima
*
* 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 __WINE_EVCODE_H
#define __WINE_EVCODE_H
#define EC_SYSTEMBASE 0x00
#define EC_USER 0x8000
#define EC_COMPLETE 0x01
#define EC_USERABORT 0x02
#define EC_ERRORABORT 0x03
#define EC_TIME 0x04
#define EC_REPAINT 0x05
#define EC_STREAM_ERROR_STOPPED 0x06
#define EC_STREAM_ERROR_STILLPLAYING 0x07
#define EC_ERROR_STILLPLAYING 0x08
#define EC_PALETTE_CHANGED 0x09
#define EC_VIDEO_SIZE_CHANGED 0x0A
#define EC_QUALITY_CHANGE 0x0B
#define EC_SHUTTING_DOWN 0x0C
#define EC_CLOCK_CHANGED 0x0D
#define EC_OPENING_FILE 0x10
#define EC_BUFFERING_DATA 0x11
#define EC_FULLSCREEN_LOST 0x12
#define EC_ACTIVATE 0x13
#define EC_NEED_RESTART 0x14
#define EC_WINDOW_DESTROYED 0x15
#define EC_DISPLAY_CHANGED 0x16
#define EC_STARVATION 0x17
#define EC_OLE_EVENT 0x18
#define EC_NOTIFY_WINDOW 0x19
#define EC_STREAM_CONTROL_STOPPED 0x1A
#define EC_STREAM_CONTROL_STARTED 0x1B
#define EC_END_OF_SEGMENT 0x1C
#define EC_SEGMENT_STARTED 0x1D
#define EC_LENGTH_CHANGED 0x1E
#endif /* __WINE_EVCODE_H */

File diff suppressed because it is too large Load Diff

View File

@ -69,8 +69,8 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
#include "vfw.h"
/* for dshow */
#include "strmif.h"
#include "control.h"
/*#include "strmif.h"*/
/*#include "control.h"*/
#include "uuids.h"
/* GUIDs not declared in an exported header file */

View File

@ -298,500 +298,6 @@
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{8856f961-340a-11d0-a96b-00c04fd705a2}\shellex\MayChangeDefaultMenu]
@=""
#
# Entries for quartz.dll
#
# CLSID_FilterGraph
[HKEY_CLASSES_ROOT\CLSID\{E436EBB3-524F-11CE-9F53-0020AF0BA770}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
# CLSID_FilterGraphNoThread
[HKEY_CLASSES_ROOT\CLSID\{E436EBB8-524F-11CE-9F53-0020AF0BA770}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
# CLSID_SystemClock
[HKEY_CLASSES_ROOT\CLSID\{E436EBB1-524F-11CE-9F53-0020AF0BA770}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
# CLSID_MemoryAllocator
[HKEY_CLASSES_ROOT\CLSID\{1E651CC0-B199-11D0-8212-00C04FC32C45}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
# CLSID_SystemDeviceEnum
[HKEY_CLASSES_ROOT\CLSID\{62BE5D10-60EB-11D0-BD3B-00A0C911CE86}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
# CLSID_FilterMapper
[HKEY_CLASSES_ROOT\CLSID\{E436EBB2-524f-11CE-9F53-0020AF0BA770}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
# CLSID_FilterMapper2
[HKEY_CLASSES_ROOT\CLSID\{CDA42200-BD88-11D0-BD4E-00A0C911CE86}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
# CLSID_SeekingPassThru
[HKEY_CLASSES_ROOT\CLSID\{060AF76C-68DD-11D0-8FC1-00C04FD9189D}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
# CLSID_CaptureGraphBuilder
[HKEY_CLASSES_ROOT\CLSID\{BF87B6E0-8C27-11D0-B3F0-00AA003761C5}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
# DirectShow filter categories
[HKEY_CLASSES_ROOT\CLSID\{DA4E3DA0-D07D-11D0-BD50-00A0C911CE86}]
@="ActiveMovie Filter Categories"
[HKEY_CLASSES_ROOT\CLSID\{DA4E3DA0-D07D-11D0-BD50-00A0C911CE86}\Instance\{083863F1-70DE-11D0-BD40-00A0C911CE86}]
"CLSID"="{083863F1-70DE-11D0-BD40-00A0C911CE86}"
"FriendlyName"="DirectShow Filters"
"Merit"=dword:00600000
[HKEY_CLASSES_ROOT\CLSID\{DA4E3DA0-D07D-11D0-BD50-00A0C911CE86}\Instance\{33D9A760-90C8-11D0-BD43-00A0C911CE86}]
"CLSID"="{33D9A760-90C8-11D0-BD43-00A0C911CE86}"
"FriendlyName"="Video Compressors"
[HKEY_CLASSES_ROOT\CLSID\{DA4E3DA0-D07D-11D0-BD50-00A0C911CE86}\Instance\{33D9A761-90C8-11D0-BD43-00A0C911CE86}"]
"CLSID"="{33D9A761-90C8-11D0-BD43-00A0C911CE86}"
"FriendlyName"="Audio Compressors"
[HKEY_CLASSES_ROOT\CLSID\{DA4E3DA0-D07D-11D0-BD50-00A0C911CE86}\Instance\{33D9A762-90C8-11D0-BD43-00A0C911CE86}]
"CLSID"="{33D9A762-90C8-11D0-BD43-00A0C911CE86}"
"FriendlyName"="Audio Capture Sources"
[HKEY_CLASSES_ROOT\CLSID\{DA4E3DA0-D07D-11D0-BD50-00A0C911CE86}\Instance\{4EFE2452-168A-11D1-BC76-00C04FB9453B}]
"CLSID"="{4EFE2452-168A-11D1-BC76-00C04FB9453B}"
"FriendlyName"="Midi Renderers"
"Merit"=dword:00600000
[HKEY_CLASSES_ROOT\CLSID\{DA4E3DA0-D07D-11D0-BD50-00A0C911CE86}\Instance\{860BB310-5D01-11D0-BD3B-00A0C911CE86}]
"CLSID"="{860BB310-5D01-11D0-BD3B-00A0C911CE86}"
"FriendlyName"="Video Capture Sources"
[HKEY_CLASSES_ROOT\CLSID\{DA4E3DA0-D07D-11D0-BD50-00A0C911CE86}\Instance\{CC7BFB41-F175-11D1-A392-00E0291F3959}]
"CLSID"="{CC7BFB41-F175-11D1-A392-00E0291F3959}"
"FriendlyName"="External Renderers"
[HKEY_CLASSES_ROOT\CLSID\{DA4E3DA0-D07D-11D0-BD50-00A0C911CE86}\Instance\{CC7BFB46-F175-11D1-A392-00E0291F3959}]
"CLSID"="{CC7BFB46-F175-11D1-A392-00E0291F3959}"
"FriendlyName"="Device Control Filters"
[HKEY_CLASSES_ROOT\CLSID\{DA4E3DA0-D07D-11D0-BD50-00A0C911CE86}\Instance\{E0F158E1-CB04-11D0-BD4E-00A0C911CE86}]
"CLSID"="{E0F158E1-CB04-11D0-BD4E-00A0C911CE86}"
"FriendlyName"="Audio Renderers"
"Merit"=dword:00600000
# CLSID_AudioRender
[HKEY_CLASSES_ROOT\CLSID\{e30629d1-27e5-11ce-875d-00608cb78066}]
@="Audio Renderer"
[HKEY_CLASSES_ROOT\CLSID\{e30629d1-27e5-11ce-875d-00608cb78066}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{E0F158E1-CB04-11D0-BD4E-00A0C911CE86}\Instance\{e30629d1-27e5-11ce-875d-00608cb78066}]
"CLSID"="{e30629d1-27e5-11ce-875d-00608cb78066}"
# FriendlyName seems to be the driver name and to be generated dynamically.
"FriendlyName"="Waveout audio renderer"
# FilterData of generic renderer.
"FilterData"=hex:02,00,00,00,00,00,60,00,01,00,00,00,00,00,00,00,\
30,70,69,33,02,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,38,00,00,00,38,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
# CLSID_VideoRenderer
[HKEY_CLASSES_ROOT\CLSID\{70e102b0-5556-11ce-97c0-00aa0055595a}]
@="Video Renderer"
[HKEY_CLASSES_ROOT\CLSID\{70e102b0-5556-11ce-97c0-00aa0055595a}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{70e102b0-5556-11ce-97c0-00aa0055595a}]
"CLSID"="{70e102b0-5556-11ce-97c0-00aa0055595a}"
"FriendlyName"="Video Renderer"
# FilterData of generic renderer.
"FilterData"=hex:02,00,00,00,00,00,60,00,01,00,00,00,00,00,00,00,\
30,70,69,33,02,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,38,00,00,00,38,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
# CLSID_FileWriter
[HKEY_CLASSES_ROOT\CLSID\{8596e5f0-0da5-11d0-bd21-00a0c911ce86}]
@="File Writer"
[HKEY_CLASSES_ROOT\CLSID\{8596e5f0-0da5-11d0-bd21-00a0c911ce86}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{8596e5f0-0da5-11d0-bd21-00a0c911ce86}]
"CLSID"="{8596e5f0-0da5-11d0-bd21-00a0c911ce86}"
"FriendlyName"="File Writer"
# FilterData of generic renderer.
"FilterData"=hex:02,00,00,00,00,00,20,00,01,00,00,00,00,00,00,00,\
30,70,69,33,02,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,38,00,00,00,38,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
# Wave Parser
[HKEY_CLASSES_ROOT\CLSID\{D51BD5A1-7548-11CF-A520-0080C77EF58A}]
@="Wave Parser"
[HKEY_CLASSES_ROOT\CLSID\{D51BD5A1-7548-11CF-A520-0080C77EF58A}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{D51BD5A1-7548-11CF-A520-0080C77EF58A}]
"CLSID"="{D51BD5A1-7548-11CF-A520-0080C77EF58A}"
"FriendlyName"="Wave Parser"
# FilterData of generic transform filter.
"FilterData"=hex:02,00,00,00,00,00,60,00,02,00,00,00,00,00,00,00,\
30,70,69,33,00,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
31,70,69,33,08,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
# CLSID_AVIDec(AVI Decompressor)
[HKEY_CLASSES_ROOT\CLSID\{CF49D4E0-1115-11CE-B03A-0020AF0BA770}]
@="AVI Decompressor"
[HKEY_CLASSES_ROOT\CLSID\{CF49D4E0-1115-11CE-B03A-0020AF0BA770}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{CF49D4E0-1115-11CE-B03A-0020AF0BA770}]
"CLSID"="{CF49D4E0-1115-11CE-B03A-0020AF0BA770}"
"FriendlyName"="AVI Decompressor"
# FilterData of generic transform filter.
"FilterData"=hex:02,00,00,00,00,00,60,00,02,00,00,00,00,00,00,00,\
30,70,69,33,00,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
31,70,69,33,08,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
# CLSID_AsyncReader
[HKEY_CLASSES_ROOT\CLSID\{E436EBB5-524F-11CE-9F53-0020AF0BA770}]
@="File Source (Async.)"
[HKEY_CLASSES_ROOT\CLSID\{E436EBB5-524F-11CE-9F53-0020AF0BA770}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{E436EBB5-524F-11CE-9F53-0020AF0BA770}]
"CLSID"="{E436EBB5-524F-11CE-9F53-0020AF0BA770}"
"FriendlyName"="File Source (Async.)"
# FilterData of generic source filter.
"FilterData"=hex:02,00,00,00,00,00,60,00,01,00,00,00,00,00,00,00,\
30,70,69,33,08,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,38,00,00,00,38,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
# CLSID_URLReader (not implemented yet)
[HKEY_CLASSES_ROOT\CLSID\{E436EBB6-524F-11CE-9F53-0020AF0BA770}]
@="File Source (URL)"
[HKEY_CLASSES_ROOT\CLSID\{E436EBB6-524F-11CE-9F53-0020AF0BA770}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{E436EBB6-524F-11CE-9F53-0020AF0BA770}]
"CLSID"="{E436EBB6-524F-11CE-9F53-0020AF0BA770}"
"FriendlyName"="File Source (URL)"
# FilterData of generic source filter.
"FilterData"=hex:02,00,00,00,00,00,60,00,01,00,00,00,00,00,00,00,\
30,70,69,33,08,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,38,00,00,00,38,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
# CLSID_AviSplitter
[HKEY_CLASSES_ROOT\CLSID\{1B544C20-FD0B-11CE-8C63-00AA0044B51E}]
@="AVI Splitter"
[HKEY_CLASSES_ROOT\CLSID\{1B544C20-FD0B-11CE-8C63-00AA0044B51E}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{1B544C20-FD0B-11CE-8C63-00AA0044B51E}]
"CLSID"="{1B544C20-FD0B-11CE-8C63-00AA0044B51E}"
"FriendlyName"="AVI Splitter"
# FilterData of generic transform filter.
"FilterData"=hex:02,00,00,00,00,00,60,00,02,00,00,00,00,00,00,00,\
30,70,69,33,00,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
31,70,69,33,08,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
# QuickTime Parser
[HKEY_CLASSES_ROOT\CLSID\{D51BD5A0-7548-11CF-A520-0080C77EF58A}]
@="QuickTime Movie Parser"
[HKEY_CLASSES_ROOT\CLSID\{D51BD5A0-7548-11CF-A520-0080C77EF58A}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{D51BD5A0-7548-11CF-A520-0080C77EF58A}]
"CLSID"="{D51BD5A0-7548-11CF-A520-0080C77EF58A}"
"FriendlyName"="QuickTime Movie Parser"
# FilterData of generic transform filter.
"FilterData"=hex:02,00,00,00,00,00,60,00,02,00,00,00,00,00,00,00,\
30,70,69,33,00,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
31,70,69,33,08,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
# MIDI Parser
[HKEY_CLASSES_ROOT\CLSID\{D51BD5A2-7548-11CF-A520-0080C77EF58A}]
@="MIDI Parser"
[HKEY_CLASSES_ROOT\CLSID\{D51BD5A2-7548-11CF-A520-0080C77EF58A}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{D51BD5A2-7548-11CF-A520-0080C77EF58A}]
"CLSID"="{D51BD5A2-7548-11CF-A520-0080C77EF58A}"
"FriendlyName"="MIDI Parser"
# FilterData of generic transform filter.
"FilterData"=hex:02,00,00,00,00,00,60,00,02,00,00,00,00,00,00,00,\
30,70,69,33,00,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
31,70,69,33,08,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
# CLSID_Colour(Color space converter)
[HKEY_CLASSES_ROOT\CLSID\{1643E180-90F5-11CE-97D5-00AA0055595A}]
@="Color Space Converter"
[HKEY_CLASSES_ROOT\CLSID\{1643E180-90F5-11CE-97D5-00AA0055595A}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{1643E180-90F5-11CE-97D5-00AA0055595A}]
"CLSID"="{1643E180-90F5-11CE-97D5-00AA0055595A}"
"FriendlyName"="Color Space Converter"
# FilterData of generic transform filter.
"FilterData"=hex:02,00,00,00,00,00,60,00,02,00,00,00,00,00,00,00,\
30,70,69,33,00,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
31,70,69,33,08,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
# CLSID_MPEG1Splitter
[HKEY_CLASSES_ROOT\CLSID\{336475D0-942A-11CE-A870-00AA002FEAB5}]
@="MPEG1 Splitter"
[HKEY_CLASSES_ROOT\CLSID\{336475D0-942A-11CE-A870-00AA002FEAB5}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{336475D0-942A-11CE-A870-00AA002FEAB5}]
"CLSID"="{336475D0-942A-11CE-A870-00AA002FEAB5}"
"FriendlyName"="MPEG1 Splitter"
# FilterData of generic transform filter.
"FilterData"=hex:02,00,00,00,00,00,60,00,02,00,00,00,00,00,00,00,\
30,70,69,33,00,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
31,70,69,33,08,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
# CLSID_ACMWrapper
[HKEY_CLASSES_ROOT\CLSID\{6A08CF80-0E18-11CF-A24D-0020AFD79767}]
@="ACM Wrapper"
[HKEY_CLASSES_ROOT\CLSID\{6A08CF80-0E18-11CF-A24D-0020AFD79767}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{6A08CF80-0E18-11CF-A24D-0020AFD79767}]
"CLSID"="{6A08CF80-0E18-11CF-A24D-0020AFD79767}"
"FriendlyName"="ACM Wrapper"
# FilterData of generic transform filter.
"FilterData"=hex:02,00,00,00,00,00,60,00,02,00,00,00,00,00,00,00,\
30,70,69,33,00,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
31,70,69,33,08,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
# CLSID_CMpegVideoCodec
[HKEY_CLASSES_ROOT\CLSID\{feb50740-7bef-11ce-9bd9-0000e202599c}]
@="MPEG Video Decoder"
[HKEY_CLASSES_ROOT\CLSID\{feb50740-7bef-11ce-9bd9-0000e202599c}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{feb50740-7bef-11ce-9bd9-0000e202599c}]
"CLSID"="{feb50740-7bef-11ce-9bd9-0000e202599c}"
"FriendlyName"="MPEG Video Decoder"
# FilterData of generic transform filter.
"FilterData"=hex:02,00,00,00,00,00,60,00,02,00,00,00,00,00,00,00,\
30,70,69,33,00,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
31,70,69,33,08,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
# CLSID_CMpegAudioCodec
[HKEY_CLASSES_ROOT\CLSID\{4a2286e0-7bef-11ce-9bd9-0000e202599c}]
@="MPEG Audio Decoder"
[HKEY_CLASSES_ROOT\CLSID\{4a2286e0-7bef-11ce-9bd9-0000e202599c}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{4a2286e0-7bef-11ce-9bd9-0000e202599c}]
"CLSID"="{4a2286e0-7bef-11ce-9bd9-0000e202599c}"
"FriendlyName"="MPEG Audio Decoder"
# FilterData of generic transform filter.
"FilterData"=hex:02,00,00,00,00,00,60,00,02,00,00,00,00,00,00,00,\
30,70,69,33,00,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
31,70,69,33,08,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
# MJPG Decompressor
[HKEY_CLASSES_ROOT\CLSID\{301056D0-6DFF-11D2-9EEB-006008039E37}]
@="MJPG Decompressor"
[HKEY_CLASSES_ROOT\CLSID\{301056D0-6DFF-11D2-9EEB-006008039E37}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{301056D0-6DFF-11D2-9EEB-006008039E37}]
"CLSID"="{301056D0-6DFF-11D2-9EEB-006008039E37}"
"FriendlyName"="MJPG Decompressor"
# FilterData of generic transform filter.
"FilterData"=hex:02,00,00,00,00,00,60,00,02,00,00,00,00,00,00,00,\
30,70,69,33,00,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
31,70,69,33,08,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
# QuickTime Decompressor
[HKEY_CLASSES_ROOT\CLSID\{FDFE9681-74A3-11D0-AFA7-00AA00B67A42}]
@="QuickTime Decompressor"
[HKEY_CLASSES_ROOT\CLSID\{FDFE9681-74A3-11D0-AFA7-00AA00B67A42}\InprocServer32]
@="quartz.dll"
"ThreadingModel"="Both"
[HKEY_CLASSES_ROOT\CLSID\{083863F1-70DE-11D0-BD40-00A0C911CE86}\Instance\{FDFE9681-74A3-11D0-AFA7-00AA00B67A42}]
"CLSID"="{FDFE9681-74A3-11D0-AFA7-00AA00B67A42}"
"FriendlyName"="QuickTime Decompressor"
# FilterData of generic transform filter.
"FilterData"=hex:02,00,00,00,00,00,60,00,02,00,00,00,00,00,00,00,\
30,70,69,33,00,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
31,70,69,33,08,00,00,00,00,00,00,00,\
01,00,00,00,00,00,00,00,00,00,00,00,\
30,74,79,33,00,00,00,00,60,00,00,00,60,00,00,00,\
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
#
# quartz Media Types.
#
# audio/wav
# RIFF****WAVE
[HKEY_CLASSES_ROOT\Media Type\{E436EB83-524F-11CE-9F53-0020AF0BA770}\{E436EB8B-524F-11CE-9F53-0020AF0BA770}]
"0"="0,4,,52494646, 8,4,,57415645"
"Source Filter"="{E436EBB5-524F-11CE-9F53-0020AF0BA770}"
# audio/basic
# .snd
[HKEY_CLASSES_ROOT\Media Type\{E436EB83-524F-11CE-9F53-0020AF0BA770}\{E436EB8C-524F-11CE-9F53-0020AF0BA770}]
"0"="0,4,,2E736E64"
"Source Filter"="{E436EBB5-524F-11CE-9F53-0020AF0BA770}"
# audio/aiff
# FORM****AIFF
[HKEY_CLASSES_ROOT\Media Type\{E436EB83-524F-11CE-9F53-0020AF0BA770}\{E436EB8D-524F-11CE-9F53-0020AF0BA770}]
"0"="0,4,,464F524D, 8,4,,41494646"
"Source Filter"="{E436EBB5-524F-11CE-9F53-0020AF0BA770}"
# video/x-msvideo
# RIFF****AVI
[HKEY_CLASSES_ROOT\Media Type\{E436EB83-524F-11CE-9F53-0020AF0BA770}\{E436EB88-524F-11CE-9F53-0020AF0BA770}]
"0"="0,4,,52494646, 8,4,,41564920"
"Source Filter"="{E436EBB5-524F-11CE-9F53-0020AF0BA770}"
# video/quicktime
# ****mdat / ****moov
[HKEY_CLASSES_ROOT\Media Type\{E436EB83-524F-11CE-9F53-0020AF0BA770}\{E436EB89-524F-11CE-9F53-0020AF0BA770}]
"0"="4,4,,6D646174"
"1"="4,4,,6D6F6F76"
"Source Filter"="{E436EBB5-524F-11CE-9F53-0020AF0BA770}"
# video/mpeg (MPEG-1/System)
# 0x00 0x00 0x01 0xba
[HKEY_CLASSES_ROOT\Media Type\{E436EB83-524F-11CE-9F53-0020AF0BA770}\{E436EB84-524F-11CE-9F53-0020AF0BA770}]
"0"="0,4,,000001BA"
"Source Filter"="{E436EBB5-524F-11CE-9F53-0020AF0BA770}"
# video/mpeg (MPEG-1/Video)
# 0x00 0x00 0x01 0xb3
[HKEY_CLASSES_ROOT\Media Type\{E436EB83-524F-11CE-9F53-0020AF0BA770}\{E436EB86-524F-11CE-9F53-0020AF0BA770}]
"0"="0,4,,000001B3"
"Source Filter"="{E436EBB5-524F-11CE-9F53-0020AF0BA770}"
# audio/mpeg
# 12bit 0xFFF + 1bit 0 + 2bit Layer(non-zero) + 1bit flag
[HKEY_CLASSES_ROOT\Media Type\{E436EB83-524F-11CE-9F53-0020AF0BA770}\{E436EB87-524F-11CE-9F53-0020AF0BA770}]
"0"="0,2,FFF8,FFF8"
"Source Filter"="{E436EBB5-524F-11CE-9F53-0020AF0BA770}"
#
# Entries for Mozilla ActiveX control support