From b6a7ca5855cb044a42bdfbf9ea03563ab97223a2 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 2 May 2002 01:29:18 +0000 Subject: [PATCH] Removed a bunch of multimedia code at Hidenori's request. --- dlls/Makefile.in | 11 +- dlls/avifil32/Makefile.in | 9 +- dlls/avifil32/api.c | 566 ------- dlls/avifil32/avifil32.spec | 30 +- dlls/avifil32/avifile.c | 616 ++++++++ dlls/avifil32/avifile_private.h | 86 -- dlls/avifil32/comentry.c | 156 -- dlls/avifil32/iafile.c | 758 ---------- dlls/avifil32/iastream.c | 433 ------ dlls/avifil32/igframe.c | 428 ------ dlls/avifil32/main.c | 103 -- dlls/avifil32/string.c | 109 -- dlls/imm32/imm.c | 957 +++--------- dlls/imm32/imm32.spec | 44 +- dlls/imm32/immddk.h | 144 -- dlls/quartz/Makefile.in | 47 +- dlls/quartz/README | 32 - dlls/quartz/acmwrap.c | 695 --------- dlls/quartz/amundoc.c | 76 - dlls/quartz/asyncsrc.c | 1153 --------------- dlls/quartz/asyncsrc.h | 144 -- dlls/quartz/audioutl.c | 77 - dlls/quartz/audioutl.h | 29 - dlls/quartz/audren.c | 1048 ------------- dlls/quartz/audren.h | 91 -- dlls/quartz/avidec.c | 458 ------ dlls/quartz/aviparse.c | 720 --------- dlls/quartz/basefilt.c | 586 -------- dlls/quartz/basefilt.h | 220 --- dlls/quartz/basepin.c | 1462 ------------------ dlls/quartz/capgraph.c | 242 --- dlls/quartz/capgraph.h | 47 - dlls/quartz/complist.c | 309 ---- dlls/quartz/complist.h | 58 - dlls/quartz/csconv.c | 452 ------ dlls/quartz/devenum.c | 1301 ---------------- dlls/quartz/devenum.h | 144 -- dlls/quartz/enumunk.c | 255 ---- dlls/quartz/enumunk.h | 30 - dlls/quartz/fgevent.c | 645 -------- dlls/quartz/fgpass.c | 1487 ------------------- dlls/quartz/fgraph.c | 341 ----- dlls/quartz/fgraph.h | 217 --- dlls/quartz/filesink.c | 914 ------------ dlls/quartz/filesink.h | 92 -- dlls/quartz/fmap.c | 1125 -------------- dlls/quartz/fmap.h | 85 -- dlls/quartz/ifgraph.c | 1521 ------------------- dlls/quartz/ijgdec.c | 182 --- dlls/quartz/ijgdec.h | 22 - dlls/quartz/imcntl.c | 274 ---- dlls/quartz/imfilter.c | 487 ------ dlls/quartz/impos.c | 541 ------- dlls/quartz/imseek.c | 710 --------- dlls/quartz/iunk.c | 160 -- dlls/quartz/iunk.h | 83 -- dlls/quartz/main.c | 613 +------- dlls/quartz/memalloc.c | 464 ------ dlls/quartz/memalloc.h | 61 - dlls/quartz/midparse.c | 191 --- dlls/quartz/mjpgdec.c | 406 ----- dlls/quartz/mpadec.c | 369 ----- dlls/quartz/mpgparse.c | 751 ---------- dlls/quartz/mpvdec.c | 276 ---- dlls/quartz/mtype.c | 552 ------- dlls/quartz/mtype.h | 51 - dlls/quartz/parser.c | 2152 --------------------------- dlls/quartz/parser.h | 215 --- dlls/quartz/qtdec.c | 234 --- dlls/quartz/qtparse.c | 211 --- dlls/quartz/quartz.spec | 26 +- dlls/quartz/quartz_private.h | 38 - dlls/quartz/regsvr.c | 389 ----- dlls/quartz/regsvr.h | 76 - dlls/quartz/sample.c | 677 --------- dlls/quartz/sample.h | 66 - dlls/quartz/seekpass.c | 862 ----------- dlls/quartz/seekpass.h | 81 - dlls/quartz/sysclock.c | 530 ------- dlls/quartz/sysclock.h | 77 - dlls/quartz/videoblt.c | 126 -- dlls/quartz/videoblt.h | 51 - dlls/quartz/vidren.c | 2440 ------------------------------- dlls/quartz/vidren.h | 92 -- dlls/quartz/wavparse.c | 746 ---------- dlls/quartz/xform.c | 823 ----------- dlls/quartz/xform.h | 139 -- include/Makefile.in | 6 - include/amaudio.h | 67 - include/amvideo.h | 323 ---- include/control.h | 718 --------- include/errors.h | 38 - include/evcode.h | 56 - include/strmif.h | 1521 ------------------- ole/uuid.c | 4 +- winedefault.reg | 494 ------- 96 files changed, 836 insertions(+), 39188 deletions(-) delete mode 100644 dlls/avifil32/api.c create mode 100644 dlls/avifil32/avifile.c delete mode 100644 dlls/avifil32/avifile_private.h delete mode 100644 dlls/avifil32/comentry.c delete mode 100644 dlls/avifil32/iafile.c delete mode 100644 dlls/avifil32/iastream.c delete mode 100644 dlls/avifil32/igframe.c delete mode 100644 dlls/avifil32/main.c delete mode 100644 dlls/avifil32/string.c delete mode 100644 dlls/imm32/immddk.h delete mode 100644 dlls/quartz/README delete mode 100644 dlls/quartz/acmwrap.c delete mode 100644 dlls/quartz/amundoc.c delete mode 100644 dlls/quartz/asyncsrc.c delete mode 100644 dlls/quartz/asyncsrc.h delete mode 100644 dlls/quartz/audioutl.c delete mode 100644 dlls/quartz/audioutl.h delete mode 100644 dlls/quartz/audren.c delete mode 100644 dlls/quartz/audren.h delete mode 100644 dlls/quartz/avidec.c delete mode 100644 dlls/quartz/aviparse.c delete mode 100644 dlls/quartz/basefilt.c delete mode 100644 dlls/quartz/basefilt.h delete mode 100644 dlls/quartz/basepin.c delete mode 100644 dlls/quartz/capgraph.c delete mode 100644 dlls/quartz/capgraph.h delete mode 100644 dlls/quartz/complist.c delete mode 100644 dlls/quartz/complist.h delete mode 100644 dlls/quartz/csconv.c delete mode 100644 dlls/quartz/devenum.c delete mode 100644 dlls/quartz/devenum.h delete mode 100644 dlls/quartz/enumunk.c delete mode 100644 dlls/quartz/enumunk.h delete mode 100644 dlls/quartz/fgevent.c delete mode 100644 dlls/quartz/fgpass.c delete mode 100644 dlls/quartz/fgraph.c delete mode 100644 dlls/quartz/fgraph.h delete mode 100644 dlls/quartz/filesink.c delete mode 100644 dlls/quartz/filesink.h delete mode 100644 dlls/quartz/fmap.c delete mode 100644 dlls/quartz/fmap.h delete mode 100644 dlls/quartz/ifgraph.c delete mode 100644 dlls/quartz/ijgdec.c delete mode 100644 dlls/quartz/ijgdec.h delete mode 100644 dlls/quartz/imcntl.c delete mode 100644 dlls/quartz/imfilter.c delete mode 100644 dlls/quartz/impos.c delete mode 100644 dlls/quartz/imseek.c delete mode 100644 dlls/quartz/iunk.c delete mode 100644 dlls/quartz/iunk.h delete mode 100644 dlls/quartz/memalloc.c delete mode 100644 dlls/quartz/memalloc.h delete mode 100644 dlls/quartz/midparse.c delete mode 100644 dlls/quartz/mjpgdec.c delete mode 100644 dlls/quartz/mpadec.c delete mode 100644 dlls/quartz/mpgparse.c delete mode 100644 dlls/quartz/mpvdec.c delete mode 100644 dlls/quartz/mtype.c delete mode 100644 dlls/quartz/mtype.h delete mode 100644 dlls/quartz/parser.c delete mode 100644 dlls/quartz/parser.h delete mode 100644 dlls/quartz/qtdec.c delete mode 100644 dlls/quartz/qtparse.c delete mode 100644 dlls/quartz/quartz_private.h delete mode 100644 dlls/quartz/regsvr.c delete mode 100644 dlls/quartz/regsvr.h delete mode 100644 dlls/quartz/sample.c delete mode 100644 dlls/quartz/sample.h delete mode 100644 dlls/quartz/seekpass.c delete mode 100644 dlls/quartz/seekpass.h delete mode 100644 dlls/quartz/sysclock.c delete mode 100644 dlls/quartz/sysclock.h delete mode 100644 dlls/quartz/videoblt.c delete mode 100644 dlls/quartz/videoblt.h delete mode 100644 dlls/quartz/vidren.c delete mode 100644 dlls/quartz/vidren.h delete mode 100644 dlls/quartz/wavparse.c delete mode 100644 dlls/quartz/xform.c delete mode 100644 dlls/quartz/xform.h delete mode 100644 include/amaudio.h delete mode 100644 include/amvideo.h delete mode 100644 include/control.h delete mode 100644 include/errors.h delete mode 100644 include/evcode.h delete mode 100644 include/strmif.h diff --git a/dlls/Makefile.in b/dlls/Makefile.in index 1bdb3108957..e7abe94c05a 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -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) diff --git a/dlls/avifil32/Makefile.in b/dlls/avifil32/Makefile.in index 0c1f49593ce..5d2ecdfb1aa 100644 --- a/dlls/avifil32/Makefile.in +++ b/dlls/avifil32/Makefile.in @@ -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: - diff --git a/dlls/avifil32/api.c b/dlls/avifil32/api.c deleted file mode 100644 index 43a24f1e483..00000000000 --- a/dlls/avifil32/api.c +++ /dev/null @@ -1,566 +0,0 @@ -/* - * Copyright 1999 Marcus Meissner - * Copyright 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 - */ - -#include -#include -#include - -#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; -} - diff --git a/dlls/avifil32/avifil32.spec b/dlls/avifil32/avifil32.spec index d04fc982219..d19a3962422 100644 --- a/dlls/avifil32/avifil32.spec +++ b/dlls/avifil32/avifil32.spec @@ -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 diff --git a/dlls/avifil32/avifile.c b/dlls/avifil32/avifile.c new file mode 100644 index 00000000000..c04f2388fee --- /dev/null +++ b/dlls/avifil32/avifile.c @@ -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 +#include +#include + +#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 (sizeszName, 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"); +} diff --git a/dlls/avifil32/avifile_private.h b/dlls/avifil32/avifile_private.h deleted file mode 100644 index 756e55336aa..00000000000 --- a/dlls/avifil32/avifile_private.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 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_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 */ diff --git a/dlls/avifil32/comentry.c b/dlls/avifil32/comentry.c deleted file mode 100644 index 1ead934e8f0..00000000000 --- a/dlls/avifil32/comentry.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright 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 - */ - -#include -#include -#include - -#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; -} - diff --git a/dlls/avifil32/iafile.c b/dlls/avifil32/iafile.c deleted file mode 100644 index 92b05ec419b..00000000000 --- a/dlls/avifil32/iafile.c +++ /dev/null @@ -1,758 +0,0 @@ -/* - * Copyright 1999 Marcus Meissner - * Copyright 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 - * - * FIXME - implements editing/writing. - */ - -#include -#include -#include - -#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; -} - diff --git a/dlls/avifil32/iastream.c b/dlls/avifil32/iastream.c deleted file mode 100644 index bd76c3aab0a..00000000000 --- a/dlls/avifil32/iastream.c +++ /dev/null @@ -1,433 +0,0 @@ -/* - * Copyright 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 - */ - -#include -#include -#include - -#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; -} - diff --git a/dlls/avifil32/igframe.c b/dlls/avifil32/igframe.c deleted file mode 100644 index 546a2fdcfb7..00000000000 --- a/dlls/avifil32/igframe.c +++ /dev/null @@ -1,428 +0,0 @@ -/* - * Copyright 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 - * - * FIXME - implements color space(depth) converter. - */ - -#include -#include -#include - -#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; -} diff --git a/dlls/avifil32/main.c b/dlls/avifil32/main.c deleted file mode 100644 index bb09d8783cf..00000000000 --- a/dlls/avifil32/main.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 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 - */ - -#include -#include -#include - -#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; -} - - diff --git a/dlls/avifil32/string.c b/dlls/avifil32/string.c deleted file mode 100644 index 0c85d586d58..00000000000 --- a/dlls/avifil32/string.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 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 - */ - -#include -#include -#include - -#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; -} - - - diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index a1f3b0af2ff..6d6e064fdff 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -1,8 +1,7 @@ /* - * IMM32 - Input Method contexts Manager ??? + * IMM32 library * * Copyright 1998 Patrik Stridvall - * Copyright 2002 Hidenori Takeshima * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,24 +16,17 @@ * 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 - * - * NOTE for implementors of forwarding to XIM/XIC: - * Implementing low-level APIs with XIM is too hard since - * XIM is a high-level interface. - * some comments are added for implementor with XIM. */ #include "winbase.h" #include "windef.h" #include "wingdi.h" #include "winuser.h" -#include "winnls.h" #include "winerror.h" -#include "immddk.h" - #include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(imm); +#include "imm.h" +WINE_DEFAULT_DEBUG_CHANNEL(imm); /*********************************************************************** * ImmAssociateContext (IMM32.@) @@ -43,9 +35,6 @@ HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC) { FIXME("(0x%08x, 0x%08x): stub\n",hWnd,hIMC); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - - /* changing contexts is hard -> return default dummy imc */ - return (HIMC)NULL; } @@ -55,8 +44,6 @@ HIMC WINAPI ImmAssociateContext(HWND hWnd, HIMC hIMC) BOOL WINAPI ImmConfigureIMEA( HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData) { - /* are any configurations needed? */ - FIXME("(0x%08x, 0x%08x, %ld, %p): stub\n", hKL, hWnd, dwMode, lpData ); @@ -70,8 +57,6 @@ BOOL WINAPI ImmConfigureIMEA( BOOL WINAPI ImmConfigureIMEW( HKL hKL, HWND hWnd, DWORD dwMode, LPVOID lpData) { - /* are any configurations needed? */ - FIXME("(0x%08x, 0x%08x, %ld, %p): stub\n", hKL, hWnd, dwMode, lpData ); @@ -80,16 +65,59 @@ BOOL WINAPI ImmConfigureIMEW( } /*********************************************************************** - * ImmDisableIME (IMM32.@) + * ImmCreateContext (IMM32.@) */ -BOOL WINAPI ImmDisableIME( - DWORD idThread) +HIMC WINAPI ImmCreateContext() { - FIXME("(idThread %lu): stub\n", idThread); + FIXME("(): stub\n"); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return (HIMC)NULL; +} + +/*********************************************************************** + * ImmDestroyContext (IMM32.@) + */ +BOOL WINAPI ImmDestroyContext(HIMC hIMC) +{ + FIXME("(0x%08x): stub\n",hIMC); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } +/*********************************************************************** + * ImmEnumRegisterWordA (IMM32.@) + */ +UINT WINAPI ImmEnumRegisterWordA( + HKL hKL, REGISTERWORDENUMPROCA lpfnEnumProc, + LPCSTR lpszReading, DWORD dwStyle, + LPCSTR lpszRegister, LPVOID lpData) +{ + FIXME("(0x%08x, %p, %s, %ld, %s, %p): stub\n", + hKL, lpfnEnumProc, + debugstr_a(lpszReading), dwStyle, + debugstr_a(lpszRegister), lpData + ); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + +/*********************************************************************** + * ImmEnumRegisterWordW (IMM32.@) + */ +UINT WINAPI ImmEnumRegisterWordW( + HKL hKL, REGISTERWORDENUMPROCW lpfnEnumProc, + LPCWSTR lpszReading, DWORD dwStyle, + LPCWSTR lpszRegister, LPVOID lpData) +{ + FIXME("(0x%08x, %p, %s, %ld, %s, %p): stub\n", + hKL, lpfnEnumProc, + debugstr_w(lpszReading), dwStyle, + debugstr_w(lpszRegister), lpData + ); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + /*********************************************************************** * ImmEscapeA (IMM32.@) */ @@ -97,7 +125,6 @@ LRESULT WINAPI ImmEscapeA( HKL hKL, HIMC hIMC, UINT uEscape, LPVOID lpData) { - /* hard to implement with XIM */ FIXME("(0x%08x, 0x%08x, %d, %p): stub\n", hKL, hIMC, uEscape, lpData ); @@ -112,7 +139,6 @@ LRESULT WINAPI ImmEscapeW( HKL hKL, HIMC hIMC, UINT uEscape, LPVOID lpData) { - /* hard to implement with XIM */ FIXME("(0x%08x, 0x%08x, %d, %p): stub\n", hKL, hIMC, uEscape, lpData ); @@ -127,7 +153,6 @@ DWORD WINAPI ImmGetCandidateListA( HIMC hIMC, DWORD deIndex, LPCANDIDATELIST lpCandList, DWORD dwBufLen) { - /* hard to implement with XIM */ FIXME("(0x%08x, %ld, %p, %ld): stub\n", hIMC, deIndex, lpCandList, dwBufLen @@ -142,7 +167,6 @@ DWORD WINAPI ImmGetCandidateListA( DWORD WINAPI ImmGetCandidateListCountA( HIMC hIMC, LPDWORD lpdwListCount) { - /* hard to implement with XIM */ FIXME("(0x%08x, %p): stub\n", hIMC, lpdwListCount); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return 0; @@ -154,7 +178,6 @@ DWORD WINAPI ImmGetCandidateListCountA( DWORD WINAPI ImmGetCandidateListCountW( HIMC hIMC, LPDWORD lpdwListCount) { - /* hard to implement with XIM */ FIXME("(0x%08x, %p): stub\n", hIMC, lpdwListCount); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return 0; @@ -167,7 +190,6 @@ DWORD WINAPI ImmGetCandidateListW( HIMC hIMC, DWORD deIndex, LPCANDIDATELIST lpCandList, DWORD dwBufLen) { - /* hard to implement with XIM */ FIXME("(0x%08x, %ld, %p, %ld): stub\n", hIMC, deIndex, lpCandList, dwBufLen @@ -182,8 +204,6 @@ DWORD WINAPI ImmGetCandidateListW( BOOL WINAPI ImmGetCandidateWindow( HIMC hIMC, DWORD dwBufLen, LPCANDIDATEFORM lpCandidate) { - /* return positions of 'candidate window' -> hard? */ - FIXME("(0x%08x, %ld, %p): stub\n", hIMC, dwBufLen, lpCandidate); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; @@ -194,7 +214,6 @@ BOOL WINAPI ImmGetCandidateWindow( */ BOOL WINAPI ImmGetCompositionFontA(HIMC hIMC, LPLOGFONTA lplf) { - /* hard to implement with XIM */ FIXME("(0x%08x, %p): stub\n", hIMC, lplf); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; @@ -205,7 +224,6 @@ BOOL WINAPI ImmGetCompositionFontA(HIMC hIMC, LPLOGFONTA lplf) */ BOOL WINAPI ImmGetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf) { - /* hard to implement with XIM */ FIXME("(0x%08x, %p): stub\n", hIMC, lplf); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; @@ -217,20 +235,18 @@ BOOL WINAPI ImmGetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf) LONG WINAPI ImmGetCompositionStringA( HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen) { - /* hard to implement with XIM */ OSVERSIONINFOA version; FIXME("(0x%08x, %ld, %p, %ld): stub\n", hIMC, dwIndex, lpBuf, dwBufLen ); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); GetVersionExA( &version ); switch(version.dwPlatformId) { case VER_PLATFORM_WIN32_WINDOWS: return -1; case VER_PLATFORM_WIN32_NT: return 0; default: - FIXME("%ld not supported\n",version.dwPlatformId); + FIXME("%ld not supported",version.dwPlatformId); return -1; } } @@ -242,20 +258,18 @@ LONG WINAPI ImmGetCompositionStringW( HIMC hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen) { - /* hard to implement with XIM */ OSVERSIONINFOA version; FIXME("(0x%08x, %ld, %p, %ld): stub\n", hIMC, dwIndex, lpBuf, dwBufLen ); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); GetVersionExA( &version ); switch(version.dwPlatformId) { case VER_PLATFORM_WIN32_WINDOWS: return -1; case VER_PLATFORM_WIN32_NT: return 0; default: - FIXME("%ld not supported\n",version.dwPlatformId); + FIXME("%ld not supported",version.dwPlatformId); return -1; } } @@ -265,8 +279,6 @@ LONG WINAPI ImmGetCompositionStringW( */ BOOL WINAPI ImmGetCompositionWindow(HIMC hIMC, LPCOMPOSITIONFORM lpCompForm) { - /* return positions of 'composition window' -> hard? */ - FIXME("(0x%08x, %p): stub\n", hIMC, lpCompForm); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return 0; @@ -277,8 +289,6 @@ BOOL WINAPI ImmGetCompositionWindow(HIMC hIMC, LPCOMPOSITIONFORM lpCompForm) */ HIMC WINAPI ImmGetContext(HWND hWnd) { - /* enter critical section of default context and return it */ - FIXME("(0x%08x): stub\n", hWnd); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return (HIMC)NULL; @@ -292,7 +302,6 @@ DWORD WINAPI ImmGetConversionListA( LPCSTR pSrc, LPCANDIDATELIST lpDst, DWORD dwBufLen, UINT uFlag) { - /* hard to implement with XIM */ FIXME("(0x%08x, 0x%08x, %s, %p, %ld, %d): stub\n", hKL, hIMC, debugstr_a(pSrc), lpDst, dwBufLen, uFlag ); @@ -308,7 +317,6 @@ DWORD WINAPI ImmGetConversionListW( LPCWSTR pSrc, LPCANDIDATELIST lpDst, DWORD dwBufLen, UINT uFlag) { - /* hard to implement with XIM */ FIXME("(0x%08x, 0x%08x, %s, %p, %ld, %d): stub\n", hKL, hIMC, debugstr_w(pSrc), lpDst, dwBufLen, uFlag ); @@ -322,8 +330,6 @@ DWORD WINAPI ImmGetConversionListW( BOOL WINAPI ImmGetConversionStatus( HIMC hIMC, LPDWORD lpfdwConversion, LPDWORD lpfdwSentence) { - /* hard -> pretend? */ - FIXME("(0x%08x, %p, %p): stub\n", hIMC, lpfdwConversion, lpfdwSentence ); @@ -336,7 +342,6 @@ BOOL WINAPI ImmGetConversionStatus( */ HWND WINAPI ImmGetDefaultIMEWnd(HWND hWnd) { - /* hard to implement with XIM */ FIXME("(0x%08x): stub\n", hWnd); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return (HWND)NULL; @@ -373,8 +378,6 @@ UINT WINAPI ImmGetDescriptionW(HKL hKL, LPWSTR lpszDescription, UINT uBufLen) DWORD WINAPI ImmGetGuideLineA( HIMC hIMC, DWORD dwIndex, LPSTR lpBuf, DWORD dwBufLen) { - /* ??? hard?? */ - FIXME("(0x%08x, %ld, %s, %ld): stub\n", hIMC, dwIndex, debugstr_a(lpBuf), dwBufLen ); @@ -387,8 +390,6 @@ DWORD WINAPI ImmGetGuideLineA( */ DWORD WINAPI ImmGetGuideLineW(HIMC hIMC, DWORD dwIndex, LPWSTR lpBuf, DWORD dwBufLen) { - /* ??? hard?? */ - FIXME("(0x%08x, %ld, %s, %ld): stub\n", hIMC, dwIndex, debugstr_w(lpBuf), dwBufLen ); @@ -396,25 +397,79 @@ DWORD WINAPI ImmGetGuideLineW(HIMC hIMC, DWORD dwIndex, LPWSTR lpBuf, DWORD dwBu return 0; } +/*********************************************************************** + * ImmGetIMEFileNameA (IMM32.@) + */ +UINT WINAPI ImmGetIMEFileNameA( + HKL hKL, LPSTR lpszFileName, UINT uBufLen) +{ + FIXME("(0x%08x, %s, %d): stub\n", + hKL, debugstr_a(lpszFileName), uBufLen + ); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + +/*********************************************************************** + * ImmGetIMEFileNameW (IMM32.@) + */ +UINT WINAPI ImmGetIMEFileNameW( + HKL hKL, LPWSTR lpszFileName, UINT uBufLen) +{ + FIXME("(0x%08x, %s, %d): stub\n", + hKL, debugstr_w(lpszFileName), uBufLen + ); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + /*********************************************************************** * ImmGetOpenStatus (IMM32.@) */ BOOL WINAPI ImmGetOpenStatus(HIMC hIMC) { - /* return whether XIC is activated */ - FIXME("(0x%08x): stub\n", hIMC); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } +/*********************************************************************** + * ImmGetProperty (IMM32.@) + */ +DWORD WINAPI ImmGetProperty(HKL hKL, DWORD fdwIndex) +{ + FIXME("(0x%08x, %ld): stub\n", hKL, fdwIndex); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + +/*********************************************************************** + * ImmGetRegisterWordStyleA (IMM32.@) + */ +UINT WINAPI ImmGetRegisterWordStyleA( + HKL hKL, UINT nItem, LPSTYLEBUFA lpStyleBuf) +{ + FIXME("(0x%08x, %d, %p): stub\n", hKL, nItem, lpStyleBuf); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + +/*********************************************************************** + * ImmGetRegisterWordStyleW (IMM32.@) + */ +UINT WINAPI ImmGetRegisterWordStyleW( + HKL hKL, UINT nItem, LPSTYLEBUFW lpStyleBuf) +{ + FIXME("(0x%08x, %d, %p): stub\n", hKL, nItem, lpStyleBuf); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; +} + /*********************************************************************** * ImmGetStatusWindowPos (IMM32.@) */ BOOL WINAPI ImmGetStatusWindowPos(HIMC hIMC, LPPOINT lpptPos) { - /* hard??? */ - FIXME("(0x%08x, %p): stub\n", hIMC, lpptPos); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; @@ -425,11 +480,9 @@ BOOL WINAPI ImmGetStatusWindowPos(HIMC hIMC, LPPOINT lpptPos) */ UINT WINAPI ImmGetVirtualKey(HWND hWnd) { - /* hard??? */ OSVERSIONINFOA version; FIXME("(0x%08x): stub\n", hWnd); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - version.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); GetVersionExA( &version ); switch(version.dwPlatformId) { @@ -438,18 +491,79 @@ UINT WINAPI ImmGetVirtualKey(HWND hWnd) case VER_PLATFORM_WIN32_NT: return 0; default: - FIXME("%ld not supported\n",version.dwPlatformId); + FIXME("%ld not supported",version.dwPlatformId); return VK_PROCESSKEY; } } +/*********************************************************************** + * ImmInstallIMEA (IMM32.@) + */ +HKL WINAPI ImmInstallIMEA( + LPCSTR lpszIMEFileName, LPCSTR lpszLayoutText) +{ + FIXME("(%s, %s): stub\n", + debugstr_a(lpszIMEFileName), debugstr_a(lpszLayoutText) + ); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return (HKL)NULL; +} + +/*********************************************************************** + * ImmInstallIMEW (IMM32.@) + */ +HKL WINAPI ImmInstallIMEW( + LPCWSTR lpszIMEFileName, LPCWSTR lpszLayoutText) +{ + FIXME("(%s, %s): stub\n", + debugstr_w(lpszIMEFileName), debugstr_w(lpszLayoutText) + ); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return (HKL)NULL; +} + +/*********************************************************************** + * ImmIsIME (IMM32.@) + */ +BOOL WINAPI ImmIsIME(HKL hKL) +{ + FIXME("(0x%08x): stub\n", hKL); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +/*********************************************************************** + * ImmIsUIMessageA (IMM32.@) + */ +BOOL WINAPI ImmIsUIMessageA( + HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam) +{ + FIXME("(0x%08x, %d, %d, %ld): stub\n", + hWndIME, msg, wParam, lParam + ); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +/*********************************************************************** + * ImmIsUIMessageW (IMM32.@) + */ +BOOL WINAPI ImmIsUIMessageW( + HWND hWndIME, UINT msg, WPARAM wParam, LPARAM lParam) +{ + FIXME("(0x%08x, %d, %d, %ld): stub\n", + hWndIME, msg, wParam, lParam + ); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + /*********************************************************************** * ImmNotifyIME (IMM32.@) */ BOOL WINAPI ImmNotifyIME( HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue) { - /* hard to implement with XIM */ FIXME("(0x%08x, %ld, %ld, %ld): stub\n", hIMC, dwAction, dwIndex, dwValue ); @@ -463,7 +577,6 @@ BOOL WINAPI ImmNotifyIME( BOOL WINAPI ImmRegisterWordA( HKL hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR lpszRegister) { - /* hard to implement with XIM */ FIXME("(0x%08x, %s, %ld, %s): stub\n", hKL, debugstr_a(lpszReading), dwStyle, debugstr_a(lpszRegister) ); @@ -477,7 +590,6 @@ BOOL WINAPI ImmRegisterWordA( BOOL WINAPI ImmRegisterWordW( HKL hKL, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR lpszRegister) { - /* hard to implement with XIM */ FIXME("(0x%08x, %s, %ld, %s): stub\n", hKL, debugstr_w(lpszReading), dwStyle, debugstr_w(lpszRegister) ); @@ -490,8 +602,6 @@ BOOL WINAPI ImmRegisterWordW( */ BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC) { - /* release critical section of default context and return */ - FIXME("(0x%08x, 0x%08x): stub\n", hWnd, hIMC); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; @@ -503,8 +613,6 @@ BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC) BOOL WINAPI ImmSetCandidateWindow( HIMC hIMC, LPCANDIDATEFORM lpCandidate) { - /* hard??? */ - FIXME("(0x%08x, %p): stub\n", hIMC, lpCandidate); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; @@ -515,7 +623,6 @@ BOOL WINAPI ImmSetCandidateWindow( */ BOOL WINAPI ImmSetCompositionFontA(HIMC hIMC, LPLOGFONTA lplf) { - /* hard to implement with XIM */ FIXME("(0x%08x, %p): stub\n", hIMC, lplf); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; @@ -526,7 +633,6 @@ BOOL WINAPI ImmSetCompositionFontA(HIMC hIMC, LPLOGFONTA lplf) */ BOOL WINAPI ImmSetCompositionFontW(HIMC hIMC, LPLOGFONTW lplf) { - /* hard to implement with XIM */ FIXME("(0x%08x, %p): stub\n", hIMC, lplf); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; @@ -540,8 +646,6 @@ BOOL WINAPI ImmSetCompositionStringA( LPCVOID lpComp, DWORD dwCompLen, LPCVOID lpRead, DWORD dwReadLen) { - /* hard??? */ - FIXME("(0x%08x, %ld, %p, %ld, %p, %ld): stub\n", hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen ); @@ -557,8 +661,6 @@ BOOL WINAPI ImmSetCompositionStringW( LPCVOID lpComp, DWORD dwCompLen, LPCVOID lpRead, DWORD dwReadLen) { - /* hard??? */ - FIXME("(0x%08x, %ld, %p, %ld, %p, %ld): stub\n", hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen ); @@ -572,8 +674,6 @@ BOOL WINAPI ImmSetCompositionStringW( BOOL WINAPI ImmSetCompositionWindow( HIMC hIMC, LPCOMPOSITIONFORM lpCompForm) { - /* hard??? */ - FIXME("(0x%08x, %p): stub\n", hIMC, lpCompForm); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; @@ -585,7 +685,6 @@ BOOL WINAPI ImmSetCompositionWindow( BOOL WINAPI ImmSetConversionStatus( HIMC hIMC, DWORD fdwConversion, DWORD fdwSentence) { - /* hard to implement with XIM? */ FIXME("(0x%08x, %ld, %ld): stub\n", hIMC, fdwConversion, fdwSentence ); @@ -598,8 +697,6 @@ BOOL WINAPI ImmSetConversionStatus( */ BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen) { - /* activate/inactivate XIC */ - FIXME("(0x%08x, %d): stub\n", hIMC, fOpen); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; @@ -610,8 +707,6 @@ BOOL WINAPI ImmSetOpenStatus(HIMC hIMC, BOOL fOpen) */ BOOL WINAPI ImmSetStatusWindowPos(HIMC hIMC, LPPOINT lpptPos) { - /* hard??? */ - FIXME("(0x%08x, %p): stub\n", hIMC, lpptPos); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; @@ -622,8 +717,6 @@ BOOL WINAPI ImmSetStatusWindowPos(HIMC hIMC, LPPOINT lpptPos) */ BOOL WINAPI ImmSimulateHotKey(HWND hWnd, DWORD dwHotKeyID) { - /* hard??? */ - FIXME("(0x%08x, %ld): stub\n", hWnd, dwHotKeyID); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; @@ -635,7 +728,6 @@ BOOL WINAPI ImmSimulateHotKey(HWND hWnd, DWORD dwHotKeyID) BOOL WINAPI ImmUnregisterWordA( HKL hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR lpszUnregister) { - /* hard to implement with XIM */ FIXME("(0x%08x, %s, %ld, %s): stub\n", hKL, debugstr_a(lpszReading), dwStyle, debugstr_a(lpszUnregister) ); @@ -649,712 +741,9 @@ BOOL WINAPI ImmUnregisterWordA( BOOL WINAPI ImmUnregisterWordW( HKL hKL, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR lpszUnregister) { - /* hard to implement with XIM */ FIXME("(0x%08x, %s, %ld, %s): stub\n", hKL, debugstr_w(lpszReading), dwStyle, debugstr_w(lpszUnregister) ); SetLastError(ERROR_CALL_NOT_IMPLEMENTED); return FALSE; } - -/*********************************************************************** - * ImmCreateSoftKeyboard (IMM32.@) - */ -HWND WINAPI ImmCreateSoftKeyboard(UINT uType, HWND hOwner, int x, int y) -{ - /* hard to implement with XIM */ - FIXME("(0x%08x, 0x%08x, %d, %d): stub\n", uType, (unsigned)hOwner, x, y); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return (HWND)NULL; -} - -/*********************************************************************** - * ImmDestroySoftKeyboard (IMM32.@) - */ -BOOL WINAPI ImmDestroySoftKeyboard(HWND hwndSoftKeyboard) -{ - /* hard to implement with XIM */ - FIXME("(0x%08x): stub\n", (unsigned)hwndSoftKeyboard); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -/*********************************************************************** - * ImmShowSoftKeyboard (IMM32.@) - */ -BOOL WINAPI ImmShowSoftKeyboard(HWND hwndSoftKeyboard, int nCmdShow) -{ - /* hard to implement with XIM */ - FIXME("(0x%08x, %d): stub\n", (unsigned)hwndSoftKeyboard, nCmdShow); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -/*********************************************************************** - * ImmGetHotKey (IMM32.@) - */ -BOOL WINAPI ImmGetHotKey(DWORD dwHotKeyID, LPUINT lpuModifiers, - LPUINT lpuVKey, LPHKL lphKL) -{ - /* hard??? */ - - FIXME("(0x%08lx, %p, %p, %p): stub\n", - dwHotKeyID, lpuModifiers, lpuVKey, lphKL); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -/*********************************************************************** - * ImmSetHotKey (IMM32.@) - */ -BOOL WINAPI ImmSetHotKey(DWORD dwHotKeyID, UINT uModifiers, - UINT uVKey, HKL hKL) -{ - /* hard??? */ - - FIXME("(0x%08lx, 0x%08x, 0x%08x, 0x%08x): stub\n", - dwHotKeyID, uModifiers, uVKey, (unsigned)hKL); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -/*********************************************************************** - * ImmGenerateMessage (IMM32.@) - */ -BOOL WINAPI ImmGenerateMessage(HIMC hIMC) -{ - /* hard to implement with XIM */ - FIXME("(0x%08x): stub\n", (unsigned)hIMC); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -/*********************************************************************** - * ImmCreateContext (IMM32.@) - */ -HIMC WINAPI ImmCreateContext( void ) -{ - /* hard to implement with XIM??? */ - FIXME("(): stub\n"); - return (HIMC)NULL; -} - -/*********************************************************************** - * ImmDestroyContext (IMM32.@) - */ -BOOL WINAPI ImmDestroyContext( HIMC hIMC ) -{ - /* hard to implement with XIM??? */ - FIXME("(): stub\n"); - return FALSE; -} - -/*********************************************************************** - * ImmLockIMC (IMM32.@) - */ -LPINPUTCONTEXT WINAPI ImmLockIMC(HIMC hIMC) -{ - /* don't need to implement unless use native drivers */ - FIXME("(): stub\n"); - return NULL; -} - -/*********************************************************************** - * ImmUnlockIMC (IMM32.@) - */ -BOOL WINAPI ImmUnlockIMC(HIMC hIMC) -{ - /* don't need to implement unless use native drivers */ - FIXME("(): stub\n"); - return FALSE; -} - -/*********************************************************************** - * ImmGetIMCLockCount (IMM32.@) - */ -DWORD WINAPI ImmGetIMCLockCount(HIMC hIMC) -{ - /* don't need to implement unless use native drivers */ - FIXME("(): stub\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - -/*********************************************************************** - * IMM32_IsUIMessage (internal) - */ -static BOOL IMM32_IsUIMessage( UINT nMsg ) -{ - switch ( nMsg ) - { - case WM_IME_STARTCOMPOSITION: - case WM_IME_ENDCOMPOSITION: - case WM_IME_COMPOSITION: - case WM_IME_SETCONTEXT: - case WM_IME_NOTIFY: - case WM_IME_COMPOSITIONFULL: - case WM_IME_SELECT: - case 0x287: /* What is this message? IMM32.DLL returns TRUE. */ - return TRUE; - } - - return FALSE; -} - - -/*********************************************************************** - * ImmIsUIMessageA (IMM32.@) - */ -BOOL WINAPI ImmIsUIMessageA( - HWND hwndIME, UINT msg, WPARAM wParam, LPARAM lParam) -{ - TRACE("(0x%08x, %d, %d, %ld)\n", - hwndIME, msg, wParam, lParam); - - if ( !IMM32_IsUIMessage( msg ) ) - return FALSE; - if ( hwndIME == (HWND)NULL ) - return TRUE; - - switch ( msg ) - { - case WM_IME_STARTCOMPOSITION: - case WM_IME_ENDCOMPOSITION: - case WM_IME_COMPOSITION: - case WM_IME_SETCONTEXT: - case WM_IME_NOTIFY: - case WM_IME_COMPOSITIONFULL: - case WM_IME_SELECT: - SendMessageA( hwndIME, msg, wParam, lParam ); - break; - case 0x287: /* What is this message? */ - FIXME("(0x%08x, %d, %d, %ld) - unknown message 0x287.\n", - hwndIME, msg, wParam, lParam); - SendMessageA( hwndIME, msg, wParam, lParam ); - break; - } - - return TRUE; -} - -/*********************************************************************** - * ImmIsUIMessageW (IMM32.@) - */ -BOOL WINAPI ImmIsUIMessageW( - HWND hwndIME, UINT msg, WPARAM wParam, LPARAM lParam) -{ - TRACE("(0x%08x, %d, %d, %ld)\n", - hwndIME, msg, wParam, lParam); - - if ( !IMM32_IsUIMessage( msg ) ) - return FALSE; - if ( hwndIME == (HWND)NULL ) - return TRUE; - - switch ( msg ) - { - case WM_IME_STARTCOMPOSITION: - case WM_IME_ENDCOMPOSITION: - case WM_IME_COMPOSITION: - case WM_IME_SETCONTEXT: - case WM_IME_NOTIFY: - case WM_IME_COMPOSITIONFULL: - case WM_IME_SELECT: - SendMessageW( hwndIME, msg, wParam, lParam ); - break; - case 0x287: /* What is this message? */ - FIXME("(0x%08x, %d, %d, %ld) - unknown message 0x287.\n", - hwndIME, msg, wParam, lParam); - SendMessageW( hwndIME, msg, wParam, lParam ); - break; - } - - return TRUE; -} - - -/*********************************************************************** - * ImmInstallIMEA (IMM32.@) - */ -HKL WINAPI ImmInstallIMEA( - LPCSTR lpszIMEFileName, LPCSTR lpszLayoutText) -{ - /* don't need to implement unless use native drivers */ - FIXME("(): stub\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return (HKL)NULL; -} - -/*********************************************************************** - * ImmInstallIMEW (IMM32.@) - */ -HKL WINAPI ImmInstallIMEW( - LPCWSTR lpszIMEFileName, LPCWSTR lpszLayoutText) -{ - /* don't need to implement unless use native drivers */ - FIXME("(): stub\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return (HKL)NULL; -} - -/*********************************************************************** - * ImmIsIME (IMM32.@) - */ -BOOL WINAPI ImmIsIME(HKL hkl) -{ - /* hard to implement with XIM */ - FIXME("(): stub\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return FALSE; -} - -/*********************************************************************** - * ImmGetIMEFileNameA (IMM32.@) - */ -UINT WINAPI ImmGetIMEFileNameA(HKL hkl, LPSTR lpszFileName, UINT uBufLen) -{ - /* don't need to implement unless use native drivers */ - FIXME("(): stub\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - -/*********************************************************************** - * ImmGetIMEFileNameW (IMM32.@) - */ -UINT WINAPI ImmGetIMEFileNameW(HKL hkl, LPWSTR lpszFileName, UINT uBufLen) -{ - /* don't need to implement unless use native drivers */ - FIXME("(): stub\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - -/*********************************************************************** - * ImmGetProperty (IMM32.@) - */ -DWORD WINAPI ImmGetProperty(HKL hkl, DWORD fdwIndex) -{ - /* hard to implement with XIM */ - FIXME("(): stub\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - -/*********************************************************************** - * ImmEnumRegisterWordA (IMM32.@) - */ -UINT WINAPI ImmEnumRegisterWordA( - HKL hkl, REGISTERWORDENUMPROCA lpfnEnumProc, - LPCSTR lpszReading, DWORD dwStyle, - LPCSTR lpszRegister, LPVOID lpData) -{ - /* hard to implement with XIM */ - FIXME("(): stub\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - -/*********************************************************************** - * ImmEnumRegisterWordW (IMM32.@) - */ -UINT WINAPI ImmEnumRegisterWordW( - HKL hkl, REGISTERWORDENUMPROCW lpfnEnumProc, - LPCWSTR lpszReading, DWORD dwStyle, - LPCWSTR lpszRegister, LPVOID lpData) -{ - /* hard to implement with XIM */ - FIXME("(): stub\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - -/*********************************************************************** - * ImmGetRegisterWordStyleA (IMM32.@) - */ -UINT WINAPI ImmGetRegisterWordStyleA( - HKL hkl, UINT nItem, LPSTYLEBUFA lpStyleBuf) -{ - /* hard to implement with XIM */ - FIXME("(): stub\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - -/*********************************************************************** - * ImmGetRegisterWordStyleW (IMM32.@) - */ -UINT WINAPI ImmGetRegisterWordStyleW( - HKL hkl, UINT nItem, LPSTYLEBUFW lpStyleBuf) -{ - /* hard to implement with XIM */ - FIXME("(): stub\n"); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - -/*********************************************************************** - * IMM32_HeapAlloc (internal) - */ -LPVOID IMM32_HeapAlloc( DWORD dwFlags, DWORD dwSize ) -{ - return HeapAlloc( GetProcessHeap(), dwFlags, dwSize ); -} - -/*********************************************************************** - * IMM32_HeapReAlloc (internal) - */ -LPVOID IMM32_HeapReAlloc( DWORD dwFlags, LPVOID lpv, DWORD dwSize ) -{ - if ( lpv == NULL ) - return IMM32_HeapAlloc( dwFlags, dwSize ); - return HeapReAlloc( GetProcessHeap(), dwFlags, lpv, dwSize ); -} - -/*********************************************************************** - * IMM32_HeapFree (internal) - */ -void IMM32_HeapFree( LPVOID lpv ) -{ - if ( lpv != NULL ) - HeapFree( GetProcessHeap(), 0, lpv ); -} - - -/*********************************************************************** - * IMM32_strlenAtoW (internal) - */ -INT IMM32_strlenAtoW( LPCSTR lpstr ) -{ - INT len; - - len = MultiByteToWideChar( CP_ACP, 0, lpstr, -1, NULL, 0 ); - return ( len > 0 ) ? (len-1) : 0; -} - -/*********************************************************************** - * IMM32_strlenWtoA (internal) - */ -INT IMM32_strlenWtoA( LPCWSTR lpwstr ) -{ - INT len; - - len = WideCharToMultiByte( CP_ACP, 0, lpwstr, -1, - NULL, 0, NULL, NULL ); - return ( len > 0 ) ? (len-1) : 0; -} - -/*********************************************************************** - * IMM32_strncpyAtoW (internal) - */ -LPWSTR IMM32_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; -} - -/*********************************************************************** - * IMM32_strncpyWtoA (internal) - */ -LPSTR IMM32_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; -} - -/*********************************************************************** - * IMM32_strdupAtoW (internal) - */ -LPWSTR IMM32_strdupAtoW( LPCSTR lpstr ) -{ - INT len; - LPWSTR lpwstr = NULL; - - len = IMM32_strlenAtoW( lpstr ); - if ( len > 0 ) - { - lpwstr = (LPWSTR)IMM32_HeapAlloc( 0, sizeof(WCHAR)*(len+1) ); - if ( lpwstr != NULL ) - (void)IMM32_strncpyAtoW( lpwstr, lpstr, len+1 ); - } - - return lpwstr; -} - -/*********************************************************************** - * IMM32_strdupWtoA (internal) - */ -LPSTR IMM32_strdupWtoA( LPCWSTR lpwstr ) -{ - INT len; - LPSTR lpstr = NULL; - - len = IMM32_strlenWtoA( lpwstr ); - if ( len > 0 ) - { - lpstr = (LPSTR)IMM32_HeapAlloc( 0, sizeof(CHAR)*(len+1) ); - if ( lpstr != NULL ) - (void)IMM32_strncpyWtoA( lpstr, lpwstr, len+1 ); - } - - return lpstr; -} - - -#define IMM32_MOVEABLEMEM_LOCK_MAX ((DWORD)0xffffffff) - -typedef struct IMM32_tagMOVEABLEMEM -{ - DWORD dwLockCount; - DWORD dwSize; - LPVOID lpvMem; -} IMM32_MOVEABLEMEM; - -/*********************************************************************** - * IMM32_MoveableAlloc (internal) - */ -IMM32_MOVEABLEMEM* IMM32_MoveableAlloc( DWORD dwHeapFlags, DWORD dwHeapSize ) -{ - IMM32_MOVEABLEMEM* lpMoveable; - - lpMoveable = (IMM32_MOVEABLEMEM*) - IMM32_HeapAlloc( 0, sizeof( IMM32_MOVEABLEMEM ) ); - if ( lpMoveable != NULL ) - { - lpMoveable->dwLockCount = 0; - lpMoveable->dwSize = dwHeapSize; - lpMoveable->lpvMem = NULL; - - if ( dwHeapSize > 0 ) - { - lpMoveable->lpvMem = - IMM32_HeapAlloc( dwHeapFlags, dwHeapSize ); - if ( lpMoveable->lpvMem == NULL ) - { - IMM32_HeapFree( lpMoveable ); - lpMoveable = NULL; - } - } - } - - return lpMoveable; -} - -/*********************************************************************** - * IMM32_MoveableFree (internal) - */ -void IMM32_MoveableFree( IMM32_MOVEABLEMEM* lpMoveable ) -{ - IMM32_HeapFree( lpMoveable->lpvMem ); - IMM32_HeapFree( lpMoveable ); -} - -/*********************************************************************** - * IMM32_MoveableReAlloc (internal) - */ -BOOL IMM32_MoveableReAlloc( IMM32_MOVEABLEMEM* lpMoveable, - DWORD dwHeapFlags, DWORD dwHeapSize ) -{ - LPVOID lpv; - - if ( dwHeapSize > 0 ) - { - if ( lpMoveable->dwLockCount > 0 ) - dwHeapFlags |= HEAP_REALLOC_IN_PLACE_ONLY; - lpv = IMM32_HeapReAlloc( dwHeapFlags, - lpMoveable->lpvMem, dwHeapSize ); - if ( lpv == NULL ) - return FALSE; - } - else - { - IMM32_HeapFree( lpMoveable->lpvMem ); - lpv = NULL; - } - - lpMoveable->dwSize = dwHeapSize; - lpMoveable->lpvMem = lpv; - - return TRUE; -} - -/*********************************************************************** - * IMM32_MoveableLock (internal) - */ -LPVOID IMM32_MoveableLock( IMM32_MOVEABLEMEM* lpMoveable ) -{ - if ( lpMoveable->dwLockCount == IMM32_MOVEABLEMEM_LOCK_MAX ) - { - ERR( "lock count is 0xffffffff\n" ); - } - else - { - lpMoveable->dwLockCount ++; - } - - return lpMoveable->lpvMem; -} - -/*********************************************************************** - * IMM32_MoveableUnlock (internal) - */ -BOOL IMM32_MoveableUnlock( IMM32_MOVEABLEMEM* lpMoveable ) -{ - if ( lpMoveable->dwLockCount == 0 ) - return FALSE; - - if ( --lpMoveable->dwLockCount > 0 ) - return TRUE; - - return FALSE; -} - -/*********************************************************************** - * IMM32_MoveableGetLockCount (internal) - */ -DWORD IMM32_MoveableGetLockCount( IMM32_MOVEABLEMEM* lpMoveable ) -{ - return lpMoveable->dwLockCount; -} - -/*********************************************************************** - * IMM32_MoveableGetSize (internal) - */ -DWORD IMM32_MoveableGetSize( IMM32_MOVEABLEMEM* lpMoveable ) -{ - return lpMoveable->dwSize; -} - -/*********************************************************************** - * ImmCreateIMCC (IMM32.@) - */ -HIMCC WINAPI ImmCreateIMCC(DWORD dwSize) -{ - IMM32_MOVEABLEMEM* lpMoveable; - - TRACE("(%lu)\n", dwSize); - - /* implemented but don't need to implement unless use native drivers */ - - lpMoveable = IMM32_MoveableAlloc( HEAP_ZERO_MEMORY, dwSize ); - if ( lpMoveable == NULL ) - { - SetLastError(ERROR_OUTOFMEMORY); - return (HIMCC)NULL; - } - - return (HIMCC)lpMoveable; -} - -/*********************************************************************** - * ImmDestroyIMCC (IMM32.@) - */ -HIMCC WINAPI ImmDestroyIMCC(HIMCC hIMCC) -{ - TRACE("(0x%08x)\n", (unsigned)hIMCC); - - /* implemented but don't need to implement unless use native drivers */ - - IMM32_MoveableFree( (IMM32_MOVEABLEMEM*)hIMCC ); - return (HIMCC)NULL; -} - -/*********************************************************************** - * ImmLockIMCC (IMM32.@) - */ -LPVOID WINAPI ImmLockIMCC(HIMCC hIMCC) -{ - TRACE("(0x%08x)\n", (unsigned)hIMCC); - - /* implemented but don't need to implement unless use native drivers */ - - return IMM32_MoveableLock( (IMM32_MOVEABLEMEM*)hIMCC ); -} - -/*********************************************************************** - * ImmUnlockIMCC (IMM32.@) - */ -BOOL WINAPI ImmUnlockIMCC(HIMCC hIMCC) -{ - TRACE("(0x%08x)\n", (unsigned)hIMCC); - - /* implemented but don't need to implement unless use native drivers */ - - return IMM32_MoveableUnlock( (IMM32_MOVEABLEMEM*)hIMCC ); -} - -/*********************************************************************** - * ImmGetIMCCLockCount (IMM32.@) - */ -DWORD WINAPI ImmGetIMCCLockCount(HIMCC hIMCC) -{ - TRACE("(0x%08x)\n", (unsigned)hIMCC); - - /* implemented but don't need to implement unless use native drivers */ - - return IMM32_MoveableGetLockCount( (IMM32_MOVEABLEMEM*)hIMCC ); -} - -/*********************************************************************** - * ImmReSizeIMCC (IMM32.@) - */ -HIMCC WINAPI ImmReSizeIMCC(HIMCC hIMCC, DWORD dwSize) -{ - TRACE("(0x%08x,%lu)\n", (unsigned)hIMCC, dwSize); - - /* implemented but don't need to implement unless use native drivers */ - - if ( !IMM32_MoveableReAlloc( (IMM32_MOVEABLEMEM*)hIMCC, - HEAP_ZERO_MEMORY, dwSize ) ) - { - SetLastError(ERROR_OUTOFMEMORY); - return (HIMCC)NULL; - } - - return hIMCC; -} - -/*********************************************************************** - * ImmGetIMCCSize (IMM32.@) - */ -DWORD WINAPI ImmGetIMCCSize(HIMCC hIMCC) -{ - TRACE("(0x%08x)\n", (unsigned)hIMCC); - - /* implemented but don't need to implement unless use native drivers */ - - return IMM32_MoveableGetSize( (IMM32_MOVEABLEMEM*)hIMCC ); -} - - -/*********************************************************************** - * IMM32_DllMain - */ -BOOL WINAPI IMM32_DllMain( - HINSTANCE hInstDLL, - DWORD fdwReason, - LPVOID lpvReserved ) -{ - switch ( fdwReason ) - { - case DLL_PROCESS_ATTACH: - break; - case DLL_PROCESS_DETACH: - break; - case DLL_THREAD_ATTACH: - break; - case DLL_THREAD_DETACH: - break; - } - - return TRUE; -} diff --git a/dlls/imm32/imm32.spec b/dlls/imm32/imm32.spec index 19edb74b13d..a87e52689a3 100644 --- a/dlls/imm32/imm32.spec +++ b/dlls/imm32/imm32.spec @@ -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 diff --git a/dlls/imm32/immddk.h b/dlls/imm32/immddk.h deleted file mode 100644 index e2f1780ab6c..00000000000 --- a/dlls/imm32/immddk.h +++ /dev/null @@ -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 */ diff --git a/dlls/quartz/Makefile.in b/dlls/quartz/Makefile.in index 5cd714b7d8d..3e51f7103c8 100644 --- a/dlls/quartz/Makefile.in +++ b/dlls/quartz/Makefile.in @@ -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@ diff --git a/dlls/quartz/README b/dlls/quartz/README deleted file mode 100644 index 95f2cd78088..00000000000 --- a/dlls/quartz/README +++ /dev/null @@ -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 - - diff --git a/dlls/quartz/acmwrap.c b/dlls/quartz/acmwrap.c deleted file mode 100644 index dbc4cb4291c..00000000000 --- a/dlls/quartz/acmwrap.c +++ /dev/null @@ -1,695 +0,0 @@ -/* - * Implements ACM Wrapper(CLSID_ACMWrapper). - * - * FIXME - stub - * FIXME - no encoding - * - * Copyright (C) 2002 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 "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 ); -} - - diff --git a/dlls/quartz/amundoc.c b/dlls/quartz/amundoc.c deleted file mode 100644 index 860f70eb76f..00000000000 --- a/dlls/quartz/amundoc.c +++ /dev/null @@ -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 -#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; -} - diff --git a/dlls/quartz/asyncsrc.c b/dlls/quartz/asyncsrc.c deleted file mode 100644 index a132fae9844..00000000000 --- a/dlls/quartz/asyncsrc.c +++ /dev/null @@ -1,1153 +0,0 @@ -/* - * Implements Asynchronous File/URL Source. - * - * FIXME - URL source is not implemented yet. - * - * 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 "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winerror.h" -#include "strmif.h" -#include "vfwmsgs.h" -#include "uuids.h" - -#include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(quartz); - -#include "quartz_private.h" -#include "asyncsrc.h" -#include "memalloc.h" - - - -const WCHAR QUARTZ_wszAsyncFileSourceName[] = -{'F','i','l','e',' ','S','o','u','r','c','e',' ','(','A','s','y','n','c','.',')',0}; -const WCHAR QUARTZ_wszAsyncFileSourcePinName[] = -{'O','u','t',0}; -const WCHAR QUARTZ_wszAsyncURLSourceName[] = -{'F','i','l','e',' ','S','o','u','r','c','e',' ','(','U','R','L',')',0}; -const WCHAR QUARTZ_wszAsyncURLSourcePinName[] = -{'O','u','t',0}; - - - -/*************************************************************************** - * - * CAsyncReaderImpl internal methods - * - */ - -static -AsyncSourceRequest* CAsyncReaderImpl_AllocRequest( CAsyncReaderImpl* This ) -{ - AsyncSourceRequest* pReq; - - EnterCriticalSection( &This->m_csFree ); - pReq = This->m_pFreeFirst; - if ( pReq != NULL ) - This->m_pFreeFirst = pReq->pNext; - LeaveCriticalSection( &This->m_csFree ); - - if ( pReq == NULL ) - { - pReq = (AsyncSourceRequest*)QUARTZ_AllocMem( - sizeof(AsyncSourceRequest) ); - if ( pReq == NULL ) - return NULL; - } - - pReq->pNext = NULL; - pReq->pSample = NULL; - pReq->dwContext = 0; - pReq->hr = E_FAIL; - - return pReq; -} - -static -void CAsyncReaderImpl_FreeRequest( CAsyncReaderImpl* This, AsyncSourceRequest* pReq, BOOL bReleaseMem ) -{ - if ( !bReleaseMem ) - { - EnterCriticalSection( &This->m_csFree ); - pReq->pNext = This->m_pFreeFirst; - This->m_pFreeFirst = pReq; - LeaveCriticalSection( &This->m_csFree ); - } - else - { - QUARTZ_FreeMem( pReq ); - } -} - -static -AsyncSourceRequest* CAsyncReaderImpl_GetReply( CAsyncReaderImpl* This ) -{ - AsyncSourceRequest* pReq; - - EnterCriticalSection( &This->m_csReply ); - pReq = This->m_pReplyFirst; - if ( pReq != NULL ) - This->m_pReplyFirst = pReq->pNext; - LeaveCriticalSection( &This->m_csReply ); - - return pReq; -} - -static -void CAsyncReaderImpl_PostReply( CAsyncReaderImpl* This, AsyncSourceRequest* pReq ) -{ - /* FIXME - add to tail */ - EnterCriticalSection( &This->m_csReply ); - pReq->pNext = This->m_pReplyFirst; - This->m_pReplyFirst = pReq; - LeaveCriticalSection( &This->m_csReply ); -} - -static -void CAsyncReaderImpl_ReleaseReqList( CAsyncReaderImpl* This, AsyncSourceRequest** ppReq, BOOL bReleaseMem ) -{ - AsyncSourceRequest* pReq; - AsyncSourceRequest* pReqNext; - - TRACE("(%p,%p,%d)\n",This,*ppReq,bReleaseMem); - pReq = *ppReq; *ppReq = NULL; - while ( pReq != NULL ) - { - pReqNext = pReq->pNext; - CAsyncReaderImpl_FreeRequest(This,pReq,bReleaseMem); - pReq = pReqNext; - } -} - -/*************************************************************************** - * - * CAsyncReaderImpl methods - * - */ - -static HRESULT WINAPI -CAsyncReaderImpl_fnQueryInterface(IAsyncReader* iface,REFIID riid,void** ppobj) -{ - ICOM_THIS(CAsyncReaderImpl,iface); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->punkControl,riid,ppobj); -} - -static ULONG WINAPI -CAsyncReaderImpl_fnAddRef(IAsyncReader* iface) -{ - ICOM_THIS(CAsyncReaderImpl,iface); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->punkControl); -} - -static ULONG WINAPI -CAsyncReaderImpl_fnRelease(IAsyncReader* iface) -{ - ICOM_THIS(CAsyncReaderImpl,iface); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->punkControl); -} - -static HRESULT WINAPI -CAsyncReaderImpl_fnRequestAllocator(IAsyncReader* iface,IMemAllocator* pAlloc,ALLOCATOR_PROPERTIES* pProp,IMemAllocator** ppAllocActual) -{ - ICOM_THIS(CAsyncReaderImpl,iface); - HRESULT hr; - ALLOCATOR_PROPERTIES propActual; - IUnknown* punk = NULL; - - TRACE("(%p)->(%p,%p,%p)\n",This,pAlloc,pProp,ppAllocActual); - - if ( pAlloc == NULL || pProp == NULL || ppAllocActual == NULL ) - return E_POINTER; - - IMemAllocator_AddRef(pAlloc); - hr = IMemAllocator_SetProperties( pAlloc, pProp, &propActual ); - if ( SUCCEEDED(hr) ) - { - *ppAllocActual = pAlloc; - return S_OK; - } - IMemAllocator_Release(pAlloc); - - hr = QUARTZ_CreateMemoryAllocator(NULL,(void**)&punk); - if ( FAILED(hr) ) - return hr; - hr = IUnknown_QueryInterface( punk, &IID_IMemAllocator, (void**)&pAlloc ); - IUnknown_Release(punk); - if ( FAILED(hr) ) - return hr; - - hr = IMemAllocator_SetProperties( pAlloc, pProp, &propActual ); - if ( SUCCEEDED(hr) ) - { - *ppAllocActual = pAlloc; - return S_OK; - } - IMemAllocator_Release(pAlloc); - - return hr; -} - -static HRESULT WINAPI -CAsyncReaderImpl_fnRequest(IAsyncReader* iface,IMediaSample* pSample,DWORD_PTR dwContext) -{ - ICOM_THIS(CAsyncReaderImpl,iface); - AsyncSourceRequest* pReq; - HRESULT hr = NOERROR; - - /* - * before implementing asynchronous I/O, - * please check patents by yourself - */ - WARN("(%p,%p,%u) no async I/O\n",This,pSample,dwContext); - - hr = IAsyncReader_SyncReadAligned(iface,pSample); - if ( FAILED(hr) ) - return hr; - pReq = CAsyncReaderImpl_AllocRequest(This); - if ( pReq == NULL ) - return E_OUTOFMEMORY; - pReq->pSample = pSample; - pReq->dwContext = dwContext; - pReq->hr = hr; - CAsyncReaderImpl_PostReply( This, pReq ); - - return NOERROR; -} - -static HRESULT WINAPI -CAsyncReaderImpl_fnWaitForNext(IAsyncReader* iface,DWORD dwTimeout,IMediaSample** ppSample,DWORD_PTR* pdwContext) -{ - ICOM_THIS(CAsyncReaderImpl,iface); - HRESULT hr = NOERROR; - AsyncSourceRequest* pReq; - - /* - * before implementing asynchronous I/O, - * please check patents by yourself - */ - WARN("(%p)->(%lu,%p,%p) no async I/O\n",This,dwTimeout,ppSample,pdwContext); - EnterCriticalSection( &This->m_csRequest ); - if ( This->m_bInFlushing ) - hr = VFW_E_TIMEOUT; - LeaveCriticalSection( &This->m_csRequest ); - - if ( hr == NOERROR ) - { - pReq = CAsyncReaderImpl_GetReply(This); - if ( pReq != NULL ) - { - *ppSample = pReq->pSample; - *pdwContext = pReq->dwContext; - hr = pReq->hr; - } - else - { - hr = VFW_E_TIMEOUT; - } - } - - return hr; -} - -static HRESULT WINAPI -CAsyncReaderImpl_fnSyncReadAligned(IAsyncReader* iface,IMediaSample* pSample) -{ - ICOM_THIS(CAsyncReaderImpl,iface); - HRESULT hr; - REFERENCE_TIME rtStart; - REFERENCE_TIME rtEnd; - BYTE* pData = NULL; - LONGLONG llStart; - LONG lLength; - LONG lActual; - - TRACE("(%p)->(%p)\n",This,pSample); - - hr = IMediaSample_GetPointer(pSample,&pData); - if ( SUCCEEDED(hr) ) - hr = IMediaSample_GetTime(pSample,&rtStart,&rtEnd); - if ( FAILED(hr) ) - return hr; - - llStart = rtStart / QUARTZ_TIMEUNITS; - lLength = (LONG)(rtEnd / QUARTZ_TIMEUNITS - rtStart / QUARTZ_TIMEUNITS); - lActual = 0; - if ( lLength > IMediaSample_GetSize(pSample) ) - { - FIXME("invalid length\n"); - return E_FAIL; - } - - EnterCriticalSection( &This->m_csReader ); - hr = This->pSource->m_pHandler->pRead( This->pSource, llStart, lLength, pData, &lActual, (HANDLE)NULL ); - LeaveCriticalSection( &This->m_csReader ); - - if ( hr == NOERROR ) - { - hr = IMediaSample_SetActualDataLength(pSample,lActual); - if ( hr == S_OK ) - { - rtStart = llStart * QUARTZ_TIMEUNITS; - rtEnd = (llStart + lActual) * QUARTZ_TIMEUNITS; - hr = IMediaSample_SetTime(pSample,&rtStart,&rtEnd); - } - if ( hr == S_OK && lActual != lLength ) - hr = S_FALSE; - } - - return hr; -} - -static HRESULT WINAPI -CAsyncReaderImpl_fnSyncRead(IAsyncReader* iface,LONGLONG llPosStart,LONG lLength,BYTE* pbBuf) -{ - ICOM_THIS(CAsyncReaderImpl,iface); - HRESULT hr; - LONG lActual; - - TRACE("(%p)->()\n",This); - - EnterCriticalSection( &This->m_csReader ); - hr = This->pSource->m_pHandler->pRead( This->pSource, llPosStart, lLength, pbBuf, &lActual, (HANDLE)NULL ); - LeaveCriticalSection( &This->m_csReader ); - - if ( hr == S_OK && lLength != lActual ) - hr = S_FALSE; - - return hr; -} - -static HRESULT WINAPI -CAsyncReaderImpl_fnLength(IAsyncReader* iface,LONGLONG* pllTotal,LONGLONG* pllAvailable) -{ - ICOM_THIS(CAsyncReaderImpl,iface); - HRESULT hr; - - TRACE("(%p)->()\n",This); - - hr = This->pSource->m_pHandler->pGetLength( This->pSource, pllTotal, pllAvailable ); - - return hr; -} - -static HRESULT WINAPI -CAsyncReaderImpl_fnBeginFlush(IAsyncReader* iface) -{ - ICOM_THIS(CAsyncReaderImpl,iface); - - TRACE("(%p)->()\n",This); - - EnterCriticalSection( &This->m_csRequest ); - This->m_bInFlushing = TRUE; - CAsyncReaderImpl_ReleaseReqList(This,&This->m_pReplyFirst,FALSE); - LeaveCriticalSection( &This->m_csRequest ); - - return NOERROR; -} - -static HRESULT WINAPI -CAsyncReaderImpl_fnEndFlush(IAsyncReader* iface) -{ - ICOM_THIS(CAsyncReaderImpl,iface); - - TRACE("(%p)->()\n",This); - - EnterCriticalSection( &This->m_csRequest ); - This->m_bInFlushing = FALSE; - LeaveCriticalSection( &This->m_csRequest ); - - return NOERROR; -} - - -static ICOM_VTABLE(IAsyncReader) iasyncreader = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - CAsyncReaderImpl_fnQueryInterface, - CAsyncReaderImpl_fnAddRef, - CAsyncReaderImpl_fnRelease, - - /* IAsyncReader fields */ - CAsyncReaderImpl_fnRequestAllocator, - CAsyncReaderImpl_fnRequest, - CAsyncReaderImpl_fnWaitForNext, - CAsyncReaderImpl_fnSyncReadAligned, - CAsyncReaderImpl_fnSyncRead, - CAsyncReaderImpl_fnLength, - CAsyncReaderImpl_fnBeginFlush, - CAsyncReaderImpl_fnEndFlush, -}; - -HRESULT CAsyncReaderImpl_InitIAsyncReader( - CAsyncReaderImpl* This, IUnknown* punkControl, - CAsyncSourceImpl* pSource ) -{ - TRACE("(%p,%p)\n",This,punkControl); - - if ( punkControl == NULL ) - { - ERR( "punkControl must not be NULL\n" ); - return E_INVALIDARG; - } - - ICOM_VTBL(This) = &iasyncreader; - This->punkControl = punkControl; - This->pSource = pSource; - This->m_bInFlushing = FALSE; - This->m_pReplyFirst = NULL; - This->m_pFreeFirst = NULL; - - InitializeCriticalSection( &This->m_csReader ); - InitializeCriticalSection( &This->m_csRequest ); - InitializeCriticalSection( &This->m_csReply ); - InitializeCriticalSection( &This->m_csFree ); - - return NOERROR; -} - -void CAsyncReaderImpl_UninitIAsyncReader( - CAsyncReaderImpl* This ) -{ - TRACE("(%p) enter\n",This); - - CAsyncReaderImpl_ReleaseReqList(This,&This->m_pReplyFirst,TRUE); - CAsyncReaderImpl_ReleaseReqList(This,&This->m_pFreeFirst,TRUE); - - DeleteCriticalSection( &This->m_csReader ); - DeleteCriticalSection( &This->m_csRequest ); - DeleteCriticalSection( &This->m_csReply ); - DeleteCriticalSection( &This->m_csFree ); - - TRACE("(%p) leave\n",This); -} - -/*************************************************************************** - * - * CFileSourceFilterImpl - * - */ - -static HRESULT WINAPI -CFileSourceFilterImpl_fnQueryInterface(IFileSourceFilter* iface,REFIID riid,void** ppobj) -{ - ICOM_THIS(CFileSourceFilterImpl,iface); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->punkControl,riid,ppobj); -} - -static ULONG WINAPI -CFileSourceFilterImpl_fnAddRef(IFileSourceFilter* iface) -{ - ICOM_THIS(CFileSourceFilterImpl,iface); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->punkControl); -} - -static ULONG WINAPI -CFileSourceFilterImpl_fnRelease(IFileSourceFilter* iface) -{ - ICOM_THIS(CFileSourceFilterImpl,iface); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->punkControl); -} - -static HRESULT WINAPI -CFileSourceFilterImpl_fnLoad(IFileSourceFilter* iface,LPCOLESTR pFileName,const AM_MEDIA_TYPE* pmt) -{ - ICOM_THIS(CFileSourceFilterImpl,iface); - HRESULT hr; - - TRACE("(%p)->(%s,%p)\n",This,debugstr_w(pFileName),pmt); - - if ( pFileName == NULL ) - return E_POINTER; - - if ( This->m_pwszFileName != NULL ) - return E_UNEXPECTED; - - This->m_cbFileName = sizeof(WCHAR)*(lstrlenW(pFileName)+1); - This->m_pwszFileName = (WCHAR*)QUARTZ_AllocMem( This->m_cbFileName ); - if ( This->m_pwszFileName == NULL ) - return E_OUTOFMEMORY; - memcpy( This->m_pwszFileName, pFileName, 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) ); - } - - hr = This->pSource->m_pHandler->pLoad( This->pSource, pFileName ); - if ( FAILED(hr) ) - goto err; - - This->pSource->pPin->pin.pmtAcceptTypes = &This->m_mt; - This->pSource->pPin->pin.cAcceptTypes = 1; - - return NOERROR; -err:; - return hr; -} - -static HRESULT WINAPI -CFileSourceFilterImpl_fnGetCurFile(IFileSourceFilter* iface,LPOLESTR* ppFileName,AM_MEDIA_TYPE* pmt) -{ - ICOM_THIS(CFileSourceFilterImpl,iface); - HRESULT hr = E_NOTIMPL; - - TRACE("(%p)->(%p,%p)\n",This,ppFileName,pmt); - - if ( ppFileName == NULL || pmt == NULL ) - return E_POINTER; - - if ( This->m_pwszFileName == NULL ) - return E_FAIL; - - hr = QUARTZ_MediaType_Copy( pmt, &This->m_mt ); - if ( FAILED(hr) ) - return hr; - - *ppFileName = (WCHAR*)CoTaskMemAlloc( This->m_cbFileName ); - if ( *ppFileName == NULL ) - { - QUARTZ_MediaType_Free(pmt); - ZeroMemory( pmt, sizeof(AM_MEDIA_TYPE) ); - return E_OUTOFMEMORY; - } - - memcpy( *ppFileName, This->m_pwszFileName, This->m_cbFileName ); - - return NOERROR; -} - -static ICOM_VTABLE(IFileSourceFilter) ifilesource = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - CFileSourceFilterImpl_fnQueryInterface, - CFileSourceFilterImpl_fnAddRef, - CFileSourceFilterImpl_fnRelease, - /* IFileSourceFilter fields */ - CFileSourceFilterImpl_fnLoad, - CFileSourceFilterImpl_fnGetCurFile, -}; - -HRESULT CFileSourceFilterImpl_InitIFileSourceFilter( - CFileSourceFilterImpl* This, IUnknown* punkControl, - CAsyncSourceImpl* pSource, - CRITICAL_SECTION* pcsFileSource ) -{ - TRACE("(%p,%p)\n",This,punkControl); - - if ( punkControl == NULL ) - { - ERR( "punkControl must not be NULL\n" ); - return E_INVALIDARG; - } - - ICOM_VTBL(This) = &ifilesource; - This->punkControl = punkControl; - This->pSource = pSource; - This->pcsFileSource = pcsFileSource; - This->m_pwszFileName = NULL; - This->m_cbFileName = 0; - ZeroMemory( &This->m_mt, sizeof(AM_MEDIA_TYPE) ); - - return NOERROR; -} - -void CFileSourceFilterImpl_UninitIFileSourceFilter( - CFileSourceFilterImpl* This ) -{ - TRACE("(%p)\n",This); - - This->pSource->m_pHandler->pCleanup( This->pSource ); - if ( This->m_pwszFileName != NULL ) - QUARTZ_FreeMem( This->m_pwszFileName ); - QUARTZ_MediaType_Free( &This->m_mt ); -} - -/*************************************************************************** - * - * CAsyncSourcePinImpl methods - * - */ - - -static HRESULT CAsyncSourcePinImpl_OnPreConnect( CPinBaseImpl* pImpl, IPin* pPin ) -{ - CAsyncSourcePinImpl_THIS(pImpl,pin); - - TRACE("(%p,%p)\n",This,pPin); - - This->bAsyncReaderQueried = FALSE; - - return NOERROR; -} - -static HRESULT CAsyncSourcePinImpl_OnPostConnect( CPinBaseImpl* pImpl, IPin* pPin ) -{ - CAsyncSourcePinImpl_THIS(pImpl,pin); - - TRACE("(%p,%p)\n",This,pPin); - - if ( !This->bAsyncReaderQueried ) - return E_FAIL; - - return NOERROR; -} - -static HRESULT CAsyncSourcePinImpl_OnDisconnect( CPinBaseImpl* pImpl ) -{ - CAsyncSourcePinImpl_THIS(pImpl,pin); - - TRACE("(%p)\n",This); - - This->bAsyncReaderQueried = FALSE; - - return NOERROR; -} - -static HRESULT CAsyncSourcePinImpl_CheckMediaType( CPinBaseImpl* pImpl, const AM_MEDIA_TYPE* pmt ) -{ - CAsyncSourcePinImpl_THIS(pImpl,pin); - - TRACE("(%p,%p)\n",This,pmt); - if ( pmt == NULL ) - return E_POINTER; - - if ( !IsEqualGUID( &pmt->majortype, &MEDIATYPE_Stream ) ) - return E_FAIL; - - return NOERROR; -} - -static const CBasePinHandlers outputpinhandlers = -{ - CAsyncSourcePinImpl_OnPreConnect, /* pOnPreConnect */ - CAsyncSourcePinImpl_OnPostConnect, /* pOnPostConnect */ - CAsyncSourcePinImpl_OnDisconnect, /* pOnDisconnect */ - CAsyncSourcePinImpl_CheckMediaType, /* pCheckMediaType */ - NULL, /* pQualityNotify */ - NULL, /* pReceive */ - NULL, /* pReceiveCanBlock */ - NULL, /* pEndOfStream */ - NULL, /* pBeginFlush */ - NULL, /* pEndFlush */ - NULL, /* pNewSegment */ -}; - -/*************************************************************************** - * - * CAsyncSourceImpl methods - * - */ - -static HRESULT CAsyncSourceImpl_OnStop( CBaseFilterImpl* pImpl ) -{ - CAsyncSourceImpl_THIS(pImpl,basefilter); - CAsyncReaderImpl* pReader; - - TRACE( "(%p)\n", This ); - - if ( This->pPin != NULL ) - { - pReader = &This->pPin->async; - CAsyncReaderImpl_ReleaseReqList(pReader,&pReader->m_pReplyFirst,FALSE); - } - - return NOERROR; -} - -static const CBaseFilterHandlers filterhandlers = -{ - NULL, /* pOnActive */ - NULL, /* pOnInactive */ - CAsyncSourceImpl_OnStop, /* pOnStop */ -}; - -/*************************************************************************** - * - * new/delete CAsyncSourceImpl - * - */ - -/* can I use offsetof safely? - FIXME? */ -static QUARTZ_IFEntry FilterIFEntries[] = -{ - { &IID_IPersist, offsetof(CAsyncSourceImpl,basefilter)-offsetof(CAsyncSourceImpl,unk) }, - { &IID_IMediaFilter, offsetof(CAsyncSourceImpl,basefilter)-offsetof(CAsyncSourceImpl,unk) }, - { &IID_IBaseFilter, offsetof(CAsyncSourceImpl,basefilter)-offsetof(CAsyncSourceImpl,unk) }, - { &IID_IFileSourceFilter, offsetof(CAsyncSourceImpl,filesrc)-offsetof(CAsyncSourceImpl,unk) }, -}; - -static void QUARTZ_DestroyAsyncSource(IUnknown* punk) -{ - CAsyncSourceImpl_THIS(punk,unk); - - TRACE( "(%p)\n", This ); - - if ( This->pPin != NULL ) - { - IUnknown_Release(This->pPin->unk.punkControl); - This->pPin = NULL; - } - - This->m_pHandler->pCleanup( This ); - - CFileSourceFilterImpl_UninitIFileSourceFilter(&This->filesrc); - CBaseFilterImpl_UninitIBaseFilter(&This->basefilter); - - DeleteCriticalSection( &This->csFilter ); -} - -HRESULT QUARTZ_CreateAsyncSource( - IUnknown* punkOuter,void** ppobj, - const CLSID* pclsidAsyncSource, - LPCWSTR pwszAsyncSourceName, - LPCWSTR pwszOutPinName, - const AsyncSourceHandlers* pHandler ) -{ - CAsyncSourceImpl* This = NULL; - HRESULT hr; - - TRACE("(%p,%p)\n",punkOuter,ppobj); - - This = (CAsyncSourceImpl*) - QUARTZ_AllocObj( sizeof(CAsyncSourceImpl) ); - if ( This == NULL ) - return E_OUTOFMEMORY; - - This->pPin = NULL; - This->m_pHandler = pHandler; - This->m_pUserData = NULL; - - QUARTZ_IUnkInit( &This->unk, punkOuter ); - - hr = CBaseFilterImpl_InitIBaseFilter( - &This->basefilter, - This->unk.punkControl, - pclsidAsyncSource, - pwszAsyncSourceName, - &filterhandlers ); - if ( SUCCEEDED(hr) ) - { - /* construct this class. */ - hr = CFileSourceFilterImpl_InitIFileSourceFilter( - &This->filesrc, This->unk.punkControl, - This, &This->csFilter ); - 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_DestroyAsyncSource; - InitializeCriticalSection( &This->csFilter ); - - /* create the output pin. */ - hr = QUARTZ_CreateAsyncSourcePin( - This, &This->csFilter, - &This->pPin, pwszOutPinName ); - if ( SUCCEEDED(hr) ) - hr = QUARTZ_CompList_AddComp( - This->basefilter.pOutPins, - (IUnknown*)&(This->pPin->pin), - NULL, 0 ); - - if ( FAILED(hr) ) - { - IUnknown_Release( This->unk.punkControl ); - return hr; - } - - *ppobj = (void*)&(This->unk); - - return S_OK; -} - -/*************************************************************************** - * - * new/delete CAsyncSourcePinImpl - * - */ - -/* can I use offsetof safely? - FIXME? */ -static QUARTZ_IFEntry OutPinIFEntries[] = -{ - { &IID_IPin, offsetof(CAsyncSourcePinImpl,pin)-offsetof(CAsyncSourcePinImpl,unk) }, - /***{ &IID_IAsyncReader, offsetof(CAsyncSourcePinImpl,async)-offsetof(CAsyncSourcePinImpl,unk) },***/ -}; - -static HRESULT CAsyncSourceImpl_OnQueryInterface( - IUnknown* punk, const IID* piid, void** ppobj ) -{ - CAsyncSourcePinImpl_THIS(punk,unk); - - if ( IsEqualGUID( &IID_IAsyncReader, piid ) ) - { - TRACE("IAsyncReader has been queried.\n"); - *ppobj = (void*)&This->async; - IUnknown_AddRef(punk); - This->bAsyncReaderQueried = TRUE; - return S_OK; - } - - return E_NOINTERFACE; -} - -static void QUARTZ_DestroyAsyncSourcePin(IUnknown* punk) -{ - CAsyncSourcePinImpl_THIS(punk,unk); - - TRACE( "(%p)\n", This ); - - CAsyncReaderImpl_UninitIAsyncReader( &This->async ); - CPinBaseImpl_UninitIPin( &This->pin ); -} - -HRESULT QUARTZ_CreateAsyncSourcePin( - CAsyncSourceImpl* pFilter, - CRITICAL_SECTION* pcsPin, - CAsyncSourcePinImpl** ppPin, - LPCWSTR pwszPinName ) -{ - CAsyncSourcePinImpl* This = NULL; - HRESULT hr; - - TRACE("(%p,%p,%p)\n",pFilter,pcsPin,ppPin); - - This = (CAsyncSourcePinImpl*) - QUARTZ_AllocObj( sizeof(CAsyncSourcePinImpl) ); - if ( This == NULL ) - return E_OUTOFMEMORY; - - QUARTZ_IUnkInit( &This->unk, NULL ); - This->qiext.pNext = NULL; - This->qiext.pOnQueryInterface = &CAsyncSourceImpl_OnQueryInterface; - QUARTZ_IUnkAddDelegation( &This->unk, &This->qiext ); - - This->bAsyncReaderQueried = FALSE; - This->pSource = pFilter; - - hr = CPinBaseImpl_InitIPin( - &This->pin, - This->unk.punkControl, - pcsPin, NULL, - &pFilter->basefilter, - pwszPinName, - TRUE, - &outputpinhandlers ); - - if ( SUCCEEDED(hr) ) - { - hr = CAsyncReaderImpl_InitIAsyncReader( - &This->async, - This->unk.punkControl, - pFilter ); - 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_DestroyAsyncSourcePin; - - *ppPin = This; - - TRACE("returned successfully.\n"); - - return S_OK; -} - - - -/*************************************************************************** - * - * Implements File Source. - * - */ - -typedef struct AsyncSourceFileImpl -{ - HANDLE hFile; - LONGLONG llTotal; -} AsyncSourceFileImpl; - - -static HRESULT AsyncSourceFileImpl_Load( CAsyncSourceImpl* pImpl, LPCWSTR lpwszSourceName ) -{ - AsyncSourceFileImpl* This = (AsyncSourceFileImpl*)pImpl->m_pUserData; - DWORD dwLow; - DWORD dwHigh; - - if ( This != NULL ) - return E_UNEXPECTED; - This = (AsyncSourceFileImpl*)QUARTZ_AllocMem( sizeof(AsyncSourceFileImpl) ); - pImpl->m_pUserData = (void*)This; - if ( This == NULL ) - return E_OUTOFMEMORY; - This->hFile = INVALID_HANDLE_VALUE; - This->llTotal = 0; - - This->hFile = CreateFileW( lpwszSourceName, - GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE)NULL ); - if ( This->hFile == INVALID_HANDLE_VALUE ) - return E_FAIL; - - SetLastError(NO_ERROR); - dwLow = GetFileSize( This->hFile, &dwHigh ); - if ( dwLow == 0xffffffff && GetLastError() != NO_ERROR ) - return E_FAIL; - - This->llTotal = (LONGLONG)dwLow | ((LONGLONG)dwHigh << 32); - - return NOERROR; -} - -static HRESULT AsyncSourceFileImpl_Cleanup( CAsyncSourceImpl* pImpl ) -{ - AsyncSourceFileImpl* This = (AsyncSourceFileImpl*)pImpl->m_pUserData; - - if ( This == NULL ) - return NOERROR; - - if ( This->hFile != INVALID_HANDLE_VALUE ) - CloseHandle(This->hFile); - - QUARTZ_FreeMem(This); - pImpl->m_pUserData = NULL; - - return NOERROR; -} - -static HRESULT AsyncSourceFileImpl_GetLength( CAsyncSourceImpl* pImpl, LONGLONG* pllTotal, LONGLONG* pllAvailable ) -{ - AsyncSourceFileImpl* This = (AsyncSourceFileImpl*)pImpl->m_pUserData; - - if ( This == NULL ) - return E_UNEXPECTED; - - *pllTotal = This->llTotal; - *pllAvailable = This->llTotal; - - return NOERROR; -} - -static HRESULT AsyncSourceFileImpl_Read( CAsyncSourceImpl* pImpl, LONGLONG llOfsStart, LONG lLength, BYTE* pBuf, LONG* plReturned, HANDLE hEventCancel ) -{ - AsyncSourceFileImpl* This = (AsyncSourceFileImpl*)pImpl->m_pUserData; - LONG lReturned; - LONG lBlock; - LONG lOfsLow; - LONG lOfsHigh; - DWORD dw; - HRESULT hr = S_OK; - - if ( This == NULL || This->hFile == INVALID_HANDLE_VALUE ) - return E_UNEXPECTED; - - lReturned = 0; - - lOfsLow = (LONG)(llOfsStart & 0xffffffff); - lOfsHigh = (LONG)(llOfsStart >> 32); - SetLastError(NO_ERROR); - lOfsLow = SetFilePointer( This->hFile, lOfsLow, &lOfsHigh, FILE_BEGIN ); - if ( lOfsLow == (LONG)0xffffffff && GetLastError() != NO_ERROR ) - return E_FAIL; - - while ( lLength > 0 ) - { - if ( hEventCancel != (HANDLE)NULL && - WaitForSingleObject( hEventCancel, 0 ) == WAIT_OBJECT_0 ) - { - hr = S_FALSE; - break; - } - - lBlock = ( lLength > ASYNCSRC_FILE_BLOCKSIZE ) ? - ASYNCSRC_FILE_BLOCKSIZE : lLength; - - if ( !ReadFile(This->hFile,pBuf,(DWORD)lBlock,&dw,NULL) ) - { - hr = E_FAIL; - break; - } - pBuf += dw; - lReturned += (LONG)dw; - lLength -= (LONG)dw; - if ( lBlock > (LONG)dw ) - break; - } - - *plReturned = lReturned; - - return hr; -} - -static const struct AsyncSourceHandlers asyncsrc_file = -{ - AsyncSourceFileImpl_Load, - AsyncSourceFileImpl_Cleanup, - AsyncSourceFileImpl_GetLength, - AsyncSourceFileImpl_Read, -}; - -HRESULT QUARTZ_CreateAsyncReader(IUnknown* punkOuter,void** ppobj) -{ - return QUARTZ_CreateAsyncSource( - punkOuter, ppobj, - &CLSID_AsyncReader, - QUARTZ_wszAsyncFileSourceName, - QUARTZ_wszAsyncFileSourcePinName, - &asyncsrc_file ); -} - -/*************************************************************************** - * - * Implements URL Source. - * - */ - -typedef struct AsyncSourceURLImpl -{ - DWORD dwDummy; -} AsyncSourceURLImpl; - - -static HRESULT AsyncSourceURLImpl_Load( CAsyncSourceImpl* pImpl, LPCWSTR lpwszSourceName ) -{ - AsyncSourceURLImpl* This = (AsyncSourceURLImpl*)pImpl->m_pUserData; - - FIXME("(%p,%p) stub!\n", pImpl, lpwszSourceName); - - if ( This != NULL ) - return E_UNEXPECTED; - This = (AsyncSourceURLImpl*)QUARTZ_AllocMem( sizeof(AsyncSourceURLImpl) ); - pImpl->m_pUserData = (void*)This; - if ( This == NULL ) - return E_OUTOFMEMORY; - - return E_NOTIMPL; -} - -static HRESULT AsyncSourceURLImpl_Cleanup( CAsyncSourceImpl* pImpl ) -{ - AsyncSourceURLImpl* This = (AsyncSourceURLImpl*)pImpl->m_pUserData; - - FIXME("(%p) stub!\n", This); - - if ( This == NULL ) - return NOERROR; - - QUARTZ_FreeMem(This); - pImpl->m_pUserData = NULL; - - return NOERROR; -} - -static HRESULT AsyncSourceURLImpl_GetLength( CAsyncSourceImpl* pImpl, LONGLONG* pllTotal, LONGLONG* pllAvailable ) -{ - AsyncSourceURLImpl* This = (AsyncSourceURLImpl*)pImpl->m_pUserData; - - FIXME("(%p,%p,%p) stub!\n", This, pllTotal, pllAvailable); - - if ( This == NULL ) - return E_UNEXPECTED; - - return E_NOTIMPL; -} - -static HRESULT AsyncSourceURLImpl_Read( CAsyncSourceImpl* pImpl, LONGLONG llOfsStart, LONG lLength, BYTE* pBuf, LONG* plReturned, HANDLE hEventCancel ) -{ - AsyncSourceURLImpl* This = (AsyncSourceURLImpl*)pImpl->m_pUserData; - - FIXME("(%p) stub!\n", This); - - if ( This == NULL ) - return E_UNEXPECTED; - - return E_NOTIMPL; -} - -static const struct AsyncSourceHandlers asyncsrc_url = -{ - AsyncSourceURLImpl_Load, - AsyncSourceURLImpl_Cleanup, - AsyncSourceURLImpl_GetLength, - AsyncSourceURLImpl_Read, -}; - - -HRESULT QUARTZ_CreateURLReader(IUnknown* punkOuter,void** ppobj) -{ - return QUARTZ_CreateAsyncSource( - punkOuter, ppobj, - &CLSID_URLReader, - QUARTZ_wszAsyncURLSourceName, - QUARTZ_wszAsyncURLSourcePinName, - &asyncsrc_url ); -} diff --git a/dlls/quartz/asyncsrc.h b/dlls/quartz/asyncsrc.h deleted file mode 100644 index ae2d2bcd9a6..00000000000 --- a/dlls/quartz/asyncsrc.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Implements Asynchronous File/URL Source. - * - * 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_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 */ diff --git a/dlls/quartz/audioutl.c b/dlls/quartz/audioutl.c deleted file mode 100644 index c68a3789c7b..00000000000 --- a/dlls/quartz/audioutl.c +++ /dev/null @@ -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 - */ - -#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; - } -} - - diff --git a/dlls/quartz/audioutl.h b/dlls/quartz/audioutl.h deleted file mode 100644 index 1a5fb61e60d..00000000000 --- a/dlls/quartz/audioutl.h +++ /dev/null @@ -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 */ diff --git a/dlls/quartz/audren.c b/dlls/quartz/audren.c deleted file mode 100644 index 9a80d633726..00000000000 --- a/dlls/quartz/audren.c +++ /dev/null @@ -1,1048 +0,0 @@ -/* - * Audio Renderer (CLSID_AudioRender) - * - * FIXME - * - implement IReferenceClock. - * - * 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 "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "mmsystem.h" -#include "winerror.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 "audren.h" -#include "seekpass.h" - - -static const WCHAR QUARTZ_AudioRender_Name[] = -{ 'A','u','d','i','o',' ','R','e','n','d','e','r',0 }; -static const WCHAR QUARTZ_AudioRenderPin_Name[] = -{ 'I','n',0 }; - - - -/*************************************************************************** - * - * CAudioRendererImpl waveOut methods (internal) - * - */ - -static -HRESULT QUARTZ_HRESULT_From_MMRESULT( MMRESULT mr ) -{ - HRESULT hr = E_FAIL; - - switch ( mr ) - { - case MMSYSERR_NOERROR: - hr = S_OK; - break; - case MMSYSERR_NOMEM: - hr = E_OUTOFMEMORY; - break; - } - - return hr; -} - -void CAudioRendererImpl_waveOutEventCallback( - HWAVEOUT hwo, UINT uMsg, - DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ) -{ - CAudioRendererImpl* This = (CAudioRendererImpl*)dwInstance; - - if ( uMsg == WOM_DONE ) - SetEvent( This->m_hEventRender ); -} - -static -void CAudioRendererImpl_waveOutReset( - CAudioRendererImpl* This ) -{ - if ( !This->m_fWaveOutInit ) - return; - - waveOutReset( This->m_hWaveOut ); - SetEvent( This->m_hEventRender ); -} - -static -void CAudioRendererImpl_waveOutUninit( - CAudioRendererImpl* This ) -{ - DWORD i; - - TRACE("(%p)\n",This); - - if ( !This->m_fWaveOutInit ) - return; - - waveOutReset( This->m_hWaveOut ); - SetEvent( This->m_hEventRender ); - - for ( i = 0; i < WINE_QUARTZ_WAVEOUT_COUNT; i++ ) - { - if ( This->m_hdr[i].dwFlags & WHDR_PREPARED ) - { - waveOutUnprepareHeader( - This->m_hWaveOut, - &This->m_hdr[i], sizeof(WAVEHDR) ); - This->m_hdr[i].dwFlags = 0; - } - if ( This->m_hdr[i].lpData != NULL ) - { - QUARTZ_FreeMem( This->m_hdr[i].lpData ); - This->m_hdr[i].lpData = NULL; - } - } - - waveOutClose( This->m_hWaveOut ); - This->m_hWaveOut = (HWAVEOUT)NULL; - if ( This->m_hEventRender != (HANDLE)NULL ) - { - CloseHandle( This->m_hEventRender ); - This->m_hEventRender = (HANDLE)NULL; - } - - This->m_fWaveOutInit = FALSE; -} - -static -HRESULT CAudioRendererImpl_waveOutInit( - CAudioRendererImpl* This, WAVEFORMATEX* pwfx ) -{ - MMRESULT mr; - HRESULT hr; - DWORD i; - DWORD dwBlockSize; - - if ( This->m_fWaveOutInit ) - return NOERROR; - - if ( pwfx == NULL ) - return E_POINTER; - if ( pwfx->nBlockAlign == 0 ) - return E_INVALIDARG; - - This->m_hEventRender = (HANDLE)NULL; - This->m_hWaveOut = (HWAVEOUT)NULL; - This->m_dwBlockSize = 0; - This->m_phdrCur = NULL; - ZeroMemory( &This->m_hdr, sizeof(This->m_hdr) ); - - - mr = waveOutOpen( - &This->m_hWaveOut, WAVE_MAPPER, pwfx, - (DWORD)CAudioRendererImpl_waveOutEventCallback, (DWORD)This, - CALLBACK_FUNCTION ); - hr = QUARTZ_HRESULT_From_MMRESULT( mr ); - if ( FAILED(hr) ) - return hr; - This->m_fWaveOutInit = TRUE; - - This->m_hEventRender = CreateEventA( - NULL, TRUE, TRUE, NULL ); - if ( This->m_hEventRender == (HANDLE)NULL ) - { - hr = E_OUTOFMEMORY; - goto err; - } - - dwBlockSize = pwfx->nAvgBytesPerSec / pwfx->nBlockAlign; - if ( dwBlockSize == 0 ) - dwBlockSize = 1; - dwBlockSize *= pwfx->nBlockAlign; - This->m_dwBlockSize = dwBlockSize; - - for ( i = 0; i < WINE_QUARTZ_WAVEOUT_COUNT; i++ ) - { - This->m_hdr[i].lpData = (CHAR*)QUARTZ_AllocMem( dwBlockSize ); - if ( This->m_hdr[i].lpData == NULL ) - { - hr = E_OUTOFMEMORY; - goto err; - } - mr = waveOutPrepareHeader( - This->m_hWaveOut, - &This->m_hdr[i], sizeof(WAVEHDR) ); - hr = QUARTZ_HRESULT_From_MMRESULT( mr ); - if ( FAILED(hr) ) - goto err; - This->m_hdr[i].dwFlags |= WHDR_DONE; - This->m_hdr[i].dwBufferLength = dwBlockSize; - This->m_hdr[i].dwUser = i; - } - - return S_OK; -err: - CAudioRendererImpl_waveOutUninit(This); - return hr; -} - -static HRESULT CAudioRendererImpl_waveOutPause( CAudioRendererImpl* This ) -{ - if ( !This->m_fWaveOutInit ) - return E_UNEXPECTED; - - return QUARTZ_HRESULT_From_MMRESULT( waveOutPause( - This->m_hWaveOut ) ); -} - -static HRESULT CAudioRendererImpl_waveOutRun( CAudioRendererImpl* This ) -{ - if ( !This->m_fWaveOutInit ) - return E_UNEXPECTED; - - return QUARTZ_HRESULT_From_MMRESULT( waveOutRestart( - This->m_hWaveOut ) ); -} - -static -WAVEHDR* CAudioRendererImpl_waveOutGetBuffer( - CAudioRendererImpl* This ) -{ - DWORD i; - - if ( !This->m_fWaveOutInit ) - return NULL; - - if ( This->m_phdrCur != NULL ) - return This->m_phdrCur; - - for ( i = 0; i < WINE_QUARTZ_WAVEOUT_COUNT; i++ ) - { - if ( This->m_hdr[i].dwFlags & WHDR_DONE ) - { - This->m_phdrCur = &(This->m_hdr[i]); - This->m_phdrCur->dwFlags &= ~WHDR_DONE; - This->m_phdrCur->dwBufferLength = 0; - return This->m_phdrCur; - } - } - - return NULL; -} - -static -HRESULT CAudioRendererImpl_waveOutWriteData( - CAudioRendererImpl* This, - const BYTE* pData, DWORD cbData, DWORD* pcbWritten ) -{ - DWORD cbAvail; - - *pcbWritten = 0; - - if ( !This->m_fWaveOutInit ) - return E_UNEXPECTED; - - if ( cbData == 0 ) - return S_OK; - - if ( CAudioRendererImpl_waveOutGetBuffer(This) == NULL ) - return S_FALSE; - - cbAvail = This->m_dwBlockSize - This->m_phdrCur->dwBufferLength; - if ( cbAvail > cbData ) - cbAvail = cbData; - memcpy( This->m_phdrCur->lpData, pData, cbAvail ); - pData += cbAvail; - cbData -= cbAvail; - This->m_phdrCur->dwBufferLength += cbAvail; - - *pcbWritten = cbAvail; - - return S_OK; -} - -static -HRESULT CAudioRendererImpl_waveOutFlush( - CAudioRendererImpl* This ) -{ - MMRESULT mr; - HRESULT hr; - - if ( !This->m_fWaveOutInit ) - return E_UNEXPECTED; - if ( This->m_phdrCur == NULL ) - return E_UNEXPECTED; - - if ( This->m_phdrCur->dwBufferLength == 0 ) - return S_OK; - - mr = waveOutWrite( - This->m_hWaveOut, - This->m_phdrCur, sizeof(WAVEHDR) ); - hr = QUARTZ_HRESULT_From_MMRESULT( mr ); - if ( FAILED(hr) ) - return hr; - - This->m_phdrCur = NULL; - return S_OK; -} - -#if 0 -/* FIXME: Not used for now */ - -static -HRESULT CAudioRendererImpl_waveOutGetVolume( - CAudioRendererImpl* This, - DWORD* pdwLeft, DWORD* pdwRight ) -{ - MMRESULT mr; - HRESULT hr; - DWORD dwVol; - - if ( !This->m_fWaveOutInit ) - return E_UNEXPECTED; - - mr = waveOutGetVolume( - This->m_hWaveOut, &dwVol ); - hr = QUARTZ_HRESULT_From_MMRESULT( mr ); - if ( FAILED(hr) ) - return hr; - - *pdwLeft = LOWORD(dwVol); - *pdwRight = HIWORD(dwVol); - - return NOERROR; -} - -#endif - -static -HRESULT CAudioRendererImpl_waveOutSetVolume( - CAudioRendererImpl* This, - DWORD dwLeft, DWORD dwRight ) -{ - MMRESULT mr; - DWORD dwVol; - - if ( !This->m_fWaveOutInit ) - return E_UNEXPECTED; - - dwVol = dwLeft | (dwRight<<16); - - mr = waveOutSetVolume( - This->m_hWaveOut, dwVol ); - return QUARTZ_HRESULT_From_MMRESULT( mr ); -} - -static HRESULT CAudioRendererImpl_UpdateVolume( CAudioRendererImpl* This ) -{ - HRESULT hr; - long leftlevel; - long rightlevel; - - if ( This->m_lAudioBalance >= 0 ) - { - leftlevel = This->m_lAudioVolume - This->m_lAudioBalance; - rightlevel = This->m_lAudioVolume; - } - else - { - leftlevel = This->m_lAudioVolume; - rightlevel = This->m_lAudioVolume + This->m_lAudioBalance; - } - leftlevel = QUARTZ_DBToAmpFactor( leftlevel ); - rightlevel = QUARTZ_DBToAmpFactor( rightlevel ); - - hr = CAudioRendererImpl_waveOutSetVolume( - This, (DWORD)leftlevel, (DWORD)rightlevel ); - if ( hr == E_UNEXPECTED ) - hr = S_OK; - - return hr; -} - - -/*************************************************************************** - * - * CAudioRendererImpl methods - * - */ - - -static HRESULT CAudioRendererImpl_OnActive( CBaseFilterImpl* pImpl ) -{ - CAudioRendererImpl_THIS(pImpl,basefilter); - HRESULT hr; - - TRACE( "(%p)\n", This ); - - if ( This->pPin->pin.pmtConn == NULL ) - return NOERROR; - - This->m_fInFlush = FALSE; - - hr = CAudioRendererImpl_waveOutRun(This); - if ( FAILED(hr) ) - return hr; - - return NOERROR; -} - -static HRESULT CAudioRendererImpl_OnInactive( CBaseFilterImpl* pImpl ) -{ - CAudioRendererImpl_THIS(pImpl,basefilter); - WAVEFORMATEX* pwfx; - HRESULT hr; - - TRACE( "(%p)\n", This ); - - if ( This->pPin->pin.pmtConn == NULL ) - return NOERROR; - - pwfx = (WAVEFORMATEX*)This->pPin->pin.pmtConn->pbFormat; - if ( pwfx == NULL ) - return E_FAIL; - - This->m_fInFlush = FALSE; - - hr = CAudioRendererImpl_waveOutInit(This,pwfx); - if ( FAILED(hr) ) - return hr; - - hr = CAudioRendererImpl_waveOutPause(This); - if ( FAILED(hr) ) - return hr; - - return NOERROR; -} - -static HRESULT CAudioRendererImpl_OnStop( CBaseFilterImpl* pImpl ) -{ - CAudioRendererImpl_THIS(pImpl,basefilter); - - TRACE( "(%p)\n", This ); - - This->m_fInFlush = TRUE; - - CAudioRendererImpl_waveOutUninit(This); - - This->m_fInFlush = FALSE; - - TRACE("returned\n" ); - - return NOERROR; -} - -static const CBaseFilterHandlers filterhandlers = -{ - CAudioRendererImpl_OnActive, /* pOnActive */ - CAudioRendererImpl_OnInactive, /* pOnInactive */ - CAudioRendererImpl_OnStop, /* pOnStop */ -}; - -/*************************************************************************** - * - * CAudioRendererPinImpl methods - * - */ - -static HRESULT CAudioRendererPinImpl_OnDisconnect( CPinBaseImpl* pImpl ) -{ - CAudioRendererPinImpl_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 CAudioRendererPinImpl_CheckMediaType( CPinBaseImpl* pImpl, const AM_MEDIA_TYPE* pmt ) -{ - CAudioRendererPinImpl_THIS(pImpl,pin); - const WAVEFORMATEX* pwfx; - - TRACE("(%p,%p)\n",This,pmt); - - if ( !IsEqualGUID( &pmt->majortype, &MEDIATYPE_Audio ) ) - { - TRACE("not audio\n"); - return E_FAIL; - } - if ( !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_NULL ) && - !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_PCM ) ) - { - TRACE("not PCM\n"); - return E_FAIL; - } - if ( !IsEqualGUID( &pmt->formattype, &FORMAT_WaveFormatEx ) ) - { - TRACE("not WAVE\n"); - return E_FAIL; - } - - TRACE("testing WAVE header\n"); - - if ( pmt->cbFormat < (sizeof(WAVEFORMATEX)-sizeof(WORD)) ) - return E_FAIL; - - pwfx = (const WAVEFORMATEX*)pmt->pbFormat; - if ( pwfx == NULL ) - return E_FAIL; - if ( pwfx->wFormatTag != 1 ) - return E_FAIL; - - TRACE("returned successfully.\n"); - - return NOERROR; -} - -static HRESULT CAudioRendererPinImpl_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample ) -{ - CAudioRendererPinImpl_THIS(pImpl,pin); - HRESULT hr; - BYTE* pData = NULL; - DWORD dwDataLength; - DWORD dwWritten; - - TRACE( "(%p,%p)\n",This,pSample ); - - if ( !This->pRender->m_fWaveOutInit ) - return E_UNEXPECTED; - if ( pSample == NULL ) - return E_POINTER; - - hr = IMediaSample_GetPointer( pSample, &pData ); - if ( FAILED(hr) ) - return hr; - dwDataLength = (DWORD)IMediaSample_GetActualDataLength( pSample ); - - while ( 1 ) - { - TRACE("trying to write %lu bytes\n",dwDataLength); - - if ( This->pRender->m_fInFlush ) - return S_FALSE; - - ResetEvent( This->pRender->m_hEventRender ); - hr = CAudioRendererImpl_waveOutWriteData( - This->pRender,pData,dwDataLength,&dwWritten); - if ( FAILED(hr) ) - break; - if ( hr == S_FALSE ) - { - WaitForSingleObject( This->pRender->m_hEventRender, INFINITE ); - continue; - } - pData += dwWritten; - dwDataLength -= dwWritten; - hr = CAudioRendererImpl_waveOutFlush(This->pRender); - if ( FAILED(hr) ) - break; - if ( dwDataLength == 0 ) - break; - } - - return hr; -} - -static HRESULT CAudioRendererPinImpl_ReceiveCanBlock( CPinBaseImpl* pImpl ) -{ - CAudioRendererPinImpl_THIS(pImpl,pin); - - TRACE( "(%p)\n", This ); - - /* might block. */ - return S_OK; -} - -static HRESULT CAudioRendererPinImpl_EndOfStream( CPinBaseImpl* pImpl ) -{ - CAudioRendererPinImpl_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 CAudioRendererPinImpl_BeginFlush( CPinBaseImpl* pImpl ) -{ - CAudioRendererPinImpl_THIS(pImpl,pin); - - TRACE( "(%p)\n", This ); - - This->pRender->m_fInFlush = TRUE; - CAudioRendererImpl_waveOutReset(This->pRender); - - return NOERROR; -} - -static HRESULT CAudioRendererPinImpl_EndFlush( CPinBaseImpl* pImpl ) -{ - CAudioRendererPinImpl_THIS(pImpl,pin); - - TRACE( "(%p)\n", This ); - - This->pRender->m_fInFlush = FALSE; - - return NOERROR; -} - -static HRESULT CAudioRendererPinImpl_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate ) -{ - CAudioRendererPinImpl_THIS(pImpl,pin); - - FIXME( "(%p)\n", This ); - - This->pRender->m_fInFlush = FALSE; - - return NOERROR; -} - -static const CBasePinHandlers pinhandlers = -{ - NULL, /* pOnPreConnect */ - NULL, /* pOnPostConnect */ - CAudioRendererPinImpl_OnDisconnect, /* pOnDisconnect */ - CAudioRendererPinImpl_CheckMediaType, /* pCheckMediaType */ - NULL, /* pQualityNotify */ - CAudioRendererPinImpl_Receive, /* pReceive */ - CAudioRendererPinImpl_ReceiveCanBlock, /* pReceiveCanBlock */ - CAudioRendererPinImpl_EndOfStream, /* pEndOfStream */ - CAudioRendererPinImpl_BeginFlush, /* pBeginFlush */ - CAudioRendererPinImpl_EndFlush, /* pEndFlush */ - CAudioRendererPinImpl_NewSegment, /* pNewSegment */ -}; - - -/*************************************************************************** - * - * new/delete CAudioRendererImpl - * - */ - -/* can I use offsetof safely? - FIXME? */ -static QUARTZ_IFEntry FilterIFEntries[] = -{ - { &IID_IPersist, offsetof(CAudioRendererImpl,basefilter)-offsetof(CAudioRendererImpl,unk) }, - { &IID_IMediaFilter, offsetof(CAudioRendererImpl,basefilter)-offsetof(CAudioRendererImpl,unk) }, - { &IID_IBaseFilter, offsetof(CAudioRendererImpl,basefilter)-offsetof(CAudioRendererImpl,unk) }, - { &IID_IBasicAudio, offsetof(CAudioRendererImpl,basaud)-offsetof(CAudioRendererImpl,unk) }, -}; - -static HRESULT CAudioRendererImpl_OnQueryInterface( - IUnknown* punk, const IID* piid, void** ppobj ) -{ - CAudioRendererImpl_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_DestroyAudioRenderer(IUnknown* punk) -{ - CAudioRendererImpl_THIS(punk,unk); - - TRACE( "(%p)\n", This ); - - 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; - } - - CAudioRendererImpl_UninitIBasicAudio(This); - CBaseFilterImpl_UninitIBaseFilter(&This->basefilter); - - DeleteCriticalSection( &This->m_csReceive ); -} - -HRESULT QUARTZ_CreateAudioRenderer(IUnknown* punkOuter,void** ppobj) -{ - CAudioRendererImpl* This = NULL; - HRESULT hr; - - TRACE("(%p,%p)\n",punkOuter,ppobj); - - This = (CAudioRendererImpl*) - QUARTZ_AllocObj( sizeof(CAudioRendererImpl) ); - if ( This == NULL ) - return E_OUTOFMEMORY; - This->pSeekPass = NULL; - This->pPin = NULL; - This->m_fInFlush = FALSE; - This->m_lAudioVolume = 0; - This->m_lAudioBalance = 0; - This->m_fWaveOutInit = FALSE; - This->m_hEventRender = (HANDLE)NULL; - - QUARTZ_IUnkInit( &This->unk, punkOuter ); - This->qiext.pNext = NULL; - This->qiext.pOnQueryInterface = &CAudioRendererImpl_OnQueryInterface; - QUARTZ_IUnkAddDelegation( &This->unk, &This->qiext ); - - hr = CBaseFilterImpl_InitIBaseFilter( - &This->basefilter, - This->unk.punkControl, - &CLSID_AudioRender, - QUARTZ_AudioRender_Name, - &filterhandlers ); - if ( SUCCEEDED(hr) ) - { - hr = CAudioRendererImpl_InitIBasicAudio(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_DestroyAudioRenderer; - - InitializeCriticalSection( &This->m_csReceive ); - - hr = QUARTZ_CreateAudioRendererPin( - 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 CAudioRendererPinImpl - * - */ - -/* can I use offsetof safely? - FIXME? */ -static QUARTZ_IFEntry PinIFEntries[] = -{ - { &IID_IPin, offsetof(CAudioRendererPinImpl,pin)-offsetof(CAudioRendererPinImpl,unk) }, - { &IID_IMemInputPin, offsetof(CAudioRendererPinImpl,meminput)-offsetof(CAudioRendererPinImpl,unk) }, -}; - -static void QUARTZ_DestroyAudioRendererPin(IUnknown* punk) -{ - CAudioRendererPinImpl_THIS(punk,unk); - - TRACE( "(%p)\n", This ); - - CPinBaseImpl_UninitIPin( &This->pin ); - CMemInputPinBaseImpl_UninitIMemInputPin( &This->meminput ); -} - -HRESULT QUARTZ_CreateAudioRendererPin( - CAudioRendererImpl* pFilter, - CRITICAL_SECTION* pcsPin, - CRITICAL_SECTION* pcsPinReceive, - CAudioRendererPinImpl** ppPin) -{ - CAudioRendererPinImpl* This = NULL; - HRESULT hr; - - TRACE("(%p,%p,%p,%p)\n",pFilter,pcsPin,pcsPinReceive,ppPin); - - This = (CAudioRendererPinImpl*) - QUARTZ_AllocObj( sizeof(CAudioRendererPinImpl) ); - 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_AudioRenderPin_Name, - FALSE, - &pinhandlers ); - - 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 = PinIFEntries; - This->unk.dwEntries = sizeof(PinIFEntries)/sizeof(PinIFEntries[0]); - This->unk.pOnFinalRelease = QUARTZ_DestroyAudioRendererPin; - - *ppPin = This; - - TRACE("returned successfully.\n"); - - return S_OK; -} - - -/*************************************************************************** - * - * CAudioRendererImpl::IBasicAudio - * - */ - -static HRESULT WINAPI -IBasicAudio_fnQueryInterface(IBasicAudio* iface,REFIID riid,void** ppobj) -{ - CAudioRendererImpl_THIS(iface,basaud); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); -} - -static ULONG WINAPI -IBasicAudio_fnAddRef(IBasicAudio* iface) -{ - CAudioRendererImpl_THIS(iface,basaud); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->unk.punkControl); -} - -static ULONG WINAPI -IBasicAudio_fnRelease(IBasicAudio* iface) -{ - CAudioRendererImpl_THIS(iface,basaud); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->unk.punkControl); -} - -static HRESULT WINAPI -IBasicAudio_fnGetTypeInfoCount(IBasicAudio* iface,UINT* pcTypeInfo) -{ - CAudioRendererImpl_THIS(iface,basaud); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicAudio_fnGetTypeInfo(IBasicAudio* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj) -{ - CAudioRendererImpl_THIS(iface,basaud); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicAudio_fnGetIDsOfNames(IBasicAudio* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId) -{ - CAudioRendererImpl_THIS(iface,basaud); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicAudio_fnInvoke(IBasicAudio* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr) -{ - CAudioRendererImpl_THIS(iface,basaud); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - - -static HRESULT WINAPI -IBasicAudio_fnput_Volume(IBasicAudio* iface,long lVol) -{ - CAudioRendererImpl_THIS(iface,basaud); - HRESULT hr; - - TRACE("(%p)->(%ld)\n",This,lVol); - - if ( lVol > 0 || lVol < -10000 ) - return E_INVALIDARG; - - EnterCriticalSection( &This->basefilter.csFilter ); - This->m_lAudioVolume = lVol; - hr = CAudioRendererImpl_UpdateVolume( This ); - LeaveCriticalSection( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IBasicAudio_fnget_Volume(IBasicAudio* iface,long* plVol) -{ - CAudioRendererImpl_THIS(iface,basaud); - - TRACE("(%p)->(%p)\n",This,plVol); - - if ( plVol == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->basefilter.csFilter ); - *plVol = This->m_lAudioVolume; - LeaveCriticalSection( &This->basefilter.csFilter ); - - return S_OK; -} - -static HRESULT WINAPI -IBasicAudio_fnput_Balance(IBasicAudio* iface,long lBalance) -{ - CAudioRendererImpl_THIS(iface,basaud); - HRESULT hr; - - TRACE("(%p)->(%ld)\n",This,lBalance); - - if ( lBalance > 0 || lBalance < -10000 ) - return E_INVALIDARG; - - EnterCriticalSection( &This->basefilter.csFilter ); - This->m_lAudioBalance = lBalance; - hr = CAudioRendererImpl_UpdateVolume( This ); - LeaveCriticalSection( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IBasicAudio_fnget_Balance(IBasicAudio* iface,long* plBalance) -{ - CAudioRendererImpl_THIS(iface,basaud); - - TRACE("(%p)->(%p)\n",This,plBalance); - - if ( plBalance == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->basefilter.csFilter ); - *plBalance = This->m_lAudioBalance; - LeaveCriticalSection( &This->basefilter.csFilter ); - - return S_OK; -} - - -static ICOM_VTABLE(IBasicAudio) ibasicaudio = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - IBasicAudio_fnQueryInterface, - IBasicAudio_fnAddRef, - IBasicAudio_fnRelease, - /* IDispatch fields */ - IBasicAudio_fnGetTypeInfoCount, - IBasicAudio_fnGetTypeInfo, - IBasicAudio_fnGetIDsOfNames, - IBasicAudio_fnInvoke, - /* IBasicAudio fields */ - IBasicAudio_fnput_Volume, - IBasicAudio_fnget_Volume, - IBasicAudio_fnput_Balance, - IBasicAudio_fnget_Balance, -}; - - -HRESULT CAudioRendererImpl_InitIBasicAudio( CAudioRendererImpl* This ) -{ - TRACE("(%p)\n",This); - ICOM_VTBL(&This->basaud) = &ibasicaudio; - - return NOERROR; -} - -void CAudioRendererImpl_UninitIBasicAudio( CAudioRendererImpl* This ) -{ - TRACE("(%p)\n",This); -} - diff --git a/dlls/quartz/audren.h b/dlls/quartz/audren.h deleted file mode 100644 index a28d952bd5d..00000000000 --- a/dlls/quartz/audren.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Audio Renderer (CLSID_AudioRender) - * - * FIXME - * - implements IRefereneceClock. - * - * 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_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 */ diff --git a/dlls/quartz/avidec.c b/dlls/quartz/avidec.c deleted file mode 100644 index 241f7c0ef96..00000000000 --- a/dlls/quartz/avidec.c +++ /dev/null @@ -1,458 +0,0 @@ -/* - * Implements AVI Decompressor(CLSID_AVIDec). - * - * 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 "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<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<bmiHeader.biBitCount; - if ( pbiOut->bmiHeader.biClrUsed > (1<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 ); -} - diff --git a/dlls/quartz/aviparse.c b/dlls/quartz/aviparse.c deleted file mode 100644 index f4434bbd695..00000000000 --- a/dlls/quartz/aviparse.c +++ /dev/null @@ -1,720 +0,0 @@ -/* - * Implements AVI Parser(Splitter). - * - * FIXME - no seeking - * - * 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 "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 ); -} - - diff --git a/dlls/quartz/basefilt.c b/dlls/quartz/basefilt.c deleted file mode 100644 index 143dbd3bacf..00000000000 --- a/dlls/quartz/basefilt.c +++ /dev/null @@ -1,586 +0,0 @@ -/* - * Implements IBaseFilter. (internal) - * - * 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 "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; -} - diff --git a/dlls/quartz/basefilt.h b/dlls/quartz/basefilt.h deleted file mode 100644 index 3b7daaba296..00000000000 --- a/dlls/quartz/basefilt.h +++ /dev/null @@ -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 */ diff --git a/dlls/quartz/basepin.c b/dlls/quartz/basepin.c deleted file mode 100644 index cb1fb029c59..00000000000 --- a/dlls/quartz/basepin.c +++ /dev/null @@ -1,1462 +0,0 @@ -/* - * Implements IPin and IMemInputPin. (internal) - * - * 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 "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 "memalloc.h" - - -/*************************************************************************** - * - * CPinBaseImpl - * - */ - -static HRESULT WINAPI -CPinBaseImpl_fnQueryInterface(IPin* iface,REFIID riid,void** ppobj) -{ - ICOM_THIS(CPinBaseImpl,iface); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->punkControl,riid,ppobj); -} - -static ULONG WINAPI -CPinBaseImpl_fnAddRef(IPin* iface) -{ - ICOM_THIS(CPinBaseImpl,iface); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->punkControl); -} - -static ULONG WINAPI -CPinBaseImpl_fnRelease(IPin* iface) -{ - ICOM_THIS(CPinBaseImpl,iface); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->punkControl); -} - -static HRESULT WINAPI -CPinBaseImpl_fnConnect(IPin* iface,IPin* pPin,const AM_MEDIA_TYPE* pmt) -{ - ICOM_THIS(CPinBaseImpl,iface); - HRESULT hr = E_NOTIMPL; - ULONG i; - FILTER_STATE fs; - - TRACE("(%p)->(%p,%p)\n",This,pPin,pmt); - - if ( !This->bOutput ) - { - TRACE("Connect() should not be sent to input pins\n"); - return E_UNEXPECTED; - } - if ( pPin == NULL ) - return E_POINTER; - - TRACE("try to connect to %p\n",pPin); - - EnterCriticalSection( This->pcsPin ); - - if ( This->pPinConnectedTo != NULL ) - { - hr = VFW_E_ALREADY_CONNECTED; - goto err; - } - - /* return fail if running */ - hr = IBaseFilter_GetState((IBaseFilter*)(This->pFilter),0,&fs); - if ( hr != S_OK || fs != State_Stopped ) - { - TRACE("not stopped\n"); - hr = VFW_E_NOT_STOPPED; - goto err; - } - - if ( This->pHandlers->pOnPreConnect != NULL ) - { - hr = This->pHandlers->pOnPreConnect(This,pPin); - if ( FAILED(hr) ) - { - TRACE("OnPreconnect() failed hr = %08lx\n",hr); - goto err; - } - } - - if ( pmt != NULL ) - { - hr = IPin_QueryAccept(iface,pmt); - if ( FAILED(hr) ) - goto err; - This->pPinConnectedTo = pPin; - hr = IPin_ReceiveConnection(pPin,iface,pmt); - This->pPinConnectedTo = NULL; - if ( FAILED(hr) ) - goto err; - } - else - { - for ( i = 0; i < This->cAcceptTypes; i++ ) - { - pmt = &This->pmtAcceptTypes[i]; - hr = IPin_QueryAccept(iface,pmt); - if ( SUCCEEDED(hr) ) - { - This->pPinConnectedTo = pPin; - hr = IPin_ReceiveConnection(pPin,iface,pmt); - This->pPinConnectedTo = NULL; - - TRACE("ReceiveConnection - %08lx\n",hr); - if ( SUCCEEDED(hr) ) - { - goto connected; - } - } - } - - hr = VFW_E_TYPE_NOT_ACCEPTED; - goto err; - } - -connected:; - This->pmtConn = QUARTZ_MediaType_Duplicate( pmt ); - if ( This->pmtConn == NULL ) - { - hr = E_OUTOFMEMORY; - IPin_Disconnect(pPin); - goto err; - } - - This->pPinConnectedTo = pPin; IPin_AddRef(pPin); - hr = IPin_QueryInterface(pPin,&IID_IMemInputPin,(void**)&This->pMemInputPinConnectedTo); - if ( FAILED(hr) ) - { - TRACE("no IMemInputPin\n"); - IPin_Disconnect(pPin); - goto err; - } - - if ( This->pHandlers->pOnPostConnect != NULL ) - { - hr = This->pHandlers->pOnPostConnect(This,pPin); - if ( FAILED(hr) ) - { - TRACE("OnPostConnect() failed hr = %08lx\n",hr); - IPin_Disconnect(pPin); - goto err; - } - } - - hr = S_OK; - -err: - if ( FAILED(hr) ) - { - IPin_Disconnect(iface); - } - LeaveCriticalSection( This->pcsPin ); - - TRACE("return %08lx\n",hr); - - return hr; -} - -static HRESULT WINAPI -CPinBaseImpl_fnReceiveConnection(IPin* iface,IPin* pPin,const AM_MEDIA_TYPE* pmt) -{ - ICOM_THIS(CPinBaseImpl,iface); - HRESULT hr = E_NOTIMPL; - FILTER_STATE fs; - - TRACE("(%p)->(%p,%p)\n",This,pPin,pmt); - - if ( This->bOutput ) - { - TRACE("ReceiveConnection() should not be sent to output pins\n"); - return E_UNEXPECTED; - } - if ( pPin == NULL || pmt == NULL ) - return E_POINTER; - - EnterCriticalSection( This->pcsPin ); - - if ( This->pPinConnectedTo != NULL ) - { - hr = VFW_E_ALREADY_CONNECTED; - goto err; - } - - /* return fail if running */ - hr = IBaseFilter_GetState((IBaseFilter*)(This->pFilter),0,&fs); - if ( hr != S_OK || fs != State_Stopped ) - { - TRACE("not stopped\n"); - hr = VFW_E_NOT_STOPPED; - goto err; - } - - if ( This->pHandlers->pOnPreConnect != NULL ) - { - hr = This->pHandlers->pOnPreConnect(This,pPin); - if ( FAILED(hr) ) - { - TRACE("OnPreConnect() failed hr = %08lx\n",hr); - goto err; - } - } - - hr = IPin_QueryAccept(iface,pmt); - if ( FAILED(hr) ) - goto err; - - This->pmtConn = QUARTZ_MediaType_Duplicate( pmt ); - if ( This->pmtConn == NULL ) - { - hr = E_OUTOFMEMORY; - goto err; - } - - if ( This->pHandlers->pOnPostConnect != NULL ) - { - hr = This->pHandlers->pOnPostConnect(This,pPin); - if ( FAILED(hr) ) - { - TRACE("OnPostConnect() failed hr = %08lx\n",hr); - goto err; - } - } - - hr = S_OK; - This->pPinConnectedTo = pPin; IPin_AddRef(pPin); - -err: - if ( FAILED(hr) ) - IPin_Disconnect(iface); - LeaveCriticalSection( This->pcsPin ); - - return hr; -} - -static HRESULT WINAPI -CPinBaseImpl_fnDisconnect(IPin* iface) -{ - ICOM_THIS(CPinBaseImpl,iface); - HRESULT hr = NOERROR; - FILTER_STATE fs; - - TRACE("(%p)->()\n",This); - - EnterCriticalSection( This->pcsPin ); - - /* return fail if running */ - hr = IBaseFilter_GetState((IBaseFilter*)(This->pFilter),0,&fs); - if ( hr != S_OK || fs != State_Stopped ) - { - TRACE("not stopped\n"); - hr = VFW_E_NOT_STOPPED; - goto err; - } - - if ( This->pHandlers->pOnDisconnect != NULL ) - hr = This->pHandlers->pOnDisconnect(This); - - if ( This->pmtConn != NULL ) - { - QUARTZ_MediaType_Destroy( This->pmtConn ); - This->pmtConn = NULL; - } - if ( This->pMemInputPinConnectedTo != NULL ) - { - IMemInputPin_Release(This->pMemInputPinConnectedTo); - This->pMemInputPinConnectedTo = NULL; - } - if ( This->pPinConnectedTo != NULL ) - { - /* FIXME - cleanup */ - - IPin_Release(This->pPinConnectedTo); - This->pPinConnectedTo = NULL; - hr = NOERROR; - } - else - { - hr = S_FALSE; /* FIXME - is this correct??? */ - } - -err: - LeaveCriticalSection( This->pcsPin ); - - return hr; -} - -static HRESULT WINAPI -CPinBaseImpl_fnConnectedTo(IPin* iface,IPin** ppPin) -{ - ICOM_THIS(CPinBaseImpl,iface); - HRESULT hr = VFW_E_NOT_CONNECTED; - - TRACE("(%p)->(%p)\n",This,ppPin); - - if ( ppPin == NULL ) - return E_POINTER; - - EnterCriticalSection( This->pcsPin ); - - *ppPin = This->pPinConnectedTo; - if ( This->pPinConnectedTo != NULL ) - { - IPin_AddRef(This->pPinConnectedTo); - hr = NOERROR; - } - - LeaveCriticalSection( This->pcsPin ); - - return hr; -} - -static HRESULT WINAPI -CPinBaseImpl_fnConnectionMediaType(IPin* iface,AM_MEDIA_TYPE* pmt) -{ - ICOM_THIS(CPinBaseImpl,iface); - HRESULT hr = E_FAIL; - - TRACE("(%p)->(%p)\n",This,pmt); - - if ( pmt == NULL ) - return E_POINTER; - - EnterCriticalSection( This->pcsPin ); - - if ( This->pmtConn != NULL ) - { - hr = QUARTZ_MediaType_Copy( pmt, This->pmtConn ); - } - else - { - ZeroMemory( pmt, sizeof(AM_MEDIA_TYPE) ); - pmt->bFixedSizeSamples = TRUE; - pmt->lSampleSize = 1; - hr = VFW_E_NOT_CONNECTED; - } - - LeaveCriticalSection( This->pcsPin ); - - return hr; -} - -static HRESULT WINAPI -CPinBaseImpl_fnQueryPinInfo(IPin* iface,PIN_INFO* pinfo) -{ - ICOM_THIS(CPinBaseImpl,iface); - - TRACE("(%p)->(%p)\n",This,pinfo); - - if ( pinfo == NULL ) - return E_POINTER; - - EnterCriticalSection( This->pcsPin ); - - ZeroMemory( pinfo, sizeof(PIN_INFO) ); - pinfo->pFilter = (IBaseFilter*)(This->pFilter); - if ( pinfo->pFilter != NULL ) - IBaseFilter_AddRef( pinfo->pFilter ); - pinfo->dir = This->bOutput ? PINDIR_OUTPUT : PINDIR_INPUT; - if ( This->cbIdLen <= sizeof(pinfo->achName) ) - memcpy( pinfo->achName, This->pwszId, This->cbIdLen ); - else - { - memcpy( pinfo->achName, This->pwszId, sizeof(pinfo->achName) ); - pinfo->achName[sizeof(pinfo->achName)/sizeof(pinfo->achName[0])-1] = 0; - } - - LeaveCriticalSection( This->pcsPin ); - - return NOERROR; -} - -static HRESULT WINAPI -CPinBaseImpl_fnQueryDirection(IPin* iface,PIN_DIRECTION* pdir) -{ - ICOM_THIS(CPinBaseImpl,iface); - - TRACE("(%p)->(%p)\n",This,pdir); - - if ( pdir == NULL ) - return E_POINTER; - - *pdir = This->bOutput ? PINDIR_OUTPUT : PINDIR_INPUT; - - return NOERROR; -} - -static HRESULT WINAPI -CPinBaseImpl_fnQueryId(IPin* iface,LPWSTR* lpwszId) -{ - ICOM_THIS(CPinBaseImpl,iface); - - TRACE("(%p)->(%p)\n",This,lpwszId); - - if ( lpwszId == NULL ) - return E_POINTER; - - *lpwszId = (WCHAR*)CoTaskMemAlloc( This->cbIdLen ); - if ( *lpwszId == NULL ) - return E_OUTOFMEMORY; - memcpy( *lpwszId, This->pwszId, This->cbIdLen ); - - return NOERROR; -} - -static HRESULT WINAPI -CPinBaseImpl_fnQueryAccept(IPin* iface,const AM_MEDIA_TYPE* pmt) -{ - ICOM_THIS(CPinBaseImpl,iface); - HRESULT hr; - - TRACE("(%p)->(%p)\n",This,pmt); - - if ( pmt == NULL ) - return E_POINTER; - - hr = NOERROR; - EnterCriticalSection( This->pcsPin ); - if ( This->pHandlers->pCheckMediaType != NULL ) - hr = This->pHandlers->pCheckMediaType(This,pmt); - LeaveCriticalSection( This->pcsPin ); - - return hr; -} - -static HRESULT WINAPI -CPinBaseImpl_fnEnumMediaTypes(IPin* iface,IEnumMediaTypes** ppenum) -{ - ICOM_THIS(CPinBaseImpl,iface); - HRESULT hr; - - TRACE("(%p)->(%p)\n",This,ppenum); - - if ( ppenum == NULL ) - return E_POINTER; - - hr = E_NOTIMPL; - - EnterCriticalSection( This->pcsPin ); - if ( This->cAcceptTypes > 0 ) - hr = QUARTZ_CreateEnumMediaTypes( - ppenum, This->pmtAcceptTypes, This->cAcceptTypes ); - LeaveCriticalSection( This->pcsPin ); - - return hr; -} - -static HRESULT WINAPI -CPinBaseImpl_fnQueryInternalConnections(IPin* iface,IPin** ppPin,ULONG* pul) -{ - ICOM_THIS(CPinBaseImpl,iface); - - TRACE("(%p)->(%p,%p)\n",This,ppPin,pul); - - /* E_NOTIMPL means 'no internal connections'. */ - return E_NOTIMPL; -} - -static HRESULT WINAPI -CPinBaseImpl_fnEndOfStream(IPin* iface) -{ - ICOM_THIS(CPinBaseImpl,iface); - HRESULT hr = E_NOTIMPL; - - TRACE("(%p)->()\n",This); - - if ( This->bOutput ) - return E_UNEXPECTED; - - EnterCriticalSection( This->pcsPinReceive ); - if ( This->pHandlers->pEndOfStream != NULL ) - hr = This->pHandlers->pEndOfStream(This); - LeaveCriticalSection( This->pcsPinReceive ); - - return hr; -} - -static HRESULT WINAPI -CPinBaseImpl_fnBeginFlush(IPin* iface) -{ - ICOM_THIS(CPinBaseImpl,iface); - HRESULT hr = E_NOTIMPL; - - TRACE("(%p)->()\n",This); - - if ( This->bOutput ) - return E_UNEXPECTED; - - EnterCriticalSection( This->pcsPin ); - if ( This->pHandlers->pBeginFlush != NULL ) - hr = This->pHandlers->pBeginFlush(This); - LeaveCriticalSection( This->pcsPin ); - - EnterCriticalSection( This->pcsPinReceive ); - LeaveCriticalSection( This->pcsPinReceive ); - - return hr; -} - -static HRESULT WINAPI -CPinBaseImpl_fnEndFlush(IPin* iface) -{ - ICOM_THIS(CPinBaseImpl,iface); - HRESULT hr = E_NOTIMPL; - - TRACE("(%p)->()\n",This); - - if ( This->bOutput ) - return E_UNEXPECTED; - - EnterCriticalSection( This->pcsPin ); - if ( This->pHandlers->pEndFlush != NULL ) - hr = This->pHandlers->pEndFlush(This); - LeaveCriticalSection( This->pcsPin ); - - return hr; -} - -static HRESULT WINAPI -CPinBaseImpl_fnNewSegment(IPin* iface,REFERENCE_TIME rtStart,REFERENCE_TIME rtStop,double rate) -{ - ICOM_THIS(CPinBaseImpl,iface); - HRESULT hr = E_NOTIMPL; - - TRACE("(%p)->()\n",This); - - if ( This->bOutput ) - return E_UNEXPECTED; - - EnterCriticalSection( This->pcsPin ); - if ( This->pHandlers->pNewSegment != NULL ) - hr = This->pHandlers->pNewSegment(This,rtStart,rtStop,rate); - LeaveCriticalSection( This->pcsPin ); - - return hr; -} - - - - -static ICOM_VTABLE(IPin) ipin = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - CPinBaseImpl_fnQueryInterface, - CPinBaseImpl_fnAddRef, - CPinBaseImpl_fnRelease, - /* IPin fields */ - CPinBaseImpl_fnConnect, - CPinBaseImpl_fnReceiveConnection, - CPinBaseImpl_fnDisconnect, - CPinBaseImpl_fnConnectedTo, - CPinBaseImpl_fnConnectionMediaType, - CPinBaseImpl_fnQueryPinInfo, - CPinBaseImpl_fnQueryDirection, - CPinBaseImpl_fnQueryId, - CPinBaseImpl_fnQueryAccept, - CPinBaseImpl_fnEnumMediaTypes, - CPinBaseImpl_fnQueryInternalConnections, - CPinBaseImpl_fnEndOfStream, - CPinBaseImpl_fnBeginFlush, - CPinBaseImpl_fnEndFlush, - CPinBaseImpl_fnNewSegment, -}; - - -HRESULT CPinBaseImpl_InitIPin( - CPinBaseImpl* This, IUnknown* punkControl, - CRITICAL_SECTION* pcsPin, - CRITICAL_SECTION* pcsPinReceive, - CBaseFilterImpl* pFilter, LPCWSTR pwszId, - BOOL bOutput, - const CBasePinHandlers* pHandlers ) -{ - HRESULT hr = NOERROR; - - TRACE("(%p,%p,%p)\n",This,punkControl,pFilter); - - if ( punkControl == NULL ) - { - ERR( "punkControl must not be NULL\n" ); - return E_INVALIDARG; - } - - ICOM_VTBL(This) = &ipin; - This->punkControl = punkControl; - This->pHandlers = pHandlers; - This->cbIdLen = sizeof(WCHAR)*(lstrlenW(pwszId)+1); - This->pwszId = NULL; - This->bOutput = bOutput; - This->pmtAcceptTypes = NULL; - This->cAcceptTypes = 0; - This->pcsPin = pcsPin; - This->pcsPinReceive = pcsPinReceive; - This->pFilter = pFilter; - This->pPinConnectedTo = NULL; - This->pMemInputPinConnectedTo = NULL; - This->pmtConn = NULL; - This->pAsyncOut = NULL; - - This->pwszId = (WCHAR*)QUARTZ_AllocMem( This->cbIdLen ); - if ( This->pwszId == NULL ) - { - hr = E_OUTOFMEMORY; - goto err; - } - memcpy( This->pwszId, pwszId, This->cbIdLen ); - - return NOERROR; - -err:; - CPinBaseImpl_UninitIPin( This ); - return hr; -} - -void CPinBaseImpl_UninitIPin( CPinBaseImpl* This ) -{ - TRACE("(%p)\n",This); - - IPin_Disconnect( (IPin*)(This) ); - - if ( This->pwszId != NULL ) - { - QUARTZ_FreeMem( This->pwszId ); - This->pwszId = NULL; - } -} - - -/*************************************************************************** - * - * CMemInputPinBaseImpl - * - */ - - -static HRESULT WINAPI -CMemInputPinBaseImpl_fnQueryInterface(IMemInputPin* iface,REFIID riid,void** ppobj) -{ - ICOM_THIS(CMemInputPinBaseImpl,iface); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->punkControl,riid,ppobj); -} - -static ULONG WINAPI -CMemInputPinBaseImpl_fnAddRef(IMemInputPin* iface) -{ - ICOM_THIS(CMemInputPinBaseImpl,iface); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->punkControl); -} - -static ULONG WINAPI -CMemInputPinBaseImpl_fnRelease(IMemInputPin* iface) -{ - ICOM_THIS(CMemInputPinBaseImpl,iface); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->punkControl); -} - - -static HRESULT WINAPI -CMemInputPinBaseImpl_fnGetAllocator(IMemInputPin* iface,IMemAllocator** ppAllocator) -{ - ICOM_THIS(CMemInputPinBaseImpl,iface); - HRESULT hr = NOERROR; - IUnknown* punk; - - TRACE("(%p)->()\n",This); - - if ( ppAllocator == NULL ) - return E_POINTER; - - EnterCriticalSection( This->pPin->pcsPin ); - - if ( This->pAllocator == NULL ) - { - hr = QUARTZ_CreateMemoryAllocator(NULL,(void**)&punk); - if ( hr == NOERROR ) - { - hr = IUnknown_QueryInterface(punk, - &IID_IMemAllocator,(void**)&This->pAllocator); - IUnknown_Release(punk); - } - } - - if ( hr == NOERROR ) - { - *ppAllocator = This->pAllocator; - IMemAllocator_AddRef(This->pAllocator); - } - - LeaveCriticalSection( This->pPin->pcsPin ); - - return hr; -} - -static HRESULT WINAPI -CMemInputPinBaseImpl_fnNotifyAllocator(IMemInputPin* iface,IMemAllocator* pAllocator,BOOL bReadonly) -{ - ICOM_THIS(CMemInputPinBaseImpl,iface); - - TRACE("(%p)->()\n",This); - - if ( pAllocator == NULL ) - return E_POINTER; - - EnterCriticalSection( This->pPin->pcsPin ); - - if ( This->pAllocator != NULL ) - { - IMemAllocator_Release(This->pAllocator); - This->pAllocator = NULL; - } - This->pAllocator = pAllocator; - IMemAllocator_AddRef(This->pAllocator); - - This->bReadonly = bReadonly; - - LeaveCriticalSection( This->pPin->pcsPin ); - - return NOERROR; -} - -static HRESULT WINAPI -CMemInputPinBaseImpl_fnGetAllocatorRequirements(IMemInputPin* iface,ALLOCATOR_PROPERTIES* pProp) -{ - ICOM_THIS(CMemInputPinBaseImpl,iface); - - TRACE("(%p)->(%p)\n",This,pProp); - - if ( pProp == NULL ) - return E_POINTER; - - /* E_MOTIMPL means 'no requirements' */ - return E_NOTIMPL; -} - -static HRESULT WINAPI -CMemInputPinBaseImpl_fnReceive(IMemInputPin* iface,IMediaSample* pSample) -{ - ICOM_THIS(CMemInputPinBaseImpl,iface); - HRESULT hr = E_NOTIMPL; - - TRACE("(%p)->(%p)\n",This,pSample); - - EnterCriticalSection( This->pPin->pcsPinReceive ); - if ( This->pPin->pHandlers->pReceive != NULL ) - hr = This->pPin->pHandlers->pReceive(This->pPin,pSample); - LeaveCriticalSection( This->pPin->pcsPinReceive ); - - return hr; -} - -static HRESULT WINAPI -CMemInputPinBaseImpl_fnReceiveMultiple(IMemInputPin* iface,IMediaSample** ppSample,long nSample,long* pnSampleProcessed) -{ - ICOM_THIS(CMemInputPinBaseImpl,iface); - long n; - HRESULT hr; - - TRACE("(%p)->()\n",This); - - if ( ppSample == NULL || pnSampleProcessed == NULL ) - return E_POINTER; - - hr = NOERROR; - for ( n = 0; n < nSample; n++ ) - { - hr = IMemInputPin_Receive(iface,ppSample[n]); - if ( FAILED(hr) ) - break; - } - - *pnSampleProcessed = n; - return hr; -} - -static HRESULT WINAPI -CMemInputPinBaseImpl_fnReceiveCanBlock(IMemInputPin* iface) -{ - ICOM_THIS(CMemInputPinBaseImpl,iface); - HRESULT hr = E_NOTIMPL; - - TRACE("(%p)->()\n",This); - - EnterCriticalSection( This->pPin->pcsPin ); - if ( This->pPin->pHandlers->pReceiveCanBlock != NULL ) - hr = This->pPin->pHandlers->pReceiveCanBlock(This->pPin); - LeaveCriticalSection( This->pPin->pcsPin ); - - return hr; -} - - -static ICOM_VTABLE(IMemInputPin) imeminputpin = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - CMemInputPinBaseImpl_fnQueryInterface, - CMemInputPinBaseImpl_fnAddRef, - CMemInputPinBaseImpl_fnRelease, - /* IMemInputPin fields */ - CMemInputPinBaseImpl_fnGetAllocator, - CMemInputPinBaseImpl_fnNotifyAllocator, - CMemInputPinBaseImpl_fnGetAllocatorRequirements, - CMemInputPinBaseImpl_fnReceive, - CMemInputPinBaseImpl_fnReceiveMultiple, - CMemInputPinBaseImpl_fnReceiveCanBlock, -}; - -HRESULT CMemInputPinBaseImpl_InitIMemInputPin( - CMemInputPinBaseImpl* This, IUnknown* punkControl, - CPinBaseImpl* pPin ) -{ - TRACE("(%p,%p)\n",This,punkControl); - - if ( punkControl == NULL ) - { - ERR( "punkControl must not be NULL\n" ); - return E_INVALIDARG; - } - - ICOM_VTBL(This) = &imeminputpin; - This->punkControl = punkControl; - This->pPin = pPin; - This->pAllocator = NULL; - This->bReadonly = FALSE; - - return NOERROR; -} - -void CMemInputPinBaseImpl_UninitIMemInputPin( - CMemInputPinBaseImpl* This ) -{ - TRACE("(%p)\n",This); - - if ( This->pAllocator != NULL ) - { - IMemAllocator_Release(This->pAllocator); - This->pAllocator = NULL; - } -} - -/*************************************************************************** - * - * CQualityControlPassThruImpl - * - */ - -static HRESULT WINAPI -CQualityControlPassThruImpl_fnQueryInterface(IQualityControl* iface,REFIID riid,void** ppobj) -{ - ICOM_THIS(CQualityControlPassThruImpl,iface); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->punkControl,riid,ppobj); -} - -static ULONG WINAPI -CQualityControlPassThruImpl_fnAddRef(IQualityControl* iface) -{ - ICOM_THIS(CQualityControlPassThruImpl,iface); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->punkControl); -} - -static ULONG WINAPI -CQualityControlPassThruImpl_fnRelease(IQualityControl* iface) -{ - ICOM_THIS(CQualityControlPassThruImpl,iface); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->punkControl); -} - - -static HRESULT WINAPI -CQualityControlPassThruImpl_fnNotify(IQualityControl* iface,IBaseFilter* pFilter,Quality q) -{ - ICOM_THIS(CQualityControlPassThruImpl,iface); - HRESULT hr = S_FALSE; - - TRACE("(%p)->()\n",This); - - if ( This->pControl != NULL ) - return IQualityControl_Notify( This->pControl, pFilter, q ); - - EnterCriticalSection( This->pPin->pcsPin ); - if ( This->pPin->pHandlers->pQualityNotify != NULL ) - hr = This->pPin->pHandlers->pQualityNotify(This->pPin,pFilter,q); - LeaveCriticalSection( This->pPin->pcsPin ); - - return hr; -} - -static HRESULT WINAPI -CQualityControlPassThruImpl_fnSetSink(IQualityControl* iface,IQualityControl* pControl) -{ - ICOM_THIS(CQualityControlPassThruImpl,iface); - - TRACE("(%p)->()\n",This); - - This->pControl = pControl; /* AddRef() must not be called */ - - return NOERROR; -} - -static ICOM_VTABLE(IQualityControl) iqualitycontrol = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - CQualityControlPassThruImpl_fnQueryInterface, - CQualityControlPassThruImpl_fnAddRef, - CQualityControlPassThruImpl_fnRelease, - /* IQualityControl fields */ - CQualityControlPassThruImpl_fnNotify, - CQualityControlPassThruImpl_fnSetSink, -}; - -HRESULT CQualityControlPassThruImpl_InitIQualityControl( - CQualityControlPassThruImpl* This, IUnknown* punkControl, - CPinBaseImpl* pPin ) -{ - TRACE("(%p,%p)\n",This,punkControl); - - if ( punkControl == NULL ) - { - ERR( "punkControl must not be NULL\n" ); - return E_INVALIDARG; - } - - ICOM_VTBL(This) = &iqualitycontrol; - This->punkControl = punkControl; - This->pPin = pPin; - - return NOERROR; -} - -void CQualityControlPassThruImpl_UninitIQualityControl( - CQualityControlPassThruImpl* This ) -{ -} - -/*************************************************************************** - * - * helper methods for output pins. - * - */ - -HRESULT CPinBaseImpl_SendSample( CPinBaseImpl* This, IMediaSample* pSample ) -{ - if ( This->pHandlers->pReceive == NULL ) - return E_NOTIMPL; - - return This->pHandlers->pReceive( This, pSample ); -} - -HRESULT CPinBaseImpl_SendReceiveCanBlock( CPinBaseImpl* This ) -{ - if ( This->pHandlers->pReceiveCanBlock == NULL ) - return E_NOTIMPL; - - return This->pHandlers->pReceiveCanBlock( This ); -} - -HRESULT CPinBaseImpl_SendEndOfStream( CPinBaseImpl* This ) -{ - if ( This->pHandlers->pEndOfStream == NULL ) - return E_NOTIMPL; - - return This->pHandlers->pEndOfStream( This ); -} - -HRESULT CPinBaseImpl_SendBeginFlush( CPinBaseImpl* This ) -{ - if ( This->pHandlers->pBeginFlush == NULL ) - return E_NOTIMPL; - - return This->pHandlers->pBeginFlush( This ); -} - -HRESULT CPinBaseImpl_SendEndFlush( CPinBaseImpl* This ) -{ - if ( This->pHandlers->pEndFlush == NULL ) - return E_NOTIMPL; - - return This->pHandlers->pEndFlush( This ); -} - -HRESULT CPinBaseImpl_SendNewSegment( CPinBaseImpl* This, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate ) -{ - if ( This->pHandlers->pNewSegment == NULL ) - return E_NOTIMPL; - - return This->pHandlers->pNewSegment( This, rtStart, rtStop, rate ); -} - - - -/*************************************************************************** - * - * handlers for output pins. - * - */ - -HRESULT OutputPinSync_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample ) -{ - if ( pImpl->pMemInputPinConnectedTo == NULL ) - return NOERROR; - - return IMemInputPin_Receive(pImpl->pMemInputPinConnectedTo,pSample); -} - -HRESULT OutputPinSync_ReceiveCanBlock( CPinBaseImpl* pImpl ) -{ - if ( pImpl->pMemInputPinConnectedTo == NULL ) - return S_FALSE; - - return IMemInputPin_ReceiveCanBlock(pImpl->pMemInputPinConnectedTo); -} - -HRESULT OutputPinSync_EndOfStream( CPinBaseImpl* pImpl ) -{ - if ( pImpl->pPinConnectedTo == NULL ) - return NOERROR; - - return IPin_EndOfStream(pImpl->pPinConnectedTo); -} - -HRESULT OutputPinSync_BeginFlush( CPinBaseImpl* pImpl ) -{ - if ( pImpl->pPinConnectedTo == NULL ) - return NOERROR; - - return IPin_BeginFlush(pImpl->pPinConnectedTo); -} - -HRESULT OutputPinSync_EndFlush( CPinBaseImpl* pImpl ) -{ - if ( pImpl->pPinConnectedTo == NULL ) - return NOERROR; - - return IPin_EndFlush(pImpl->pPinConnectedTo); -} - -HRESULT OutputPinSync_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate ) -{ - if ( pImpl->pPinConnectedTo == NULL ) - return NOERROR; - - return IPin_NewSegment(pImpl->pPinConnectedTo,rtStart,rtStop,rate); -} - -/*************************************************************************** - * - * handlers for output pins (async). - * - */ - -typedef struct OutputPinTask OutputPinTask; - -enum OutputPinTaskType -{ - OutTask_ExitThread, - OutTask_Receive, - OutTask_EndOfStream, - OutTask_BeginFlush, - OutTask_EndFlush, - OutTask_NewSegment, -}; - -struct OutputPinTask -{ - OutputPinTask* pNext; - enum OutputPinTaskType tasktype; - IMediaSample* pSample; - REFERENCE_TIME rtStart; - REFERENCE_TIME rtStop; - double rate; -}; - -struct OutputPinAsyncImpl -{ - HANDLE m_hTaskThread; - HANDLE m_hTaskEvent; - IPin* m_pPin; /* connected pin */ - IMemInputPin* m_pMemInputPin; /* connected pin */ - CRITICAL_SECTION m_csTasks; - OutputPinTask* m_pFirst; - OutputPinTask* m_pLast; - OutputPinTask* m_pTaskExitThread; -}; - -static OutputPinTask* OutputPinAsync_AllocTask( enum OutputPinTaskType tasktype ) -{ - OutputPinTask* pTask; - - pTask = (OutputPinTask*)QUARTZ_AllocMem( sizeof(OutputPinTask) ); - pTask->pNext = NULL; - pTask->tasktype = tasktype; - pTask->pSample = NULL; - - return pTask; -} - -static void OutputPinAsync_FreeTask( OutputPinTask* pTask ) -{ - if ( pTask->pSample != NULL ) - IMediaSample_Release( pTask->pSample ); - QUARTZ_FreeMem( pTask ); -} - -static void OutputPinAsync_AddTask( OutputPinAsyncImpl* This, OutputPinTask* pTask, BOOL bFirst ) -{ - EnterCriticalSection( &This->m_csTasks ); - - if ( bFirst ) - { - pTask->pNext = This->m_pFirst; - This->m_pFirst = pTask; - if ( This->m_pLast == NULL ) - This->m_pLast = pTask; - } - else - { - if ( This->m_pLast != NULL ) - This->m_pLast->pNext = pTask; - else - This->m_pFirst = pTask; - This->m_pLast = pTask; - } - - LeaveCriticalSection( &This->m_csTasks ); - - SetEvent( This->m_hTaskEvent ); -} - -static OutputPinTask* OutputPinAsync_GetNextTask( OutputPinAsyncImpl* This ) -{ - OutputPinTask* pTask; - - EnterCriticalSection( &This->m_csTasks ); - pTask = This->m_pFirst; - if ( pTask != NULL ) - { - This->m_pFirst = pTask->pNext; - if ( This->m_pFirst == NULL ) - This->m_pLast = NULL; - else - SetEvent( This->m_hTaskEvent ); - } - - LeaveCriticalSection( &This->m_csTasks ); - - return pTask; -} - -static DWORD WINAPI OutputPinAsync_ThreadEntry( LPVOID pv ) -{ - OutputPinAsyncImpl* This = ((CPinBaseImpl*)pv)->pAsyncOut; - OutputPinTask* pTask; - BOOL bLoop = TRUE; - BOOL bInFlush = FALSE; - HRESULT hr; - - while ( bLoop ) - { - WaitForSingleObject( This->m_hTaskEvent, INFINITE ); - ResetEvent( This->m_hTaskEvent ); - - pTask = OutputPinAsync_GetNextTask( This ); - if ( pTask == NULL ) - continue; - - hr = S_OK; - switch ( pTask->tasktype ) - { - case OutTask_ExitThread: - bLoop = FALSE; - break; - case OutTask_Receive: - if ( !bInFlush ) - hr = IMemInputPin_Receive( This->m_pMemInputPin, pTask->pSample ); - break; - case OutTask_EndOfStream: - hr = IPin_EndOfStream( This->m_pPin ); - break; - case OutTask_BeginFlush: - bInFlush = TRUE; - hr = IPin_BeginFlush( This->m_pPin ); - break; - case OutTask_EndFlush: - bInFlush = FALSE; - hr = IPin_EndFlush( This->m_pPin ); - break; - case OutTask_NewSegment: - hr = IPin_NewSegment( This->m_pPin, pTask->rtStart, pTask->rtStop, pTask->rate ); - break; - default: - ERR( "unexpected task type %d.\n", pTask->tasktype ); - bLoop = FALSE; - break; - } - - OutputPinAsync_FreeTask( pTask ); - - if ( FAILED(hr) ) - { - ERR( "hresult %08lx\n", hr ); - bLoop = FALSE; - } - } - - return 0; -} - -HRESULT OutputPinAsync_OnActive( CPinBaseImpl* pImpl ) -{ - HRESULT hr; - DWORD dwThreadId; - - FIXME("(%p)\n",pImpl); - - if ( pImpl->pMemInputPinConnectedTo == NULL ) - return NOERROR; - - pImpl->pAsyncOut = (OutputPinAsyncImpl*) - QUARTZ_AllocMem( sizeof( OutputPinAsyncImpl ) ); - if ( pImpl->pAsyncOut == NULL ) - return E_OUTOFMEMORY; - - InitializeCriticalSection( &pImpl->pAsyncOut->m_csTasks ); - pImpl->pAsyncOut->m_hTaskThread = (HANDLE)NULL; - pImpl->pAsyncOut->m_hTaskEvent = (HANDLE)NULL; - pImpl->pAsyncOut->m_pFirst = NULL; - pImpl->pAsyncOut->m_pLast = NULL; - pImpl->pAsyncOut->m_pTaskExitThread = NULL; - pImpl->pAsyncOut->m_pPin = pImpl->pPinConnectedTo; - pImpl->pAsyncOut->m_pMemInputPin = pImpl->pMemInputPinConnectedTo; - - pImpl->pAsyncOut->m_hTaskEvent = - CreateEventA( NULL, TRUE, FALSE, NULL ); - if ( pImpl->pAsyncOut->m_hTaskEvent == (HANDLE)NULL ) - { - hr = E_FAIL; - goto err; - } - - pImpl->pAsyncOut->m_pTaskExitThread = - OutputPinAsync_AllocTask( OutTask_ExitThread ); - if ( pImpl->pAsyncOut->m_pTaskExitThread == NULL ) - { - hr = E_OUTOFMEMORY; - goto err; - } - - pImpl->pAsyncOut->m_hTaskThread = CreateThread( - NULL, 0, OutputPinAsync_ThreadEntry, pImpl, - 0, &dwThreadId ); - if ( pImpl->pAsyncOut->m_hTaskThread == (HANDLE)NULL ) - { - hr = E_FAIL; - goto err; - } - - return NOERROR; -err: - OutputPinAsync_OnInactive( pImpl ); - return hr; -} - -HRESULT OutputPinAsync_OnInactive( CPinBaseImpl* pImpl ) -{ - OutputPinTask* pTask; - - FIXME("(%p)\n",pImpl); - - if ( pImpl->pAsyncOut == NULL ) - return NOERROR; - - if ( pImpl->pAsyncOut->m_pTaskExitThread != NULL ) - { - OutputPinAsync_AddTask( pImpl->pAsyncOut, pImpl->pAsyncOut->m_pTaskExitThread, TRUE ); - pImpl->pAsyncOut->m_pTaskExitThread = NULL; - } - - if ( pImpl->pAsyncOut->m_hTaskThread != (HANDLE)NULL ) - { - WaitForSingleObject( pImpl->pAsyncOut->m_hTaskThread, INFINITE ); - CloseHandle( pImpl->pAsyncOut->m_hTaskThread ); - } - if ( pImpl->pAsyncOut->m_hTaskEvent != (HANDLE)NULL ) - CloseHandle( pImpl->pAsyncOut->m_hTaskEvent ); - - /* release all tasks. */ - while ( 1 ) - { - pTask = OutputPinAsync_GetNextTask( pImpl->pAsyncOut ); - if ( pTask == NULL ) - break; - OutputPinAsync_FreeTask( pTask ); - } - - DeleteCriticalSection( &pImpl->pAsyncOut->m_csTasks ); - - QUARTZ_FreeMem( pImpl->pAsyncOut ); - pImpl->pAsyncOut = NULL; - - return NOERROR; -} - -HRESULT OutputPinAsync_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample ) -{ - OutputPinAsyncImpl* This = pImpl->pAsyncOut; - OutputPinTask* pTask; - - TRACE("(%p,%p)\n",pImpl,pSample); - - if ( This == NULL ) - return NOERROR; - - pTask = OutputPinAsync_AllocTask( OutTask_Receive ); - if ( pTask == NULL ) - return E_OUTOFMEMORY; - pTask->pSample = pSample; IMediaSample_AddRef( pSample ); - OutputPinAsync_AddTask( pImpl->pAsyncOut, pTask, FALSE ); - - return NOERROR; -} - -HRESULT OutputPinAsync_ReceiveCanBlock( CPinBaseImpl* pImpl ) -{ - return S_FALSE; -} - -HRESULT OutputPinAsync_EndOfStream( CPinBaseImpl* pImpl ) -{ - OutputPinAsyncImpl* This = pImpl->pAsyncOut; - OutputPinTask* pTask; - - TRACE("(%p)\n",pImpl); - - if ( This == NULL ) - return NOERROR; - - pTask = OutputPinAsync_AllocTask( OutTask_EndOfStream ); - if ( pTask == NULL ) - return E_OUTOFMEMORY; - OutputPinAsync_AddTask( pImpl->pAsyncOut, pTask, FALSE ); - - return NOERROR; -} - -HRESULT OutputPinAsync_BeginFlush( CPinBaseImpl* pImpl ) -{ - OutputPinAsyncImpl* This = pImpl->pAsyncOut; - OutputPinTask* pTask; - - TRACE("(%p)\n",pImpl); - - if ( This == NULL ) - return NOERROR; - - pTask = OutputPinAsync_AllocTask( OutTask_BeginFlush ); - if ( pTask == NULL ) - return E_OUTOFMEMORY; - OutputPinAsync_AddTask( pImpl->pAsyncOut, pTask, TRUE ); - - return NOERROR; -} - -HRESULT OutputPinAsync_EndFlush( CPinBaseImpl* pImpl ) -{ - OutputPinAsyncImpl* This = pImpl->pAsyncOut; - OutputPinTask* pTask; - - TRACE("(%p)\n",pImpl); - - if ( This == NULL ) - return NOERROR; - - pTask = OutputPinAsync_AllocTask( OutTask_EndFlush ); - if ( pTask == NULL ) - return E_OUTOFMEMORY; - OutputPinAsync_AddTask( pImpl->pAsyncOut, pTask, FALSE ); - - return NOERROR; -} - -HRESULT OutputPinAsync_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate ) -{ - OutputPinAsyncImpl* This = pImpl->pAsyncOut; - OutputPinTask* pTask; - - TRACE("(%p)\n",pImpl); - - if ( This == NULL ) - return NOERROR; - - pTask = OutputPinAsync_AllocTask( OutTask_NewSegment ); - if ( pTask == NULL ) - return E_OUTOFMEMORY; - pTask->rtStart = rtStart; - pTask->rtStop = rtStop; - pTask->rate = rate; - OutputPinAsync_AddTask( pImpl->pAsyncOut, pTask, FALSE ); - - return NOERROR; -} - - diff --git a/dlls/quartz/capgraph.c b/dlls/quartz/capgraph.c deleted file mode 100644 index c86765b5508..00000000000 --- a/dlls/quartz/capgraph.c +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Implementation of CLSID_CaptureGraphBuilder[2]. - * - * 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 - * - * 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; -} diff --git a/dlls/quartz/capgraph.h b/dlls/quartz/capgraph.h deleted file mode 100644 index ebead2d55f1..00000000000 --- a/dlls/quartz/capgraph.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Implementation of CLSID_CaptureGraphBuilder[2]. - * - * 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_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 */ diff --git a/dlls/quartz/complist.c b/dlls/quartz/complist.c deleted file mode 100644 index dad0970b5c1..00000000000 --- a/dlls/quartz/complist.c +++ /dev/null @@ -1,309 +0,0 @@ -/* - * List of components. (for internal use) - * - * 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 "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; -} diff --git a/dlls/quartz/complist.h b/dlls/quartz/complist.h deleted file mode 100644 index ee53e38facd..00000000000 --- a/dlls/quartz/complist.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * List of components. (for internal use) - * - * 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_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 */ diff --git a/dlls/quartz/csconv.c b/dlls/quartz/csconv.c deleted file mode 100644 index 1360e22f096..00000000000 --- a/dlls/quartz/csconv.c +++ /dev/null @@ -1,452 +0,0 @@ -/* - * Implements Color Space Converter(CLSID_Colour). - * - * 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 "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 ); -} - diff --git a/dlls/quartz/devenum.c b/dlls/quartz/devenum.c deleted file mode 100644 index e71622c45fb..00000000000 --- a/dlls/quartz/devenum.c +++ /dev/null @@ -1,1301 +0,0 @@ -/* - * Implementation of CLSID_SystemDeviceEnum. - * Implements IMoniker for CLSID_CDeviceMoniker. - * Implements IPropertyBag. (internal) - * - * 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 "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winreg.h" -#include "winerror.h" -#include "objidl.h" -#include "oleidl.h" -#include "ocidl.h" -#include "oleauto.h" -#include "strmif.h" -#include "uuids.h" - -#include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(quartz); - -#include "quartz_private.h" -#include "devenum.h" -#include "enumunk.h" -#include "complist.h" -#include "regsvr.h" - -#ifndef NUMELEMS -#define NUMELEMS(elem) (sizeof(elem)/sizeof(elem[0])) -#endif /* NUMELEMS */ - -/*************************************************************************** - * - * new/delete for CLSID_SystemDeviceEnum - * - */ - -/* can I use offsetof safely? - FIXME? */ -static QUARTZ_IFEntry CSysDevEnum_IFEntries[] = -{ - { &IID_ICreateDevEnum, offsetof(CSysDevEnum,createdevenum)-offsetof(CSysDevEnum,unk) }, -}; - - -static void QUARTZ_DestroySystemDeviceEnum(IUnknown* punk) -{ - CSysDevEnum_THIS(punk,unk); - - CSysDevEnum_UninitICreateDevEnum( This ); -} - -HRESULT QUARTZ_CreateSystemDeviceEnum(IUnknown* punkOuter,void** ppobj) -{ - CSysDevEnum* psde; - HRESULT hr; - - TRACE("(%p,%p)\n",punkOuter,ppobj); - - psde = (CSysDevEnum*)QUARTZ_AllocObj( sizeof(CSysDevEnum) ); - if ( psde == NULL ) - return E_OUTOFMEMORY; - - QUARTZ_IUnkInit( &psde->unk, punkOuter ); - - hr = CSysDevEnum_InitICreateDevEnum( psde ); - if ( FAILED(hr) ) - { - QUARTZ_FreeObj( psde ); - return hr; - } - - psde->unk.pEntries = CSysDevEnum_IFEntries; - psde->unk.dwEntries = sizeof(CSysDevEnum_IFEntries)/sizeof(CSysDevEnum_IFEntries[0]); - psde->unk.pOnFinalRelease = QUARTZ_DestroySystemDeviceEnum; - - *ppobj = (void*)(&psde->unk); - - return S_OK; -} - - -/*************************************************************************** - * - * CSysDevEnum::ICreateDevEnum - * - */ - - -static HRESULT WINAPI -ICreateDevEnum_fnQueryInterface(ICreateDevEnum* iface,REFIID riid,void** ppobj) -{ - CSysDevEnum_THIS(iface,createdevenum); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); -} - -static ULONG WINAPI -ICreateDevEnum_fnAddRef(ICreateDevEnum* iface) -{ - CSysDevEnum_THIS(iface,createdevenum); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->unk.punkControl); -} - -static ULONG WINAPI -ICreateDevEnum_fnRelease(ICreateDevEnum* iface) -{ - CSysDevEnum_THIS(iface,createdevenum); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->unk.punkControl); -} - -static HRESULT WINAPI -ICreateDevEnum_fnCreateClassEnumerator(ICreateDevEnum* iface,REFCLSID rclsidDeviceClass,IEnumMoniker** ppobj, DWORD dwFlags) -{ - CSysDevEnum_THIS(iface,createdevenum); - HRESULT hr; - HKEY hKey; - QUARTZ_CompList* pMonList; - IMoniker* pMon; - DWORD dwIndex; - LONG lr; - WCHAR wszPath[ 1024 ]; - DWORD dwLen; - DWORD dwNameMax; - DWORD cbName; - FILETIME ftLastWrite; - - TRACE("(%p)->(%s,%p,%08lx)\n",This, - debugstr_guid(rclsidDeviceClass),ppobj,dwFlags); - if ( dwFlags != 0 ) - { - FIXME("unknown flags %08lx\n",dwFlags); - return E_NOTIMPL; - } - - if ( ppobj == NULL ) - return E_POINTER; - *ppobj = NULL; - - hr = QUARTZ_CreateCLSIDPath( - wszPath, sizeof(wszPath)/sizeof(wszPath[0]) - 16, - rclsidDeviceClass, QUARTZ_wszInstance ); - if ( FAILED(hr) ) - return hr; - - lr = RegOpenKeyExW( HKEY_CLASSES_ROOT, wszPath, - 0, KEY_READ, &hKey ); - if ( lr != ERROR_SUCCESS ) - { - TRACE("cannot open %s\n",debugstr_w(wszPath)); - if ( lr == ERROR_FILE_NOT_FOUND || - lr == ERROR_PATH_NOT_FOUND ) - return S_FALSE; - return E_FAIL; - } - - dwLen = lstrlenW(wszPath); - wszPath[dwLen++] = '\\'; wszPath[dwLen] = 0; - dwNameMax = sizeof(wszPath)/sizeof(wszPath[0]) - dwLen - 8; - - pMonList = QUARTZ_CompList_Alloc(); - if ( pMonList == NULL ) - { - hr = E_OUTOFMEMORY; - goto err; - } - - /* enumerate all subkeys. */ - dwIndex = 0; - while ( 1 ) - { - cbName = dwNameMax; - lr = RegEnumKeyExW( - hKey, dwIndex, &wszPath[dwLen], &cbName, - NULL, NULL, NULL, &ftLastWrite ); - if ( lr == ERROR_NO_MORE_ITEMS ) - break; - if ( lr != ERROR_SUCCESS ) - { - TRACE("RegEnumKeyEx returns %08lx\n",lr); - hr = E_FAIL; - goto err; - } - - hr = QUARTZ_CreateDeviceMoniker( - HKEY_CLASSES_ROOT, wszPath, &pMon ); - if ( FAILED(hr) ) - goto err; - - hr = QUARTZ_CompList_AddComp( - pMonList, (IUnknown*)pMon, NULL, 0 ); - IMoniker_Release( pMon ); - - if ( FAILED(hr) ) - goto err; - - dwIndex ++; - } - - /* create an enumerator. */ - hr = QUARTZ_CreateEnumUnknown( - &IID_IEnumMoniker, (void**)ppobj, pMonList ); - if ( FAILED(hr) ) - goto err; - - hr = S_OK; -err: - if ( pMonList != NULL ) - QUARTZ_CompList_Free( pMonList ); - RegCloseKey( hKey ); - - return hr; -} - -static ICOM_VTABLE(ICreateDevEnum) icreatedevenum = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - ICreateDevEnum_fnQueryInterface, - ICreateDevEnum_fnAddRef, - ICreateDevEnum_fnRelease, - /* ICreateDevEnum fields */ - ICreateDevEnum_fnCreateClassEnumerator, -}; - -HRESULT CSysDevEnum_InitICreateDevEnum( CSysDevEnum* psde ) -{ - TRACE("(%p)\n",psde); - ICOM_VTBL(&psde->createdevenum) = &icreatedevenum; - - return NOERROR; -} - -void CSysDevEnum_UninitICreateDevEnum( CSysDevEnum* psde ) -{ - TRACE("(%p)\n",psde); -} - - -/*************************************************************************** - * - * CDeviceMoniker::IMoniker - * - */ - -static HRESULT WINAPI -IMoniker_fnQueryInterface(IMoniker* iface,REFIID riid,void** ppobj) -{ - CDeviceMoniker_THIS(iface,moniker); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); -} - -static ULONG WINAPI -IMoniker_fnAddRef(IMoniker* iface) -{ - CDeviceMoniker_THIS(iface,moniker); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->unk.punkControl); -} - -static ULONG WINAPI -IMoniker_fnRelease(IMoniker* iface) -{ - CDeviceMoniker_THIS(iface,moniker); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->unk.punkControl); -} - -static HRESULT WINAPI IMoniker_fnGetClassID(IMoniker* iface, CLSID *pClassID) -{ - CDeviceMoniker_THIS(iface,moniker); - - TRACE("(%p)->()\n",This); - - if ( pClassID == NULL ) - return E_POINTER; - memcpy( pClassID, &CLSID_CDeviceMoniker, sizeof(CLSID) ); - - return NOERROR; -} - -static HRESULT WINAPI IMoniker_fnIsDirty(IMoniker* iface) -{ - CDeviceMoniker_THIS(iface,moniker); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI IMoniker_fnLoad(IMoniker* iface, IStream* pStm) -{ - CDeviceMoniker_THIS(iface,moniker); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI IMoniker_fnSave(IMoniker* iface, IStream* pStm, BOOL fClearDirty) -{ - CDeviceMoniker_THIS(iface,moniker); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI IMoniker_fnGetSizeMax(IMoniker* iface, ULARGE_INTEGER* pcbSize) -{ - CDeviceMoniker_THIS(iface,moniker); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI IMoniker_fnBindToObject(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult) -{ - CDeviceMoniker_THIS(iface,moniker); - HRESULT hr; - IPropertyBag* pPropBag; - IPersistPropertyBag* pPersistPropBag; - VARIANT vClsid; - CLSID clsid; - - TRACE("(%p)->(%p,%p,%s,%p)\n",This, - pbc,pmkToLeft,debugstr_guid(riid),ppvResult); - if ( pbc != NULL ) - { - FIXME("IBindCtx* pbc != NULL not implemented.\n"); - return E_FAIL; - } - if ( pmkToLeft != NULL ) - { - FIXME("IMoniker* pmkToLeft != NULL not implemented.\n"); - return E_FAIL; - } - if ( ppvResult == NULL ) - return E_POINTER; - - hr = QUARTZ_CreateRegPropertyBag( - This->m_hkRoot, This->m_pwszPath, &pPropBag ); - if ( FAILED(hr) ) - return hr; - - vClsid.n1.n2.vt = VT_BSTR; - hr = IPropertyBag_Read( - pPropBag, QUARTZ_wszCLSID, &vClsid, NULL ); - IPropertyBag_Release( pPropBag ); - if ( FAILED(hr) ) - return hr; - - hr = CLSIDFromString( vClsid.n1.n2.n3.bstrVal, &clsid ); - SysFreeString(vClsid.n1.n2.n3.bstrVal); - if ( FAILED(hr) ) - return hr; - - hr = CoCreateInstance( - &clsid, NULL, CLSCTX_INPROC_SERVER, riid, ppvResult ); - if ( FAILED(hr) ) - return hr; - - hr = IUnknown_QueryInterface((IUnknown*)*ppvResult,&IID_IPersistPropertyBag,(void**)&pPersistPropBag); - if ( hr == E_NOINTERFACE ) - { - hr = S_OK; - } - else - if ( SUCCEEDED(hr) ) - { - hr = QUARTZ_CreateRegPropertyBag( - This->m_hkRoot, This->m_pwszPath, &pPropBag ); - if ( SUCCEEDED(hr) ) - { - hr = IPersistPropertyBag_Load(pPersistPropBag,pPropBag,NULL); - IPropertyBag_Release( pPropBag ); - } - IPersistPropertyBag_Release(pPersistPropBag); - } - - if ( FAILED(hr) ) - { - IUnknown_Release((IUnknown*)*ppvResult); - *ppvResult = NULL; - } - - TRACE( "hr = %08lx\n", hr ); - - return hr; -} - -static HRESULT WINAPI IMoniker_fnBindToStorage(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, REFIID riid, VOID** ppvResult) -{ - CDeviceMoniker_THIS(iface,moniker); - HRESULT hr; - - TRACE("(%p)->(%p,%p,%s,%p)\n",This, - pbc,pmkToLeft,debugstr_guid(riid),ppvResult); - if ( pbc != NULL ) - { - FIXME("IBindCtx* pbc != NULL not implemented.\n"); - return E_FAIL; - } - if ( pmkToLeft != NULL ) - { - FIXME("IMoniker* pmkToLeft != NULL not implemented.\n"); - return E_FAIL; - } - if ( ppvResult == NULL ) - return E_POINTER; - - hr = E_NOINTERFACE; - if ( IsEqualGUID(riid,&IID_IUnknown) || - IsEqualGUID(riid,&IID_IPropertyBag) ) - { - hr = QUARTZ_CreateRegPropertyBag( - This->m_hkRoot, This->m_pwszPath, - (IPropertyBag**)ppvResult ); - } - - return hr; -} - -static HRESULT WINAPI IMoniker_fnReduce(IMoniker* iface,IBindCtx* pbc, DWORD dwReduceHowFar,IMoniker** ppmkToLeft, IMoniker** ppmkReduced) -{ - CDeviceMoniker_THIS(iface,moniker); - - TRACE("(%p)->()\n",This); - - if ( ppmkReduced == NULL ) - return E_POINTER; - - *ppmkReduced = iface; IMoniker_AddRef(iface); - - return MK_S_REDUCED_TO_SELF; -} - -static HRESULT WINAPI IMoniker_fnComposeWith(IMoniker* iface,IMoniker* pmkRight,BOOL fOnlyIfNotGeneric, IMoniker** ppmkComposite) -{ - CDeviceMoniker_THIS(iface,moniker); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI IMoniker_fnEnum(IMoniker* iface,BOOL fForward, IEnumMoniker** ppenumMoniker) -{ - CDeviceMoniker_THIS(iface,moniker); - - TRACE("(%p)->()\n",This); - - if ( ppenumMoniker == NULL ) - return E_POINTER; - - *ppenumMoniker = NULL; - return NOERROR; -} - -static HRESULT WINAPI IMoniker_fnIsEqual(IMoniker* iface,IMoniker* pmkOtherMoniker) -{ - CDeviceMoniker_THIS(iface,moniker); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI IMoniker_fnHash(IMoniker* iface,DWORD* pdwHash) -{ - CDeviceMoniker_THIS(iface,moniker); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI IMoniker_fnIsRunning(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, IMoniker* pmkNewlyRunning) -{ - CDeviceMoniker_THIS(iface,moniker); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI IMoniker_fnGetTimeOfLastChange(IMoniker* iface, IBindCtx* pbc, IMoniker* pmkToLeft, FILETIME* pCompositeTime) -{ - CDeviceMoniker_THIS(iface,moniker); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI IMoniker_fnInverse(IMoniker* iface,IMoniker** ppmk) -{ - CDeviceMoniker_THIS(iface,moniker); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI IMoniker_fnCommonPrefixWith(IMoniker* iface,IMoniker* pmkOther, IMoniker** ppmkPrefix) -{ - CDeviceMoniker_THIS(iface,moniker); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI IMoniker_fnRelativePathTo(IMoniker* iface,IMoniker* pmOther, IMoniker** ppmkRelPath) -{ - CDeviceMoniker_THIS(iface,moniker); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI IMoniker_fnGetDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR *ppszDisplayName) -{ - CDeviceMoniker_THIS(iface,moniker); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI IMoniker_fnParseDisplayName(IMoniker* iface,IBindCtx* pbc, IMoniker* pmkToLeft, LPOLESTR pszDisplayName, ULONG* pchEaten, IMoniker** ppmkOut) -{ - CDeviceMoniker_THIS(iface,moniker); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI IMoniker_fnIsSystemMoniker(IMoniker* iface,DWORD* pdwMksys) -{ - CDeviceMoniker_THIS(iface,moniker); - - TRACE("(%p)->()\n",This); - if ( pdwMksys == NULL ) - return E_POINTER; - - *pdwMksys = MKSYS_NONE; - return S_FALSE; -} - - -static ICOM_VTABLE(IMoniker) imoniker = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - IMoniker_fnQueryInterface, - IMoniker_fnAddRef, - IMoniker_fnRelease, - /* IPersist fields */ - IMoniker_fnGetClassID, - /* IPersistStream fields */ - IMoniker_fnIsDirty, - IMoniker_fnLoad, - IMoniker_fnSave, - IMoniker_fnGetSizeMax, - /* IMoniker fields */ - IMoniker_fnBindToObject, - IMoniker_fnBindToStorage, - IMoniker_fnReduce, - IMoniker_fnComposeWith, - IMoniker_fnEnum, - IMoniker_fnIsEqual, - IMoniker_fnHash, - IMoniker_fnIsRunning, - IMoniker_fnGetTimeOfLastChange, - IMoniker_fnInverse, - IMoniker_fnCommonPrefixWith, - IMoniker_fnRelativePathTo, - IMoniker_fnGetDisplayName, - IMoniker_fnParseDisplayName, - IMoniker_fnIsSystemMoniker, -}; - - -static HRESULT CDeviceMoniker_InitIMoniker( - CDeviceMoniker* pdm, HKEY hkRoot, LPCWSTR lpKeyPath ) -{ - DWORD dwLen; - - ICOM_VTBL(&pdm->moniker) = &imoniker; - pdm->m_hkRoot = hkRoot; - pdm->m_pwszPath = NULL; - - dwLen = sizeof(WCHAR)*(lstrlenW(lpKeyPath)+1); - pdm->m_pwszPath = (WCHAR*)QUARTZ_AllocMem( dwLen ); - if ( pdm->m_pwszPath == NULL ) - return E_OUTOFMEMORY; - memcpy( pdm->m_pwszPath, lpKeyPath, dwLen ); - - return NOERROR; -} - -static void CDeviceMoniker_UninitIMoniker( - CDeviceMoniker* pdm ) -{ - if ( pdm->m_pwszPath != NULL ) - QUARTZ_FreeMem( pdm->m_pwszPath ); -} - -/*************************************************************************** - * - * new/delete for CDeviceMoniker - * - */ - -static void QUARTZ_DestroyDeviceMoniker(IUnknown* punk) -{ - CDeviceMoniker_THIS(punk,unk); - - CDeviceMoniker_UninitIMoniker( This ); -} - -/* can I use offsetof safely? - FIXME? */ -static QUARTZ_IFEntry CDeviceMoniker_IFEntries[] = -{ - { &IID_IPersist, offsetof(CDeviceMoniker,moniker)-offsetof(CDeviceMoniker,unk) }, - { &IID_IPersistStream, offsetof(CDeviceMoniker,moniker)-offsetof(CDeviceMoniker,unk) }, - { &IID_IMoniker, offsetof(CDeviceMoniker,moniker)-offsetof(CDeviceMoniker,unk) }, -}; - -HRESULT QUARTZ_CreateDeviceMoniker( - HKEY hkRoot, LPCWSTR lpKeyPath, - IMoniker** ppMoniker ) -{ - CDeviceMoniker* pdm; - HRESULT hr; - - TRACE("(%08x,%s,%p)\n",hkRoot,debugstr_w(lpKeyPath),ppMoniker ); - - pdm = (CDeviceMoniker*)QUARTZ_AllocObj( sizeof(CDeviceMoniker) ); - if ( pdm == NULL ) - return E_OUTOFMEMORY; - - QUARTZ_IUnkInit( &pdm->unk, NULL ); - hr = CDeviceMoniker_InitIMoniker( pdm, hkRoot, lpKeyPath ); - if ( FAILED(hr) ) - { - QUARTZ_FreeObj( pdm ); - return hr; - } - - pdm->unk.pEntries = CDeviceMoniker_IFEntries; - pdm->unk.dwEntries = sizeof(CDeviceMoniker_IFEntries)/sizeof(CDeviceMoniker_IFEntries[0]); - pdm->unk.pOnFinalRelease = &QUARTZ_DestroyDeviceMoniker; - - *ppMoniker = (IMoniker*)(&pdm->moniker); - - return S_OK; -} - - -/*************************************************************************** - * - * CRegPropertyBag::IPropertyBag - * - */ - -static HRESULT WINAPI -IPropertyBag_fnQueryInterface(IPropertyBag* iface,REFIID riid,void** ppobj) -{ - CRegPropertyBag_THIS(iface,propbag); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); -} - -static ULONG WINAPI -IPropertyBag_fnAddRef(IPropertyBag* iface) -{ - CRegPropertyBag_THIS(iface,propbag); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->unk.punkControl); -} - -static ULONG WINAPI -IPropertyBag_fnRelease(IPropertyBag* iface) -{ - CRegPropertyBag_THIS(iface,propbag); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->unk.punkControl); -} - -static HRESULT WINAPI -IPropertyBag_fnRead(IPropertyBag* iface,LPCOLESTR lpszPropName,VARIANT* pVar,IErrorLog* pLog) -{ - CRegPropertyBag_THIS(iface,propbag); - HRESULT hr; - LONG lr; - DWORD dwSize; - DWORD dwValueType; - DWORD dwDWordValue; - SAFEARRAYBOUND sab; - SAFEARRAY* pArray; - - TRACE("(%p)->(%s,%p,%p)\n",This, - debugstr_w(lpszPropName),pVar,pLog); - - if ( lpszPropName == NULL || pVar == NULL ) - return E_POINTER; - - dwSize = 0; - lr = RegQueryValueExW( - This->m_hKey, lpszPropName, NULL, - &dwValueType, NULL, &dwSize ); - if ( lr != ERROR_SUCCESS ) - { - WARN( "RegQueryValueExW failed.\n" ); - return E_INVALIDARG; - } - - switch ( dwValueType ) - { - case REG_SZ: - TRACE( "REG_SZ / length = %lu\n", dwSize ); - if ( pVar->n1.n2.vt == VT_EMPTY ) - pVar->n1.n2.vt = VT_BSTR; - if ( pVar->n1.n2.vt != VT_BSTR ) - { - FIXME( "type of VARIANT is not BSTR.\n" ); - return E_FAIL; - } - - pVar->n1.n2.n3.bstrVal = SysAllocStringByteLen( - NULL, dwSize ); - if ( pVar->n1.n2.n3.bstrVal == NULL ) - { - WARN( "out of memory.\n" ); - return E_OUTOFMEMORY; - } - lr = RegQueryValueExW( - This->m_hKey, lpszPropName, NULL, - &dwValueType, - (BYTE*)pVar->n1.n2.n3.bstrVal, &dwSize ); - if ( lr != ERROR_SUCCESS ) - { - WARN( "failed to query value\n" ); - SysFreeString(pVar->n1.n2.n3.bstrVal); - return E_FAIL; - } - TRACE( "value is BSTR; %s\n", debugstr_w(pVar->n1.n2.n3.bstrVal) ); - break; - case REG_BINARY: - TRACE( "REG_BINARY / length = %lu\n", dwSize ); - if ( pVar->n1.n2.vt == VT_EMPTY ) - pVar->n1.n2.vt = VT_ARRAY|VT_UI1; - if ( pVar->n1.n2.vt != (VT_ARRAY|VT_UI1) ) - { - FIXME( "type of VARIANT is not VT_ARRAY|VT_UI1.\n" ); - return E_FAIL; - } - sab.lLbound = 0; - sab.cElements = dwSize; - pArray = SafeArrayCreate( VT_UI1, 1, &sab ); - if ( pArray == NULL ) - return E_OUTOFMEMORY; - hr = SafeArrayLock( pArray ); - if ( FAILED(hr) ) - { - WARN( "safe array can't be locked\n" ); - SafeArrayDestroy( pArray ); - return hr; - } - lr = RegQueryValueExW( - This->m_hKey, lpszPropName, NULL, - &dwValueType, - (BYTE*)pArray->pvData, &dwSize ); - SafeArrayUnlock( pArray ); - if ( lr != ERROR_SUCCESS ) - { - WARN( "failed to query value\n" ); - SafeArrayDestroy( pArray ); - return E_FAIL; - } - pVar->n1.n2.n3.parray = pArray; - TRACE( "value is SAFEARRAY - array of BYTE; \n" ); - break; - case REG_DWORD: - TRACE( "REG_DWORD / length = %lu\n", dwSize ); - if ( dwSize != sizeof(DWORD) ) - { - WARN( "The length of REG_DWORD value is not sizeof(DWORD).\n" ); - return E_FAIL; - } - if ( pVar->n1.n2.vt == VT_EMPTY ) - pVar->n1.n2.vt = VT_I4; - if ( pVar->n1.n2.vt != VT_I4 ) - { - FIXME( "type of VARIANT is not VT_I4.\n" ); - return E_FAIL; - } - lr = RegQueryValueExW( - This->m_hKey, lpszPropName, NULL, - &dwValueType, - (BYTE*)(&dwDWordValue), &dwSize ); - if ( lr != ERROR_SUCCESS ) - { - WARN( "failed to query value\n" ); - return E_FAIL; - } - pVar->n1.n2.n3.lVal = dwDWordValue; - TRACE( "value is DWORD; %08lx\n", dwDWordValue ); - break; - default: - FIXME("(%p)->(%s,%p,%p) - unsupported value type.\n",This, - debugstr_w(lpszPropName),pVar,pLog); - return E_FAIL; - } - - TRACE( "returned successfully.\n" ); - return NOERROR; -} - -static HRESULT WINAPI -IPropertyBag_fnWrite(IPropertyBag* iface,LPCOLESTR lpszPropName,VARIANT* pVar) -{ - CRegPropertyBag_THIS(iface,propbag); - HRESULT hr; - LONG lr; - DWORD dwDWordValue; - SAFEARRAY* pArray; - - TRACE("(%p)->(%s,%p)\n",This, - debugstr_w(lpszPropName),pVar); - - if ( lpszPropName == NULL || pVar == NULL ) - return E_POINTER; - - switch ( pVar->n1.n2.vt ) - { - case VT_I4: /* REG_DWORD */ - dwDWordValue = pVar->n1.n2.n3.lVal; - lr = RegSetValueExW( - This->m_hKey, lpszPropName, 0, - REG_DWORD, - (const BYTE*)(&dwDWordValue), sizeof(DWORD) ); - if ( lr != ERROR_SUCCESS ) - { - WARN( "failed to set value\n" ); - return E_FAIL; - } - break; - case VT_BSTR: /* REG_SZ */ - lr = RegSetValueExW( - This->m_hKey, lpszPropName, 0, - REG_SZ, - (const BYTE*)(pVar->n1.n2.n3.bstrVal), - SysStringByteLen( pVar->n1.n2.n3.bstrVal ) ); - if ( lr != ERROR_SUCCESS ) - { - WARN( "failed to set value\n" ); - return E_FAIL; - } - break; - case (VT_ARRAY|VT_UI1): /* REG_BINARY */ - pArray = pVar->n1.n2.n3.parray; - if ( pArray->cDims != 1 || pArray->cbElements != 1 || - pArray->rgsabound[0].lLbound != 0 ) - { - WARN( "invalid array\n" ); - return E_INVALIDARG; - } - hr = SafeArrayLock( pArray ); - if ( FAILED(hr) ) - { - WARN( "safe array can't be locked\n" ); - return hr; - } - lr = RegSetValueExW( - This->m_hKey, lpszPropName, 0, - REG_BINARY, - (const BYTE*)pArray->pvData, - pArray->rgsabound[0].cElements ); - SafeArrayUnlock( pArray ); - if ( lr != ERROR_SUCCESS ) - { - WARN( "failed to set value\n" ); - return E_FAIL; - } - break; - default: - FIXME("(%p)->(%s,%p) invalid/unsupported VARIANT type %04x\n",This, - debugstr_w(lpszPropName),pVar,pVar->n1.n2.vt); - return E_INVALIDARG; - } - - TRACE( "returned successfully.\n" ); - return NOERROR; -} - - - - -static ICOM_VTABLE(IPropertyBag) ipropbag = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - IPropertyBag_fnQueryInterface, - IPropertyBag_fnAddRef, - IPropertyBag_fnRelease, - /* IPropertyBag fields */ - IPropertyBag_fnRead, - IPropertyBag_fnWrite, -}; - -static HRESULT CRegPropertyBag_InitIPropertyBag( - CRegPropertyBag* prpb, HKEY hkRoot, LPCWSTR lpKeyPath ) -{ - WCHAR wszREG_SZ[ NUMELEMS(QUARTZ_wszREG_SZ) ]; - DWORD dwDisp; - - ICOM_VTBL(&prpb->propbag) = &ipropbag; - - memcpy(wszREG_SZ,QUARTZ_wszREG_SZ,sizeof(QUARTZ_wszREG_SZ) ); - - if ( RegCreateKeyExW( - hkRoot, lpKeyPath, 0, wszREG_SZ, - REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, - &prpb->m_hKey, &dwDisp ) != ERROR_SUCCESS ) - return E_FAIL; - - return NOERROR; -} - -static void CRegPropertyBag_UninitIPropertyBag( - CRegPropertyBag* prpb ) -{ - RegCloseKey( prpb->m_hKey ); -} - - -/*************************************************************************** - * - * new/delete for CRegPropertyBag - * - */ - -static void QUARTZ_DestroyRegPropertyBag(IUnknown* punk) -{ - CRegPropertyBag_THIS(punk,unk); - - CRegPropertyBag_UninitIPropertyBag(This); -} - - -/* can I use offsetof safely? - FIXME? */ -static QUARTZ_IFEntry CRegPropertyBag_IFEntries[] = -{ - { &IID_IPropertyBag, offsetof(CRegPropertyBag,propbag)-offsetof(CRegPropertyBag,unk) }, -}; - -HRESULT QUARTZ_CreateRegPropertyBag( - HKEY hkRoot, LPCWSTR lpKeyPath, - IPropertyBag** ppPropBag ) -{ - CRegPropertyBag* prpb; - HRESULT hr; - - TRACE("(%08x,%s,%p)\n",hkRoot,debugstr_w(lpKeyPath),ppPropBag ); - - prpb = (CRegPropertyBag*)QUARTZ_AllocObj( sizeof(CRegPropertyBag) ); - if ( prpb == NULL ) - return E_OUTOFMEMORY; - - QUARTZ_IUnkInit( &prpb->unk, NULL ); - hr = CRegPropertyBag_InitIPropertyBag( prpb, hkRoot, lpKeyPath ); - if ( FAILED(hr) ) - { - QUARTZ_FreeObj( prpb ); - return hr; - } - - prpb->unk.pEntries = CRegPropertyBag_IFEntries; - prpb->unk.dwEntries = sizeof(CRegPropertyBag_IFEntries)/sizeof(CRegPropertyBag_IFEntries[0]); - prpb->unk.pOnFinalRelease = &QUARTZ_DestroyRegPropertyBag; - - *ppPropBag = (IPropertyBag*)(&prpb->propbag); - - return S_OK; -} - -/*************************************************************************** - * - * Helper for registering filters. - * - */ - -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 hr; - WCHAR szKey[ 1024 ]; - WCHAR szFilterPath[ 512 ]; - WCHAR szCLSID[ 256 ]; - int buflen; - - TRACE("(%p,%s,%s,%s)\n",ppwszPath,debugstr_guid(pguidFilterCategory),debugstr_guid(pclsid),debugstr_w(lpInstance) ); - - *ppwszPath = NULL; - - QUARTZ_GUIDtoString( szCLSID, pclsid ); - lstrcpyW( szFilterPath, QUARTZ_wszInstance ); - QUARTZ_CatPathSepW( szFilterPath ); - if ( lpInstance != NULL ) - { - if ( lstrlenW(lpInstance) >= 256 ) - return E_INVALIDARG; - lstrcatW( szFilterPath, lpInstance ); - } - else - { - lstrcatW( szFilterPath, szCLSID ); - } - - hr = QUARTZ_CreateCLSIDPath( - szKey, NUMELEMS(szKey), - pguidFilterCategory, szFilterPath ); - if ( FAILED(hr) ) - return hr; - - buflen = sizeof(WCHAR)*(lstrlenW(szKey)+1); - *ppwszPath = QUARTZ_AllocMem( buflen ); - if ( *ppwszPath == NULL ) - return E_OUTOFMEMORY; - memcpy( *ppwszPath, szKey, buflen ); - return S_OK; -} - -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 */ -{ - IPropertyBag* pPropBag = NULL; - WCHAR wszClsid[128]; - VARIANT var; - HRESULT hr; - SAFEARRAYBOUND sab; - SAFEARRAY* pArray = NULL; - - TRACE("(%p,%s,%s,%p,%08lu)\n",pMoniker,debugstr_guid(pclsid),debugstr_w(lpFriendlyName),pbFilterData,cbFilterData); - - hr = IMoniker_BindToStorage(pMoniker,NULL,NULL,&IID_IPropertyBag,(void**)&pPropBag); - if ( FAILED(hr) ) - goto err; - QUARTZ_GUIDtoString( wszClsid, pclsid ); - var.n1.n2.vt = VT_BSTR; - var.n1.n2.n3.bstrVal = SysAllocString(wszClsid); - if ( var.n1.n2.n3.bstrVal == NULL ) - { - hr = E_OUTOFMEMORY; - goto err; - } - hr = IPropertyBag_Write(pPropBag,QUARTZ_wszCLSID,&var); - SysFreeString(var.n1.n2.n3.bstrVal); - if ( FAILED(hr) ) - goto err; - - var.n1.n2.vt = VT_BSTR; - var.n1.n2.n3.bstrVal = SysAllocString(lpFriendlyName); - if ( var.n1.n2.n3.bstrVal == NULL ) - { - hr = E_OUTOFMEMORY; - goto err; - } - hr = IPropertyBag_Write(pPropBag,QUARTZ_wszFriendlyName,&var); - SysFreeString(var.n1.n2.n3.bstrVal); - if ( FAILED(hr) ) - goto err; - - if ( pbFilterData != NULL ) - { - var.n1.n2.vt = VT_ARRAY|VT_UI1; - sab.lLbound = 0; - sab.cElements = cbFilterData; - pArray = SafeArrayCreate( VT_UI1, 1, &sab ); - if ( pArray == NULL ) - { - hr = E_OUTOFMEMORY; - goto err; - } - hr = SafeArrayLock( pArray ); - if ( FAILED(hr) ) - goto err; - var.n1.n2.n3.parray = pArray; - memcpy( pArray->pvData, pbFilterData, cbFilterData ); - hr = IPropertyBag_Write(pPropBag,QUARTZ_wszFilterData,&var); - SafeArrayUnlock( pArray ); - if ( FAILED(hr) ) - goto err; - } - - hr = NOERROR; -err: - if ( pArray != NULL ) - SafeArrayDestroy( pArray ); - if ( pPropBag != NULL ) - IPropertyBag_Release(pPropBag); - - return hr; -} - -HRESULT QUARTZ_RegDeleteKey( HKEY hkRoot, LPCWSTR lpKeyPath ) -{ - LONG lr; - HRESULT hr; - HKEY hKey; - DWORD dwIndex; - DWORD cbName; - FILETIME ftLastWrite; - DWORD dwType; - WCHAR wszPath[ 512 ]; - - TRACE("(%08x,%s)\n",hkRoot,debugstr_w(lpKeyPath)); - - lr = RegOpenKeyExW( hkRoot, lpKeyPath, 0, KEY_ALL_ACCESS, &hKey ); - if ( lr == ERROR_SUCCESS ) - { - dwIndex = 0; - while ( 1 ) - { - cbName = NUMELEMS(wszPath); - lr = RegEnumKeyExW( - hKey, dwIndex, wszPath, &cbName, - NULL, NULL, NULL, &ftLastWrite ); - if ( lr != ERROR_SUCCESS ) - break; - hr = QUARTZ_RegDeleteKey( hKey, wszPath ); - if ( FAILED(hr) ) - return hr; - if ( hr != S_OK ) - dwIndex ++; - } - while ( 1 ) - { - cbName = NUMELEMS(wszPath); - lr = RegEnumValueW( - hKey, 0, wszPath, &cbName, 0, - &dwType, NULL, 0 ); - if ( lr != ERROR_SUCCESS ) - break; - lr = RegDeleteValueW( hKey, wszPath ); - if ( lr != ERROR_SUCCESS ) - { - WARN("RegDeleteValueW - %08lx\n",lr); - return E_FAIL; - } - } - } - RegCloseKey( hKey ); - - lr = RegDeleteKeyW( hkRoot, lpKeyPath ); - WARN("RegDeleteKeyW - %08lx\n",lr); - if ( lr != ERROR_SUCCESS && lr != ERROR_FILE_NOT_FOUND ) - return S_FALSE; - return S_OK; -} - -static -HRESULT QUARTZ_GetPropertyFromMoniker( - IMoniker* pMoniker, /* [IN] Moniker */ - LPCOLESTR lpszPropName, /* [IN] Property */ - VARIANT* pVar ) /* [OUT] */ -{ - IPropertyBag* pPropBag = NULL; - HRESULT hr; - - TRACE("(%p,%s,%p)\n",pMoniker,debugstr_w(lpszPropName),pVar); - - hr = IMoniker_BindToStorage(pMoniker,NULL,NULL,&IID_IPropertyBag,(void**)&pPropBag); - if ( FAILED(hr) ) - return hr; - hr = IPropertyBag_Read(pPropBag,lpszPropName,pVar,NULL); - IPropertyBag_Release(pPropBag); - - return hr; -} - -HRESULT QUARTZ_GetCLSIDFromMoniker( - IMoniker* pMoniker, /* [IN] Moniker */ - CLSID* pclsid ) /* [OUT] */ -{ - VARIANT var; - HRESULT hr; - - var.n1.n2.vt = VT_BSTR; - hr = QUARTZ_GetPropertyFromMoniker( - pMoniker, QUARTZ_wszCLSID, &var ); - if ( hr == S_OK ) - { - hr = CLSIDFromString(var.n1.n2.n3.bstrVal,pclsid); - SysFreeString(var.n1.n2.n3.bstrVal); - } - - return hr; -} - -HRESULT QUARTZ_GetMeritFromMoniker( - IMoniker* pMoniker, /* [IN] Moniker */ - DWORD* pdwMerit ) /* [OUT] */ -{ - VARIANT var; - HRESULT hr; - - var.n1.n2.vt = VT_I4; - hr = QUARTZ_GetPropertyFromMoniker( - pMoniker, QUARTZ_wszMerit, &var ); - if ( hr == S_OK ) - *pdwMerit = var.n1.n2.n3.lVal; - - return hr; -} - -HRESULT QUARTZ_GetFilterDataFromMoniker( - IMoniker* pMoniker, /* [IN] Moniker */ - BYTE** ppbFilterData, /* [OUT] */ - DWORD* pcbFilterData ) /* [OUT] */ -{ - VARIANT var; - HRESULT hr; - SAFEARRAY* pArray; - - var.n1.n2.vt = VT_ARRAY|VT_UI1; - hr = QUARTZ_GetPropertyFromMoniker( - pMoniker, QUARTZ_wszFilterData, &var ); - if ( hr == S_OK ) - { - pArray = var.n1.n2.n3.parray; - hr = SafeArrayLock( pArray ); - if ( SUCCEEDED(hr) ) - { - *pcbFilterData = pArray->rgsabound[0].cElements - pArray->rgsabound[0].lLbound; - *ppbFilterData = (BYTE*)QUARTZ_AllocMem( *pcbFilterData ); - if ( *ppbFilterData == NULL ) - hr = E_OUTOFMEMORY; - else - memcpy( *ppbFilterData, pArray->pvData, *pcbFilterData ); - - SafeArrayUnlock( pArray ); - } - SafeArrayDestroy( pArray ); - } - - return hr; -} - diff --git a/dlls/quartz/devenum.h b/dlls/quartz/devenum.h deleted file mode 100644 index e18a85479c7..00000000000 --- a/dlls/quartz/devenum.h +++ /dev/null @@ -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 */ diff --git a/dlls/quartz/enumunk.c b/dlls/quartz/enumunk.c deleted file mode 100644 index 3853c453d6f..00000000000 --- a/dlls/quartz/enumunk.c +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Implementation of IEnumUnknown (for internal use). - * - * 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 "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; -} - diff --git a/dlls/quartz/enumunk.h b/dlls/quartz/enumunk.h deleted file mode 100644 index eb59f7d0ce0..00000000000 --- a/dlls/quartz/enumunk.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Implementation of IEnumUnknown (for internal use). - * - * 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_ENUMUNK_H -#define QUARTZ_ENUMUNK_H - -#include "complist.h" - -HRESULT QUARTZ_CreateEnumUnknown( - REFIID riidEnum, void** ppobj, const QUARTZ_CompList* pCompList ); - - -#endif /* QUARTZ_ENUMUNK_H */ diff --git a/dlls/quartz/fgevent.c b/dlls/quartz/fgevent.c deleted file mode 100644 index 1e8523d990a..00000000000 --- a/dlls/quartz/fgevent.c +++ /dev/null @@ -1,645 +0,0 @@ -/* - * CLSID_FilterGraph event handling. - * - * 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 "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); -} - diff --git a/dlls/quartz/fgpass.c b/dlls/quartz/fgpass.c deleted file mode 100644 index ce53c311069..00000000000 --- a/dlls/quartz/fgpass.c +++ /dev/null @@ -1,1487 +0,0 @@ -/* - * Implementation of IBasicAudio, IBasicVideo, IVideoWindow for FilterGraph. - * - * 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 "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 CFilterGraph_QIFilters( - CFilterGraph* This, REFIID riid, void** ppvobj ) -{ - HRESULT hr = E_NOINTERFACE; - DWORD n; - - TRACE( "(%p,%p,%p)\n",This,riid,ppvobj); - - EnterCriticalSection ( &This->m_csFilters ); - - for ( n = 0; n < This->m_cActiveFilters; n++ ) - { - if ( IUnknown_QueryInterface(This->m_pActiveFilters[n].pFilter,riid,ppvobj) == S_OK ) - { - hr = S_OK; - break; - } - } - - LeaveCriticalSection ( &This->m_csFilters ); - - return hr; -} - - -static HRESULT CFilterGraph_QueryBasicAudio( - CFilterGraph* This, IBasicAudio** ppAudio ) -{ - return CFilterGraph_QIFilters(This,&IID_IBasicAudio,(void**)ppAudio); -} - -static HRESULT CFilterGraph_QueryBasicVideo( - CFilterGraph* This, IBasicVideo** ppVideo ) -{ - return CFilterGraph_QIFilters(This,&IID_IBasicVideo,(void**)ppVideo); -} - -static HRESULT CFilterGraph_QueryVideoWindow( - CFilterGraph* This, IVideoWindow** ppVidWin ) -{ - return CFilterGraph_QIFilters(This,&IID_IVideoWindow,(void**)ppVidWin); -} - - - -/*************************************************************************** - * - * CFilterGraph::IBasicAudio - * - */ - -#define QUERYBASICAUDIO \ - IBasicAudio* pAudio = NULL; \ - HRESULT hr; \ - hr = CFilterGraph_QueryBasicAudio( This, &pAudio ); \ - if ( FAILED(hr) ) return hr; - - -static HRESULT WINAPI -IBasicAudio_fnQueryInterface(IBasicAudio* iface,REFIID riid,void** ppobj) -{ - CFilterGraph_THIS(iface,basaud); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); -} - -static ULONG WINAPI -IBasicAudio_fnAddRef(IBasicAudio* iface) -{ - CFilterGraph_THIS(iface,basaud); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->unk.punkControl); -} - -static ULONG WINAPI -IBasicAudio_fnRelease(IBasicAudio* iface) -{ - CFilterGraph_THIS(iface,basaud); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->unk.punkControl); -} - -static HRESULT WINAPI -IBasicAudio_fnGetTypeInfoCount(IBasicAudio* iface,UINT* pcTypeInfo) -{ - CFilterGraph_THIS(iface,basaud); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicAudio_fnGetTypeInfo(IBasicAudio* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj) -{ - CFilterGraph_THIS(iface,basaud); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicAudio_fnGetIDsOfNames(IBasicAudio* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId) -{ - CFilterGraph_THIS(iface,basaud); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicAudio_fnInvoke(IBasicAudio* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr) -{ - CFilterGraph_THIS(iface,basaud); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - - -static HRESULT WINAPI -IBasicAudio_fnput_Volume(IBasicAudio* iface,long lVol) -{ - CFilterGraph_THIS(iface,basaud); - QUERYBASICAUDIO - - TRACE("(%p)->()\n",This); - - hr = IBasicAudio_put_Volume(pAudio,lVol); - IBasicAudio_Release(pAudio); - return hr; -} - -static HRESULT WINAPI -IBasicAudio_fnget_Volume(IBasicAudio* iface,long* plVol) -{ - CFilterGraph_THIS(iface,basaud); - QUERYBASICAUDIO - - TRACE("(%p)->()\n",This); - - hr = IBasicAudio_get_Volume(pAudio,plVol); - IBasicAudio_Release(pAudio); - return hr; -} - -static HRESULT WINAPI -IBasicAudio_fnput_Balance(IBasicAudio* iface,long lBalance) -{ - CFilterGraph_THIS(iface,basaud); - QUERYBASICAUDIO - - TRACE("(%p)->()\n",This); - - hr = IBasicAudio_put_Balance(pAudio,lBalance); - IBasicAudio_Release(pAudio); - return hr; -} - -static HRESULT WINAPI -IBasicAudio_fnget_Balance(IBasicAudio* iface,long* plBalance) -{ - CFilterGraph_THIS(iface,basaud); - QUERYBASICAUDIO - - TRACE("(%p)->()\n",This); - - hr = IBasicAudio_get_Balance(pAudio,plBalance); - IBasicAudio_Release(pAudio); - return hr; -} - - -static ICOM_VTABLE(IBasicAudio) ibasicaudio = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - IBasicAudio_fnQueryInterface, - IBasicAudio_fnAddRef, - IBasicAudio_fnRelease, - /* IDispatch fields */ - IBasicAudio_fnGetTypeInfoCount, - IBasicAudio_fnGetTypeInfo, - IBasicAudio_fnGetIDsOfNames, - IBasicAudio_fnInvoke, - /* IBasicAudio fields */ - IBasicAudio_fnput_Volume, - IBasicAudio_fnget_Volume, - IBasicAudio_fnput_Balance, - IBasicAudio_fnget_Balance, -}; - - -HRESULT CFilterGraph_InitIBasicAudio( CFilterGraph* pfg ) -{ - TRACE("(%p)\n",pfg); - ICOM_VTBL(&pfg->basaud) = &ibasicaudio; - - return NOERROR; -} - -void CFilterGraph_UninitIBasicAudio( CFilterGraph* pfg ) -{ - TRACE("(%p)\n",pfg); -} - -#undef QUERYBASICAUDIO - - -/*************************************************************************** - * - * CFilterGraph::IBasicVideo - * - */ - - -#define QUERYBASICVIDEO \ - IBasicVideo* pVideo = NULL; \ - HRESULT hr; \ - hr = CFilterGraph_QueryBasicVideo( This, &pVideo ); \ - if ( FAILED(hr) ) return hr; - - -static HRESULT WINAPI -IBasicVideo_fnQueryInterface(IBasicVideo* iface,REFIID riid,void** ppobj) -{ - CFilterGraph_THIS(iface,basvid); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); -} - -static ULONG WINAPI -IBasicVideo_fnAddRef(IBasicVideo* iface) -{ - CFilterGraph_THIS(iface,basvid); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->unk.punkControl); -} - -static ULONG WINAPI -IBasicVideo_fnRelease(IBasicVideo* iface) -{ - CFilterGraph_THIS(iface,basvid); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->unk.punkControl); -} - -static HRESULT WINAPI -IBasicVideo_fnGetTypeInfoCount(IBasicVideo* iface,UINT* pcTypeInfo) -{ - CFilterGraph_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnGetTypeInfo(IBasicVideo* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj) -{ - CFilterGraph_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnGetIDsOfNames(IBasicVideo* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId) -{ - CFilterGraph_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnInvoke(IBasicVideo* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr) -{ - CFilterGraph_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - - -static HRESULT WINAPI -IBasicVideo_fnget_AvgTimePerFrame(IBasicVideo* iface,REFTIME* prefTime) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_get_AvgTimePerFrame(pVideo,prefTime); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnget_BitRate(IBasicVideo* iface,long* plRate) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_get_BitRate(pVideo,plRate); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnget_BitErrorRate(IBasicVideo* iface,long* plRate) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_get_BitErrorRate(pVideo,plRate); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnget_VideoWidth(IBasicVideo* iface,long* plWidth) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_get_VideoWidth(pVideo,plWidth); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnget_VideoHeight(IBasicVideo* iface,long* plHeight) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_get_VideoHeight(pVideo,plHeight); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnput_SourceLeft(IBasicVideo* iface,long lLeft) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_put_SourceLeft(pVideo,lLeft); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnget_SourceLeft(IBasicVideo* iface,long* plLeft) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_get_SourceLeft(pVideo,plLeft); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnput_SourceWidth(IBasicVideo* iface,long lWidth) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_put_SourceWidth(pVideo,lWidth); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnget_SourceWidth(IBasicVideo* iface,long* plWidth) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_get_SourceWidth(pVideo,plWidth); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnput_SourceTop(IBasicVideo* iface,long lTop) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_put_SourceTop(pVideo,lTop); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnget_SourceTop(IBasicVideo* iface,long* plTop) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_get_SourceTop(pVideo,plTop); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnput_SourceHeight(IBasicVideo* iface,long lHeight) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_put_SourceHeight(pVideo,lHeight); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnget_SourceHeight(IBasicVideo* iface,long* plHeight) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_get_SourceHeight(pVideo,plHeight); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnput_DestinationLeft(IBasicVideo* iface,long lLeft) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_put_DestinationLeft(pVideo,lLeft); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnget_DestinationLeft(IBasicVideo* iface,long* plLeft) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_get_DestinationLeft(pVideo,plLeft); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnput_DestinationWidth(IBasicVideo* iface,long lWidth) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_put_DestinationWidth(pVideo,lWidth); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnget_DestinationWidth(IBasicVideo* iface,long* plWidth) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_get_DestinationWidth(pVideo,plWidth); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnput_DestinationTop(IBasicVideo* iface,long lTop) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_put_DestinationTop(pVideo,lTop); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnget_DestinationTop(IBasicVideo* iface,long* plTop) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_get_DestinationTop(pVideo,plTop); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnput_DestinationHeight(IBasicVideo* iface,long lHeight) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_put_DestinationHeight(pVideo,lHeight); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnget_DestinationHeight(IBasicVideo* iface,long* plHeight) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_get_DestinationHeight(pVideo,plHeight); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnSetSourcePosition(IBasicVideo* iface,long lLeft,long lTop,long lWidth,long lHeight) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_SetSourcePosition(pVideo,lLeft,lTop,lWidth,lHeight); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnGetSourcePosition(IBasicVideo* iface,long* plLeft,long* plTop,long* plWidth,long* plHeight) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_GetSourcePosition(pVideo,plLeft,plTop,plWidth,plHeight); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnSetDefaultSourcePosition(IBasicVideo* iface) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_SetDefaultSourcePosition(pVideo); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnSetDestinationPosition(IBasicVideo* iface,long lLeft,long lTop,long lWidth,long lHeight) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_SetDestinationPosition(pVideo,lLeft,lTop,lWidth,lHeight); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnGetDestinationPosition(IBasicVideo* iface,long* plLeft,long* plTop,long* plWidth,long* plHeight) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_GetDestinationPosition(pVideo,plLeft,plTop,plWidth,plHeight); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnSetDefaultDestinationPosition(IBasicVideo* iface) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_SetDefaultDestinationPosition(pVideo); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnGetVideoSize(IBasicVideo* iface,long* plWidth,long* plHeight) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_GetVideoSize(pVideo,plWidth,plHeight); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnGetVideoPaletteEntries(IBasicVideo* iface,long lStart,long lCount,long* plRet,long* plPaletteEntry) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_GetVideoPaletteEntries(pVideo,lStart,lCount,plRet,plPaletteEntry); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnGetCurrentImage(IBasicVideo* iface,long* plBufferSize,long* plDIBBuffer) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_GetCurrentImage(pVideo,plBufferSize,plDIBBuffer); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnIsUsingDefaultSource(IBasicVideo* iface) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_IsUsingDefaultSource(pVideo); - IBasicVideo_Release(pVideo); - return hr; -} - -static HRESULT WINAPI -IBasicVideo_fnIsUsingDefaultDestination(IBasicVideo* iface) -{ - CFilterGraph_THIS(iface,basvid); - QUERYBASICVIDEO - - TRACE("(%p)->()\n",This); - - hr = IBasicVideo_IsUsingDefaultDestination(pVideo); - IBasicVideo_Release(pVideo); - return hr; -} - - - -static ICOM_VTABLE(IBasicVideo) ibasicvideo = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - IBasicVideo_fnQueryInterface, - IBasicVideo_fnAddRef, - IBasicVideo_fnRelease, - /* IDispatch fields */ - IBasicVideo_fnGetTypeInfoCount, - IBasicVideo_fnGetTypeInfo, - IBasicVideo_fnGetIDsOfNames, - IBasicVideo_fnInvoke, - /* IBasicVideo fields */ - IBasicVideo_fnget_AvgTimePerFrame, - IBasicVideo_fnget_BitRate, - IBasicVideo_fnget_BitErrorRate, - IBasicVideo_fnget_VideoWidth, - IBasicVideo_fnget_VideoHeight, - IBasicVideo_fnput_SourceLeft, - IBasicVideo_fnget_SourceLeft, - IBasicVideo_fnput_SourceWidth, - IBasicVideo_fnget_SourceWidth, - IBasicVideo_fnput_SourceTop, - IBasicVideo_fnget_SourceTop, - IBasicVideo_fnput_SourceHeight, - IBasicVideo_fnget_SourceHeight, - IBasicVideo_fnput_DestinationLeft, - IBasicVideo_fnget_DestinationLeft, - IBasicVideo_fnput_DestinationWidth, - IBasicVideo_fnget_DestinationWidth, - IBasicVideo_fnput_DestinationTop, - IBasicVideo_fnget_DestinationTop, - IBasicVideo_fnput_DestinationHeight, - IBasicVideo_fnget_DestinationHeight, - IBasicVideo_fnSetSourcePosition, - IBasicVideo_fnGetSourcePosition, - IBasicVideo_fnSetDefaultSourcePosition, - IBasicVideo_fnSetDestinationPosition, - IBasicVideo_fnGetDestinationPosition, - IBasicVideo_fnSetDefaultDestinationPosition, - IBasicVideo_fnGetVideoSize, - IBasicVideo_fnGetVideoPaletteEntries, - IBasicVideo_fnGetCurrentImage, - IBasicVideo_fnIsUsingDefaultSource, - IBasicVideo_fnIsUsingDefaultDestination, -}; - - -HRESULT CFilterGraph_InitIBasicVideo( CFilterGraph* pfg ) -{ - TRACE("(%p)\n",pfg); - ICOM_VTBL(&pfg->basvid) = &ibasicvideo; - - return NOERROR; -} - -void CFilterGraph_UninitIBasicVideo( CFilterGraph* pfg ) -{ - TRACE("(%p)\n",pfg); -} - -#undef QUERYBASICVIDEO - -/*************************************************************************** - * - * CFilterGraph::IVideoWindow - * - */ - -#define QUERYVIDEOWINDOW \ - IVideoWindow* pVidWin = NULL; \ - HRESULT hr; \ - hr = CFilterGraph_QueryVideoWindow( This, &pVidWin ); \ - if ( FAILED(hr) ) return hr; - - -static HRESULT WINAPI -IVideoWindow_fnQueryInterface(IVideoWindow* iface,REFIID riid,void** ppobj) -{ - CFilterGraph_THIS(iface,vidwin); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); -} - -static ULONG WINAPI -IVideoWindow_fnAddRef(IVideoWindow* iface) -{ - CFilterGraph_THIS(iface,vidwin); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->unk.punkControl); -} - -static ULONG WINAPI -IVideoWindow_fnRelease(IVideoWindow* iface) -{ - CFilterGraph_THIS(iface,vidwin); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->unk.punkControl); -} - -static HRESULT WINAPI -IVideoWindow_fnGetTypeInfoCount(IVideoWindow* iface,UINT* pcTypeInfo) -{ - CFilterGraph_THIS(iface,vidwin); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IVideoWindow_fnGetTypeInfo(IVideoWindow* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj) -{ - CFilterGraph_THIS(iface,vidwin); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IVideoWindow_fnGetIDsOfNames(IVideoWindow* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId) -{ - CFilterGraph_THIS(iface,vidwin); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IVideoWindow_fnInvoke(IVideoWindow* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr) -{ - CFilterGraph_THIS(iface,vidwin); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - - - -static HRESULT WINAPI -IVideoWindow_fnput_Caption(IVideoWindow* iface,BSTR strCaption) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_put_Caption(pVidWin,strCaption); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_Caption(IVideoWindow* iface,BSTR* pstrCaption) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_get_Caption(pVidWin,pstrCaption); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_WindowStyle(IVideoWindow* iface,long lStyle) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_put_WindowStyle(pVidWin,lStyle); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_WindowStyle(IVideoWindow* iface,long* plStyle) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_get_WindowStyle(pVidWin,plStyle); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_WindowStyleEx(IVideoWindow* iface,long lExStyle) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_put_WindowStyleEx(pVidWin,lExStyle); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_WindowStyleEx(IVideoWindow* iface,long* plExStyle) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_get_WindowStyleEx(pVidWin,plExStyle); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_AutoShow(IVideoWindow* iface,long lAutoShow) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_put_AutoShow(pVidWin,lAutoShow); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_AutoShow(IVideoWindow* iface,long* plAutoShow) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_get_AutoShow(pVidWin,plAutoShow); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_WindowState(IVideoWindow* iface,long lState) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_put_WindowState(pVidWin,lState); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_WindowState(IVideoWindow* iface,long* plState) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_get_WindowState(pVidWin,plState); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_BackgroundPalette(IVideoWindow* iface,long lBackPal) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_put_BackgroundPalette(pVidWin,lBackPal); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_BackgroundPalette(IVideoWindow* iface,long* plBackPal) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_get_BackgroundPalette(pVidWin,plBackPal); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_Visible(IVideoWindow* iface,long lVisible) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_put_Visible(pVidWin,lVisible); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_Visible(IVideoWindow* iface,long* plVisible) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_get_Visible(pVidWin,plVisible); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_Left(IVideoWindow* iface,long lLeft) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_put_Left(pVidWin,lLeft); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_Left(IVideoWindow* iface,long* plLeft) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_get_Left(pVidWin,plLeft); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_Width(IVideoWindow* iface,long lWidth) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_put_Width(pVidWin,lWidth); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_Width(IVideoWindow* iface,long* plWidth) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr =IVideoWindow_get_Width(pVidWin,plWidth); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_Top(IVideoWindow* iface,long lTop) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_put_Top(pVidWin,lTop); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_Top(IVideoWindow* iface,long* plTop) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_get_Top(pVidWin,plTop); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_Height(IVideoWindow* iface,long lHeight) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_put_Height(pVidWin,lHeight); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_Height(IVideoWindow* iface,long* plHeight) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_get_Height(pVidWin,plHeight); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_Owner(IVideoWindow* iface,OAHWND hwnd) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_put_Owner(pVidWin,hwnd); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_Owner(IVideoWindow* iface,OAHWND* phwnd) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_get_Owner(pVidWin,phwnd); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_MessageDrain(IVideoWindow* iface,OAHWND hwnd) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_put_MessageDrain(pVidWin,hwnd); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_MessageDrain(IVideoWindow* iface,OAHWND* phwnd) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_get_MessageDrain(pVidWin,phwnd); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_BorderColor(IVideoWindow* iface,long* plColor) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_get_BorderColor(pVidWin,plColor); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_BorderColor(IVideoWindow* iface,long lColor) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_put_BorderColor(pVidWin,lColor); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_FullScreenMode(IVideoWindow* iface,long* plMode) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_get_FullScreenMode(pVidWin,plMode); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_FullScreenMode(IVideoWindow* iface,long lMode) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_put_FullScreenMode(pVidWin,lMode); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnSetWindowForeground(IVideoWindow* iface,long lFocus) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_SetWindowForeground(pVidWin,lFocus); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnNotifyOwnerMessage(IVideoWindow* iface,OAHWND hwnd,long message,LONG_PTR wParam,LONG_PTR lParam) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_NotifyOwnerMessage(pVidWin,hwnd,message,wParam,lParam); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnSetWindowPosition(IVideoWindow* iface,long lLeft,long lTop,long lWidth,long lHeight) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_SetWindowPosition(pVidWin,lLeft,lTop,lWidth,lHeight); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnGetWindowPosition(IVideoWindow* iface,long* plLeft,long* plTop,long* plWidth,long* plHeight) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_GetWindowPosition(pVidWin,plLeft,plTop,plWidth,plHeight); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnGetMinIdealImageSize(IVideoWindow* iface,long* plWidth,long* plHeight) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_GetMinIdealImageSize(pVidWin,plWidth,plHeight); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnGetMaxIdealImageSize(IVideoWindow* iface,long* plWidth,long* plHeight) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_GetMaxIdealImageSize(pVidWin,plWidth,plHeight); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnGetRestorePosition(IVideoWindow* iface,long* plLeft,long* plTop,long* plWidth,long* plHeight) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_GetRestorePosition(pVidWin,plLeft,plTop,plWidth,plHeight); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnHideCursor(IVideoWindow* iface,long lHide) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_HideCursor(pVidWin,lHide); - IVideoWindow_Release(pVidWin); - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnIsCursorHidden(IVideoWindow* iface,long* plHide) -{ - CFilterGraph_THIS(iface,vidwin); - QUERYVIDEOWINDOW - - TRACE("(%p)->()\n",This); - - hr = IVideoWindow_IsCursorHidden(pVidWin,plHide); - IVideoWindow_Release(pVidWin); - return hr; -} - - - - -static ICOM_VTABLE(IVideoWindow) ivideowindow = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - IVideoWindow_fnQueryInterface, - IVideoWindow_fnAddRef, - IVideoWindow_fnRelease, - /* IDispatch fields */ - IVideoWindow_fnGetTypeInfoCount, - IVideoWindow_fnGetTypeInfo, - IVideoWindow_fnGetIDsOfNames, - IVideoWindow_fnInvoke, - /* IVideoWindow fields */ - IVideoWindow_fnput_Caption, - IVideoWindow_fnget_Caption, - IVideoWindow_fnput_WindowStyle, - IVideoWindow_fnget_WindowStyle, - IVideoWindow_fnput_WindowStyleEx, - IVideoWindow_fnget_WindowStyleEx, - IVideoWindow_fnput_AutoShow, - IVideoWindow_fnget_AutoShow, - IVideoWindow_fnput_WindowState, - IVideoWindow_fnget_WindowState, - IVideoWindow_fnput_BackgroundPalette, - IVideoWindow_fnget_BackgroundPalette, - IVideoWindow_fnput_Visible, - IVideoWindow_fnget_Visible, - IVideoWindow_fnput_Left, - IVideoWindow_fnget_Left, - IVideoWindow_fnput_Width, - IVideoWindow_fnget_Width, - IVideoWindow_fnput_Top, - IVideoWindow_fnget_Top, - IVideoWindow_fnput_Height, - IVideoWindow_fnget_Height, - IVideoWindow_fnput_Owner, - IVideoWindow_fnget_Owner, - IVideoWindow_fnput_MessageDrain, - IVideoWindow_fnget_MessageDrain, - IVideoWindow_fnget_BorderColor, - IVideoWindow_fnput_BorderColor, - IVideoWindow_fnget_FullScreenMode, - IVideoWindow_fnput_FullScreenMode, - IVideoWindow_fnSetWindowForeground, - IVideoWindow_fnNotifyOwnerMessage, - IVideoWindow_fnSetWindowPosition, - IVideoWindow_fnGetWindowPosition, - IVideoWindow_fnGetMinIdealImageSize, - IVideoWindow_fnGetMaxIdealImageSize, - IVideoWindow_fnGetRestorePosition, - IVideoWindow_fnHideCursor, - IVideoWindow_fnIsCursorHidden, - -}; - - -HRESULT CFilterGraph_InitIVideoWindow( CFilterGraph* pfg ) -{ - TRACE("(%p)\n",pfg); - ICOM_VTBL(&pfg->vidwin) = &ivideowindow; - - return NOERROR; -} - -void CFilterGraph_UninitIVideoWindow( CFilterGraph* pfg ) -{ - TRACE("(%p)\n",pfg); -} - -#undef QUERYVIDEOWINDOW diff --git a/dlls/quartz/fgraph.c b/dlls/quartz/fgraph.c deleted file mode 100644 index 2f136616426..00000000000 --- a/dlls/quartz/fgraph.c +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Implementation of CLSID_FilterGraph. - * - * 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 "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); -} - - - diff --git a/dlls/quartz/fgraph.h b/dlls/quartz/fgraph.h deleted file mode 100644 index aaba52097ff..00000000000 --- a/dlls/quartz/fgraph.h +++ /dev/null @@ -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 */ diff --git a/dlls/quartz/filesink.c b/dlls/quartz/filesink.c deleted file mode 100644 index 5d972391fa7..00000000000 --- a/dlls/quartz/filesink.c +++ /dev/null @@ -1,914 +0,0 @@ -/* - * Implements CLSID_FileWriter. - * - * 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 - * - * FIXME - not tested - */ - -#include "config.h" - -#include -#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; -} - - diff --git a/dlls/quartz/filesink.h b/dlls/quartz/filesink.h deleted file mode 100644 index 5c2fb830b49..00000000000 --- a/dlls/quartz/filesink.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Implements CLSID_FileWriter. - * - * 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_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 */ diff --git a/dlls/quartz/fmap.c b/dlls/quartz/fmap.c deleted file mode 100644 index 4a113acf817..00000000000 --- a/dlls/quartz/fmap.c +++ /dev/null @@ -1,1125 +0,0 @@ -/* - * Implementation of CLSID_FilterMapper and CLSID_FilterMapper2. - * - * FIXME - some stubs - * - * 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 -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winreg.h" -#include "winerror.h" -#include "strmif.h" -#include "uuids.h" - -#include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(quartz); - -#include "quartz_private.h" -#include "fmap.h" -#include "regsvr.h" -#include "devenum.h" -#include "complist.h" -#include "enumunk.h" - -/***************************************************************************/ - -typedef struct QUARTZ_REGFILTERDATA -{ - DWORD dwVersion; /* =2 */ - DWORD dwMerit; - DWORD cPins; /* count of pins */ - DWORD dwZero; /* padding??? */ -} QUARTZ_REGFILTERDATA; - -typedef struct QUARTZ_REGPINDATA -{ - CHAR id[4]; /* '0pi3', '1pi3', ... */ - DWORD dwFlags; /* flags */ - UINT cInstances; /* FIXME - is this correct? */ - UINT nMediaTypes; /* count of media types('0ty3') */ - UINT nMediums; /* FIXME - is this correct? */ - UINT nOfsClsPinCategory; /* FIXME - is this correct? */ -} QUARTZ_REGPINDATA; - -typedef struct QUARTZ_REGMEDIATYPE -{ - CHAR id[4]; /* '0ty3', '1ty3', ... */ - DWORD nZero; /* padding??? */ - UINT nOfsMajorType; - UINT nOfsMinorType; -} QUARTZ_REGMEDIATYPE; - - - -/***************************************************************************/ - -static -REGFILTER2* QUARTZ_RegFilterV2FromFilterData( - const BYTE* pData, DWORD cbData ) -{ - REGFILTER2* pFilter; - REGFILTERPINS2* pPin; - REGPINTYPES* pTypes; - BYTE* pDst; - const QUARTZ_REGFILTERDATA* pRegFilter; - const QUARTZ_REGPINDATA* pRegPin; - const QUARTZ_REGMEDIATYPE* pRegMediaType; - DWORD cPins; - DWORD cbBufSize; - UINT n; - - TRACE("(%p,%lu)\n",pData,cbData); - - if ( cbData < sizeof(QUARTZ_REGFILTERDATA) ) - return NULL; - - pRegFilter = (QUARTZ_REGFILTERDATA*)pData; - - if ( pRegFilter->dwVersion != 2 ) return NULL; /* FIXME */ - - if ( cbData < (sizeof(QUARTZ_REGFILTERDATA)+sizeof(QUARTZ_REGPINDATA)*pRegFilter->cPins) ) - return NULL; - - cbBufSize = sizeof(REGFILTER2); - cPins = pRegFilter->cPins; - pRegPin = (const QUARTZ_REGPINDATA*)(pRegFilter+1); - while ( cPins-- > 0 ) - { - if ( pRegPin->nMediums != 0 || - pRegPin->nOfsClsPinCategory != 0 ) - return NULL; /* FIXME */ - - cbBufSize += sizeof(REGFILTERPINS2) + - pRegPin->nMediaTypes * (sizeof(REGPINTYPES) + sizeof(GUID)*2) + - pRegPin->nMediums * sizeof(REGPINMEDIUM) + - sizeof(CLSID); - pRegPin = (const QUARTZ_REGPINDATA*)( ((const BYTE*)pRegPin) + - sizeof(QUARTZ_REGPINDATA) + - sizeof(QUARTZ_REGMEDIATYPE) * pRegPin->nMediaTypes ); - } - - pFilter = (REGFILTER2*)QUARTZ_AllocMem( cbBufSize ); - if ( pFilter == NULL ) return NULL; - ZeroMemory( pFilter, cbBufSize ); - pPin = (REGFILTERPINS2*)(pFilter+1); - pDst = (BYTE*)(pPin + pRegFilter->cPins); - - pFilter->dwVersion = 2; - pFilter->dwMerit = pRegFilter->dwMerit; - pFilter->u.s2.cPins2 = pRegFilter->cPins; - pFilter->u.s2.rgPins2 = pPin; - - cPins = pRegFilter->cPins; - TRACE("cPins = %lu\n",cPins); - - pRegPin = (const QUARTZ_REGPINDATA*)(pRegFilter+1); - while ( cPins-- > 0 ) - { - pPin->dwFlags = pRegPin->dwFlags; - pPin->cInstances = pRegPin->cInstances; - pPin->nMediaTypes = pRegPin->nMediaTypes; - pPin->lpMediaType = NULL; - pPin->nMediums = pRegPin->nMediums; - pPin->lpMedium = NULL; - pPin->clsPinCategory = NULL; - - pTypes = (REGPINTYPES*)pDst; - pPin->lpMediaType = pTypes; - pDst += sizeof(REGPINTYPES) * pRegPin->nMediaTypes; - - pRegPin = (const QUARTZ_REGPINDATA*)( ((const BYTE*)pRegPin) + - sizeof(QUARTZ_REGPINDATA) ); - - for ( n = 0; n < pPin->nMediaTypes; n++ ) - { - pRegMediaType = ((const QUARTZ_REGMEDIATYPE*)pRegPin); - TRACE("ofsMajor = %u, ofsMinor = %u\n", pRegMediaType->nOfsMajorType, pRegMediaType->nOfsMinorType); - memcpy( pDst, pData+pRegMediaType->nOfsMajorType, sizeof(GUID) ); - pTypes->clsMajorType = (const GUID*)pDst; pDst += sizeof(GUID); - memcpy( pDst, pData+pRegMediaType->nOfsMinorType, sizeof(GUID) ); - pTypes->clsMinorType = (const GUID*)pDst; pDst += sizeof(GUID); - - pRegPin = (const QUARTZ_REGPINDATA*)( ((const BYTE*)pRegPin) + - sizeof(QUARTZ_REGMEDIATYPE) ); - pTypes ++; - } - - /* FIXME - pPin->lpMedium */ - /* FIXME - pPin->clsPinCategory */ - - pPin ++; - } - - return pFilter; -} - -static -BYTE* QUARTZ_RegFilterV2ToFilterData( - const REGFILTER2* pFilter, DWORD* pcbData ) -{ - DWORD cbData; - DWORD cbPinData; - DWORD cPins; - const REGFILTERPINS2* pPin; - const REGPINTYPES* pTypes; - BYTE* pRet = NULL; - BYTE* pDst; - QUARTZ_REGFILTERDATA* pRegFilter; - QUARTZ_REGPINDATA* pRegPin; - QUARTZ_REGMEDIATYPE* pRegMediaType; - UINT n; - - if ( pFilter->dwVersion != 2 ) return NULL; /* FIXME */ - - cbData = sizeof(QUARTZ_REGFILTERDATA); - cPins = pFilter->u.s2.cPins2; - pPin = pFilter->u.s2.rgPins2; - if ( cPins > 10 ) return NULL; /* FIXME */ - - cbPinData = 0; - while ( cPins-- > 0 ) - { - if ( pPin->cInstances != 0 || - pPin->nMediaTypes > 10 || - pPin->nMediums != 0 || - pPin->clsPinCategory != 0 ) - { - FIXME( "not implemented.\n" ); - return NULL; /* FIXME */ - } - - cbPinData += sizeof(QUARTZ_REGPINDATA) + - pPin->nMediaTypes * sizeof(QUARTZ_REGMEDIATYPE); - cbData += pPin->nMediaTypes * (sizeof(GUID)*2); - pPin ++; - } - cbData += cbPinData; - TRACE("cbData %lu, cbPinData %lu\n",cbData,cbPinData); - - pRet = (BYTE*)QUARTZ_AllocMem( cbData ); - if ( pRet == NULL ) return NULL; - ZeroMemory( pRet, cbData ); - pDst = pRet; - - pRegFilter = (QUARTZ_REGFILTERDATA*)pDst; - pDst += sizeof(QUARTZ_REGFILTERDATA); - - pRegFilter->dwVersion = 2; - pRegFilter->dwMerit = pFilter->dwMerit; - pRegFilter->cPins = pFilter->u.s2.cPins2; - - pRegPin = (QUARTZ_REGPINDATA*)pDst; - pDst += cbPinData; - - pPin = pFilter->u.s2.rgPins2; - for ( cPins = 0; cPins < pFilter->u.s2.cPins2; cPins++ ) - { - pRegPin->id[0] = '0'+cPins; - pRegPin->id[1] = 'p'; - pRegPin->id[2] = 'i'; - pRegPin->id[3] = '3'; - pRegPin->dwFlags = pPin->dwFlags; /* flags */ - pRegPin->cInstances = pPin->cInstances; - pRegPin->nMediaTypes = pPin->nMediaTypes; - pRegPin->nMediums = pPin->nMediums; - pRegPin->nOfsClsPinCategory = 0; /* FIXME */ - - pTypes = pPin->lpMediaType; - pRegPin = (QUARTZ_REGPINDATA*)( ((const BYTE*)pRegPin) + - sizeof(QUARTZ_REGPINDATA) ); - for ( n = 0; n < pPin->nMediaTypes; n++ ) - { - pRegMediaType = ((QUARTZ_REGMEDIATYPE*)pRegPin); - - pRegMediaType->id[0] = '0'+n; - pRegMediaType->id[1] = 't'; - pRegMediaType->id[2] = 'y'; - pRegMediaType->id[3] = '3'; - - /* FIXME - CLSID should be shared. */ - pRegMediaType->nOfsMajorType = pDst - pRet; - memcpy( pDst, pTypes->clsMajorType, sizeof(GUID) ); - pDst += sizeof(GUID); - pRegMediaType->nOfsMinorType = pDst - pRet; - memcpy( pDst, pTypes->clsMinorType, sizeof(GUID) ); - pDst += sizeof(GUID); - - pRegPin = (QUARTZ_REGPINDATA*)( ((const BYTE*)pRegPin) + - sizeof(QUARTZ_REGMEDIATYPE) ); - pTypes ++; - } - pPin ++; - } - - *pcbData = pDst - pRet; - TRACE("cbData %lu/%lu\n",*pcbData,cbData); - - return pRet; -} - -static -REGFILTER2* QUARTZ_RegFilterV1ToV2( const REGFILTER2* prfV1 ) -{ - REGFILTER2* prfV2; - const REGFILTERPINS* pPinV1; - REGFILTERPINS2* pPinV2; - DWORD cPins; - - if ( prfV1->dwVersion != 1 ) return NULL; - - prfV2 = (REGFILTER2*)QUARTZ_AllocMem( - sizeof(REGFILTER2) + sizeof(REGFILTERPINS2) * prfV1->u.s1.cPins ); - if ( prfV2 == NULL ) return NULL; - ZeroMemory( prfV2, sizeof(REGFILTER2) + sizeof(REGFILTERPINS2) * prfV1->u.s1.cPins ); - pPinV1 = prfV1->u.s1.rgPins; - pPinV2 = (REGFILTERPINS2*)(prfV2+1); - prfV2->dwVersion = 2; - prfV2->dwMerit = prfV1->dwMerit; - prfV2->u.s2.cPins2 = prfV1->u.s1.cPins; - prfV2->u.s2.rgPins2 = pPinV2; - - cPins = prfV1->u.s1.cPins; - while ( cPins-- > 0 ) - { - pPinV2->dwFlags = 0; - pPinV2->cInstances = 0; - pPinV2->nMediaTypes = pPinV1->nMediaTypes; - pPinV2->lpMediaType = pPinV1->lpMediaType; - pPinV2->nMediums = 0; - pPinV2->lpMedium = NULL; - pPinV2->clsPinCategory = NULL; - - if ( pPinV1->bRendered ) - pPinV2->dwFlags |= REG_PINFLAG_B_RENDERER; - if ( pPinV1->bOutput ) - pPinV2->dwFlags |= REG_PINFLAG_B_OUTPUT; - if ( pPinV1->bZero ) - pPinV2->dwFlags |= REG_PINFLAG_B_ZERO; - if ( pPinV1->bMany ) - pPinV2->dwFlags |= REG_PINFLAG_B_MANY; - - pPinV1 ++; - pPinV2 ++; - } - - return prfV2; -} - -static -BYTE* QUARTZ_RegFilterToFilterData( - const REGFILTER2* pFilter, DWORD* pcbData ) -{ - REGFILTER2* prfV2; - BYTE* pRet = NULL; - - *pcbData = 0; - switch ( pFilter->dwVersion ) - { - case 1: - prfV2 = QUARTZ_RegFilterV1ToV2( pFilter ); - if ( prfV2 != NULL ) - { - pRet = QUARTZ_RegFilterV2ToFilterData( prfV2, pcbData ); - QUARTZ_FreeMem( prfV2 ); - } - break; - case 2: - pRet = QUARTZ_RegFilterV2ToFilterData( pFilter, pcbData ); - break; - default: - FIXME( "unknown REGFILTER2 version - %08lu\n", pFilter->dwVersion ); - break; - } - - return pRet; -} - -/***************************************************************************/ - -static -BOOL QUARTZ_CheckPinType( BOOL bExactMatch, const REGFILTERPINS2* pPin, DWORD cTypes, const GUID* pTypes, const REGPINMEDIUM* pMedium, const CLSID* pCategory, BOOL bRender ) -{ - DWORD n1, n2; - BOOL bMatch; - - if ( cTypes > 0 && pTypes != NULL ) - { - bMatch = FALSE; - for ( n1 = 0; n1 < pPin->nMediaTypes; n1++ ) - { - for ( n2 = 0; n2 < cTypes; n2++ ) - { - if ( IsEqualGUID(pPin->lpMediaType[n1].clsMajorType,&GUID_NULL) || IsEqualGUID(pPin->lpMediaType[n1].clsMajorType, &pTypes[n2*2+0]) || (!bExactMatch && IsEqualGUID(pPin->lpMediaType[n1].clsMajorType,&GUID_NULL)) ) - { - if ( IsEqualGUID(pPin->lpMediaType[n1].clsMinorType,&GUID_NULL) || IsEqualGUID(pPin->lpMediaType[n1].clsMinorType, &pTypes[n2*2+1]) || (!bExactMatch && IsEqualGUID(pPin->lpMediaType[n1].clsMinorType,&GUID_NULL)) ) - { - bMatch = TRUE; - break; - } - } - } - } - TRACE("Check media type %d\n",(int)bMatch); - if ( !bMatch ) - return FALSE; - } - - if ( pMedium != NULL ) - { - bMatch = FALSE; - for ( n1 = 0; n1 < pPin->nMediums; n1++ ) - { - if ( IsEqualGUID( &pPin->lpMedium[n1].clsMedium, &pMedium->clsMedium ) && pPin->lpMedium[n1].dw1 == pMedium->dw1 && pPin->lpMedium[n1].dw2 == pMedium->dw2 ) - { - bMatch = TRUE; - break; - } - } - TRACE("Check medium %d\n",(int)bMatch); - if ( !bMatch ) - return FALSE; - } - - if ( pCategory != NULL ) - { - if ( pPin->clsPinCategory == NULL ) - return FALSE; - if ( (!bExactMatch && IsEqualGUID(pCategory,&GUID_NULL)) || IsEqualGUID(pCategory,pPin->clsPinCategory) ) - return TRUE; - return FALSE; - } - - if ( bRender && (!(pPin->dwFlags & REG_PINFLAG_B_RENDERER)) ) - { - TRACE("not a renderer\n"); - return FALSE; - } - - return TRUE; -} - - - - -/*************************************************************************** - * - * new/delete for CLSID_FilterMapper - * - */ - -/* can I use offsetof safely? - FIXME? */ -static QUARTZ_IFEntry FMapIFEntries[] = -{ - { &IID_IFilterMapper, offsetof(CFilterMapper,fmap)-offsetof(CFilterMapper,unk) }, -}; - - -static void QUARTZ_DestroyFilterMapper(IUnknown* punk) -{ - CFilterMapper_THIS(punk,unk); - - CFilterMapper_UninitIFilterMapper( This ); -} - -HRESULT QUARTZ_CreateFilterMapper(IUnknown* punkOuter,void** ppobj) -{ - CFilterMapper* pfm; - HRESULT hr; - - TRACE("(%p,%p)\n",punkOuter,ppobj); - - pfm = (CFilterMapper*)QUARTZ_AllocObj( sizeof(CFilterMapper) ); - if ( pfm == NULL ) - return E_OUTOFMEMORY; - - QUARTZ_IUnkInit( &pfm->unk, punkOuter ); - hr = CFilterMapper_InitIFilterMapper( pfm ); - if ( FAILED(hr) ) - { - QUARTZ_FreeObj( pfm ); - return hr; - } - - pfm->unk.pEntries = FMapIFEntries; - pfm->unk.dwEntries = sizeof(FMapIFEntries)/sizeof(FMapIFEntries[0]); - pfm->unk.pOnFinalRelease = QUARTZ_DestroyFilterMapper; - - *ppobj = (void*)(&pfm->unk); - - return S_OK; -} - -/*************************************************************************** - * - * CLSID_FilterMapper::IFilterMapper - * - */ - -static HRESULT WINAPI -IFilterMapper_fnQueryInterface(IFilterMapper* iface,REFIID riid,void** ppobj) -{ - CFilterMapper_THIS(iface,fmap); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); -} - -static ULONG WINAPI -IFilterMapper_fnAddRef(IFilterMapper* iface) -{ - CFilterMapper_THIS(iface,fmap); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->unk.punkControl); -} - -static ULONG WINAPI -IFilterMapper_fnRelease(IFilterMapper* iface) -{ - CFilterMapper_THIS(iface,fmap); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->unk.punkControl); -} - - -static HRESULT WINAPI -IFilterMapper_fnRegisterFilter(IFilterMapper* iface,CLSID clsid,LPCWSTR lpwszName,DWORD dwMerit) -{ - CFilterMapper_THIS(iface,fmap); - - FIXME("(%p)->(%s,%s,%08lx)\n",This, - debugstr_guid(&clsid),debugstr_w(lpwszName),dwMerit); - - /* FIXME */ - /* FIXME - handle dwMerit! */ - return QUARTZ_RegisterAMovieFilter( - &CLSID_LegacyAmFilterCategory, - &clsid, - NULL, 0, - lpwszName, NULL, TRUE ); -} - -static HRESULT WINAPI -IFilterMapper_fnRegisterFilterInstance(IFilterMapper* iface,CLSID clsid,LPCWSTR lpwszName,CLSID* pclsidMedia) -{ - CFilterMapper_THIS(iface,fmap); - HRESULT hr; - - FIXME("(%p)->()\n",This); - - if ( pclsidMedia == NULL ) - return E_POINTER; - hr = CoCreateGuid(pclsidMedia); - if ( FAILED(hr) ) - return hr; - - /* FIXME */ - /* this doesn't work. */ - /* return IFilterMapper_RegisterFilter(iface, - *pclsidMedia,lpwszName,0x60000000); */ - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IFilterMapper_fnRegisterPin(IFilterMapper* iface,CLSID clsidFilter,LPCWSTR lpwszName,BOOL bRendered,BOOL bOutput,BOOL bZero,BOOL bMany,CLSID clsidReserved,LPCWSTR lpwszReserved) -{ - CFilterMapper_THIS(iface,fmap); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IFilterMapper_fnRegisterPinType(IFilterMapper* iface,CLSID clsidFilter,LPCWSTR lpwszName,CLSID clsidMajorType,CLSID clsidSubType) -{ - CFilterMapper_THIS(iface,fmap); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IFilterMapper_fnUnregisterFilter(IFilterMapper* iface,CLSID clsidFilter) -{ - CFilterMapper_THIS(iface,fmap); - - FIXME("(%p)->(%s)\n",This,debugstr_guid(&clsidFilter)); - - /* FIXME */ - return QUARTZ_RegisterAMovieFilter( - &CLSID_LegacyAmFilterCategory, - &clsidFilter, - NULL, 0, NULL, NULL, FALSE ); -} - -static HRESULT WINAPI -IFilterMapper_fnUnregisterFilterInstance(IFilterMapper* iface,CLSID clsidMedia) -{ - CFilterMapper_THIS(iface,fmap); - - FIXME("(%p)->(%s)\n",This,debugstr_guid(&clsidMedia)); - - /* FIXME */ - /* this doesn't work. */ - /* return IFilterMapper_UnregisterFilter(iface,clsidMedia); */ - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IFilterMapper_fnUnregisterPin(IFilterMapper* iface,CLSID clsidPin,LPCWSTR lpwszName) -{ - CFilterMapper_THIS(iface,fmap); - - FIXME("(%p)->(%s,%s) stub!\n",This, - debugstr_guid(&clsidPin),debugstr_w(lpwszName)); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IFilterMapper_fnEnumMatchingFilters(IFilterMapper* iface,IEnumRegFilters** ppobj,DWORD dwMerit,BOOL bInputNeeded,CLSID clsInMajorType,CLSID clsidSubType,BOOL bRender,BOOL bOutputNeeded,CLSID clsOutMajorType,CLSID clsOutSubType) -{ - CFilterMapper_THIS(iface,fmap); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - - - -static ICOM_VTABLE(IFilterMapper) ifmap = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - IFilterMapper_fnQueryInterface, - IFilterMapper_fnAddRef, - IFilterMapper_fnRelease, - /* IFilterMapper fields */ - IFilterMapper_fnRegisterFilter, - IFilterMapper_fnRegisterFilterInstance, - IFilterMapper_fnRegisterPin, - IFilterMapper_fnRegisterPinType, - IFilterMapper_fnUnregisterFilter, - IFilterMapper_fnUnregisterFilterInstance, - IFilterMapper_fnUnregisterPin, - IFilterMapper_fnEnumMatchingFilters, -}; - - -HRESULT CFilterMapper_InitIFilterMapper( CFilterMapper* pfm ) -{ - TRACE("(%p)\n",pfm); - ICOM_VTBL(&pfm->fmap) = &ifmap; - - return NOERROR; -} - -void CFilterMapper_UninitIFilterMapper( CFilterMapper* pfm ) -{ - TRACE("(%p)\n",pfm); -} - - -/*************************************************************************** - * - * new/delete for CLSID_FilterMapper2 - * - */ - -/* can I use offsetof safely? - FIXME? */ -static QUARTZ_IFEntry FMap2IFEntries[] = -{ - { &IID_IFilterMapper2, offsetof(CFilterMapper2,fmap2)-offsetof(CFilterMapper2,unk) }, -}; - - -static void QUARTZ_DestroyFilterMapper2(IUnknown* punk) -{ - CFilterMapper2_THIS(punk,unk); - - CFilterMapper2_UninitIFilterMapper2( This ); -} - -HRESULT QUARTZ_CreateFilterMapper2(IUnknown* punkOuter,void** ppobj) -{ - CFilterMapper2* pfm; - HRESULT hr; - - TRACE("(%p,%p)\n",punkOuter,ppobj); - - pfm = (CFilterMapper2*)QUARTZ_AllocObj( sizeof(CFilterMapper2) ); - if ( pfm == NULL ) - return E_OUTOFMEMORY; - - QUARTZ_IUnkInit( &pfm->unk, punkOuter ); - hr = CFilterMapper2_InitIFilterMapper2( pfm ); - if ( FAILED(hr) ) - { - QUARTZ_FreeObj( pfm ); - return hr; - } - - pfm->unk.pEntries = FMap2IFEntries; - pfm->unk.dwEntries = sizeof(FMap2IFEntries)/sizeof(FMap2IFEntries[0]); - pfm->unk.pOnFinalRelease = QUARTZ_DestroyFilterMapper2; - - *ppobj = (void*)(&pfm->unk); - - return S_OK; -} - -/*************************************************************************** - * - * CLSID_FilterMapper2::IFilterMapper2 - * - */ - - -static HRESULT WINAPI -IFilterMapper2_fnQueryInterface(IFilterMapper2* iface,REFIID riid,void** ppobj) -{ - CFilterMapper2_THIS(iface,fmap2); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); -} - -static ULONG WINAPI -IFilterMapper2_fnAddRef(IFilterMapper2* iface) -{ - CFilterMapper2_THIS(iface,fmap2); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->unk.punkControl); -} - -static ULONG WINAPI -IFilterMapper2_fnRelease(IFilterMapper2* iface) -{ - CFilterMapper2_THIS(iface,fmap2); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->unk.punkControl); -} - -static HRESULT WINAPI -IFilterMapper2_fnCreateCategory(IFilterMapper2* iface,REFCLSID rclsidCategory,DWORD dwMerit,LPCWSTR lpwszDesc) -{ - CFilterMapper2_THIS(iface,fmap2); - - FIXME("(%p)->(%s,%lu,%s) stub!\n",This, - debugstr_guid(rclsidCategory), - (unsigned long)dwMerit,debugstr_w(lpwszDesc)); - - return E_NOTIMPL; -} - - -static HRESULT WINAPI -IFilterMapper2_fnUnregisterFilter(IFilterMapper2* iface,const CLSID* pclsidCategory,const OLECHAR* lpwszInst,REFCLSID rclsidFilter) -{ - CFilterMapper2_THIS(iface,fmap2); - WCHAR* pwszPath = NULL; - HRESULT hr; - - TRACE("(%p)->(%s,%s,%s)\n",This, - debugstr_guid(pclsidCategory), - debugstr_w(lpwszInst), - debugstr_guid(rclsidFilter)); - - if ( pclsidCategory == NULL ) - pclsidCategory = &CLSID_LegacyAmFilterCategory; - - hr = QUARTZ_GetFilterRegPath( - &pwszPath, pclsidCategory, rclsidFilter, lpwszInst ); - if ( FAILED(hr) ) - return hr; - - hr = QUARTZ_RegDeleteKey(HKEY_CLASSES_ROOT,pwszPath); - QUARTZ_FreeMem(pwszPath); - - return hr; -} - - -static HRESULT WINAPI -IFilterMapper2_fnRegisterFilter(IFilterMapper2* iface,REFCLSID rclsidFilter,LPCWSTR lpName,IMoniker** ppMoniker,const CLSID* pclsidCategory,const OLECHAR* lpwszInst,const REGFILTER2* pRF2) -{ - CFilterMapper2_THIS(iface,fmap2); - WCHAR* pwszPath = NULL; - IMoniker* pMoniker = NULL; - BYTE* pFilterData = NULL; - DWORD cbFilterData = 0; - HRESULT hr; - - TRACE( "(%p)->(%s,%s,%p,%s,%s,%p) stub!\n",This, - debugstr_guid(rclsidFilter),debugstr_w(lpName), - ppMoniker,debugstr_guid(pclsidCategory), - debugstr_w(lpwszInst),pRF2 ); - - if ( lpName == NULL || pRF2 == NULL ) - return E_POINTER; - - if ( ppMoniker != NULL && *ppMoniker != NULL ) - { - FIXME( "ppMoniker != NULL - not implemented! *ppMoniker = %p\n",*ppMoniker ); - return E_NOTIMPL; - } - - if ( pclsidCategory == NULL ) - pclsidCategory = &CLSID_LegacyAmFilterCategory; - - if ( pMoniker == NULL ) - { - hr = QUARTZ_GetFilterRegPath( - &pwszPath, pclsidCategory, rclsidFilter, lpwszInst ); - if ( FAILED(hr) ) - return hr; - hr = QUARTZ_CreateDeviceMoniker( - HKEY_CLASSES_ROOT,pwszPath,&pMoniker); - QUARTZ_FreeMem(pwszPath); - if ( FAILED(hr) ) - return hr; - } - - pFilterData = QUARTZ_RegFilterToFilterData( pRF2, &cbFilterData ); - if ( pFilterData == NULL || cbFilterData == 0 ) - { - hr = E_FAIL; - goto err; - } - - hr = QUARTZ_RegisterFilterToMoniker( - pMoniker, rclsidFilter, lpName, pFilterData, cbFilterData ); - if ( FAILED(hr) ) - goto err; - - if ( ppMoniker != NULL ) - { - *ppMoniker = pMoniker; - pMoniker = NULL; - } -err: - if ( pFilterData != NULL ) - QUARTZ_FreeMem(pFilterData); - if ( pMoniker != NULL ) - IMoniker_Release(pMoniker); - - return hr; -} - -struct MATCHED_ITEM -{ - IMoniker* pMonFilter; - DWORD dwMerit; -}; - -static int sort_comp_merit(const void* p1,const void* p2) -{ - const struct MATCHED_ITEM* pItem1 = (const struct MATCHED_ITEM*)p1; - const struct MATCHED_ITEM* pItem2 = (const struct MATCHED_ITEM*)p2; - - return (int)pItem2->dwMerit - (int)pItem1->dwMerit; -} - -static HRESULT WINAPI -IFilterMapper2_fnEnumMatchingFilters(IFilterMapper2* iface, - IEnumMoniker** ppEnumMoniker,DWORD dwFlags,BOOL bExactMatch,DWORD dwMerit, - BOOL bInputNeeded,DWORD cInputTypes,const GUID* pguidInputTypes,const REGPINMEDIUM* pPinMediumIn,const CLSID* pPinCategoryIn,BOOL bRender, - BOOL bOutputNeeded,DWORD cOutputTypes,const GUID* pguidOutputTypes,const REGPINMEDIUM* pPinMediumOut,const CLSID* pPinCategoryOut) -{ - CFilterMapper2_THIS(iface,fmap2); - ICreateDevEnum* pEnum = NULL; - IEnumMoniker* pCategories = NULL; - IMoniker* pCat = NULL; - DWORD dwCatMerit; - IEnumMoniker* pCatFilters = NULL; - IMoniker* pFilter = NULL; - CLSID clsid; - ULONG cReturned; - BYTE* pbFilterData = NULL; - DWORD cbFilterData = 0; - REGFILTER2* prf2 = NULL; - QUARTZ_CompList* pListFilters = NULL; - struct MATCHED_ITEM* pItems = NULL; - struct MATCHED_ITEM* pItemsTmp; - int cItems = 0; - const REGFILTERPINS2* pRegFilterPin; - DWORD n; - BOOL bMatch; - HRESULT hr; - - WARN("(%p)->(%p,%08lx,%d,%08lx,%d,%lu,%p,%p,%p,%d,%d,%lu,%p,%p,%p) some features are not implemented\n", - This,ppEnumMoniker,dwFlags,bExactMatch,dwMerit, - bInputNeeded,cInputTypes,pguidInputTypes, - pPinMediumIn,pPinCategoryIn, - bRender, - bOutputNeeded,cOutputTypes,pguidOutputTypes, - pPinMediumOut,pPinCategoryOut); - - if ( ppEnumMoniker == NULL ) - return E_POINTER; - *ppEnumMoniker = NULL; - if ( dwFlags != 0 ) - return E_INVALIDARG; - - hr = CoCreateInstance( - &CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, - &IID_ICreateDevEnum, (void**)&pEnum ); - if ( FAILED(hr) ) - goto err; - - hr = ICreateDevEnum_CreateClassEnumerator(pEnum,&CLSID_ActiveMovieCategories,&pCategories,0); - if ( hr != S_OK ) - goto err; - - while ( 1 ) - { - if ( pCat != NULL ) - { - IMoniker_Release(pCat); - pCat = NULL; - } - hr = IEnumMoniker_Next(pCategories,1,&pCat,&cReturned); - if ( FAILED(hr) ) - goto err; - if ( hr != S_OK ) - break; - hr = QUARTZ_GetMeritFromMoniker(pCat,&dwCatMerit); - if ( hr != S_OK || dwMerit > dwCatMerit ) - continue; - hr = QUARTZ_GetCLSIDFromMoniker(pCat,&clsid); - if ( hr != S_OK ) - continue; - - if ( pCatFilters != NULL ) - { - IEnumMoniker_Release(pCatFilters); - pCatFilters = NULL; - } - hr = ICreateDevEnum_CreateClassEnumerator(pEnum,&clsid,&pCatFilters,0); - if ( FAILED(hr) ) - goto err; - if ( hr != S_OK ) - continue; - - while ( 1 ) - { - if ( pFilter != NULL ) - { - IMoniker_Release(pFilter); - pFilter = NULL; - } - hr = IEnumMoniker_Next(pCatFilters,1,&pFilter,&cReturned); - if ( FAILED(hr) ) - goto err; - if ( hr != S_OK ) - break; - if ( pbFilterData != NULL ) - { - QUARTZ_FreeMem(pbFilterData); - pbFilterData = NULL; - } - if(TRACE_ON(quartz)) - { - CLSID clsidTrace; - if (SUCCEEDED(QUARTZ_GetCLSIDFromMoniker(pFilter,&clsidTrace))) - { - TRACE("moniker clsid %s\n",debugstr_guid(&clsidTrace)); - } - } - hr = QUARTZ_GetFilterDataFromMoniker(pFilter,&pbFilterData,&cbFilterData); - if ( hr != S_OK ) - continue; - - if ( prf2 != NULL ) - { - QUARTZ_FreeMem(prf2); - prf2 = NULL; - } - prf2 = QUARTZ_RegFilterV2FromFilterData(pbFilterData,cbFilterData); - if ( prf2 == NULL ) - continue; - TRACE("prf2 %p, Merit %08lx\n",prf2,prf2->dwMerit); - if ( prf2->dwMerit < dwMerit || prf2->dwVersion != 2 ) - continue; - - /* check input pins. */ - if ( bInputNeeded ) - { - bMatch = FALSE; - for ( n = 0; n < prf2->u.s2.cPins2; n++ ) - { - pRegFilterPin = &prf2->u.s2.rgPins2[n]; - if ( pRegFilterPin->dwFlags & REG_PINFLAG_B_OUTPUT ) - continue; - bMatch = QUARTZ_CheckPinType( bExactMatch, pRegFilterPin, cInputTypes, pguidInputTypes, pPinMediumIn, pPinCategoryIn, bRender ); - if ( bMatch ) - break; - } - if ( !bMatch ) - { - TRACE("no matching input pin\n"); - continue; - } - } - - /* check output pins. */ - if ( bOutputNeeded ) - { - bMatch = FALSE; - for ( n = 0; n < prf2->u.s2.cPins2; n++ ) - { - pRegFilterPin = &prf2->u.s2.rgPins2[n]; - if ( !(pRegFilterPin->dwFlags & REG_PINFLAG_B_OUTPUT) ) - continue; - bMatch = QUARTZ_CheckPinType( bExactMatch, pRegFilterPin, cOutputTypes, pguidOutputTypes, pPinMediumOut, pPinCategoryOut, FALSE ); - if ( bMatch ) - break; - } - if ( !bMatch ) - { - TRACE("no matching output pin\n"); - continue; - } - } - - /* matched - add pFilter to the list. */ - pItemsTmp = QUARTZ_ReallocMem( pItems, sizeof(struct MATCHED_ITEM) * (cItems+1) ); - if ( pItemsTmp == NULL ) - { - hr = E_OUTOFMEMORY; - goto err; - } - pItems = pItemsTmp; - pItemsTmp = pItems + cItems; cItems ++; - pItemsTmp->pMonFilter = pFilter; pFilter = NULL; - pItemsTmp->dwMerit = prf2->dwMerit; - } - } - - if ( pItems == NULL || cItems == 0 ) - { - hr = S_FALSE; - goto err; - } - - /* FIXME - sort in Merit order */ - TRACE("sort in Merit order\n"); - qsort( pItems, cItems, sizeof(struct MATCHED_ITEM), sort_comp_merit ); - - pListFilters = QUARTZ_CompList_Alloc(); - if ( pListFilters == NULL ) - { - hr = E_OUTOFMEMORY; - goto err; - } - for ( n = 0; n < cItems; n++ ) - { - TRACE("merit %08lx\n",pItems[n].dwMerit); - hr = QUARTZ_CompList_AddComp( pListFilters, (IUnknown*)pItems[n].pMonFilter, NULL, 0 ); - if ( FAILED(hr) ) - goto err; - } - - hr = QUARTZ_CreateEnumUnknown( &IID_IEnumMoniker, (void**)ppEnumMoniker, pListFilters ); - if ( FAILED(hr) ) - goto err; - - hr = S_OK; -err: - if ( pEnum != NULL ) - ICreateDevEnum_Release(pEnum); - if ( pCategories != NULL ) - IEnumMoniker_Release(pCategories); - if ( pCat != NULL ) - IMoniker_Release(pCat); - if ( pCatFilters != NULL ) - IEnumMoniker_Release(pCatFilters); - if ( pFilter != NULL ) - IMoniker_Release(pFilter); - if ( pbFilterData != NULL ) - QUARTZ_FreeMem(pbFilterData); - if ( prf2 != NULL ) - QUARTZ_FreeMem(prf2); - if ( pItems != NULL && cItems > 0 ) - { - for ( n = 0; n < cItems; n++ ) - { - if ( pItems[n].pMonFilter != NULL ) - IMoniker_Release(pItems[n].pMonFilter); - } - QUARTZ_FreeMem(pItems); - } - if ( pListFilters != NULL ) - QUARTZ_CompList_Free( pListFilters ); - - TRACE("returns %08lx\n",hr); - - return hr; -} - - - - -static ICOM_VTABLE(IFilterMapper2) ifmap2 = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - IFilterMapper2_fnQueryInterface, - IFilterMapper2_fnAddRef, - IFilterMapper2_fnRelease, - /* IFilterMapper2 fields */ - IFilterMapper2_fnCreateCategory, - IFilterMapper2_fnUnregisterFilter, - IFilterMapper2_fnRegisterFilter, - IFilterMapper2_fnEnumMatchingFilters, -}; - - -HRESULT CFilterMapper2_InitIFilterMapper2( CFilterMapper2* pfm ) -{ - TRACE("(%p)\n",pfm); - ICOM_VTBL(&pfm->fmap2) = &ifmap2; - - return NOERROR; -} - -void CFilterMapper2_UninitIFilterMapper2( CFilterMapper2* pfm ) -{ - TRACE("(%p)\n",pfm); -} - diff --git a/dlls/quartz/fmap.h b/dlls/quartz/fmap.h deleted file mode 100644 index 8c5981f715c..00000000000 --- a/dlls/quartz/fmap.h +++ /dev/null @@ -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 */ diff --git a/dlls/quartz/ifgraph.c b/dlls/quartz/ifgraph.c deleted file mode 100644 index e713c215fa1..00000000000 --- a/dlls/quartz/ifgraph.c +++ /dev/null @@ -1,1521 +0,0 @@ -/* - * Implementation of IFilterGraph and related interfaces - * + IGraphVersion - * - * FIXME - create a thread to process some methods correctly. - * - * FIXME - ReconnectEx - * FIXME - process Pause/Stop asynchronously and notify when completed. - * - * - * 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 "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winerror.h" -#include "winreg.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" -#include "enumunk.h" -#include "sysclock.h" -#include "regsvr.h" - - -#ifndef NUMELEMS -#define NUMELEMS(elem) (sizeof(elem)/sizeof(elem[0])) -#endif /* NUMELEMS */ - -static HRESULT CFilterGraph_DisconnectAllPins( IBaseFilter* pFilter ) -{ - IEnumPins* pEnum = NULL; - IPin* pPin; - IPin* pConnTo; - ULONG cFetched; - HRESULT hr; - - hr = IBaseFilter_EnumPins( pFilter, &pEnum ); - if ( FAILED(hr) ) - return hr; - if ( pEnum == NULL ) - return E_FAIL; - - while ( 1 ) - { - pPin = NULL; - cFetched = 0; - hr = IEnumPins_Next( pEnum, 1, &pPin, &cFetched ); - if ( FAILED(hr) ) - break; - if ( hr != NOERROR || pPin == NULL || cFetched != 1 ) - { - hr = NOERROR; - break; - } - - pConnTo = NULL; - hr = IPin_ConnectedTo(pPin,&pConnTo); - if ( hr == NOERROR && pConnTo != NULL ) - { - IPin_Disconnect(pPin); - IPin_Disconnect(pConnTo); - IPin_Release(pConnTo); - } - - IPin_Release( pPin ); - } - - IEnumPins_Release( pEnum ); - - return hr; -} - - -static HRESULT CFilterGraph_GraphChanged( CFilterGraph* This ) -{ - /* IDistributorNotify_NotifyGraphChange() */ - - This->m_lGraphVersion ++; - - return NOERROR; -} - -/*************************************************************************** - * - * CFilterGraph internal methods for IFilterGraph2::AddSourceFilter(). - * - */ - -static HRESULT QUARTZ_PeekFile( - const WCHAR* pwszFileName, - BYTE* pData, DWORD cbData, DWORD* pcbRead ) -{ - HANDLE hFile; - HRESULT hr = E_FAIL; - - *pcbRead = 0; - hFile = CreateFileW( pwszFileName, - GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE)NULL ); - if ( hFile == INVALID_HANDLE_VALUE ) - return E_FAIL; - if ( ReadFile( hFile, pData, cbData, pcbRead, NULL ) ) - hr = NOERROR; - CloseHandle( hFile ); - - return hr; -} - - -static const WCHAR* skip_space(const WCHAR* pwsz) -{ - if ( pwsz == NULL ) return NULL; - while ( *pwsz == (WCHAR)' ' ) pwsz++; - return pwsz; -} - -static const WCHAR* get_dword(const WCHAR* pwsz,DWORD* pdw) -{ - DWORD dw = 0; - - *pdw = 0; - if ( pwsz == NULL ) return NULL; - while ( *pwsz >= (WCHAR)'0' && *pwsz <= (WCHAR)'9' ) - { - dw = dw * 10 + (DWORD)(*pwsz-(WCHAR)'0'); - pwsz ++; - } - *pdw = dw; - return pwsz; -} - -static int wchar_to_hex(WCHAR wch) -{ - if ( wch >= (WCHAR)'0' && wch <= (WCHAR)'9' ) - return (int)(wch - (WCHAR)'0'); - if ( wch >= (WCHAR)'A' && wch <= (WCHAR)'F' ) - return (int)(wch - (WCHAR)'A' + 10); - if ( wch >= (WCHAR)'a' && wch <= (WCHAR)'f' ) - return (int)(wch - (WCHAR)'a' + 10); - return -1; -} - -static const WCHAR* get_hex(const WCHAR* pwsz,BYTE* pb) -{ - int hi,lo; - - *pb = 0; - if ( pwsz == NULL ) return NULL; - hi = wchar_to_hex(*pwsz); if ( hi < 0 ) return NULL; pwsz++; - lo = wchar_to_hex(*pwsz); if ( lo < 0 ) return NULL; pwsz++; - *pb = (BYTE)( (hi << 4) | lo ); - return pwsz; -} - -static const WCHAR* skip_hex(const WCHAR* pwsz) -{ - if ( pwsz == NULL ) return NULL; - while ( 1 ) - { - if ( wchar_to_hex(*pwsz) < 0 ) - break; - pwsz++; - } - return pwsz; -} - -static const WCHAR* next_token(const WCHAR* pwsz) -{ - if ( pwsz == NULL ) return NULL; - pwsz = skip_space(pwsz); - if ( *pwsz != (WCHAR)',' ) return NULL; pwsz++; - return skip_space(pwsz); -} - - -static HRESULT QUARTZ_SourceTypeIsMatch( - const BYTE* pData, DWORD cbData, - const WCHAR* pwszTempl, DWORD cchTempl ) -{ - DWORD dwOfs; - DWORD n; - DWORD cbLen; - const WCHAR* pwszMask; - const WCHAR* pwszValue; - BYTE bMask; - BYTE bValue; - - TRACE("(%p,%lu,%s,%lu)\n",pData,cbData,debugstr_w(pwszTempl),cchTempl); - - pwszTempl = skip_space(pwszTempl); - while ( 1 ) - { - pwszTempl = get_dword(pwszTempl,&dwOfs); - pwszTempl = next_token(pwszTempl); - pwszTempl = get_dword(pwszTempl,&cbLen); - pwszMask = pwszTempl = next_token(pwszTempl); - pwszTempl = skip_hex(pwszTempl); - pwszValue = pwszTempl = next_token(pwszTempl); - pwszTempl = skip_hex(pwszValue); - pwszTempl = skip_space(pwszTempl); - if ( pwszValue == NULL ) - { - WARN( "parse error\n" ); - return S_FALSE; - } - - if ( dwOfs >= cbData || ( (dwOfs+cbLen) >= cbData ) ) - { - WARN( "length of given data is too short\n" ); - return S_FALSE; - } - - for ( n = 0; n < cbLen; n++ ) - { - pwszMask = get_hex(pwszMask,&bMask); - if ( pwszMask == NULL ) bMask = 0xff; - pwszValue = get_hex(pwszValue,&bValue); - if ( pwszValue == NULL ) - { - WARN( "parse error - invalid hex data\n" ); - return S_FALSE; - } - if ( (pData[dwOfs+n]&bMask) != (bValue&bMask) ) - { - TRACE( "not matched\n" ); - return S_FALSE; - } - } - - if ( *pwszTempl == 0 ) - break; - pwszTempl = next_token(pwszTempl); - if ( pwszTempl == NULL ) - { - WARN( "parse error\n" ); - return S_FALSE; - } - } - - TRACE( "matched\n" ); - return NOERROR; -} - -static HRESULT QUARTZ_GetSourceTypeFromData( - const BYTE* pData, DWORD cbData, - GUID* pidMajor, GUID* pidSub, CLSID* pidSource ) -{ - HRESULT hr = S_FALSE; - LONG lr; - WCHAR wszMajor[128]; - WCHAR wszSub[128]; - WCHAR wszSource[128]; - WCHAR wszSourceFilter[128]; - WCHAR* pwszLocalBuf = NULL; - WCHAR* pwszTemp; - DWORD cbLocalBuf = 0; - DWORD cbPath; - DWORD dwIndexMajor; - HKEY hkMajor; - DWORD dwIndexSub; - HKEY hkSub; - DWORD dwIndexSource; - HKEY hkSource; - DWORD dwRegType; - DWORD cbRegData; - FILETIME ftLastWrite; - static const WCHAR wszFmt[] = {'%','l','u',0}; - - if ( RegOpenKeyExW( HKEY_CLASSES_ROOT, QUARTZ_wszMediaType, 0, KEY_READ, &hkMajor ) == ERROR_SUCCESS ) - { - dwIndexMajor = 0; - while ( hr == S_FALSE ) - { - cbPath = NUMELEMS(wszMajor)-1; - lr = RegEnumKeyExW( - hkMajor, dwIndexMajor ++, wszMajor, &cbPath, - NULL, NULL, NULL, &ftLastWrite ); - if ( lr != ERROR_SUCCESS ) - break; - if ( RegOpenKeyExW( hkMajor, wszMajor, 0, KEY_READ, &hkSub ) == ERROR_SUCCESS ) - { - dwIndexSub = 0; - while ( hr == S_FALSE ) - { - cbPath = NUMELEMS(wszSub)-1; - lr = RegEnumKeyExW( - hkSub, dwIndexSub ++, wszSub, &cbPath, - NULL, NULL, NULL, &ftLastWrite ); - if ( lr != ERROR_SUCCESS ) - break; - if ( RegOpenKeyExW( hkSub, wszSub, 0, KEY_READ, &hkSource ) == ERROR_SUCCESS ) - { - dwIndexSource = 0; - while ( hr == S_FALSE ) - { - wsprintfW(wszSource,wszFmt,dwIndexSource++); - lr = RegQueryValueExW( - hkSource, wszSource, NULL, - &dwRegType, NULL, &cbRegData ); - if ( lr != ERROR_SUCCESS ) - break; - if ( cbLocalBuf < cbRegData ) - { - pwszTemp = (WCHAR*)QUARTZ_ReallocMem( pwszLocalBuf, cbRegData+sizeof(WCHAR) ); - if ( pwszTemp == NULL ) - { - hr = E_OUTOFMEMORY; - break; - } - pwszLocalBuf = pwszTemp; - cbLocalBuf = cbRegData+sizeof(WCHAR); - } - cbRegData = cbLocalBuf; - lr = RegQueryValueExW( - hkSource, wszSource, NULL, - &dwRegType, (BYTE*)pwszLocalBuf, &cbRegData ); - if ( lr != ERROR_SUCCESS ) - break; - - hr = QUARTZ_SourceTypeIsMatch( - pData, cbData, - pwszLocalBuf, cbRegData / sizeof(WCHAR) ); - if ( hr == S_OK ) - { - hr = CLSIDFromString(wszMajor,pidMajor); - if ( hr == NOERROR ) - hr = CLSIDFromString(wszSub,pidSub); - if ( hr == NOERROR ) - { - lstrcpyW(wszSource,QUARTZ_wszSourceFilter); - cbRegData = NUMELEMS(wszSourceFilter)-sizeof(WCHAR); - lr = RegQueryValueExW( - hkSource, wszSource, NULL, - &dwRegType, - (BYTE*)wszSourceFilter, &cbRegData ); - if ( lr == ERROR_SUCCESS ) - { - hr = CLSIDFromString(wszSourceFilter,pidSource); - } - else - hr = E_FAIL; - } - - if ( hr != NOERROR && SUCCEEDED(hr) ) - hr = E_FAIL; - } - if ( hr != S_FALSE ) - break; - } - RegCloseKey( hkSource ); - } - } - RegCloseKey( hkSub ); - } - } - RegCloseKey( hkMajor ); - } - - if ( pwszLocalBuf != NULL ) - QUARTZ_FreeMem(pwszLocalBuf); - - return hr; -} - - - -/*************************************************************************** - * - * CFilterGraph::IFilterGraph2 methods - * - */ - -static HRESULT WINAPI -IFilterGraph2_fnQueryInterface(IFilterGraph2* iface,REFIID riid,void** ppobj) -{ - CFilterGraph_THIS(iface,fgraph); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); -} - -static ULONG WINAPI -IFilterGraph2_fnAddRef(IFilterGraph2* iface) -{ - CFilterGraph_THIS(iface,fgraph); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->unk.punkControl); -} - -static ULONG WINAPI -IFilterGraph2_fnRelease(IFilterGraph2* iface) -{ - CFilterGraph_THIS(iface,fgraph); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->unk.punkControl); -} - -static HRESULT WINAPI -IFilterGraph2_fnAddFilter(IFilterGraph2* iface,IBaseFilter* pFilter, LPCWSTR pName) -{ - CFilterGraph_THIS(iface,fgraph); - FILTER_STATE fs; - FILTER_INFO info; - IBaseFilter* pTempFilter; - FG_FilterData* pActiveFiltersNew; - HRESULT hr; - HRESULT hrSucceeded = S_OK; - int i,iLen; - - TRACE( "(%p)->(%p,%s)\n",This,pFilter,debugstr_w(pName) ); - - EnterCriticalSection( &This->m_csFilters ); - - hr = IMediaFilter_GetState(CFilterGraph_IMediaFilter(This),0,&fs); - if ( hr == VFW_S_STATE_INTERMEDIATE ) - hr = VFW_E_STATE_CHANGED; - if ( fs != State_Stopped ) - hr = VFW_E_NOT_STOPPED; - if ( FAILED(hr) ) - goto end; - - TRACE( "(%p) search the specified name.\n",This ); - - if ( pName != NULL ) - { - hr = IFilterGraph2_FindFilterByName( CFilterGraph_IFilterGraph2(This), pName, &pTempFilter ); - if ( hr == S_OK ) - { - IBaseFilter_Release(pTempFilter); - hrSucceeded = VFW_S_DUPLICATE_NAME; - } - else - { - goto name_ok; - } - - iLen = lstrlenW(pName); - if ( iLen > 32 ) - iLen = 32; - memcpy( info.achName, pName, sizeof(WCHAR)*iLen ); - info.achName[iLen] = 0; - } - else - { - ZeroMemory( &info, sizeof(info) ); - hr = IBaseFilter_QueryFilterInfo( pFilter, &info ); - if ( FAILED(hr) ) - goto end; - if ( info.pGraph != NULL ) - { - IFilterGraph_Release(info.pGraph); - hr = E_FAIL; /* FIXME */ - goto end; - } - - hr = IFilterGraph2_FindFilterByName( CFilterGraph_IFilterGraph2(This), pName, &pTempFilter ); - if ( hr != S_OK ) - { - pName = info.achName; - goto name_ok; - } - } - - /* generate modified names for this filter.. */ - iLen = lstrlenW(info.achName); - if ( iLen > 32 ) - iLen = 32; - info.achName[iLen++] = ' '; - - for ( i = 0; i <= 99; i++ ) - { - info.achName[iLen+0] = (i%10) + '0'; - info.achName[iLen+1] = ((i/10)%10) + '0'; - info.achName[iLen+2] = 0; - - hr = IFilterGraph2_FindFilterByName( CFilterGraph_IFilterGraph2(This), info.achName, &pTempFilter ); - if ( hr != S_OK ) - { - pName = info.achName; - goto name_ok; - } - } - - hr = ( pName == NULL ) ? E_FAIL : VFW_E_DUPLICATE_NAME; - goto end; - -name_ok: - TRACE( "(%p) add this filter - %s.\n",This,debugstr_w(pName) ); - - /* register this filter. */ - pActiveFiltersNew = (FG_FilterData*)QUARTZ_ReallocMem( - This->m_pActiveFilters, - sizeof(FG_FilterData) * (This->m_cActiveFilters+1) ); - if ( pActiveFiltersNew == NULL ) - { - hr = E_OUTOFMEMORY; - goto end; - } - This->m_pActiveFilters = pActiveFiltersNew; - pActiveFiltersNew = &This->m_pActiveFilters[This->m_cActiveFilters]; - - pActiveFiltersNew->pFilter = NULL; - pActiveFiltersNew->pPosition = NULL; - pActiveFiltersNew->pSeeking = NULL; - pActiveFiltersNew->pwszName = NULL; - pActiveFiltersNew->cbName = 0; - - pActiveFiltersNew->cbName = sizeof(WCHAR)*(lstrlenW(pName)+1); - pActiveFiltersNew->pwszName = (WCHAR*)QUARTZ_AllocMem( pActiveFiltersNew->cbName ); - if ( pActiveFiltersNew->pwszName == NULL ) - { - hr = E_OUTOFMEMORY; - goto end; - } - memcpy( pActiveFiltersNew->pwszName, pName, pActiveFiltersNew->cbName ); - - pActiveFiltersNew->pFilter = pFilter; - IBaseFilter_AddRef(pFilter); - IBaseFilter_QueryInterface( pFilter, &IID_IMediaPosition, (void**)&pActiveFiltersNew->pPosition ); - IBaseFilter_QueryInterface( pFilter, &IID_IMediaSeeking, (void**)&pActiveFiltersNew->pSeeking ); - - This->m_cActiveFilters ++; - - hr = IBaseFilter_JoinFilterGraph(pFilter,(IFilterGraph*)iface,pName); - if ( SUCCEEDED(hr) ) - { - EnterCriticalSection( &This->m_csClock ); - hr = IBaseFilter_SetSyncSource( pFilter, This->m_pClock ); - LeaveCriticalSection( &This->m_csClock ); - } - if ( FAILED(hr) ) - { - IBaseFilter_JoinFilterGraph(pFilter,NULL,pName); - IFilterGraph2_RemoveFilter(CFilterGraph_IFilterGraph2(This),pFilter); - goto end; - } - - hr = CFilterGraph_GraphChanged(This); - if ( FAILED(hr) ) - goto end; - - hr = hrSucceeded; -end: - LeaveCriticalSection( &This->m_csFilters ); - - TRACE( "(%p) return %08lx\n", This, hr ); - - return hr; -} - -static HRESULT WINAPI -IFilterGraph2_fnRemoveFilter(IFilterGraph2* iface,IBaseFilter* pFilter) -{ - CFilterGraph_THIS(iface,fgraph); - FILTER_STATE fs; - DWORD n,copy; - HRESULT hr = NOERROR; - - TRACE( "(%p)->(%p)\n",This,pFilter ); - - EnterCriticalSection( &This->m_csFilters ); - - hr = IMediaFilter_GetState(CFilterGraph_IMediaFilter(This),0,&fs); - if ( hr == VFW_S_STATE_INTERMEDIATE ) - hr = VFW_E_STATE_CHANGED; - if ( fs != State_Stopped ) - hr = VFW_E_NOT_STOPPED; - if ( FAILED(hr) ) - goto end; - - hr = S_FALSE; /* FIXME? */ - - for ( n = 0; n < This->m_cActiveFilters; n++ ) - { - if ( This->m_pActiveFilters[n].pFilter == pFilter ) - { - CFilterGraph_DisconnectAllPins(pFilter); - (void)IBaseFilter_SetSyncSource( pFilter, NULL ); - (void)IBaseFilter_JoinFilterGraph( - pFilter, NULL, This->m_pActiveFilters[n].pwszName ); - - if ( This->m_pActiveFilters[n].pFilter != NULL ) - IBaseFilter_Release(This->m_pActiveFilters[n].pFilter); - if ( This->m_pActiveFilters[n].pPosition != NULL ) - IMediaPosition_Release(This->m_pActiveFilters[n].pPosition); - if ( This->m_pActiveFilters[n].pSeeking != NULL ) - IMediaSeeking_Release(This->m_pActiveFilters[n].pSeeking); - if ( This->m_pActiveFilters[n].pwszName != NULL ) - QUARTZ_FreeMem(This->m_pActiveFilters[n].pwszName); - - copy = This->m_cActiveFilters - n - 1; - if ( copy > 0 ) - memmove( &This->m_pActiveFilters[n], - &This->m_pActiveFilters[n+1], - sizeof(FG_FilterData) * copy ); - This->m_cActiveFilters --; - - hr = CFilterGraph_GraphChanged(This); - break; - } - } - -end:; - LeaveCriticalSection( &This->m_csFilters ); - - return hr; -} - -static HRESULT WINAPI -IFilterGraph2_fnEnumFilters(IFilterGraph2* iface,IEnumFilters** ppEnum) -{ - CFilterGraph_THIS(iface,fgraph); - QUARTZ_CompList* pList = NULL; - DWORD n; - HRESULT hr; - - TRACE( "(%p)->(%p)\n",This,ppEnum ); - - EnterCriticalSection( &This->m_csFilters ); - - pList = QUARTZ_CompList_Alloc(); - if ( pList == NULL ) - { - hr = E_OUTOFMEMORY; - goto err; - } - for ( n = 0; n < This->m_cActiveFilters; n++ ) - { - hr = QUARTZ_CompList_AddTailComp( - pList, (IUnknown*)This->m_pActiveFilters[n].pFilter, NULL, 0 ); - if ( FAILED(hr) ) - goto err; - } - - hr = QUARTZ_CreateEnumUnknown( - &IID_IEnumFilters, (void**)ppEnum, pList ); -err: - if ( pList != NULL ) - QUARTZ_CompList_Free( pList ); - - LeaveCriticalSection( &This->m_csFilters ); - - return hr; -} - -static HRESULT WINAPI -IFilterGraph2_fnFindFilterByName(IFilterGraph2* iface,LPCWSTR pName,IBaseFilter** ppFilter) -{ - CFilterGraph_THIS(iface,fgraph); - DWORD n; - DWORD cbName; - HRESULT hr = E_FAIL; /* FIXME */ - - TRACE( "(%p)->(%s,%p)\n",This,debugstr_w(pName),ppFilter ); - - if ( pName == NULL || ppFilter == NULL ) - return E_POINTER; - *ppFilter = NULL; - - cbName = sizeof(WCHAR) * (lstrlenW(pName) + 1); - - EnterCriticalSection( &This->m_csFilters ); - - for ( n = 0; n < This->m_cActiveFilters; n++ ) - { - if ( This->m_pActiveFilters[n].cbName == cbName && - !memcmp( This->m_pActiveFilters[n].pwszName, pName, cbName ) ) - { - *ppFilter = This->m_pActiveFilters[n].pFilter; - IBaseFilter_AddRef(*ppFilter); - hr = NOERROR; - } - } - - LeaveCriticalSection( &This->m_csFilters ); - - return hr; -} - -static HRESULT WINAPI -IFilterGraph2_fnConnectDirect(IFilterGraph2* iface,IPin* pOut,IPin* pIn,const AM_MEDIA_TYPE* pmt) -{ - CFilterGraph_THIS(iface,fgraph); - IPin* pConnTo; - PIN_INFO infoIn; - PIN_INFO infoOut; - FILTER_INFO finfoIn; - FILTER_INFO finfoOut; - FILTER_STATE fs; - HRESULT hr; - - TRACE( "(%p)->(%p,%p,%p)\n",This,pOut,pIn,pmt ); - - infoIn.pFilter = NULL; - infoOut.pFilter = NULL; - finfoIn.pGraph = NULL; - finfoOut.pGraph = NULL; - - EnterCriticalSection( &This->m_csFilters ); - - hr = IMediaFilter_GetState(CFilterGraph_IMediaFilter(This),0,&fs); - if ( hr == VFW_S_STATE_INTERMEDIATE ) - hr = VFW_E_STATE_CHANGED; - if ( fs != State_Stopped ) - hr = VFW_E_NOT_STOPPED; - if ( FAILED(hr) ) - goto end; - - hr = IPin_QueryPinInfo(pIn,&infoIn); - if ( FAILED(hr) ) - goto end; - hr = IPin_QueryPinInfo(pOut,&infoOut); - if ( FAILED(hr) ) - goto end; - if ( infoIn.pFilter == NULL || infoOut.pFilter == NULL || - infoIn.dir != PINDIR_INPUT || infoOut.dir != PINDIR_OUTPUT ) - { - hr = E_FAIL; - goto end; - } - - hr = IBaseFilter_QueryFilterInfo(infoIn.pFilter,&finfoIn); - if ( FAILED(hr) ) - goto end; - hr = IBaseFilter_QueryFilterInfo(infoOut.pFilter,&finfoOut); - if ( FAILED(hr) ) - goto end; - if ( finfoIn.pGraph != ((IFilterGraph*)iface) || - finfoOut.pGraph != ((IFilterGraph*)iface) ) - { - hr = E_FAIL; - goto end; - } - - pConnTo = NULL; - hr = IPin_ConnectedTo(pIn,&pConnTo); - if ( hr == NOERROR && pConnTo != NULL ) - { - IPin_Release(pConnTo); - hr = VFW_E_ALREADY_CONNECTED; - goto end; - } - - pConnTo = NULL; - hr = IPin_ConnectedTo(pOut,&pConnTo); - if ( hr == NOERROR && pConnTo != NULL ) - { - IPin_Release(pConnTo); - hr = VFW_E_ALREADY_CONNECTED; - goto end; - } - - TRACE("(%p) try to connect %p<->%p\n",This,pIn,pOut); - hr = IPin_Connect(pOut,pIn,pmt); - if ( FAILED(hr) ) - { - TRACE("(%p)->Connect(%p,%p) hr = %08lx\n",pOut,pIn,pmt,hr); - IPin_Disconnect(pOut); - IPin_Disconnect(pIn); - goto end; - } - - hr = CFilterGraph_GraphChanged(This); - if ( FAILED(hr) ) - goto end; - -end: - LeaveCriticalSection( &This->m_csFilters ); - - if ( infoIn.pFilter != NULL ) - IBaseFilter_Release(infoIn.pFilter); - if ( infoOut.pFilter != NULL ) - IBaseFilter_Release(infoOut.pFilter); - if ( finfoIn.pGraph != NULL ) - IFilterGraph_Release(finfoIn.pGraph); - if ( finfoOut.pGraph != NULL ) - IFilterGraph_Release(finfoOut.pGraph); - - return hr; -} - -static HRESULT WINAPI -IFilterGraph2_fnReconnect(IFilterGraph2* iface,IPin* pPin) -{ - CFilterGraph_THIS(iface,fgraph); - - TRACE( "(%p)->(%p)\n",This,pPin ); - - return IFilterGraph2_ReconnectEx(iface,pPin,NULL); -} - -static HRESULT WINAPI -IFilterGraph2_fnDisconnect(IFilterGraph2* iface,IPin* pPin) -{ - CFilterGraph_THIS(iface,fgraph); - IPin* pConnTo; - HRESULT hr; - - TRACE( "(%p)->(%p)\n",This,pPin ); - - EnterCriticalSection( &This->m_csFilters ); - - pConnTo = NULL; - hr = IPin_ConnectedTo(pPin,&pConnTo); - if ( hr == NOERROR && pConnTo != NULL ) - { - IPin_Disconnect(pConnTo); - IPin_Release(pConnTo); - } - hr = IPin_Disconnect(pPin); - if ( FAILED(hr) ) - goto end; - - hr = CFilterGraph_GraphChanged(This); - if ( FAILED(hr) ) - goto end; - -end: - LeaveCriticalSection( &This->m_csFilters ); - - return hr; -} - -static HRESULT WINAPI -IFilterGraph2_fnSetDefaultSyncSource(IFilterGraph2* iface) -{ - CFilterGraph_THIS(iface,fgraph); - IUnknown* punk; - IReferenceClock* pClock; - HRESULT hr; - - FIXME( "(%p)->() stub!\n", This ); - - /* FIXME - search all filters from renderer. */ - - hr = QUARTZ_CreateSystemClock( NULL, (void**)&punk ); - if ( FAILED(hr) ) - return hr; - hr = IUnknown_QueryInterface( punk, &IID_IReferenceClock, (void**)&pClock ); IUnknown_Release( punk ); - if ( FAILED(hr) ) - return hr; - - hr = IMediaFilter_SetSyncSource( - CFilterGraph_IMediaFilter(This), pClock ); - IReferenceClock_Release( pClock ); - - return hr; -} - -static HRESULT WINAPI -IFilterGraph2_fnConnect(IFilterGraph2* iface,IPin* pOut,IPin* pIn) -{ - CFilterGraph_THIS(iface,fgraph); - IFilterMapper2* pMap2 = NULL; - IEnumMoniker* pEnumMon = NULL; - IMoniker* pMon = NULL; - IBaseFilter* pFilter = NULL; - IEnumPins* pEnumPin = NULL; - IPin* pPinTry = NULL; - PIN_INFO info; - PIN_DIRECTION pindir; - ULONG cReturned; - BOOL bTryConnect; - BOOL bConnected = FALSE; - CLSID clsidOutFilter; - CLSID clsidInFilter; - CLSID clsid; - HRESULT hr; - - TRACE( "(%p)->(%p,%p)\n",This,pOut,pIn ); - - /* At first, try to connect directly. */ - hr = IFilterGraph_ConnectDirect(iface,pOut,pIn,NULL); - if ( hr == NOERROR ) - return NOERROR; - - /* FIXME - try to connect indirectly. */ - FIXME( "(%p)->(%p,%p) not fully implemented\n",This,pOut,pIn ); - - info.pFilter = NULL; - hr = IPin_QueryPinInfo(pOut,&info); - if ( FAILED(hr) ) - return hr; - if ( info.pFilter == NULL ) - return E_FAIL; - hr = IBaseFilter_GetClassID(info.pFilter,&clsidOutFilter); - IBaseFilter_Release(info.pFilter); - if ( FAILED(hr) ) - return hr; - - info.pFilter = NULL; - hr = IPin_QueryPinInfo(pIn,&info); - if ( FAILED(hr) ) - return hr; - if ( info.pFilter == NULL ) - return E_FAIL; - hr = IBaseFilter_GetClassID(info.pFilter,&clsidInFilter); - IBaseFilter_Release(info.pFilter); - if ( FAILED(hr) ) - return hr; - - /* FIXME - try to connect with unused filters. */ - /* FIXME - try to connect with cached filters. */ - /* FIXME - enumerate transform filters and try to connect */ - hr = CoCreateInstance( - &CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, - &IID_IFilterMapper2, (void**)&pMap2 ); - if ( FAILED(hr) ) - return hr; - hr = IFilterMapper2_EnumMatchingFilters( - pMap2,&pEnumMon,0,FALSE,MERIT_DO_NOT_USE+1, - TRUE,0,NULL,NULL,NULL,FALSE, - TRUE,0,NULL,NULL,NULL); - IFilterMapper2_Release(pMap2); - if ( FAILED(hr) ) - return hr; - TRACE("try to connect indirectly\n"); - - if ( hr == S_OK ) - { - while ( !bConnected && hr == S_OK ) - { - hr = IEnumMoniker_Next(pEnumMon,1,&pMon,&cReturned); - if ( hr != S_OK ) - break; - hr = IMoniker_BindToObject(pMon,NULL,NULL,&IID_IBaseFilter,(void**)&pFilter ); - if ( hr == S_OK ) - { - hr = IBaseFilter_GetClassID(pFilter,&clsid); - if ( hr == S_OK && - ( IsEqualGUID(&clsidOutFilter,&clsid) || IsEqualGUID(&clsidInFilter,&clsid) ) ) - hr = S_FALSE; - else - hr = IFilterGraph2_AddFilter(iface,pFilter,NULL); - if ( hr == S_OK ) - { - bTryConnect = FALSE; - hr = IBaseFilter_EnumPins(pFilter,&pEnumPin); - if ( hr == S_OK ) - { - { - while ( !bTryConnect ) - { - hr = IEnumPins_Next(pEnumPin,1,&pPinTry,&cReturned); - if ( hr != S_OK ) - break; - hr = IPin_QueryDirection(pPinTry,&pindir); - if ( hr == S_OK && pindir == PINDIR_INPUT ) - { - /* try to connect directly. */ - hr = IFilterGraph2_ConnectDirect(iface,pOut,pPinTry,NULL); - if ( hr == S_OK ) - bTryConnect = TRUE; - hr = S_OK; - } - IPin_Release(pPinTry); pPinTry = NULL; - } - } - IEnumPins_Release(pEnumPin); pEnumPin = NULL; - } - TRACE("TryConnect %d\n",bTryConnect); - - if ( bTryConnect ) - { - hr = IBaseFilter_EnumPins(pFilter,&pEnumPin); - if ( hr == S_OK ) - { - while ( !bConnected ) - { - hr = IEnumPins_Next(pEnumPin,1,&pPinTry,&cReturned); - if ( hr != S_OK ) - break; - hr = IPin_QueryDirection(pPinTry,&pindir); - if ( hr == S_OK && pindir == PINDIR_OUTPUT ) - { - /* try to connect indirectly. */ - hr = IFilterGraph2_Connect(iface,pPinTry,pIn); - if ( hr == S_OK ) - bConnected = TRUE; - hr = S_OK; - } - IPin_Release(pPinTry); pPinTry = NULL; - } - IEnumPins_Release(pEnumPin); pEnumPin = NULL; - } - } - if ( !bConnected ) - hr = IFilterGraph2_RemoveFilter(iface,pFilter); - } - IBaseFilter_Release(pFilter); pFilter = NULL; - if ( SUCCEEDED(hr) ) - hr = S_OK; - } - else - { - hr = S_OK; - } - IMoniker_Release(pMon); pMon = NULL; - } - IEnumMoniker_Release(pEnumMon); pEnumMon = NULL; - } - - if ( SUCCEEDED(hr) && !bConnected ) - hr = VFW_E_CANNOT_CONNECT; - - return hr; -} - -static HRESULT WINAPI -IFilterGraph2_fnRender(IFilterGraph2* iface,IPin* pOut) -{ - CFilterGraph_THIS(iface,fgraph); - - TRACE( "(%p)->(%p)\n",This,pOut); - - return IFilterGraph2_RenderEx( CFilterGraph_IFilterGraph2(This), pOut, 0, NULL ); -} - -static HRESULT WINAPI -IFilterGraph2_fnRenderFile(IFilterGraph2* iface,LPCWSTR lpFileName,LPCWSTR lpPlayList) -{ - CFilterGraph_THIS(iface,fgraph); - HRESULT hr; - IBaseFilter* pFilter = NULL; - IEnumPins* pEnum = NULL; - IPin* pPin; - ULONG cFetched; - PIN_DIRECTION dir; - ULONG cTryToRender; - ULONG cActRender; - - TRACE( "(%p)->(%s,%s)\n",This, - debugstr_w(lpFileName),debugstr_w(lpPlayList) ); - - if ( lpPlayList != NULL ) - return E_INVALIDARG; - - pFilter = NULL; - hr = IFilterGraph2_AddSourceFilter(iface,lpFileName,NULL,&pFilter); - if ( FAILED(hr) ) - goto end; - if ( pFilter == NULL ) - { - hr = E_FAIL; - goto end; - } - TRACE("(%p) source filter %p\n",This,pFilter); - - pEnum = NULL; - hr = IBaseFilter_EnumPins( pFilter, &pEnum ); - if ( FAILED(hr) ) - goto end; - if ( pEnum == NULL ) - { - hr = E_FAIL; - goto end; - } - - cTryToRender = 0; - cActRender = 0; - - while ( 1 ) - { - pPin = NULL; - cFetched = 0; - hr = IEnumPins_Next( pEnum, 1, &pPin, &cFetched ); - if ( FAILED(hr) ) - goto end; - if ( hr != NOERROR || pPin == NULL || cFetched != 1 ) - { - hr = NOERROR; - break; - } - hr = IPin_QueryDirection( pPin, &dir ); - if ( hr == NOERROR && dir == PINDIR_OUTPUT ) - { - cTryToRender ++; - hr = IFilterGraph2_Render( iface, pPin ); - if ( hr == NOERROR ) - cActRender ++; - } - IPin_Release( pPin ); - } - - if ( hr == NOERROR ) - { - if ( cTryToRender > cActRender ) - hr = VFW_S_PARTIAL_RENDER; - if ( cActRender == 0 ) - hr = E_FAIL; - } - -end: - if ( pEnum != NULL ) - IEnumPins_Release( pEnum ); - if ( pFilter != NULL ) - IBaseFilter_Release( pFilter ); - - return hr; -} - -static HRESULT WINAPI -IFilterGraph2_fnAddSourceFilter(IFilterGraph2* iface,LPCWSTR lpFileName,LPCWSTR lpFilterName,IBaseFilter** ppBaseFilter) -{ - CFilterGraph_THIS(iface,fgraph); - HRESULT hr; - BYTE bStartData[512]; - DWORD cbStartData; - AM_MEDIA_TYPE mt; - CLSID clsidSource; - IFileSourceFilter* pSource; - - TRACE( "(%p)->(%s,%s,%p)\n",This, - debugstr_w(lpFileName),debugstr_w(lpFilterName),ppBaseFilter ); - - if ( lpFileName == NULL || ppBaseFilter == NULL ) - return E_POINTER; - *ppBaseFilter = NULL; - - hr = QUARTZ_PeekFile( lpFileName, bStartData, 512, &cbStartData ); - if ( FAILED(hr) ) - { - FIXME("cannot open %s (NOTE: URL is not implemented)\n", debugstr_w(lpFileName)); - return hr; - } - ZeroMemory( &mt, sizeof(AM_MEDIA_TYPE) ); - mt.bFixedSizeSamples = 1; - mt.lSampleSize = 1; - memcpy( &mt.majortype, &MEDIATYPE_Stream, sizeof(GUID) ); - memcpy( &mt.subtype, &MEDIASUBTYPE_NULL, sizeof(GUID) ); - memcpy( &mt.formattype, &FORMAT_None, sizeof(GUID) ); - hr = QUARTZ_GetSourceTypeFromData( - bStartData, cbStartData, - &mt.majortype, &mt.subtype, &clsidSource ); - if ( FAILED(hr) ) - { - ERR("QUARTZ_GetSourceTypeFromData() failed - return %08lx\n",hr); - return hr; - } - if ( hr != S_OK ) - { - FIXME( "file %s - unknown format\n", debugstr_w(lpFileName) ); - return VFW_E_INVALID_FILE_FORMAT; - } - - hr = CoCreateInstance( - &clsidSource, NULL, CLSCTX_INPROC_SERVER, - &IID_IBaseFilter, (void**)ppBaseFilter ); - if ( FAILED(hr) ) - return hr; - hr = IBaseFilter_QueryInterface(*ppBaseFilter,&IID_IFileSourceFilter,(void**)&pSource); - if ( SUCCEEDED(hr) ) - { - hr = IFileSourceFilter_Load(pSource,lpFileName,&mt); - IFileSourceFilter_Release(pSource); - } - if ( SUCCEEDED(hr) ) - hr = IFilterGraph2_AddFilter(iface,*ppBaseFilter,lpFilterName); - if ( FAILED(hr) ) - { - IBaseFilter_Release(*ppBaseFilter); - *ppBaseFilter = NULL; - return hr; - } - - return S_OK; -} - -static HRESULT WINAPI -IFilterGraph2_fnSetLogFile(IFilterGraph2* iface,DWORD_PTR hFile) -{ - CFilterGraph_THIS(iface,fgraph); - - FIXME( "(%p)->() stub!\n", This ); - - return S_OK; /* no debug output */ -} - -static HRESULT WINAPI -IFilterGraph2_fnAbort(IFilterGraph2* iface) -{ - CFilterGraph_THIS(iface,fgraph); - - FIXME( "(%p)->() stub!\n", This ); - - /* FIXME - abort the current asynchronous task. */ - - return S_OK; -} - -static HRESULT WINAPI -IFilterGraph2_fnShouldOperationContinue(IFilterGraph2* iface) -{ - CFilterGraph_THIS(iface,fgraph); - - FIXME( "(%p)->() stub!\n", This ); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IFilterGraph2_fnAddSourceFilterForMoniker(IFilterGraph2* iface,IMoniker* pMon,IBindCtx* pCtx,LPCWSTR pFilterName,IBaseFilter** ppFilter) -{ - CFilterGraph_THIS(iface,fgraph); - - FIXME( "(%p)->() stub!\n", This ); - return E_NOTIMPL; -} - -static HRESULT WINAPI -IFilterGraph2_fnReconnectEx(IFilterGraph2* iface,IPin* pPin,const AM_MEDIA_TYPE* pmt) -{ - CFilterGraph_THIS(iface,fgraph); - HRESULT hr; - - FIXME( "(%p)->(%p,%p) stub!\n",This,pPin,pmt ); - - /* reconnect asynchronously. */ - - EnterCriticalSection( &This->m_csFilters ); - hr = CFilterGraph_GraphChanged(This); - LeaveCriticalSection( &This->m_csFilters ); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IFilterGraph2_fnRenderEx(IFilterGraph2* iface,IPin* pOut,DWORD dwFlags,DWORD* pdwReserved) -{ - CFilterGraph_THIS(iface,fgraph); - HRESULT hr; - IFilterMapper2* pMap2 = NULL; - IEnumMoniker* pEnumMon = NULL; - IMoniker* pMon = NULL; - IBaseFilter* pFilter = NULL; - IEnumPins* pEnumPin = NULL; - IPin* pPin = NULL; - PIN_DIRECTION pindir; - BOOL bRendered = FALSE; - ULONG cReturned; - - TRACE( "(%p)->(%p,%08lx,%p)\n",This,pPin,dwFlags,pdwReserved); - - if ( pdwReserved != NULL ) - return E_INVALIDARG; - - if ( dwFlags != 0 ) - { - FIXME( "dwFlags != 0 (0x%08lx)\n", dwFlags ); - return E_INVALIDARG; - } - - /* FIXME - must be locked */ - /*EnterCriticalSection( &This->m_csFilters );*/ - - if ( pOut == NULL ) - return E_POINTER; - - hr = CoCreateInstance( - &CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER, - &IID_IFilterMapper2, (void**)&pMap2 ); - if ( FAILED(hr) ) - return hr; - hr = IFilterMapper2_EnumMatchingFilters( - pMap2,&pEnumMon,0,FALSE,MERIT_DO_NOT_USE+1, - TRUE,0,NULL,NULL,NULL,TRUE, - FALSE,0,NULL,NULL,NULL); - IFilterMapper2_Release(pMap2); - if ( FAILED(hr) ) - return hr; - TRACE("try to render pin\n"); - - if ( hr == S_OK ) - { - /* try to render pin. */ - while ( !bRendered && hr == S_OK ) - { - hr = IEnumMoniker_Next(pEnumMon,1,&pMon,&cReturned); - if ( hr != S_OK ) - break; - hr = IMoniker_BindToObject(pMon,NULL,NULL,&IID_IBaseFilter,(void**)&pFilter ); - if ( hr == S_OK ) - { - hr = IFilterGraph2_AddFilter(iface,pFilter,NULL); - if ( hr == S_OK ) - { - hr = IBaseFilter_EnumPins(pFilter,&pEnumPin); - if ( hr == S_OK ) - { - while ( !bRendered ) - { - hr = IEnumPins_Next(pEnumPin,1,&pPin,&cReturned); - if ( hr != S_OK ) - break; - hr = IPin_QueryDirection(pPin,&pindir); - if ( hr == S_OK && pindir == PINDIR_INPUT ) - { - /* try to connect. */ - hr = IFilterGraph2_Connect(iface,pOut,pPin); - if ( hr == S_OK ) - bRendered = TRUE; - hr = S_OK; - } - IPin_Release(pPin); pPin = NULL; - } - IEnumPins_Release(pEnumPin); pEnumPin = NULL; - } - if ( !bRendered ) - hr = IFilterGraph2_RemoveFilter(iface,pFilter); - } - IBaseFilter_Release(pFilter); pFilter = NULL; - if ( SUCCEEDED(hr) ) - hr = S_OK; - } - else - { - hr = S_OK; - } - IMoniker_Release(pMon); pMon = NULL; - } - IEnumMoniker_Release(pEnumMon); pEnumMon = NULL; - } - - if ( bRendered ) - { - /* successfully rendered(but may be partial now) */ - hr = S_OK; - - /* FIXME - try to render all inserted filters. */ - /* hr = VFW_S_PARTIAL_RENDER; */ - } - else - { - if ( SUCCEEDED(hr) ) - hr = VFW_E_CANNOT_RENDER; - } - - /*LeaveCriticalSection( &This->m_csFilters );*/ - - return hr; -} - - - - -static ICOM_VTABLE(IFilterGraph2) ifgraph = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - IFilterGraph2_fnQueryInterface, - IFilterGraph2_fnAddRef, - IFilterGraph2_fnRelease, - /* IFilterGraph fields */ - IFilterGraph2_fnAddFilter, - IFilterGraph2_fnRemoveFilter, - IFilterGraph2_fnEnumFilters, - IFilterGraph2_fnFindFilterByName, - IFilterGraph2_fnConnectDirect, - IFilterGraph2_fnReconnect, - IFilterGraph2_fnDisconnect, - IFilterGraph2_fnSetDefaultSyncSource, - /* IGraphBuilder fields */ - IFilterGraph2_fnConnect, - IFilterGraph2_fnRender, - IFilterGraph2_fnRenderFile, - IFilterGraph2_fnAddSourceFilter, - IFilterGraph2_fnSetLogFile, - IFilterGraph2_fnAbort, - IFilterGraph2_fnShouldOperationContinue, - /* IFilterGraph2 fields */ - IFilterGraph2_fnAddSourceFilterForMoniker, - IFilterGraph2_fnReconnectEx, - IFilterGraph2_fnRenderEx, -}; - -HRESULT CFilterGraph_InitIFilterGraph2( CFilterGraph* pfg ) -{ - TRACE("(%p)\n",pfg); - ICOM_VTBL(&pfg->fgraph) = &ifgraph; - - InitializeCriticalSection( &pfg->m_csFilters ); - pfg->m_cActiveFilters = 0; - pfg->m_pActiveFilters = NULL; - - return NOERROR; -} - -void CFilterGraph_UninitIFilterGraph2( CFilterGraph* pfg ) -{ - TRACE("(%p)\n",pfg); - - /* remove all filters... */ - while ( pfg->m_cActiveFilters > 0 ) - { - IFilterGraph2_RemoveFilter( - CFilterGraph_IFilterGraph2(pfg), - pfg->m_pActiveFilters[pfg->m_cActiveFilters-1].pFilter ); - } - - if ( pfg->m_pActiveFilters != NULL ) - QUARTZ_FreeMem( pfg->m_pActiveFilters ); - - DeleteCriticalSection( &pfg->m_csFilters ); -} - -/*************************************************************************** - * - * CFilterGraph::IGraphVersion methods - * - */ - -static HRESULT WINAPI -IGraphVersion_fnQueryInterface(IGraphVersion* iface,REFIID riid,void** ppobj) -{ - CFilterGraph_THIS(iface,graphversion); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); -} - -static ULONG WINAPI -IGraphVersion_fnAddRef(IGraphVersion* iface) -{ - CFilterGraph_THIS(iface,graphversion); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->unk.punkControl); -} - -static ULONG WINAPI -IGraphVersion_fnRelease(IGraphVersion* iface) -{ - CFilterGraph_THIS(iface,graphversion); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->unk.punkControl); -} - - -static HRESULT WINAPI -IGraphVersion_fnQueryVersion(IGraphVersion* iface,LONG* plVersion) -{ - CFilterGraph_THIS(iface,graphversion); - - TRACE("(%p)->(%p)\n",This,plVersion); - - if ( plVersion == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->m_csFilters ); - *plVersion = This->m_lGraphVersion; - LeaveCriticalSection( &This->m_csFilters ); - - return NOERROR; -} - - -static ICOM_VTABLE(IGraphVersion) igraphversion = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - IGraphVersion_fnQueryInterface, - IGraphVersion_fnAddRef, - IGraphVersion_fnRelease, - /* IGraphVersion fields */ - IGraphVersion_fnQueryVersion, -}; - - - -HRESULT CFilterGraph_InitIGraphVersion( CFilterGraph* pfg ) -{ - TRACE("(%p)\n",pfg); - ICOM_VTBL(&pfg->graphversion) = &igraphversion; - - pfg->m_lGraphVersion = 1; - - return NOERROR; -} - -void CFilterGraph_UninitIGraphVersion( CFilterGraph* pfg ) -{ - TRACE("(%p)\n",pfg); -} - - diff --git a/dlls/quartz/ijgdec.c b/dlls/quartz/ijgdec.c deleted file mode 100644 index 8b1e3059010..00000000000 --- a/dlls/quartz/ijgdec.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * A simple wrapper of JPEG decoder. - * - * 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 -#include -#include - -#include "ijgdec.h" - -#if defined(HAVE_LIBJPEG) && defined(HAVE_JPEGLIB_H) - -#include -#include -#include - -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 - * - * 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 ); - diff --git a/dlls/quartz/imcntl.c b/dlls/quartz/imcntl.c deleted file mode 100644 index 001e3b06bb2..00000000000 --- a/dlls/quartz/imcntl.c +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Implementation of IMediaControl for FilterGraph. - * - * FIXME - stub. - * - * 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 "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); -} diff --git a/dlls/quartz/imfilter.c b/dlls/quartz/imfilter.c deleted file mode 100644 index 2045ab2e4f5..00000000000 --- a/dlls/quartz/imfilter.c +++ /dev/null @@ -1,487 +0,0 @@ -/* - * Implementation of IMediaFilter for FilterGraph. - * - * FIXME - stub. - * - * 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 "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 ); -} diff --git a/dlls/quartz/impos.c b/dlls/quartz/impos.c deleted file mode 100644 index 76a95e939af..00000000000 --- a/dlls/quartz/impos.c +++ /dev/null @@ -1,541 +0,0 @@ -/* - * Implementation of IMediaPosition for FilterGraph. - * - * FIXME - stub. - * - * 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 "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); -} diff --git a/dlls/quartz/imseek.c b/dlls/quartz/imseek.c deleted file mode 100644 index 199d8dc71e6..00000000000 --- a/dlls/quartz/imseek.c +++ /dev/null @@ -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 - * - * 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); -} diff --git a/dlls/quartz/iunk.c b/dlls/quartz/iunk.c deleted file mode 100644 index d0f4c0ff7f5..00000000000 --- a/dlls/quartz/iunk.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * An implementation of IUnknown. - * - * 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 "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; -} - diff --git a/dlls/quartz/iunk.h b/dlls/quartz/iunk.h deleted file mode 100644 index bf35709e86e..00000000000 --- a/dlls/quartz/iunk.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * An implementation of IUnknown. - * - * 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_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 - ofs - }; - - */ - -/* for InterlockedExchangeAdd. */ -#include - -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 - - -void QUARTZ_IUnkInit( QUARTZ_IUnkImpl* pImpl, IUnknown* punkOuter ); -void QUARTZ_IUnkAddDelegation( - QUARTZ_IUnkImpl* pImpl, QUARTZ_IFDelegation* pDelegation ); - - -#endif /* WINE_DSHOW_IUNK_H */ diff --git a/dlls/quartz/main.c b/dlls/quartz/main.c index 04a494fb198..f67dd033a4d 100644 --- a/dlls/quartz/main.c +++ b/dlls/quartz/main.c @@ -1,612 +1 @@ -/* - * Exported APIs. - * - * 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 "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 */ diff --git a/dlls/quartz/memalloc.c b/dlls/quartz/memalloc.c deleted file mode 100644 index ea5cf1f5471..00000000000 --- a/dlls/quartz/memalloc.c +++ /dev/null @@ -1,464 +0,0 @@ -/* - * Implementation of CLSID_MemoryAllocator. - * - * 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 "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 ); -} - diff --git a/dlls/quartz/memalloc.h b/dlls/quartz/memalloc.h deleted file mode 100644 index 6cecfd1f30b..00000000000 --- a/dlls/quartz/memalloc.h +++ /dev/null @@ -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 */ diff --git a/dlls/quartz/midparse.c b/dlls/quartz/midparse.c deleted file mode 100644 index 37f77156cb2..00000000000 --- a/dlls/quartz/midparse.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Implements MIDI Parser. - * - * FIXME - stub - * FIXME - no seeking - * - * 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 "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 ); -} - - diff --git a/dlls/quartz/mjpgdec.c b/dlls/quartz/mjpgdec.c deleted file mode 100644 index 023c704a12d..00000000000 --- a/dlls/quartz/mjpgdec.c +++ /dev/null @@ -1,406 +0,0 @@ -/* - * Implements AVI MJPG Decompressor. - * - * FIXME - stub - * - * 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 "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 ); -} - - diff --git a/dlls/quartz/mpadec.c b/dlls/quartz/mpadec.c deleted file mode 100644 index 25a6e935d9c..00000000000 --- a/dlls/quartz/mpadec.c +++ /dev/null @@ -1,369 +0,0 @@ -/* - * Implements MPEG Audio Decoder(CLSID_CMpegAudioCodec) - * - * FIXME - what library can we use? SMPEG?? - * - * FIXME - stub - * - * 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 "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 ); -} - diff --git a/dlls/quartz/mpgparse.c b/dlls/quartz/mpgparse.c deleted file mode 100644 index 98f1e4e9639..00000000000 --- a/dlls/quartz/mpgparse.c +++ /dev/null @@ -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 - * - * 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 ); -} - - diff --git a/dlls/quartz/mpvdec.c b/dlls/quartz/mpvdec.c deleted file mode 100644 index f005a343e85..00000000000 --- a/dlls/quartz/mpvdec.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Implements MPEG Video Decoder(CLSID_CMpegVideoCodec) - * - * FIXME - what library can we use? SMPEG?? - * - * FIXME - stub - * - * 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 "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 ); -} - - - diff --git a/dlls/quartz/mtype.c b/dlls/quartz/mtype.c deleted file mode 100644 index ca7684df51e..00000000000 --- a/dlls/quartz/mtype.c +++ /dev/null @@ -1,552 +0,0 @@ -/* - * Implements IEnumMediaTypes and helper functions. (internal) - * - * 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 "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; -} - - diff --git a/dlls/quartz/mtype.h b/dlls/quartz/mtype.h deleted file mode 100644 index f421eb194e4..00000000000 --- a/dlls/quartz/mtype.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Implements IEnumMediaTypes and helper functions. (internal) - * - * 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_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 */ diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c deleted file mode 100644 index de3052ce24e..00000000000 --- a/dlls/quartz/parser.c +++ /dev/null @@ -1,2152 +0,0 @@ -/* - * Implements IBaseFilter for parsers. (internal) - * - * 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 - * - * FIXME - handle errors/flushing correctly. - * FIXME - handle seeking. - */ - -#include "config.h" - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "mmsystem.h" -#include "winerror.h" -#include "strmif.h" -#include "control.h" -#include "vfwmsgs.h" -#include "evcode.h" -#include "uuids.h" - -#include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(quartz); - -#include "quartz_private.h" -#include "parser.h" -#include "mtype.h" -#include "memalloc.h" - -#define QUARTZ_MSG_EXITTHREAD (WM_APP+2) -#define QUARTZ_MSG_SEEK (WM_APP+3) - -#ifndef OATRUE -#define OATRUE (-1) -#define OAFALSE (0) -#endif - -HRESULT CParserOutPinImpl_InitIMediaSeeking( CParserOutPinImpl* This ); -void CParserOutPinImpl_UninitIMediaSeeking( CParserOutPinImpl* This ); -HRESULT CParserOutPinImpl_InitIMediaPosition( CParserOutPinImpl* This ); -void CParserOutPinImpl_UninitIMediaPosition( CParserOutPinImpl* This ); - -/*************************************************************************** - * - * CParserImpl internal thread - * - */ - -static -void CParserImplThread_ClearAllRequests( CParserImpl* This ) -{ - ULONG nIndex; - - TRACE("(%p)\n",This); - - for ( nIndex = 0; nIndex < This->m_cOutStreams; nIndex++ ) - { - This->m_ppOutPins[nIndex]->m_bReqUsed = FALSE; - This->m_ppOutPins[nIndex]->m_pReqSample = NULL; - } -} - -static -void CParserImplThread_ReleaseAllRequests( CParserImpl* This ) -{ - ULONG nIndex; - - TRACE("(%p)\n",This); - - for ( nIndex = 0; nIndex < This->m_cOutStreams; nIndex++ ) - { - if ( This->m_ppOutPins[nIndex]->m_bReqUsed ) - { - if ( This->m_ppOutPins[nIndex]->m_pReqSample != NULL ) - { - IMediaSample_Release(This->m_ppOutPins[nIndex]->m_pReqSample); - This->m_ppOutPins[nIndex]->m_pReqSample = NULL; - } - This->m_ppOutPins[nIndex]->m_bReqUsed = FALSE; - } - } -} - -static -BOOL CParserImplThread_HasPendingSamples( CParserImpl* This ) -{ - ULONG nIndex; - - for ( nIndex = 0; nIndex < This->m_cOutStreams; nIndex++ ) - { - if ( This->m_ppOutPins[nIndex]->m_bReqUsed && - This->m_ppOutPins[nIndex]->m_pReqSample != NULL ) - return TRUE; - } - - return FALSE; -} - -static -HRESULT CParserImplThread_FlushAllPendingSamples( CParserImpl* This ) -{ - HRESULT hr; - IMediaSample* pSample; - DWORD_PTR dwContext; - - TRACE("(%p)\n",This); - - /* remove all samples from queue. */ - hr = IAsyncReader_BeginFlush(This->m_pReader); - if ( FAILED(hr) ) - return hr; - IAsyncReader_EndFlush(This->m_pReader); - - /* remove all processed samples from queue. */ - while ( 1 ) - { - hr = IAsyncReader_WaitForNext(This->m_pReader,0,&pSample,&dwContext); - if ( hr != S_OK ) - break; - } - - CParserImplThread_ReleaseAllRequests(This); - - return NOERROR; -} - -static HRESULT CParserImplThread_SendEndOfStream( CParserImpl* This ) -{ - ULONG nIndex; - HRESULT hr; - HRESULT hrRet; - CParserOutPinImpl* pOutPin; - - TRACE("(%p)\n",This); - if ( This->m_bSendEOS ) - return NOERROR; - This->m_bSendEOS = TRUE; - - hrRet = S_OK; - for ( nIndex = 0; nIndex < This->m_cOutStreams; nIndex++ ) - { - pOutPin = This->m_ppOutPins[nIndex]; - hr = CPinBaseImpl_SendEndOfStream(&pOutPin->pin); - if ( FAILED(hr) ) - { - if ( SUCCEEDED(hrRet) ) - hrRet = hr; - } - else - { - if ( hr != S_OK && hrRet == S_OK ) - hrRet = hr; - } - } - - return hrRet; -} - -static -void CParserImplThread_MemDecommit( CParserImpl* This ) -{ - ULONG nIndex; - IMemAllocator* pAlloc; - - TRACE("(%p)\n",This); - - if ( This->m_pAllocator != NULL ) - IMemAllocator_Decommit( This->m_pAllocator ); - - if ( This->m_ppOutPins != NULL && This->m_cOutStreams > 0 ) - { - for ( nIndex = 0; nIndex < This->m_cOutStreams; nIndex++ ) - { - pAlloc = This->m_ppOutPins[nIndex]->m_pOutPinAllocator; - if ( pAlloc != NULL ) - IMemAllocator_Decommit( pAlloc ); - } - } -} - -static HRESULT CParserImplThread_SendFlush( CParserImpl* This ) -{ - ULONG nIndex; - HRESULT hr; - HRESULT hrRet; - CParserOutPinImpl* pOutPin; - - TRACE("(%p)\n",This); - hrRet = S_OK; - for ( nIndex = 0; nIndex < This->m_cOutStreams; nIndex++ ) - { - pOutPin = This->m_ppOutPins[nIndex]; - hr = CPinBaseImpl_SendBeginFlush(&pOutPin->pin); - if ( FAILED(hr) ) - { - if ( SUCCEEDED(hrRet) ) - hrRet = hr; - } - else - { - if ( hr != S_OK && hrRet == S_OK ) - hrRet = hr; - hr = CPinBaseImpl_SendEndFlush(&pOutPin->pin); - if ( FAILED(hr) ) - hrRet = hr; - } - } - - return hrRet; -} - -static void CParserImplThread_ErrorAbort( CParserImpl* This, HRESULT hr ) -{ - CBaseFilterImpl_MediaEventNotify( - &This->basefilter,EC_ERRORABORT,(LONG_PTR)hr,(LONG_PTR)0); - CParserImplThread_SendEndOfStream(This); -} - -static -void CParserImplThread_ResetAllStreams( CParserImpl* This ) -{ - ULONG nIndex; - - if ( This->m_pHandler->pSetCurPos != NULL ) - { - for ( nIndex = 0; nIndex < This->m_cOutStreams; nIndex++ ) - This->m_pHandler->pSetCurPos(This, - &This->m_guidTimeFormat,nIndex,(LONGLONG)0); - } -} - -static -HRESULT CParserImplThread_ProcessNextSample( CParserImpl* This ) -{ - IMediaSample* pSample; - DWORD_PTR dwContext; - ULONG nIndex; - HRESULT hr; - CParserOutPinImpl* pOutPin; - MSG msg; - - while ( 1 ) - { - if ( PeekMessageA( &msg, (HWND)NULL, 0, 0, PM_REMOVE ) ) - { - hr = NOERROR; - switch ( msg.message ) - { - case QUARTZ_MSG_EXITTHREAD: - TRACE("(%p) EndThread\n",This); - CParserImplThread_FlushAllPendingSamples(This); - CParserImplThread_ClearAllRequests(This); - CParserImplThread_SendFlush(This); - CParserImplThread_SendEndOfStream(This); - This->m_bSendEOS = FALSE; - - CParserImplThread_ResetAllStreams(This); - CParserImplThread_MemDecommit(This); - - TRACE("(%p) exit thread\n",This); - return S_FALSE; - case QUARTZ_MSG_SEEK: - FIXME("(%p) Seek\n",This); - CParserImplThread_FlushAllPendingSamples(This); - hr = CParserImplThread_SendFlush(This); - CParserImplThread_SendEndOfStream(This); - /* FIXME - process seeking. */ - /* FIXME - Send NewSegment. */ - break; - default: - FIXME( "invalid message %04u\n", (unsigned)msg.message ); - hr = E_FAIL; - CParserImplThread_ErrorAbort(This,hr); - } - - return hr; - } - - hr = IAsyncReader_WaitForNext(This->m_pReader,PARSER_POLL_INTERVAL,&pSample,&dwContext); - nIndex = (ULONG)dwContext; - if ( hr != VFW_E_TIMEOUT ) - break; - } - if ( FAILED(hr) ) - { - CParserImplThread_ErrorAbort(This,hr); - return hr; - } - - pOutPin = This->m_ppOutPins[nIndex]; - if ( pOutPin != NULL && pOutPin->m_bReqUsed ) - { - if ( This->m_pHandler->pProcessSample != NULL ) - hr = This->m_pHandler->pProcessSample(This,nIndex,pOutPin->m_llReqStart,pOutPin->m_lReqLength,pOutPin->m_pReqSample); - - IMediaSample_SetSyncPoint( pOutPin->m_pReqSample, (pOutPin->m_dwSampleFlags & AM_SAMPLE_SPLICEPOINT) ? TRUE : FALSE ); - IMediaSample_SetPreroll( pOutPin->m_pReqSample, (pOutPin->m_dwSampleFlags & AM_SAMPLE_PREROLL) ? TRUE : FALSE ); - IMediaSample_SetDiscontinuity( pOutPin->m_pReqSample, (pOutPin->m_dwSampleFlags & AM_SAMPLE_DATADISCONTINUITY) ? TRUE : FALSE ); - - if ( SUCCEEDED(hr) ) - { - if ( pOutPin->m_pOutPinAllocator != NULL && - pOutPin->m_pOutPinAllocator != This->m_pAllocator ) - { - /* if pin has its own allocator, sample must be copied */ - hr = IMemAllocator_GetBuffer( This->m_pAllocator, &pSample, NULL, NULL, 0 ); - if ( SUCCEEDED(hr) ) - { - hr = QUARTZ_IMediaSample_Copy( - pSample, pOutPin->m_pReqSample, TRUE ); - if ( SUCCEEDED(hr) ) - hr = CPinBaseImpl_SendSample(&pOutPin->pin,pSample); - IMediaSample_Release(pSample); - } - } - else - { - hr = CPinBaseImpl_SendSample(&pOutPin->pin,pOutPin->m_pReqSample); - } - } - - if ( FAILED(hr) ) - CParserImplThread_ErrorAbort(This,hr); - - IMediaSample_Release(pOutPin->m_pReqSample); - pOutPin->m_pReqSample = NULL; - pOutPin->m_bReqUsed = FALSE; - } - - if ( SUCCEEDED(hr) ) - hr = NOERROR; - - TRACE("return %08lx\n",hr); - - return hr; -} - -static -DWORD WINAPI CParserImplThread_Entry( LPVOID pv ) -{ - CParserImpl* This = (CParserImpl*)pv; - BOOL bReqNext; - ULONG nIndex = 0; - HRESULT hr; - REFERENCE_TIME rtSampleTimeStart, rtSampleTimeEnd; - LONGLONG llReqStart; - LONG lReqLength; - DWORD dwSampleFlags; - REFERENCE_TIME rtReqStart, rtReqStop; - IMediaSample* pSample; - MSG msg; - - /* initialize the message queue. */ - PeekMessageA( &msg, (HWND)NULL, 0, 0, PM_NOREMOVE ); - - CParserImplThread_ClearAllRequests(This); - - /* resume the owner thread. */ - SetEvent( This->m_hEventInit ); - - TRACE( "Enter message loop.\n" ); - - bReqNext = TRUE; - while ( 1 ) - { - if ( bReqNext ) - { - /* Get the next request. */ - hr = This->m_pHandler->pGetNextRequest( This, &nIndex, &llReqStart, &lReqLength, &rtReqStart, &rtReqStop, &dwSampleFlags ); - if ( FAILED(hr) ) - { - CParserImplThread_ErrorAbort(This,hr); - break; - } - if ( hr != S_OK ) - { - /* Flush pending samples. */ - hr = S_OK; - while ( CParserImplThread_HasPendingSamples(This) ) - { - hr = CParserImplThread_ProcessNextSample(This); - if ( hr != S_OK ) - break; - } - if ( hr != S_OK ) - { - /* notification is already sent */ - break; - } - - /* Send End Of Stream. */ - hr = CParserImplThread_SendEndOfStream(This); - if ( hr != S_OK ) - { - /* notification is already sent */ - break; - } - - /* Blocking... */ - hr = CParserImplThread_ProcessNextSample(This); - if ( hr != S_OK ) - { - /* notification is already sent */ - break; - } - continue; - } - if ( This->m_ppOutPins[nIndex]->pin.pPinConnectedTo == NULL ) - continue; - - rtSampleTimeStart = This->basefilter.rtStart + llReqStart * QUARTZ_TIMEUNITS; - rtSampleTimeEnd = (llReqStart + lReqLength) * QUARTZ_TIMEUNITS; - bReqNext = FALSE; - } - - if ( !This->m_ppOutPins[nIndex]->m_bReqUsed ) - { - hr = IMemAllocator_GetBuffer( This->m_pAllocator, &pSample, NULL, NULL, 0 ); - if ( FAILED(hr) ) - { - CParserImplThread_ErrorAbort(This,hr); - break; - } - hr = IMediaSample_SetTime(pSample,&rtSampleTimeStart,&rtSampleTimeEnd); - if ( SUCCEEDED(hr) ) - hr = IAsyncReader_Request(This->m_pReader,pSample,nIndex); - if ( FAILED(hr) ) - { - CParserImplThread_ErrorAbort(This,hr); - break; - } - - This->m_ppOutPins[nIndex]->m_bReqUsed = TRUE; - This->m_ppOutPins[nIndex]->m_pReqSample = pSample; - This->m_ppOutPins[nIndex]->m_llReqStart = llReqStart; - This->m_ppOutPins[nIndex]->m_lReqLength = lReqLength; - This->m_ppOutPins[nIndex]->m_rtReqStart = rtSampleTimeStart; - This->m_ppOutPins[nIndex]->m_rtReqStop = rtSampleTimeEnd; - This->m_ppOutPins[nIndex]->m_dwSampleFlags = dwSampleFlags; - bReqNext = TRUE; - continue; - } - - hr = CParserImplThread_ProcessNextSample(This); - if ( hr != S_OK ) - { - /* notification is already sent */ - break; - } - } - - This->m_dwThreadId = 0; - This->basefilter.bIntermediateState = FALSE; - SetEvent( This->m_hEventInit ); - - return 0; -} - -/*************************************************************************** - * - * CParserImpl internal methods - * - */ - -static -void CParserImpl_SetAsyncReader( CParserImpl* This, IAsyncReader* pReader ) -{ - if ( This->m_pReader != NULL ) - { - IAsyncReader_Release( This->m_pReader ); - This->m_pReader = NULL; - } - if ( pReader != NULL ) - { - This->m_pReader = pReader; - IAsyncReader_AddRef(This->m_pReader); - } -} - -static -void CParserImpl_ReleaseOutPins( CParserImpl* This ) -{ - ULONG nIndex; - - if ( This->m_ppOutPins != NULL ) - { - for ( nIndex = 0; nIndex < This->m_cOutStreams; nIndex++ ) - { - if ( This->m_ppOutPins[nIndex] != NULL ) - { - IUnknown_Release(This->m_ppOutPins[nIndex]->unk.punkControl); - This->m_ppOutPins[nIndex] = NULL; - } - } - QUARTZ_FreeMem(This->m_ppOutPins); - This->m_ppOutPins = NULL; - } - This->m_cOutStreams = 0; -} - -static -BOOL CParserImpl_OutPinsAreConnected( CParserImpl* This ) -{ - QUARTZ_CompListItem* pItem; - IPin* pPin; - IPin* pPinPeer; - HRESULT hr; - - QUARTZ_CompList_Lock( This->basefilter.pOutPins ); - pItem = QUARTZ_CompList_GetFirst( This->basefilter.pOutPins ); - while ( pItem != NULL ) - { - if ( pItem == NULL ) - break; - pPin = (IPin*)QUARTZ_CompList_GetItemPtr(pItem); - pPinPeer = NULL; - hr = IPin_ConnectedTo(pPin,&pPinPeer); - if ( hr == S_OK && pPinPeer != NULL ) - { - IPin_Release(pPinPeer); - return TRUE; - } - pItem = QUARTZ_CompList_GetNext( This->basefilter.pOutPins, pItem ); - } - QUARTZ_CompList_Unlock( This->basefilter.pOutPins ); - - return FALSE; -} - -static -void CParserImpl_ReleaseListOfOutPins( CParserImpl* This ) -{ - QUARTZ_CompListItem* pItem; - - QUARTZ_CompList_Lock( This->basefilter.pOutPins ); - while ( 1 ) - { - pItem = QUARTZ_CompList_GetFirst( This->basefilter.pOutPins ); - if ( pItem == NULL ) - break; - QUARTZ_CompList_RemoveComp( - This->basefilter.pOutPins, - QUARTZ_CompList_GetItemPtr(pItem) ); - } - QUARTZ_CompList_Unlock( This->basefilter.pOutPins ); -} - - -static -HRESULT CParserImpl_BeginThread( CParserImpl* This ) -{ - DWORD dwRes; - HANDLE hEvents[2]; - - if ( This->m_bIsRunning ) - { - TRACE("(%p) - already running\n",This); - return NOERROR; - } - - This->m_hEventInit = CreateEventA(NULL,TRUE,FALSE,NULL); - if ( This->m_hEventInit == (HANDLE)NULL ) - return E_OUTOFMEMORY; - - /* create the processing thread. */ - This->m_hThread = CreateThread( - NULL, 0, - CParserImplThread_Entry, - (LPVOID)This, - 0, &This->m_dwThreadId ); - if ( This->m_hThread == (HANDLE)NULL ) - { - CloseHandle( This->m_hEventInit ); - This->m_hEventInit = (HANDLE)NULL; - return E_FAIL; - } - - hEvents[0] = This->m_hEventInit; - hEvents[1] = This->m_hThread; - - dwRes = WaitForMultipleObjects(2,hEvents,FALSE,INFINITE); - - ResetEvent( This->m_hEventInit ); - CloseHandle( This->m_hThread ); - This->m_hThread = (HANDLE)NULL; - - if ( dwRes != WAIT_OBJECT_0 ) - return E_FAIL; - - This->m_bIsRunning = TRUE; - - return NOERROR; -} - -static -BOOL CParserImpl_EndThread( CParserImpl* This, BOOL bAsync ) -{ - DWORD dwThreadId; - - TRACE("(%p)\n",This); - dwThreadId = This->m_dwThreadId; - if ( This->m_hEventInit != (HANDLE)NULL ) - { - if ( dwThreadId != 0 ) - PostThreadMessageA( - dwThreadId, QUARTZ_MSG_EXITTHREAD, 0, 0 ); - if ( bAsync && - WaitForSingleObject( This->m_hEventInit, 0 ) == WAIT_TIMEOUT ) - return FALSE; - - WaitForSingleObject( This->m_hEventInit, INFINITE ); - CloseHandle( This->m_hEventInit ); - This->m_bIsRunning = FALSE; - This->m_hEventInit = (HANDLE)NULL; - } - - return TRUE; -} - -static -HRESULT CParserImpl_MemCommit( CParserImpl* This ) -{ - HRESULT hr; - ULONG nIndex; - IMemAllocator* pAlloc; - - TRACE("(%p)\n",This); - - if ( This->m_pAllocator == NULL ) - return E_UNEXPECTED; - - hr = IMemAllocator_Commit( This->m_pAllocator ); - if ( FAILED(hr) ) - return hr; - - if ( This->m_ppOutPins != NULL && This->m_cOutStreams > 0 ) - { - for ( nIndex = 0; nIndex < This->m_cOutStreams; nIndex++ ) - { - pAlloc = This->m_ppOutPins[nIndex]->m_pOutPinAllocator; - if ( pAlloc != NULL && pAlloc != This->m_pAllocator ) - { - hr = IMemAllocator_Commit( pAlloc ); - if ( FAILED(hr) ) - return hr; - } - } - } - - return NOERROR; -} - -static -HRESULT CParserImpl_GetPreferredTimeFormat( CParserImpl* This, GUID* pguidFormat ) -{ - static const GUID* tryformats[] = - { - &TIME_FORMAT_MEDIA_TIME, - &TIME_FORMAT_FRAME, - &TIME_FORMAT_SAMPLE, - &TIME_FORMAT_FIELD, - &TIME_FORMAT_BYTE, - NULL, - }; - DWORD n; - - if ( This->m_pHandler->pIsTimeFormatSupported == NULL ) - return E_NOTIMPL; - - n = 0; - while ( tryformats[n] != NULL ) - { - if ( This->m_pHandler->pIsTimeFormatSupported( This, tryformats[n] ) == S_OK ) - { - memcpy( pguidFormat, tryformats[n], sizeof(GUID) ); - return S_OK; - } - n ++; - } - - return E_FAIL; - -} - - -/*************************************************************************** - * - * CParserImpl methods - * - */ - -static HRESULT CParserImpl_OnActive( CBaseFilterImpl* pImpl ) -{ - CParserImpl_THIS(pImpl,basefilter); - - TRACE( "(%p)\n", This ); - - if ( !CParserImpl_OutPinsAreConnected(This) ) - return NOERROR; - - return NOERROR; -} - -static HRESULT CParserImpl_OnInactive( CBaseFilterImpl* pImpl ) -{ - CParserImpl_THIS(pImpl,basefilter); - HRESULT hr; - - TRACE( "(%p)\n", This ); - - if ( !CParserImpl_OutPinsAreConnected(This) ) - return NOERROR; - - hr = CParserImpl_MemCommit(This); - if ( FAILED(hr) ) - return hr; - - if ( This->basefilter.fstate == State_Stopped ) - CParserImpl_EndThread(This,FALSE); - - hr = CParserImpl_BeginThread(This); - if ( FAILED(hr) ) - { - FIXME("CParserImpl_BeginThread returns %08lx\n",hr); - CParserImpl_EndThread(This,FALSE); - return hr; - } - - return NOERROR; -} - -static HRESULT CParserImpl_OnStop( CBaseFilterImpl* pImpl ) -{ - CParserImpl_THIS(pImpl,basefilter); - - TRACE( "(%p)\n", This ); - - This->basefilter.bIntermediateState = TRUE; - if ( !CParserImpl_EndThread(This,TRUE) ) - return VFW_S_STATE_INTERMEDIATE; - - This->basefilter.bIntermediateState = FALSE; - return NOERROR; -} - - -static const CBaseFilterHandlers filterhandlers = -{ - CParserImpl_OnActive, /* pOnActive */ - CParserImpl_OnInactive, /* pOnInactive */ - CParserImpl_OnStop, /* pOnStop */ -}; - - -/*************************************************************************** - * - * CParserInPinImpl methods - * - */ - -static HRESULT CParserInPinImpl_OnPreConnect( CPinBaseImpl* pImpl, IPin* pPin ) -{ - CParserInPinImpl_THIS(pImpl,pin); - HRESULT hr; - ULONG nIndex; - IUnknown* punk; - IAsyncReader* pReader = NULL; - LPCWSTR pwszOutPinName; - IMemAllocator* pAllocActual; - AM_MEDIA_TYPE* pmt; - - TRACE("(%p,%p)\n",This,pPin); - - if ( This->pParser->m_pHandler->pInitParser == NULL || - This->pParser->m_pHandler->pUninitParser == NULL || - This->pParser->m_pHandler->pGetOutPinName == NULL || - This->pParser->m_pHandler->pGetStreamType == NULL || - This->pParser->m_pHandler->pCheckStreamType == NULL || - This->pParser->m_pHandler->pGetAllocProp == NULL || - This->pParser->m_pHandler->pGetNextRequest == NULL ) - { - FIXME("this parser is not implemented.\n"); - return E_NOTIMPL; - } - - /* at first, release all output pins. */ - if ( CParserImpl_OutPinsAreConnected(This->pParser) ) - return E_FAIL; - CParserImpl_ReleaseListOfOutPins(This->pParser); - CParserImpl_ReleaseOutPins(This->pParser); - - CParserImpl_SetAsyncReader( This->pParser, NULL ); - hr = IPin_QueryInterface( pPin, &IID_IAsyncReader, (void**)&pReader ); - if ( FAILED(hr) ) - return hr; - CParserImpl_SetAsyncReader( This->pParser, pReader ); - IAsyncReader_Release(pReader); - - /* initialize parser. */ - hr = This->pParser->m_pHandler->pInitParser(This->pParser,&This->pParser->m_cOutStreams); - if ( FAILED(hr) ) - return hr; - This->pParser->m_ppOutPins = (CParserOutPinImpl**)QUARTZ_AllocMem( - sizeof(CParserOutPinImpl*) * This->pParser->m_cOutStreams ); - if ( This->pParser->m_ppOutPins == NULL ) - return E_OUTOFMEMORY; - for ( nIndex = 0; nIndex < This->pParser->m_cOutStreams; nIndex++ ) - This->pParser->m_ppOutPins[nIndex] = NULL; - - /* create and initialize an allocator. */ - hr = This->pParser->m_pHandler->pGetAllocProp(This->pParser,&This->pParser->m_propAlloc); - if ( FAILED(hr) ) - return hr; - if ( This->pParser->m_propAlloc.cbAlign == 0 ) - This->pParser->m_propAlloc.cbAlign = 1; - - if ( This->pParser->m_pAllocator == NULL ) - { - hr = QUARTZ_CreateMemoryAllocator(NULL,(void**)&punk); - if ( FAILED(hr) ) - return hr; - hr = IUnknown_QueryInterface( punk, &IID_IMemAllocator, (void**)&This->pParser->m_pAllocator ); - IUnknown_Release(punk); - if ( FAILED(hr) ) - return hr; - } - pAllocActual = NULL; - hr = IAsyncReader_RequestAllocator(pReader,This->pParser->m_pAllocator,&This->pParser->m_propAlloc,&pAllocActual); - if ( FAILED(hr) ) - return hr; - IMemAllocator_Release(This->pParser->m_pAllocator); - This->pParser->m_pAllocator = pAllocActual; - - /* create output pins. */ - for ( nIndex = 0; nIndex < This->pParser->m_cOutStreams; nIndex++ ) - { - pwszOutPinName = This->pParser->m_pHandler->pGetOutPinName(This->pParser,nIndex); - if ( pwszOutPinName == NULL ) - return E_FAIL; - hr = QUARTZ_CreateParserOutPin( - This->pParser, - &This->pParser->m_csParser, - &This->pParser->m_ppOutPins[nIndex], - nIndex, pwszOutPinName ); - if ( SUCCEEDED(hr) ) - hr = QUARTZ_CompList_AddTailComp( - This->pParser->basefilter.pOutPins, - (IUnknown*)&(This->pParser->m_ppOutPins[nIndex]->pin), - NULL, 0 ); - if ( FAILED(hr) ) - return hr; - pmt = &This->pParser->m_ppOutPins[nIndex]->m_mtOut; - QUARTZ_MediaType_Free( pmt ); - ZeroMemory( pmt, sizeof(AM_MEDIA_TYPE) ); - hr = This->pParser->m_pHandler->pGetStreamType(This->pParser,nIndex,pmt); - if ( FAILED(hr) ) - { - ZeroMemory( pmt, sizeof(AM_MEDIA_TYPE) ); - return hr; - } - This->pParser->m_ppOutPins[nIndex]->pin.cAcceptTypes = 1; - This->pParser->m_ppOutPins[nIndex]->pin.pmtAcceptTypes = pmt; - } - - return NOERROR; -} - -static HRESULT CParserInPinImpl_OnDisconnect( CPinBaseImpl* pImpl ) -{ - CParserInPinImpl_THIS(pImpl,pin); - - /* assume the graph is already stopped */ - /*CParserImpl_OnInactive(&This->pParser->basefilter);*/ - /*CParserImpl_OnStop(&This->pParser->basefilter);*/ - if ( This->pParser->m_pHandler->pUninitParser != NULL ) - This->pParser->m_pHandler->pUninitParser(This->pParser); - CParserImpl_SetAsyncReader( This->pParser, NULL ); - if ( This->pParser->m_pAllocator != NULL ) - { - IMemAllocator_Decommit(This->pParser->m_pAllocator); - IMemAllocator_Release(This->pParser->m_pAllocator); - This->pParser->m_pAllocator = NULL; - } - - return NOERROR; -} - -static HRESULT CParserInPinImpl_CheckMediaType( CPinBaseImpl* pImpl, const AM_MEDIA_TYPE* pmt ) -{ - CParserInPinImpl_THIS(pImpl,pin); - - TRACE("(%p,%p)\n",This,pmt); - - if ( !IsEqualGUID( &pmt->majortype, &MEDIATYPE_Stream ) ) - return E_FAIL; - - return NOERROR; -} - -static const CBasePinHandlers inputpinhandlers = -{ - CParserInPinImpl_OnPreConnect, /* pOnPreConnect */ - NULL, /* pOnPostConnect */ - CParserInPinImpl_OnDisconnect, /* pOnDisconnect */ - CParserInPinImpl_CheckMediaType, /* pCheckMediaType */ - NULL, /* pQualityNotify */ - NULL, /* pReceive */ - NULL, /* pReceiveCanBlock */ - NULL, /* pEndOfStream */ - NULL, /* pBeginFlush */ - NULL, /* pEndFlush */ - NULL, /* pNewSegment */ -}; - -/*************************************************************************** - * - * CParserOutPinImpl methods - * - */ - -static HRESULT CParserOutPinImpl_OnPostConnect( CPinBaseImpl* pImpl, IPin* pPin ) -{ - CParserOutPinImpl_THIS(pImpl,pin); - ALLOCATOR_PROPERTIES propReq; - ALLOCATOR_PROPERTIES propActual; - IMemAllocator* pAllocator; - HRESULT hr; - BOOL bNewAllocator = FALSE; - - TRACE("(%p,%p)\n",This,pPin); - - if ( This->pin.pMemInputPinConnectedTo == NULL ) - return E_UNEXPECTED; - - if ( This->m_pOutPinAllocator != NULL ) - { - IMemAllocator_Release(This->m_pOutPinAllocator); - This->m_pOutPinAllocator = NULL; - } - - /* try to use This->pParser->m_pAllocator. */ - ZeroMemory( &propReq, sizeof(ALLOCATOR_PROPERTIES) ); - hr = IMemInputPin_GetAllocatorRequirements( - This->pin.pMemInputPinConnectedTo, &propReq ); - if ( propReq.cbAlign != 0 ) - { - if ( This->pParser->m_propAlloc.cbAlign != ( This->pParser->m_propAlloc.cbAlign / propReq.cbAlign * propReq.cbAlign ) ) - bNewAllocator = TRUE; - } - if ( propReq.cbPrefix != 0 ) - bNewAllocator = TRUE; - if ( !bNewAllocator ) - { - hr = IMemInputPin_NotifyAllocator( - This->pin.pMemInputPinConnectedTo, - This->pParser->m_pAllocator, FALSE ); - if ( hr == NOERROR ) - { - This->m_pOutPinAllocator = This->pParser->m_pAllocator; - IMemAllocator_AddRef(This->m_pOutPinAllocator); - return NOERROR; - } - } - - hr = IMemInputPin_GetAllocator( - This->pin.pMemInputPinConnectedTo, &pAllocator ); - if ( FAILED(hr) ) - return hr; - hr = IMemAllocator_SetProperties( pAllocator, &This->pParser->m_propAlloc, &propActual ); - if ( SUCCEEDED(hr) ) - hr = IMemInputPin_NotifyAllocator( - This->pin.pMemInputPinConnectedTo, pAllocator, FALSE ); - if ( FAILED(hr) ) - { - IMemAllocator_Release(pAllocator); - return hr; - } - - This->m_pOutPinAllocator = pAllocator; - return NOERROR; -} - -static HRESULT CParserOutPinImpl_OnDisconnect( CPinBaseImpl* pImpl ) -{ - CParserOutPinImpl_THIS(pImpl,pin); - - if ( This->m_pOutPinAllocator != NULL ) - { - IMemAllocator_Release(This->m_pOutPinAllocator); - This->m_pOutPinAllocator = NULL; - } - - return NOERROR; -} - -static HRESULT CParserOutPinImpl_CheckMediaType( CPinBaseImpl* pImpl, const AM_MEDIA_TYPE* pmt ) -{ - CParserOutPinImpl_THIS(pImpl,pin); - HRESULT hr; - - TRACE("(%p,%p)\n",This,pmt); - if ( pmt == NULL ) - return E_POINTER; - - if ( This->pParser->m_pHandler->pCheckStreamType == NULL ) - return E_NOTIMPL; - - hr = This->pParser->m_pHandler->pCheckStreamType( This->pParser, This->nStreamIndex, pmt ); - if ( FAILED(hr) ) - return hr; - - return NOERROR; -} - - -static const CBasePinHandlers outputpinhandlers = -{ - NULL, /* pOnPreConnect */ - CParserOutPinImpl_OnPostConnect, /* pOnPostConnect */ - CParserOutPinImpl_OnDisconnect, /* pOnDisconnect */ - CParserOutPinImpl_CheckMediaType, /* pCheckMediaType */ - NULL, /* pQualityNotify */ - OutputPinSync_Receive, /* pReceive */ - OutputPinSync_ReceiveCanBlock, /* pReceiveCanBlock */ - OutputPinSync_EndOfStream, /* pEndOfStream */ - OutputPinSync_BeginFlush, /* pBeginFlush */ - OutputPinSync_EndFlush, /* pEndFlush */ - OutputPinSync_NewSegment, /* pNewSegment */ -}; - -/*************************************************************************** - * - * new/delete CParserImpl - * - */ - -/* can I use offsetof safely? - FIXME? */ -static QUARTZ_IFEntry FilterIFEntries[] = -{ - { &IID_IPersist, offsetof(CParserImpl,basefilter)-offsetof(CParserImpl,unk) }, - { &IID_IMediaFilter, offsetof(CParserImpl,basefilter)-offsetof(CParserImpl,unk) }, - { &IID_IBaseFilter, offsetof(CParserImpl,basefilter)-offsetof(CParserImpl,unk) }, -}; - -static void QUARTZ_DestroyParser(IUnknown* punk) -{ - CParserImpl_THIS(punk,unk); - - TRACE( "(%p)\n", This ); - - if ( This->m_pInPin != NULL ) - CParserInPinImpl_OnDisconnect(&This->m_pInPin->pin); - - CParserImpl_SetAsyncReader( This, NULL ); - if ( This->m_pAllocator != NULL ) - { - IMemAllocator_Release(This->m_pAllocator); - This->m_pAllocator = NULL; - } - if ( This->m_pInPin != NULL ) - { - IUnknown_Release(This->m_pInPin->unk.punkControl); - This->m_pInPin = NULL; - } - CParserImpl_ReleaseOutPins( This ); - - DeleteCriticalSection( &This->m_csParser ); - - CBaseFilterImpl_UninitIBaseFilter(&This->basefilter); -} - -HRESULT QUARTZ_CreateParser( - IUnknown* punkOuter,void** ppobj, - const CLSID* pclsidParser, - LPCWSTR pwszParserName, - LPCWSTR pwszInPinName, - const ParserHandlers* pHandler ) -{ - CParserImpl* This = NULL; - HRESULT hr; - - TRACE("(%p,%p)\n",punkOuter,ppobj); - - This = (CParserImpl*) - QUARTZ_AllocObj( sizeof(CParserImpl) ); - if ( This == NULL ) - return E_OUTOFMEMORY; - ZeroMemory( This, sizeof(CParserImpl) ); - - This->m_pInPin = NULL; - This->m_cOutStreams = 0; - This->m_ppOutPins = NULL; - memcpy( &This->m_guidTimeFormat, &TIME_FORMAT_NONE, sizeof(GUID) ); - This->m_pReader = NULL; - This->m_pAllocator = NULL; - ZeroMemory( &This->m_propAlloc, sizeof(ALLOCATOR_PROPERTIES) ); - This->m_hEventInit = (HANDLE)NULL; - This->m_bIsRunning = FALSE; - This->m_hThread = (HANDLE)NULL; - This->m_dwThreadId = 0; - This->m_bSendEOS = FALSE; - This->m_pHandler = pHandler; - This->m_pUserData = NULL; - - QUARTZ_IUnkInit( &This->unk, punkOuter ); - - hr = CBaseFilterImpl_InitIBaseFilter( - &This->basefilter, - This->unk.punkControl, - pclsidParser, - pwszParserName, - &filterhandlers ); - if ( SUCCEEDED(hr) ) - { - /* construct this class. */ - hr = S_OK; - - 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_DestroyParser; - InitializeCriticalSection( &This->m_csParser ); - - /* create the input pin. */ - hr = QUARTZ_CreateParserInPin( - This, - &This->m_csParser, - &This->m_pInPin, - pwszInPinName ); - if ( SUCCEEDED(hr) ) - hr = QUARTZ_CompList_AddComp( - This->basefilter.pInPins, - (IUnknown*)&(This->m_pInPin->pin), - NULL, 0 ); - - if ( FAILED(hr) ) - { - IUnknown_Release( This->unk.punkControl ); - return hr; - } - - *ppobj = (void*)&(This->unk); - - (void)CParserImpl_GetPreferredTimeFormat( This, &This->m_guidTimeFormat ); - - return S_OK; -} - -/*************************************************************************** - * - * new/delete CParserInPinImpl - * - */ - -/* can I use offsetof safely? - FIXME? */ -static QUARTZ_IFEntry InPinIFEntries[] = -{ - { &IID_IPin, offsetof(CParserInPinImpl,pin)-offsetof(CParserInPinImpl,unk) }, - { &IID_IMemInputPin, offsetof(CParserInPinImpl,meminput)-offsetof(CParserInPinImpl,unk) }, -}; - -static void QUARTZ_DestroyParserInPin(IUnknown* punk) -{ - CParserInPinImpl_THIS(punk,unk); - - TRACE( "(%p)\n", This ); - - CPinBaseImpl_UninitIPin( &This->pin ); - CMemInputPinBaseImpl_UninitIMemInputPin( &This->meminput ); -} - -HRESULT QUARTZ_CreateParserInPin( - CParserImpl* pFilter, - CRITICAL_SECTION* pcsPin, - CParserInPinImpl** ppPin, - LPCWSTR pwszPinName ) -{ - CParserInPinImpl* This = NULL; - HRESULT hr; - - TRACE("(%p,%p,%p)\n",pFilter,pcsPin,ppPin); - - This = (CParserInPinImpl*) - QUARTZ_AllocObj( sizeof(CParserInPinImpl) ); - if ( This == NULL ) - return E_OUTOFMEMORY; - - QUARTZ_IUnkInit( &This->unk, NULL ); - This->pParser = pFilter; - - hr = CPinBaseImpl_InitIPin( - &This->pin, - This->unk.punkControl, - pcsPin, NULL, - &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_DestroyParserInPin; - - *ppPin = This; - - TRACE("returned successfully.\n"); - - return S_OK; -} - - -/*************************************************************************** - * - * new/delete CParserOutPinImpl - * - */ - -/* can I use offsetof safely? - FIXME? */ -static QUARTZ_IFEntry OutPinIFEntries[] = -{ - { &IID_IPin, offsetof(CParserOutPinImpl,pin)-offsetof(CParserOutPinImpl,unk) }, - { &IID_IQualityControl, offsetof(CParserOutPinImpl,qcontrol)-offsetof(CParserOutPinImpl,unk) }, - { &IID_IMediaSeeking, offsetof(CParserOutPinImpl,mediaseeking)-offsetof(CParserOutPinImpl,unk) }, - { &IID_IMediaPosition, offsetof(CParserOutPinImpl,mediaposition)-offsetof(CParserOutPinImpl,unk) }, -}; - -static void QUARTZ_DestroyParserOutPin(IUnknown* punk) -{ - CParserOutPinImpl_THIS(punk,unk); - - TRACE( "(%p)\n", This ); - - QUARTZ_MediaType_Free( &This->m_mtOut ); - if ( This->m_pOutPinAllocator != NULL ) - IMemAllocator_Release(This->m_pOutPinAllocator); - - CParserOutPinImpl_UninitIMediaPosition(This); - CParserOutPinImpl_UninitIMediaSeeking(This); - CQualityControlPassThruImpl_UninitIQualityControl( &This->qcontrol ); - CPinBaseImpl_UninitIPin( &This->pin ); - -} - -HRESULT QUARTZ_CreateParserOutPin( - CParserImpl* pFilter, - CRITICAL_SECTION* pcsPin, - CParserOutPinImpl** ppPin, - ULONG nStreamIndex, - LPCWSTR pwszPinName ) -{ - CParserOutPinImpl* This = NULL; - HRESULT hr; - - TRACE("(%p,%p,%p)\n",pFilter,pcsPin,ppPin); - - This = (CParserOutPinImpl*) - QUARTZ_AllocObj( sizeof(CParserOutPinImpl) ); - if ( This == NULL ) - return E_OUTOFMEMORY; - - QUARTZ_IUnkInit( &This->unk, NULL ); - This->pParser = pFilter; - This->nStreamIndex = nStreamIndex; - ZeroMemory( &This->m_mtOut, sizeof(AM_MEDIA_TYPE) ); - This->m_pOutPinAllocator = NULL; - This->m_pUserData = NULL; - This->m_bReqUsed = FALSE; - This->m_pReqSample = NULL; - This->m_llReqStart = 0; - This->m_lReqLength = 0; - This->m_rtReqStart = 0; - This->m_rtReqStop = 0; - This->m_dwSampleFlags = 0; - - - 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 ( SUCCEEDED(hr) ) - { - hr = CParserOutPinImpl_InitIMediaSeeking(This); - if ( SUCCEEDED(hr) ) - { - hr = CParserOutPinImpl_InitIMediaPosition(This); - if ( FAILED(hr) ) - { - CParserOutPinImpl_UninitIMediaSeeking(This); - } - } - if ( FAILED(hr) ) - { - CQualityControlPassThruImpl_UninitIQualityControl( &This->qcontrol ); - } - } - 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_DestroyParserOutPin; - - *ppPin = This; - - TRACE("returned successfully.\n"); - - return S_OK; -} - - -/*************************************************************************** - * - * IMediaSeeking for CParserOutPinImpl - * - */ - -static HRESULT WINAPI -IMediaSeeking_fnQueryInterface(IMediaSeeking* iface,REFIID riid,void** ppobj) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); -} - -static ULONG WINAPI -IMediaSeeking_fnAddRef(IMediaSeeking* iface) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->unk.punkControl); -} - -static ULONG WINAPI -IMediaSeeking_fnRelease(IMediaSeeking* iface) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->unk.punkControl); -} - - -static HRESULT WINAPI -IMediaSeeking_fnGetCapabilities(IMediaSeeking* iface,DWORD* pdwCaps) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - HRESULT hr = E_NOTIMPL; - - TRACE("(%p)->(%p)\n",This,pdwCaps); - - if ( pdwCaps == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->pParser->m_csParser ); - if ( This->pParser->m_pHandler->pGetSeekingCaps == NULL ) - { - FIXME("(%p)->(%p) not implemented\n",This,pdwCaps); - } - else - { - hr = This->pParser->m_pHandler->pGetSeekingCaps( This->pParser, pdwCaps ); - } - LeaveCriticalSection( &This->pParser->m_csParser ); - - return hr; -} - -static HRESULT WINAPI -IMediaSeeking_fnCheckCapabilities(IMediaSeeking* iface,DWORD* pdwCaps) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - HRESULT hr = E_NOTIMPL; - DWORD dwCaps; - - TRACE("(%p)->(%p)\n",This,pdwCaps); - - if ( pdwCaps == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->pParser->m_csParser ); - if ( This->pParser->m_pHandler->pGetSeekingCaps == NULL ) - { - FIXME("(%p)->(%p) not implemented\n",This,pdwCaps); - } - else - { - hr = This->pParser->m_pHandler->pGetSeekingCaps( This->pParser, &dwCaps ); - if ( SUCCEEDED(hr) ) - { - dwCaps &= *pdwCaps; - if ( dwCaps == *pdwCaps ) - hr = S_OK; - else - if ( dwCaps != 0 ) - hr = S_FALSE; - else - hr = E_FAIL; - *pdwCaps = dwCaps; - } - } - LeaveCriticalSection( &This->pParser->m_csParser ); - - return hr; - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IMediaSeeking_fnIsFormatSupported(IMediaSeeking* iface,const GUID* pidFormat) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - HRESULT hr = E_NOTIMPL; - - TRACE("(%p)->(%s)\n",This,debugstr_guid(pidFormat)); - - if ( pidFormat == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->pParser->m_csParser ); - if ( This->pParser->m_pHandler->pIsTimeFormatSupported == NULL ) - { - FIXME("(%p)->(%s) not implemented\n",This,debugstr_guid(pidFormat)); - } - else - { - hr = This->pParser->m_pHandler->pIsTimeFormatSupported( This->pParser, pidFormat ); - } - LeaveCriticalSection( &This->pParser->m_csParser ); - - return hr; -} - -static HRESULT WINAPI -IMediaSeeking_fnQueryPreferredFormat(IMediaSeeking* iface,GUID* pidFormat) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - HRESULT hr; - - TRACE("(%p)->(%p)\n",This,pidFormat); - - EnterCriticalSection( &This->pParser->m_csParser ); - hr = CParserImpl_GetPreferredTimeFormat( This->pParser, pidFormat ); - LeaveCriticalSection( &This->pParser->m_csParser ); - - return hr; -} - -static HRESULT WINAPI -IMediaSeeking_fnGetTimeFormat(IMediaSeeking* iface,GUID* pidFormat) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - HRESULT hr = E_NOTIMPL; - - TRACE("(%p)->(%p)\n",This,pidFormat); - - if ( pidFormat == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->pParser->m_csParser ); - if ( This->pParser->m_pHandler->pIsTimeFormatSupported == NULL ) - { - FIXME("(%p)->(%p) not implemented\n",This,pidFormat); - } - else - { - memcpy( pidFormat, &This->pParser->m_guidTimeFormat, sizeof(GUID) ); - } - LeaveCriticalSection( &This->pParser->m_csParser ); - - return hr; -} - -static HRESULT WINAPI -IMediaSeeking_fnIsUsingTimeFormat(IMediaSeeking* iface,const GUID* pidFormat) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - HRESULT hr = E_NOTIMPL; - - TRACE("(%p)->(%p)\n",This,pidFormat); - - if ( pidFormat == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->pParser->m_csParser ); - if ( This->pParser->m_pHandler->pIsTimeFormatSupported == NULL ) - { - FIXME("(%p)->(%p) not implemented\n",This,pidFormat); - } - else - { - hr = IsEqualGUID( pidFormat, &This->pParser->m_guidTimeFormat ) ? S_OK : S_FALSE; - } - LeaveCriticalSection( &This->pParser->m_csParser ); - - return hr; -} - -static HRESULT WINAPI -IMediaSeeking_fnSetTimeFormat(IMediaSeeking* iface,const GUID* pidFormat) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - HRESULT hr = E_NOTIMPL; - - TRACE("(%p)->(%p)\n",This,pidFormat); - - if ( pidFormat == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->pParser->m_csParser ); - if ( This->pParser->m_pHandler->pIsTimeFormatSupported == NULL ) - { - FIXME("(%p)->(%p) not implemented\n",This,pidFormat); - } - else - { - if ( This->pParser->m_pHandler->pIsTimeFormatSupported( This->pParser, pidFormat ) == S_OK ) - { - memcpy( &This->pParser->m_guidTimeFormat, pidFormat, sizeof(GUID) ); - } - } - LeaveCriticalSection( &This->pParser->m_csParser ); - - return hr; -} - -static HRESULT WINAPI -IMediaSeeking_fnGetDuration(IMediaSeeking* iface,LONGLONG* pllDuration) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - HRESULT hr = E_NOTIMPL; - - TRACE("(%p)->(%p)\n",This,pllDuration); - - if ( pllDuration == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->pParser->m_csParser ); - if ( This->pParser->m_pHandler->pGetDuration == NULL ) - { - FIXME("(%p)->(%p) not implemented\n",This,pllDuration); - } - else - { - hr = This->pParser->m_pHandler->pGetDuration( This->pParser, &This->pParser->m_guidTimeFormat, This->nStreamIndex, pllDuration ); - } - LeaveCriticalSection( &This->pParser->m_csParser ); - - return hr; -} - -static HRESULT WINAPI -IMediaSeeking_fnGetStopPosition(IMediaSeeking* iface,LONGLONG* pllPos) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - HRESULT hr = E_NOTIMPL; - - TRACE("(%p)->(%p)\n",This,pllPos); - - if ( pllPos == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->pParser->m_csParser ); - if ( This->pParser->m_pHandler->pGetStopPos == NULL ) - { - FIXME("(%p)->(%p) not implemented\n",This,pllPos); - } - else - { - hr = This->pParser->m_pHandler->pGetStopPos( This->pParser, &This->pParser->m_guidTimeFormat, This->nStreamIndex, pllPos ); - } - LeaveCriticalSection( &This->pParser->m_csParser ); - - return hr; -} - -static HRESULT WINAPI -IMediaSeeking_fnGetCurrentPosition(IMediaSeeking* iface,LONGLONG* pllPos) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - HRESULT hr = E_NOTIMPL; - - TRACE("(%p)->(%p)\n",This,pllPos); - - if ( pllPos == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->pParser->m_csParser ); - if ( This->pParser->m_pHandler->pGetCurPos == NULL ) - { - FIXME("(%p)->(%p) not implemented\n",This,pllPos); - } - else - { - hr = This->pParser->m_pHandler->pGetCurPos( This->pParser, &This->pParser->m_guidTimeFormat, This->nStreamIndex, pllPos ); - } - LeaveCriticalSection( &This->pParser->m_csParser ); - - return hr; -} - -static HRESULT WINAPI -IMediaSeeking_fnConvertTimeFormat(IMediaSeeking* iface,LONGLONG* pllOut,const GUID* pidFmtOut,LONGLONG llIn,const GUID* pidFmtIn) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IMediaSeeking_fnSetPositions(IMediaSeeking* iface,LONGLONG* pllCur,DWORD dwCurFlags,LONGLONG* pllStop,DWORD dwStopFlags) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IMediaSeeking_fnGetPositions(IMediaSeeking* iface,LONGLONG* pllCur,LONGLONG* pllStop) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - HRESULT hr = E_NOTIMPL; - - TRACE("(%p)->(%p,%p)\n",This,pllCur,pllStop); - - if ( pllCur == NULL || pllStop == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->pParser->m_csParser ); - if ( This->pParser->m_pHandler->pGetCurPos == NULL || - This->pParser->m_pHandler->pGetStopPos == NULL ) - { - FIXME("(%p)->(%p,%p) not implemented\n",This,pllCur,pllStop); - } - else - { - hr = This->pParser->m_pHandler->pGetCurPos( This->pParser, &This->pParser->m_guidTimeFormat, This->nStreamIndex, pllCur ); - if ( SUCCEEDED(hr) ) - hr = This->pParser->m_pHandler->pGetStopPos( This->pParser, &This->pParser->m_guidTimeFormat, This->nStreamIndex, pllStop ); - } - LeaveCriticalSection( &This->pParser->m_csParser ); - - return hr; -} - -static HRESULT WINAPI -IMediaSeeking_fnGetAvailable(IMediaSeeking* iface,LONGLONG* pllFirst,LONGLONG* pllLast) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IMediaSeeking_fnSetRate(IMediaSeeking* iface,double dblRate) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IMediaSeeking_fnGetRate(IMediaSeeking* iface,double* pdblRate) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IMediaSeeking_fnGetPreroll(IMediaSeeking* iface,LONGLONG* pllPreroll) -{ - CParserOutPinImpl_THIS(iface,mediaseeking); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - - - - -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 CParserOutPinImpl_InitIMediaSeeking( CParserOutPinImpl* This ) -{ - TRACE("(%p)\n",This); - ICOM_VTBL(&This->mediaseeking) = &imediaseeking; - - return NOERROR; -} - -void CParserOutPinImpl_UninitIMediaSeeking( CParserOutPinImpl* This ) -{ - TRACE("(%p)\n",This); -} - -/*************************************************************************** - * - * IMediaPosition for CParserOutPinImpl - * - */ - -static HRESULT WINAPI -IMediaPosition_fnQueryInterface(IMediaPosition* iface,REFIID riid,void** ppobj) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); -} - -static ULONG WINAPI -IMediaPosition_fnAddRef(IMediaPosition* iface) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->unk.punkControl); -} - -static ULONG WINAPI -IMediaPosition_fnRelease(IMediaPosition* iface) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->unk.punkControl); -} - -static HRESULT WINAPI -IMediaPosition_fnGetTypeInfoCount(IMediaPosition* iface,UINT* pcTypeInfo) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IMediaPosition_fnGetTypeInfo(IMediaPosition* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - - 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) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - - 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) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - - -static HRESULT WINAPI -IMediaPosition_fnget_Duration(IMediaPosition* iface,REFTIME* prefTime) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - HRESULT hr = E_NOTIMPL; - LONGLONG llPos; - - TRACE("(%p)->(%p)\n",This,prefTime); - - if ( prefTime == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->pParser->m_csParser ); - if ( This->pParser->m_pHandler->pGetDuration == NULL ) - { - FIXME("(%p)->(%p) not implemented\n",This,prefTime); - } - else - { - hr = This->pParser->m_pHandler->pGetDuration( This->pParser, &TIME_FORMAT_MEDIA_TIME, This->nStreamIndex, &llPos ); - if ( SUCCEEDED(hr) ) - *prefTime = (REFTIME)llPos; - } - LeaveCriticalSection( &This->pParser->m_csParser ); - - return hr; -} - -static HRESULT WINAPI -IMediaPosition_fnput_CurrentPosition(IMediaPosition* iface,REFTIME refTime) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - HRESULT hr = E_NOTIMPL; - /*LONGLONG llPos;*/ - - FIXME("(%p)->() stub!\n",This); - -#if 0 /* not yet */ - EnterCriticalSection( &This->pParser->m_csParser ); - if ( This->pParser->m_pHandler->pSetCurPos == NULL ) - { - FIXME("(%p)->() not implemented\n",This); - } - else - { - llPos = (LONGLONG)refTime; - hr = This->pParser->m_pHandler->pSetCurPos( This->pParser, &TIME_FORMAT_MEDIA_TIME, This->nStreamIndex, llPos ); - /* FIXME - flush all streams. */ - } - LeaveCriticalSection( &This->pParser->m_csParser ); -#endif - - return hr; -} - -static HRESULT WINAPI -IMediaPosition_fnget_CurrentPosition(IMediaPosition* iface,REFTIME* prefTime) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - HRESULT hr = E_NOTIMPL; - LONGLONG llPos; - - TRACE("(%p)->(%p)\n",This,prefTime); - - if ( prefTime == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->pParser->m_csParser ); - if ( This->pParser->m_pHandler->pGetCurPos == NULL ) - { - FIXME("(%p)->(%p) not implemented\n",This,prefTime); - } - else - { - hr = This->pParser->m_pHandler->pGetCurPos( This->pParser, &TIME_FORMAT_MEDIA_TIME, This->nStreamIndex, &llPos ); - if ( SUCCEEDED(hr) ) - *prefTime = (REFTIME)llPos; - } - LeaveCriticalSection( &This->pParser->m_csParser ); - - return hr; -} - -static HRESULT WINAPI -IMediaPosition_fnget_StopTime(IMediaPosition* iface,REFTIME* prefTime) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - HRESULT hr = E_NOTIMPL; - LONGLONG llPos; - - TRACE("(%p)->(%p)\n",This,prefTime); - - if ( prefTime == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->pParser->m_csParser ); - if ( This->pParser->m_pHandler->pGetStopPos == NULL ) - { - FIXME("(%p)->(%p) not implemented\n",This,prefTime); - } - else - { - hr = This->pParser->m_pHandler->pGetStopPos( This->pParser, &TIME_FORMAT_MEDIA_TIME, This->nStreamIndex, &llPos ); - if ( SUCCEEDED(hr) ) - *prefTime = (REFTIME)llPos; - } - LeaveCriticalSection( &This->pParser->m_csParser ); - - return hr; -} - -static HRESULT WINAPI -IMediaPosition_fnput_StopTime(IMediaPosition* iface,REFTIME refTime) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - HRESULT hr = E_NOTIMPL; - LONGLONG llPos; - - TRACE("(%p)->()\n",This); - - EnterCriticalSection( &This->pParser->m_csParser ); - if ( This->pParser->m_pHandler->pSetStopPos == NULL ) - { - FIXME("(%p)->() not implemented\n",This); - } - else - { - llPos = (LONGLONG)refTime; - hr = This->pParser->m_pHandler->pSetStopPos( This->pParser, &TIME_FORMAT_MEDIA_TIME, This->nStreamIndex, llPos ); - } - LeaveCriticalSection( &This->pParser->m_csParser ); - - return hr; -} - -static HRESULT WINAPI -IMediaPosition_fnget_PrerollTime(IMediaPosition* iface,REFTIME* prefTime) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IMediaPosition_fnput_PrerollTime(IMediaPosition* iface,REFTIME refTime) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - - FIXME("(%p)->() stub!\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IMediaPosition_fnput_Rate(IMediaPosition* iface,double dblRate) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - - return IMediaSeeking_SetRate(CParserOutPinImpl_IMediaSeeking(This),dblRate); -} - -static HRESULT WINAPI -IMediaPosition_fnget_Rate(IMediaPosition* iface,double* pdblRate) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - - return IMediaSeeking_GetRate(CParserOutPinImpl_IMediaSeeking(This),pdblRate); -} - -static HRESULT WINAPI -IMediaPosition_fnCanSeekForward(IMediaPosition* iface,LONG* pCanSeek) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - HRESULT hr = E_NOTIMPL; - DWORD dwCaps; - - TRACE("(%p)->(%p)\n",This,pCanSeek); - - if ( pCanSeek == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->pParser->m_csParser ); - if ( This->pParser->m_pHandler->pGetSeekingCaps == NULL ) - { - FIXME("(%p)->(%p) not implemented\n",This,pCanSeek); - } - else - { - hr = This->pParser->m_pHandler->pGetSeekingCaps( This->pParser, &dwCaps ); - if ( SUCCEEDED(hr) ) - { - *pCanSeek = (dwCaps & AM_SEEKING_CanSeekForwards) ? OATRUE : OAFALSE; - hr = S_OK; - } - } - LeaveCriticalSection( &This->pParser->m_csParser ); - - return hr; -} - -static HRESULT WINAPI -IMediaPosition_fnCanSeekBackward(IMediaPosition* iface,LONG* pCanSeek) -{ - CParserOutPinImpl_THIS(iface,mediaposition); - HRESULT hr = E_NOTIMPL; - DWORD dwCaps; - - TRACE("(%p)->(%p)\n",This,pCanSeek); - - if ( pCanSeek == NULL ) - return E_POINTER; - - EnterCriticalSection( &This->pParser->m_csParser ); - if ( This->pParser->m_pHandler->pGetSeekingCaps == NULL ) - { - FIXME("(%p)->(%p) not implemented\n",This,pCanSeek); - } - else - { - hr = This->pParser->m_pHandler->pGetSeekingCaps( This->pParser, &dwCaps ); - if ( SUCCEEDED(hr) ) - { - *pCanSeek = (dwCaps & AM_SEEKING_CanSeekBackwards) ? OATRUE : OAFALSE; - hr = S_OK; - } - } - LeaveCriticalSection( &This->pParser->m_csParser ); - - 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 CParserOutPinImpl_InitIMediaPosition( CParserOutPinImpl* This ) -{ - TRACE("(%p)\n",This); - ICOM_VTBL(&This->mediaposition) = &imediaposition; - - return NOERROR; -} - -void CParserOutPinImpl_UninitIMediaPosition( CParserOutPinImpl* This ) -{ - TRACE("(%p)\n",This); -} - diff --git a/dlls/quartz/parser.h b/dlls/quartz/parser.h deleted file mode 100644 index 4ce9aaf4fd4..00000000000 --- a/dlls/quartz/parser.h +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Implements Parser. - * - * 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_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 */ diff --git a/dlls/quartz/qtdec.c b/dlls/quartz/qtdec.c deleted file mode 100644 index 33d7897cabe..00000000000 --- a/dlls/quartz/qtdec.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Implements QuickTime Video Decompressor. - * - * FIXME - stub - * - * 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 "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 ); -} - diff --git a/dlls/quartz/qtparse.c b/dlls/quartz/qtparse.c deleted file mode 100644 index 424bddb4540..00000000000 --- a/dlls/quartz/qtparse.c +++ /dev/null @@ -1,211 +0,0 @@ -/* - * Implements QuickTime Parser(Splitter). - * - * FIXME - stub - * FIXME - no seeking - * - * 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 "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 ); -} - - diff --git a/dlls/quartz/quartz.spec b/dlls/quartz/quartz.spec index 0e0a121b428..b8c333f1bac 100644 --- a/dlls/quartz/quartz.spec +++ b/dlls/quartz/quartz.spec @@ -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 diff --git a/dlls/quartz/quartz_private.h b/dlls/quartz/quartz_private.h deleted file mode 100644 index b0453662ea0..00000000000 --- a/dlls/quartz/quartz_private.h +++ /dev/null @@ -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 */ - diff --git a/dlls/quartz/regsvr.c b/dlls/quartz/regsvr.c deleted file mode 100644 index a24ceb3b8bf..00000000000 --- a/dlls/quartz/regsvr.c +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Regster/Unregister servers. (for internal use) - * - * 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 "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; -} - - diff --git a/dlls/quartz/regsvr.h b/dlls/quartz/regsvr.h deleted file mode 100644 index 54045245831..00000000000 --- a/dlls/quartz/regsvr.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Regster/Unregister servers. (for internal use) - * - * 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_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 */ diff --git a/dlls/quartz/sample.c b/dlls/quartz/sample.c deleted file mode 100644 index c46daa8b4bc..00000000000 --- a/dlls/quartz/sample.c +++ /dev/null @@ -1,677 +0,0 @@ -/* - * Implements IMediaSample2 for CMemMediaSample. - * - * 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 "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 ); -} - diff --git a/dlls/quartz/sample.h b/dlls/quartz/sample.h deleted file mode 100644 index 9d95cced739..00000000000 --- a/dlls/quartz/sample.h +++ /dev/null @@ -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 */ diff --git a/dlls/quartz/seekpass.c b/dlls/quartz/seekpass.c deleted file mode 100644 index ce30b267e68..00000000000 --- a/dlls/quartz/seekpass.c +++ /dev/null @@ -1,862 +0,0 @@ -/* - * Implementation of CLSID_SeekingPassThru - * - * FIXME - not tested yet. - * - * 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 "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 diff --git a/dlls/quartz/seekpass.h b/dlls/quartz/seekpass.h deleted file mode 100644 index af7fc3391bb..00000000000 --- a/dlls/quartz/seekpass.h +++ /dev/null @@ -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 */ diff --git a/dlls/quartz/sysclock.c b/dlls/quartz/sysclock.c deleted file mode 100644 index e12b9277217..00000000000 --- a/dlls/quartz/sysclock.c +++ /dev/null @@ -1,530 +0,0 @@ -/* - * Implementation of CLSID_SystemClock. - * - * 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 "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 ); -} diff --git a/dlls/quartz/sysclock.h b/dlls/quartz/sysclock.h deleted file mode 100644 index bfaa556971a..00000000000 --- a/dlls/quartz/sysclock.h +++ /dev/null @@ -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 */ diff --git a/dlls/quartz/videoblt.c b/dlls/quartz/videoblt.c deleted file mode 100644 index 07a01d3e1ea..00000000000 --- a/dlls/quartz/videoblt.c +++ /dev/null @@ -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; - } -} - diff --git a/dlls/quartz/videoblt.h b/dlls/quartz/videoblt.h deleted file mode 100644 index 9d4e9a42611..00000000000 --- a/dlls/quartz/videoblt.h +++ /dev/null @@ -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 */ diff --git a/dlls/quartz/vidren.c b/dlls/quartz/vidren.c deleted file mode 100644 index 98268848dae..00000000000 --- a/dlls/quartz/vidren.c +++ /dev/null @@ -1,2440 +0,0 @@ -/* - * Implements CLSID_VideoRenderer. - * - * 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 - * - * FIXME - use clock - */ - -#include "config.h" - -#include -#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 "amvideo.h" -#include "evcode.h" - -#include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(quartz); - -#include "quartz_private.h" -#include "vidren.h" -#include "seekpass.h" - - -static const WCHAR QUARTZ_VideoRenderer_Name[] = -{ 'V','i','d','e','o',' ','R','e','n','d','e','r','e','r',0 }; -static const WCHAR QUARTZ_VideoRendererPin_Name[] = -{ 'I','n',0 }; - -#define VIDRENMSG_UPDATE (WM_APP+0) -#define VIDRENMSG_ENDTHREAD (WM_APP+1) - -static const CHAR VIDREN_szWndClass[] = "Wine_VideoRenderer"; -static const CHAR VIDREN_szWndName[] = "Wine Video Renderer"; - - - - -static void VIDREN_OnPaint( CVideoRendererImpl* This, HWND hwnd ) -{ - PAINTSTRUCT ps; - const VIDEOINFOHEADER* pinfo; - const AM_MEDIA_TYPE* pmt; - - TRACE("(%p,%08x)\n",This,hwnd); - - if ( !BeginPaint( hwnd, &ps ) ) - return; - - pmt = This->pPin->pin.pmtConn; - if ( (!This->m_bSampleIsValid) || pmt == NULL ) - goto err; - - pinfo = (const VIDEOINFOHEADER*)pmt->pbFormat; - - StretchDIBits( - ps.hdc, - 0, 0, - abs(pinfo->bmiHeader.biWidth), abs(pinfo->bmiHeader.biHeight), - 0, 0, - abs(pinfo->bmiHeader.biWidth), abs(pinfo->bmiHeader.biHeight), - This->m_pSampleData, (BITMAPINFO*)(&pinfo->bmiHeader), - DIB_RGB_COLORS, SRCCOPY ); - -err: - EndPaint( hwnd, &ps ); -} - -static void VIDREN_OnQueryNewPalette( CVideoRendererImpl* This, HWND hwnd ) -{ - FIXME("(%p,%08x)\n",This,hwnd); -} - -static void VIDREN_OnUpdate( CVideoRendererImpl* This, HWND hwnd ) -{ - MSG msg; - - TRACE("(%p,%08x)\n",This,hwnd); - - InvalidateRect(hwnd,NULL,FALSE); - UpdateWindow(hwnd); - - /* FIXME */ - while ( PeekMessageA(&msg,hwnd, - VIDRENMSG_UPDATE,VIDRENMSG_UPDATE, - PM_REMOVE) != FALSE ) - { - /* discard this message. */ - } -} - - -static LRESULT CALLBACK -VIDREN_WndProc( - HWND hwnd, UINT message, - WPARAM wParam, LPARAM lParam ) -{ - CVideoRendererImpl* This = (CVideoRendererImpl*) - GetWindowLongA( hwnd, 0L ); - - TRACE("(%p) - %u/%u/%ld\n",This,message,wParam,lParam); - - if ( message == WM_NCCREATE ) - { - This = (CVideoRendererImpl*)(((CREATESTRUCTA*)lParam)->lpCreateParams); - SetWindowLongA( hwnd, 0L, (LONG)This ); - This->m_hwnd = hwnd; - } - - if ( message == WM_NCDESTROY ) - { - PostQuitMessage(0); - This->m_hwnd = (HWND)NULL; - SetWindowLongA( hwnd, 0L, (LONG)NULL ); - This = NULL; - } - - if ( This != NULL ) - { - switch ( message ) - { - case WM_PAINT: - TRACE("WM_PAINT begin\n"); - EnterCriticalSection( &This->m_csReceive ); - VIDREN_OnPaint( This, hwnd ); - LeaveCriticalSection( &This->m_csReceive ); - TRACE("WM_PAINT end\n"); - return 0; - case WM_CLOSE: - ShowWindow( hwnd, SW_HIDE ); - return 0; - case WM_PALETTECHANGED: - if ( hwnd == (HWND)wParam ) - break; - /* fall through */ - case WM_QUERYNEWPALETTE: - VIDREN_OnQueryNewPalette( This, hwnd ); - break; - case VIDRENMSG_UPDATE: - VIDREN_OnUpdate( This, hwnd ); - return 0; - case VIDRENMSG_ENDTHREAD: - DestroyWindow(hwnd); - return 0; - default: - break; - } - } - - return DefWindowProcA( hwnd, message, wParam, lParam ); -} - -static BOOL VIDREN_Register( HINSTANCE hInst ) -{ - WNDCLASSA wc; - ATOM atom; - - wc.style = 0; - wc.lpfnWndProc = VIDREN_WndProc; - wc.cbClsExtra = 0; - wc.cbWndExtra = sizeof(LONG); - wc.hInstance = hInst; - wc.hIcon = LoadIconA((HINSTANCE)NULL,IDI_WINLOGOA); - wc.hCursor = LoadCursorA((HINSTANCE)NULL,IDC_ARROWA); - wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); - wc.lpszMenuName = NULL; - wc.lpszClassName = VIDREN_szWndClass; - - atom = RegisterClassA( &wc ); - if ( atom != (ATOM)0 ) - return TRUE; - - /* FIXME */ - return FALSE; -} - -static HWND VIDREN_Create( HWND hwndOwner, CVideoRendererImpl* This ) -{ - HINSTANCE hInst = (HINSTANCE)GetModuleHandleA(NULL); - const VIDEOINFOHEADER* pinfo; - DWORD dwExStyle = 0; - DWORD dwStyle = WS_POPUP|WS_CAPTION|WS_CLIPCHILDREN; - RECT rcWnd; - HWND hwnd; - - if ( !VIDREN_Register( hInst ) ) - return (HWND)NULL; - - pinfo = (const VIDEOINFOHEADER*)This->pPin->pin.pmtConn->pbFormat; - - TRACE("width %ld, height %ld\n", pinfo->bmiHeader.biWidth, pinfo->bmiHeader.biHeight); - - rcWnd.left = 0; - rcWnd.top = 0; - rcWnd.right = pinfo->bmiHeader.biWidth; - rcWnd.bottom = abs(pinfo->bmiHeader.biHeight); - AdjustWindowRectEx( &rcWnd, dwStyle, FALSE, dwExStyle ); - - TRACE("window width %d,height %d\n", - rcWnd.right-rcWnd.left,rcWnd.bottom-rcWnd.top); - - hwnd = CreateWindowExA( - dwExStyle, - VIDREN_szWndClass, VIDREN_szWndName, - dwStyle, - 100,100, /* FIXME */ - rcWnd.right-rcWnd.left, rcWnd.bottom-rcWnd.top, - hwndOwner, (HMENU)NULL, - hInst, (LPVOID)This ); - if ( hwnd != (HWND)NULL ) - ShowWindow(hwnd,SW_SHOW); - - return hwnd; -} - -static DWORD WINAPI VIDREN_ThreadEntry( LPVOID pv ) -{ - CVideoRendererImpl* This = (CVideoRendererImpl*)pv; - MSG msg; - - TRACE("(%p)\n",This); - if ( !VIDREN_Create( (HWND)NULL, This ) ) - return 0; - TRACE("VIDREN_Create succeeded\n"); - - SetEvent( This->m_hEventInit ); - TRACE("Enter message loop\n"); - - while ( GetMessageA(&msg,(HWND)NULL,0,0) ) - { - TranslateMessage(&msg); - DispatchMessageA(&msg); - } - - return 0; -} - -static HRESULT VIDREN_StartThread( CVideoRendererImpl* This ) -{ - DWORD dwRes; - DWORD dwThreadId; - HANDLE hEvents[2]; - - if ( This->m_hEventInit != (HANDLE)NULL || - This->m_hwnd != (HWND)NULL || - This->m_hThread != (HANDLE)NULL || - This->pPin->pin.pmtConn == NULL ) - return E_UNEXPECTED; - - This->m_hEventInit = CreateEventA(NULL,TRUE,FALSE,NULL); - if ( This->m_hEventInit == (HANDLE)NULL ) - return E_OUTOFMEMORY; - - This->m_hThread = CreateThread( - NULL, 0, - VIDREN_ThreadEntry, - (LPVOID)This, - 0, &dwThreadId ); - if ( This->m_hThread == (HANDLE)NULL ) - return E_FAIL; - - hEvents[0] = This->m_hEventInit; - hEvents[1] = This->m_hThread; - - dwRes = WaitForMultipleObjects(2,hEvents,FALSE,INFINITE); - if ( dwRes != WAIT_OBJECT_0 ) - return E_FAIL; - - return S_OK; -} - -static void VIDREN_EndThread( CVideoRendererImpl* This ) -{ - if ( This->m_hwnd != (HWND)NULL ) - PostMessageA( This->m_hwnd, VIDRENMSG_ENDTHREAD, 0, 0 ); - - if ( This->m_hThread != (HANDLE)NULL ) - { - WaitForSingleObject( This->m_hThread, INFINITE ); - CloseHandle( This->m_hThread ); - This->m_hThread = (HANDLE)NULL; - } - if ( This->m_hEventInit != (HANDLE)NULL ) - { - CloseHandle( This->m_hEventInit ); - This->m_hEventInit = (HANDLE)NULL; - } -} - - - -/*************************************************************************** - * - * CVideoRendererImpl methods - * - */ - -static HRESULT CVideoRendererImpl_OnActive( CBaseFilterImpl* pImpl ) -{ - CVideoRendererImpl_THIS(pImpl,basefilter); - - TRACE( "(%p)\n", This ); - - This->m_bSampleIsValid = FALSE; - - return NOERROR; -} - -static HRESULT CVideoRendererImpl_OnInactive( CBaseFilterImpl* pImpl ) -{ - CVideoRendererImpl_THIS(pImpl,basefilter); - - TRACE( "(%p)\n", This ); - - EnterCriticalSection( &This->m_csReceive ); - This->m_bSampleIsValid = FALSE; - LeaveCriticalSection( &This->m_csReceive ); - - return NOERROR; -} - -static const CBaseFilterHandlers filterhandlers = -{ - CVideoRendererImpl_OnActive, /* pOnActive */ - CVideoRendererImpl_OnInactive, /* pOnInactive */ - NULL, /* pOnStop */ -}; - -/*************************************************************************** - * - * CVideoRendererPinImpl methods - * - */ - -static HRESULT CVideoRendererPinImpl_OnPreConnect( CPinBaseImpl* pImpl, IPin* pPin ) -{ - CVideoRendererPinImpl_THIS(pImpl,pin); - - TRACE("(%p,%p)\n",This,pPin); - - return NOERROR; -} - -static HRESULT CVideoRendererPinImpl_OnPostConnect( CPinBaseImpl* pImpl, IPin* pPin ) -{ - CVideoRendererPinImpl_THIS(pImpl,pin); - const VIDEOINFOHEADER* pinfo; - HRESULT hr; - - TRACE("(%p,%p)\n",This,pPin); - - if ( This->pRender->m_pSampleData != NULL ) - { - QUARTZ_FreeMem(This->pRender->m_pSampleData); - This->pRender->m_pSampleData = NULL; - } - This->pRender->m_cbSampleData = 0; - This->pRender->m_bSampleIsValid = FALSE; - - pinfo = (const VIDEOINFOHEADER*)This->pin.pmtConn->pbFormat; - if ( pinfo == NULL ) - return E_FAIL; - - This->pRender->m_bSampleIsValid = FALSE; - This->pRender->m_cbSampleData = DIBSIZE(pinfo->bmiHeader); - This->pRender->m_pSampleData = (BYTE*)QUARTZ_AllocMem(This->pRender->m_cbSampleData); - if ( This->pRender->m_pSampleData == NULL ) - return E_OUTOFMEMORY; - - hr = VIDREN_StartThread(This->pRender); - if ( FAILED(hr) ) - return hr; - - return NOERROR; -} - -static HRESULT CVideoRendererPinImpl_OnDisconnect( CPinBaseImpl* pImpl ) -{ - CVideoRendererPinImpl_THIS(pImpl,pin); - - TRACE("(%p)\n",This); - - VIDREN_EndThread(This->pRender); - - if ( This->pRender->m_pSampleData != NULL ) - { - QUARTZ_FreeMem(This->pRender->m_pSampleData); - This->pRender->m_pSampleData = NULL; - } - This->pRender->m_cbSampleData = 0; - This->pRender->m_bSampleIsValid = FALSE; - - if ( This->meminput.pAllocator != NULL ) - { - IMemAllocator_Decommit(This->meminput.pAllocator); - IMemAllocator_Release(This->meminput.pAllocator); - This->meminput.pAllocator = NULL; - } - - return NOERROR; -} - -static HRESULT CVideoRendererPinImpl_CheckMediaType( CPinBaseImpl* pImpl, const AM_MEDIA_TYPE* pmt ) -{ - CVideoRendererPinImpl_THIS(pImpl,pin); - const VIDEOINFOHEADER* pinfo; - - TRACE("(%p,%p)\n",This,pmt); - - if ( !IsEqualGUID( &pmt->majortype, &MEDIATYPE_Video ) ) - return E_FAIL; - if ( !IsEqualGUID( &pmt->formattype, &FORMAT_VideoInfo ) ) - return E_FAIL; - /* - * check subtype. - */ - if ( !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB555 ) && - !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB565 ) && - !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB24 ) && - !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB32 ) ) - return E_FAIL; - - /**** - * - * - if ( !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB8 ) && - !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB555 ) && - !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB565 ) && - !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB24 ) && - !IsEqualGUID( &pmt->subtype, &MEDIASUBTYPE_RGB32 ) ) - return E_FAIL; - * - ****/ - - pinfo = (const VIDEOINFOHEADER*)pmt->pbFormat; - if ( pinfo == NULL || - pinfo->bmiHeader.biSize < sizeof(BITMAPINFOHEADER) || - pinfo->bmiHeader.biWidth <= 0 || - pinfo->bmiHeader.biHeight == 0 || - pinfo->bmiHeader.biPlanes != 1 || - pinfo->bmiHeader.biCompression != 0 ) - return E_FAIL; - - return NOERROR; -} - -static HRESULT CVideoRendererPinImpl_Receive( CPinBaseImpl* pImpl, IMediaSample* pSample ) -{ - CVideoRendererPinImpl_THIS(pImpl,pin); - HWND hwnd; - BYTE* pData = NULL; - LONG lLength; - HRESULT hr; - - TRACE( "(%p,%p)\n",This,pSample ); - - hwnd = This->pRender->m_hwnd; - if ( hwnd == (HWND)NULL || - This->pRender->m_hThread == (HWND)NULL ) - return E_UNEXPECTED; - if ( This->pRender->m_fInFlush ) - return S_FALSE; - if ( pSample == NULL ) - return E_POINTER; - - /* FIXME - wait/skip/qualitycontrol */ - - - /* duplicate this sample. */ - hr = IMediaSample_GetPointer(pSample,&pData); - if ( FAILED(hr) ) - return hr; - lLength = (LONG)IMediaSample_GetActualDataLength(pSample); - if ( lLength <= 0 || (lLength < (LONG)This->pRender->m_cbSampleData) ) - { - ERR( "invalid length: %ld\n", lLength ); - return NOERROR; - } - - memcpy(This->pRender->m_pSampleData,pData,lLength); - This->pRender->m_bSampleIsValid = TRUE; - PostMessageA( hwnd, VIDRENMSG_UPDATE, 0, 0 ); - - return NOERROR; -} - -static HRESULT CVideoRendererPinImpl_ReceiveCanBlock( CPinBaseImpl* pImpl ) -{ - CVideoRendererPinImpl_THIS(pImpl,pin); - - TRACE( "(%p)\n", This ); - - /* might block. */ - return S_OK; -} - -static HRESULT CVideoRendererPinImpl_EndOfStream( CPinBaseImpl* pImpl ) -{ - CVideoRendererPinImpl_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 CVideoRendererPinImpl_BeginFlush( CPinBaseImpl* pImpl ) -{ - CVideoRendererPinImpl_THIS(pImpl,pin); - - TRACE( "(%p)\n", This ); - - This->pRender->m_fInFlush = TRUE; - EnterCriticalSection( &This->pRender->m_csReceive ); - This->pRender->m_bSampleIsValid = FALSE; - LeaveCriticalSection( &This->pRender->m_csReceive ); - - return NOERROR; -} - -static HRESULT CVideoRendererPinImpl_EndFlush( CPinBaseImpl* pImpl ) -{ - CVideoRendererPinImpl_THIS(pImpl,pin); - - TRACE( "(%p)\n", This ); - - This->pRender->m_fInFlush = FALSE; - - return NOERROR; -} - -static HRESULT CVideoRendererPinImpl_NewSegment( CPinBaseImpl* pImpl, REFERENCE_TIME rtStart, REFERENCE_TIME rtStop, double rate ) -{ - CVideoRendererPinImpl_THIS(pImpl,pin); - - FIXME( "(%p)\n", This ); - - This->pRender->m_fInFlush = FALSE; - - return NOERROR; -} - - - - -static const CBasePinHandlers pinhandlers = -{ - CVideoRendererPinImpl_OnPreConnect, /* pOnPreConnect */ - CVideoRendererPinImpl_OnPostConnect, /* pOnPostConnect */ - CVideoRendererPinImpl_OnDisconnect, /* pOnDisconnect */ - CVideoRendererPinImpl_CheckMediaType, /* pCheckMediaType */ - NULL, /* pQualityNotify */ - CVideoRendererPinImpl_Receive, /* pReceive */ - CVideoRendererPinImpl_ReceiveCanBlock, /* pReceiveCanBlock */ - CVideoRendererPinImpl_EndOfStream, /* pEndOfStream */ - CVideoRendererPinImpl_BeginFlush, /* pBeginFlush */ - CVideoRendererPinImpl_EndFlush, /* pEndFlush */ - CVideoRendererPinImpl_NewSegment, /* pNewSegment */ -}; - - -/*************************************************************************** - * - * new/delete CVideoRendererImpl - * - */ - -/* can I use offsetof safely? - FIXME? */ -static QUARTZ_IFEntry FilterIFEntries[] = -{ - { &IID_IPersist, offsetof(CVideoRendererImpl,basefilter)-offsetof(CVideoRendererImpl,unk) }, - { &IID_IMediaFilter, offsetof(CVideoRendererImpl,basefilter)-offsetof(CVideoRendererImpl,unk) }, - { &IID_IBaseFilter, offsetof(CVideoRendererImpl,basefilter)-offsetof(CVideoRendererImpl,unk) }, - { &IID_IBasicVideo, offsetof(CVideoRendererImpl,basvid)-offsetof(CVideoRendererImpl,unk) }, - { &IID_IVideoWindow, offsetof(CVideoRendererImpl,vidwin)-offsetof(CVideoRendererImpl,unk) }, -}; - -static HRESULT CVideoRendererImpl_OnQueryInterface( - IUnknown* punk, const IID* piid, void** ppobj ) -{ - CVideoRendererImpl_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_DestroyVideoRenderer(IUnknown* punk) -{ - CVideoRendererImpl_THIS(punk,unk); - - TRACE( "(%p)\n", This ); - CVideoRendererImpl_OnInactive(&This->basefilter); - VIDREN_EndThread(This); - - 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; - } - - CVideoRendererImpl_UninitIBasicVideo(This); - CVideoRendererImpl_UninitIVideoWindow(This); - CBaseFilterImpl_UninitIBaseFilter(&This->basefilter); - - DeleteCriticalSection( &This->m_csReceive ); -} - -HRESULT QUARTZ_CreateVideoRenderer(IUnknown* punkOuter,void** ppobj) -{ - CVideoRendererImpl* This = NULL; - HRESULT hr; - - TRACE("(%p,%p)\n",punkOuter,ppobj); - - This = (CVideoRendererImpl*) - QUARTZ_AllocObj( sizeof(CVideoRendererImpl) ); - if ( This == NULL ) - return E_OUTOFMEMORY; - This->pSeekPass = NULL; - This->pPin = NULL; - This->m_fInFlush = FALSE; - - This->m_hEventInit = (HANDLE)NULL; - This->m_hThread = (HANDLE)NULL; - This->m_hwnd = (HWND)NULL; - This->m_bSampleIsValid = FALSE; - This->m_pSampleData = NULL; - This->m_cbSampleData = 0; - - QUARTZ_IUnkInit( &This->unk, punkOuter ); - This->qiext.pNext = NULL; - This->qiext.pOnQueryInterface = &CVideoRendererImpl_OnQueryInterface; - QUARTZ_IUnkAddDelegation( &This->unk, &This->qiext ); - - hr = CBaseFilterImpl_InitIBaseFilter( - &This->basefilter, - This->unk.punkControl, - &CLSID_VideoRenderer, - QUARTZ_VideoRenderer_Name, - &filterhandlers ); - if ( SUCCEEDED(hr) ) - { - hr = CVideoRendererImpl_InitIBasicVideo(This); - if ( SUCCEEDED(hr) ) - { - hr = CVideoRendererImpl_InitIVideoWindow(This); - if ( FAILED(hr) ) - { - CVideoRendererImpl_UninitIBasicVideo(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_DestroyVideoRenderer; - - InitializeCriticalSection( &This->m_csReceive ); - - hr = QUARTZ_CreateVideoRendererPin( - 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 CVideoRendererPinImpl - * - */ - -/* can I use offsetof safely? - FIXME? */ -static QUARTZ_IFEntry PinIFEntries[] = -{ - { &IID_IPin, offsetof(CVideoRendererPinImpl,pin)-offsetof(CVideoRendererPinImpl,unk) }, - { &IID_IMemInputPin, offsetof(CVideoRendererPinImpl,meminput)-offsetof(CVideoRendererPinImpl,unk) }, -}; - -static void QUARTZ_DestroyVideoRendererPin(IUnknown* punk) -{ - CVideoRendererPinImpl_THIS(punk,unk); - - TRACE( "(%p)\n", This ); - - CPinBaseImpl_UninitIPin( &This->pin ); - CMemInputPinBaseImpl_UninitIMemInputPin( &This->meminput ); -} - -HRESULT QUARTZ_CreateVideoRendererPin( - CVideoRendererImpl* pFilter, - CRITICAL_SECTION* pcsPin, - CRITICAL_SECTION* pcsPinReceive, - CVideoRendererPinImpl** ppPin) -{ - CVideoRendererPinImpl* This = NULL; - HRESULT hr; - - TRACE("(%p,%p,%p,%p)\n",pFilter,pcsPin,pcsPinReceive,ppPin); - - This = (CVideoRendererPinImpl*) - QUARTZ_AllocObj( sizeof(CVideoRendererPinImpl) ); - 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_VideoRendererPin_Name, - FALSE, - &pinhandlers ); - - 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 = PinIFEntries; - This->unk.dwEntries = sizeof(PinIFEntries)/sizeof(PinIFEntries[0]); - This->unk.pOnFinalRelease = QUARTZ_DestroyVideoRendererPin; - - *ppPin = This; - - TRACE("returned successfully.\n"); - - return S_OK; -} - -/*************************************************************************** - * - * CVideoRendererImpl::IBasicVideo - * - */ - - -static HRESULT WINAPI -IBasicVideo_fnQueryInterface(IBasicVideo* iface,REFIID riid,void** ppobj) -{ - CVideoRendererImpl_THIS(iface,basvid); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); -} - -static ULONG WINAPI -IBasicVideo_fnAddRef(IBasicVideo* iface) -{ - CVideoRendererImpl_THIS(iface,basvid); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->unk.punkControl); -} - -static ULONG WINAPI -IBasicVideo_fnRelease(IBasicVideo* iface) -{ - CVideoRendererImpl_THIS(iface,basvid); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->unk.punkControl); -} - -static HRESULT WINAPI -IBasicVideo_fnGetTypeInfoCount(IBasicVideo* iface,UINT* pcTypeInfo) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnGetTypeInfo(IBasicVideo* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnGetIDsOfNames(IBasicVideo* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnInvoke(IBasicVideo* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - - -static HRESULT WINAPI -IBasicVideo_fnget_AvgTimePerFrame(IBasicVideo* iface,REFTIME* prefTime) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnget_BitRate(IBasicVideo* iface,long* plRate) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnget_BitErrorRate(IBasicVideo* iface,long* plRate) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnget_VideoWidth(IBasicVideo* iface,long* plWidth) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnget_VideoHeight(IBasicVideo* iface,long* plHeight) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnput_SourceLeft(IBasicVideo* iface,long lLeft) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnget_SourceLeft(IBasicVideo* iface,long* plLeft) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnput_SourceWidth(IBasicVideo* iface,long lWidth) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnget_SourceWidth(IBasicVideo* iface,long* plWidth) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnput_SourceTop(IBasicVideo* iface,long lTop) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnget_SourceTop(IBasicVideo* iface,long* plTop) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnput_SourceHeight(IBasicVideo* iface,long lHeight) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnget_SourceHeight(IBasicVideo* iface,long* plHeight) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnput_DestinationLeft(IBasicVideo* iface,long lLeft) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnget_DestinationLeft(IBasicVideo* iface,long* plLeft) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnput_DestinationWidth(IBasicVideo* iface,long lWidth) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnget_DestinationWidth(IBasicVideo* iface,long* plWidth) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnput_DestinationTop(IBasicVideo* iface,long lTop) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnget_DestinationTop(IBasicVideo* iface,long* plTop) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnput_DestinationHeight(IBasicVideo* iface,long lHeight) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnget_DestinationHeight(IBasicVideo* iface,long* plHeight) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnSetSourcePosition(IBasicVideo* iface,long lLeft,long lTop,long lWidth,long lHeight) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnGetSourcePosition(IBasicVideo* iface,long* plLeft,long* plTop,long* plWidth,long* plHeight) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnSetDefaultSourcePosition(IBasicVideo* iface) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnSetDestinationPosition(IBasicVideo* iface,long lLeft,long lTop,long lWidth,long lHeight) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnGetDestinationPosition(IBasicVideo* iface,long* plLeft,long* plTop,long* plWidth,long* plHeight) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnSetDefaultDestinationPosition(IBasicVideo* iface) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnGetVideoSize(IBasicVideo* iface,long* plWidth,long* plHeight) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnGetVideoPaletteEntries(IBasicVideo* iface,long lStart,long lCount,long* plRet,long* plPaletteEntry) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnGetCurrentImage(IBasicVideo* iface,long* plBufferSize,long* plDIBBuffer) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnIsUsingDefaultSource(IBasicVideo* iface) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IBasicVideo_fnIsUsingDefaultDestination(IBasicVideo* iface) -{ - CVideoRendererImpl_THIS(iface,basvid); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - - - - -static ICOM_VTABLE(IBasicVideo) ibasicvideo = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - IBasicVideo_fnQueryInterface, - IBasicVideo_fnAddRef, - IBasicVideo_fnRelease, - /* IDispatch fields */ - IBasicVideo_fnGetTypeInfoCount, - IBasicVideo_fnGetTypeInfo, - IBasicVideo_fnGetIDsOfNames, - IBasicVideo_fnInvoke, - /* IBasicVideo fields */ - IBasicVideo_fnget_AvgTimePerFrame, - IBasicVideo_fnget_BitRate, - IBasicVideo_fnget_BitErrorRate, - IBasicVideo_fnget_VideoWidth, - IBasicVideo_fnget_VideoHeight, - IBasicVideo_fnput_SourceLeft, - IBasicVideo_fnget_SourceLeft, - IBasicVideo_fnput_SourceWidth, - IBasicVideo_fnget_SourceWidth, - IBasicVideo_fnput_SourceTop, - IBasicVideo_fnget_SourceTop, - IBasicVideo_fnput_SourceHeight, - IBasicVideo_fnget_SourceHeight, - IBasicVideo_fnput_DestinationLeft, - IBasicVideo_fnget_DestinationLeft, - IBasicVideo_fnput_DestinationWidth, - IBasicVideo_fnget_DestinationWidth, - IBasicVideo_fnput_DestinationTop, - IBasicVideo_fnget_DestinationTop, - IBasicVideo_fnput_DestinationHeight, - IBasicVideo_fnget_DestinationHeight, - IBasicVideo_fnSetSourcePosition, - IBasicVideo_fnGetSourcePosition, - IBasicVideo_fnSetDefaultSourcePosition, - IBasicVideo_fnSetDestinationPosition, - IBasicVideo_fnGetDestinationPosition, - IBasicVideo_fnSetDefaultDestinationPosition, - IBasicVideo_fnGetVideoSize, - IBasicVideo_fnGetVideoPaletteEntries, - IBasicVideo_fnGetCurrentImage, - IBasicVideo_fnIsUsingDefaultSource, - IBasicVideo_fnIsUsingDefaultDestination, -}; - - -HRESULT CVideoRendererImpl_InitIBasicVideo( CVideoRendererImpl* This ) -{ - TRACE("(%p)\n",This); - ICOM_VTBL(&This->basvid) = &ibasicvideo; - - return NOERROR; -} - -void CVideoRendererImpl_UninitIBasicVideo( CVideoRendererImpl* This ) -{ - TRACE("(%p)\n",This); -} - -/*************************************************************************** - * - * CVideoRendererImpl::IVideoWindow - * - */ - - -static HRESULT WINAPI -IVideoWindow_fnQueryInterface(IVideoWindow* iface,REFIID riid,void** ppobj) -{ - CVideoRendererImpl_THIS(iface,vidwin); - - TRACE("(%p)->()\n",This); - - return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); -} - -static ULONG WINAPI -IVideoWindow_fnAddRef(IVideoWindow* iface) -{ - CVideoRendererImpl_THIS(iface,vidwin); - - TRACE("(%p)->()\n",This); - - return IUnknown_AddRef(This->unk.punkControl); -} - -static ULONG WINAPI -IVideoWindow_fnRelease(IVideoWindow* iface) -{ - CVideoRendererImpl_THIS(iface,vidwin); - - TRACE("(%p)->()\n",This); - - return IUnknown_Release(This->unk.punkControl); -} - -static HRESULT WINAPI -IVideoWindow_fnGetTypeInfoCount(IVideoWindow* iface,UINT* pcTypeInfo) -{ - CVideoRendererImpl_THIS(iface,vidwin); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IVideoWindow_fnGetTypeInfo(IVideoWindow* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj) -{ - CVideoRendererImpl_THIS(iface,vidwin); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IVideoWindow_fnGetIDsOfNames(IVideoWindow* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId) -{ - CVideoRendererImpl_THIS(iface,vidwin); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - -static HRESULT WINAPI -IVideoWindow_fnInvoke(IVideoWindow* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr) -{ - CVideoRendererImpl_THIS(iface,vidwin); - - FIXME("(%p)->()\n",This); - - return E_NOTIMPL; -} - - - -static HRESULT WINAPI -IVideoWindow_fnput_Caption(IVideoWindow* iface,BSTR strCaption) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_Caption(IVideoWindow* iface,BSTR* pstrCaption) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_WindowStyle(IVideoWindow* iface,long lStyle) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - SetLastError(0); - if ( SetWindowLongA( This->m_hwnd, GWL_STYLE, (DWORD)lStyle ) == 0 && - GetLastError() != 0 ) - { - hr = E_FAIL; - goto end; - } - - hr = S_OK; -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_WindowStyle(IVideoWindow* iface,long* plStyle) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - *plStyle = (LONG)GetWindowLongA( This->m_hwnd, GWL_STYLE ); - hr = S_OK; -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_WindowStyleEx(IVideoWindow* iface,long lExStyle) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - SetLastError(0); - if ( SetWindowLongA( This->m_hwnd, GWL_EXSTYLE, (DWORD)lExStyle ) == 0 && - GetLastError() != 0 ) - { - hr = E_FAIL; - goto end; - } - - hr = S_OK; -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_WindowStyleEx(IVideoWindow* iface,long* plExStyle) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - if ( plExStyle == NULL ) - return E_POINTER; - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - *plExStyle = (LONG)GetWindowLongA( This->m_hwnd, GWL_EXSTYLE ); - hr = S_OK; -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_AutoShow(IVideoWindow* iface,long lAutoShow) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_AutoShow(IVideoWindow* iface,long* plAutoShow) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_WindowState(IVideoWindow* iface,long lState) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_WindowState(IVideoWindow* iface,long* plState) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_BackgroundPalette(IVideoWindow* iface,long lBackPal) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_BackgroundPalette(IVideoWindow* iface,long* plBackPal) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_Visible(IVideoWindow* iface,long lVisible) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_Visible(IVideoWindow* iface,long* plVisible) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_Left(IVideoWindow* iface,long lLeft) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - RECT rc; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - if ( ! GetWindowRect( This->m_hwnd, &rc ) ) - { - hr = E_FAIL; - goto end; - } - if ( ! MoveWindow( This->m_hwnd, lLeft, rc.top, rc.right-rc.left, rc.bottom-rc.top, TRUE ) ) - { - hr = E_FAIL; - goto end; - } - hr = S_OK; -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_Left(IVideoWindow* iface,long* plLeft) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - RECT rc; - - FIXME("(%p)->()\n",This); - - if ( plLeft == NULL ) - return E_POINTER; - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - if ( ! GetWindowRect( This->m_hwnd, &rc ) ) - { - hr = E_FAIL; - goto end; - } - *plLeft = rc.left; - hr = S_OK; -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_Width(IVideoWindow* iface,long lWidth) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - RECT rc; - - FIXME("(%p)->()\n",This); - - if ( lWidth < 0 ) - return E_INVALIDARG; - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - if ( ! GetWindowRect( This->m_hwnd, &rc ) ) - { - hr = E_FAIL; - goto end; - } - if ( ! MoveWindow( This->m_hwnd, rc.left, rc.top, lWidth, rc.bottom-rc.top, TRUE ) ) - { - hr = E_FAIL; - goto end; - } - hr = S_OK; -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_Width(IVideoWindow* iface,long* plWidth) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - RECT rc; - - FIXME("(%p)->()\n",This); - - if ( plWidth == NULL ) - return E_POINTER; - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - if ( ! GetWindowRect( This->m_hwnd, &rc ) ) - { - hr = E_FAIL; - goto end; - } - *plWidth = rc.right-rc.left; - hr = S_OK; -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_Top(IVideoWindow* iface,long lTop) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - RECT rc; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - if ( ! GetWindowRect( This->m_hwnd, &rc ) ) - { - hr = E_FAIL; - goto end; - } - if ( ! MoveWindow( This->m_hwnd, rc.left, lTop, rc.right-rc.left, rc.bottom-rc.top, TRUE ) ) - { - hr = E_FAIL; - goto end; - } - hr = S_OK; -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_Top(IVideoWindow* iface,long* plTop) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - RECT rc; - - FIXME("(%p)->()\n",This); - - if ( plTop == NULL ) - return E_POINTER; - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - if ( ! GetWindowRect( This->m_hwnd, &rc ) ) - { - hr = E_FAIL; - goto end; - } - *plTop = rc.top; - hr = S_OK; -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_Height(IVideoWindow* iface,long lHeight) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - RECT rc; - - FIXME("(%p)->()\n",This); - - if ( lHeight < 0 ) - return E_INVALIDARG; - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - if ( ! GetWindowRect( This->m_hwnd, &rc ) ) - { - hr = E_FAIL; - goto end; - } - if ( ! MoveWindow( This->m_hwnd, rc.left, rc.top, rc.right-rc.left, lHeight, TRUE ) ) - { - hr = E_FAIL; - goto end; - } - hr = S_OK; -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_Height(IVideoWindow* iface,long* plHeight) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - RECT rc; - - FIXME("(%p)->()\n",This); - - if ( plHeight == NULL ) - return E_POINTER; - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - if ( ! GetWindowRect( This->m_hwnd, &rc ) ) - { - hr = E_FAIL; - goto end; - } - *plHeight = rc.bottom-rc.top; - hr = S_OK; -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_Owner(IVideoWindow* iface,OAHWND hwnd) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - DWORD dwStyle; - RECT rc; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - if ( ! GetWindowRect( This->m_hwnd, &rc ) ) - { - hr = E_FAIL; - goto end; - } - - dwStyle = (DWORD)GetWindowLongA( This->m_hwnd, GWL_STYLE ); - if ( hwnd == (HWND)NULL ) - SetWindowLongA( This->m_hwnd, GWL_STYLE, dwStyle & (~WS_CHILD) ); - SetParent( This->m_hwnd, (HWND)hwnd ); - if ( (HWND)hwnd != (HWND)NULL ) - { - SetWindowLongA( This->m_hwnd, GWL_STYLE, dwStyle | WS_CHILD ); - MoveWindow( This->m_hwnd, 0, 0, rc.right-rc.left, rc.bottom-rc.top, TRUE ); - } - - hr = S_OK; -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_Owner(IVideoWindow* iface,OAHWND* phwnd) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - if ( phwnd == NULL ) - return E_POINTER; - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - *phwnd = (OAHWND)GetParent( This->m_hwnd ); - hr = S_OK; -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_MessageDrain(IVideoWindow* iface,OAHWND hwnd) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_MessageDrain(IVideoWindow* iface,OAHWND* phwnd) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_BorderColor(IVideoWindow* iface,long* plColor) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_BorderColor(IVideoWindow* iface,long lColor) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnget_FullScreenMode(IVideoWindow* iface,long* plMode) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnput_FullScreenMode(IVideoWindow* iface,long lMode) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnSetWindowForeground(IVideoWindow* iface,long lFocus) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnNotifyOwnerMessage(IVideoWindow* iface,OAHWND hwnd,long message,LONG_PTR wParam,LONG_PTR lParam) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnSetWindowPosition(IVideoWindow* iface,long lLeft,long lTop,long lWidth,long lHeight) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - if ( ! MoveWindow( This->m_hwnd, lLeft, lTop, lWidth, lHeight, TRUE ) ) - { - hr = E_FAIL; - goto end; - } - hr = S_OK; -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnGetWindowPosition(IVideoWindow* iface,long* plLeft,long* plTop,long* plWidth,long* plHeight) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - RECT rc; - - FIXME("(%p)->()\n",This); - - if ( plLeft == NULL || plTop == NULL || - plWidth == NULL || plHeight == NULL ) - return E_POINTER; - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ - if ( ! GetWindowRect( This->m_hwnd, &rc ) ) - { - hr = E_FAIL; - goto end; - } - - *plLeft = rc.left; - *plTop = rc.top; - *plWidth = rc.right-rc.left; - *plHeight = rc.bottom-rc.top; - hr = S_OK; - -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnGetMinIdealImageSize(IVideoWindow* iface,long* plWidth,long* plHeight) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnGetMaxIdealImageSize(IVideoWindow* iface,long* plWidth,long* plHeight) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnGetRestorePosition(IVideoWindow* iface,long* plLeft,long* plTop,long* plWidth,long* plHeight) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnHideCursor(IVideoWindow* iface,long lHide) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - -static HRESULT WINAPI -IVideoWindow_fnIsCursorHidden(IVideoWindow* iface,long* plHide) -{ - CVideoRendererImpl_THIS(iface,vidwin); - HRESULT hr = E_NOTIMPL; - - FIXME("(%p)->()\n",This); - - EnterCriticalSection ( &This->basefilter.csFilter ); - if ( This->m_hwnd == (HWND)NULL ) - { - hr = VFW_E_NOT_CONNECTED; - goto end; - } - - /* FIXME */ -end: - LeaveCriticalSection ( &This->basefilter.csFilter ); - - return hr; -} - - - - -static ICOM_VTABLE(IVideoWindow) ivideowindow = -{ - ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE - /* IUnknown fields */ - IVideoWindow_fnQueryInterface, - IVideoWindow_fnAddRef, - IVideoWindow_fnRelease, - /* IDispatch fields */ - IVideoWindow_fnGetTypeInfoCount, - IVideoWindow_fnGetTypeInfo, - IVideoWindow_fnGetIDsOfNames, - IVideoWindow_fnInvoke, - /* IVideoWindow fields */ - IVideoWindow_fnput_Caption, - IVideoWindow_fnget_Caption, - IVideoWindow_fnput_WindowStyle, - IVideoWindow_fnget_WindowStyle, - IVideoWindow_fnput_WindowStyleEx, - IVideoWindow_fnget_WindowStyleEx, - IVideoWindow_fnput_AutoShow, - IVideoWindow_fnget_AutoShow, - IVideoWindow_fnput_WindowState, - IVideoWindow_fnget_WindowState, - IVideoWindow_fnput_BackgroundPalette, - IVideoWindow_fnget_BackgroundPalette, - IVideoWindow_fnput_Visible, - IVideoWindow_fnget_Visible, - IVideoWindow_fnput_Left, - IVideoWindow_fnget_Left, - IVideoWindow_fnput_Width, - IVideoWindow_fnget_Width, - IVideoWindow_fnput_Top, - IVideoWindow_fnget_Top, - IVideoWindow_fnput_Height, - IVideoWindow_fnget_Height, - IVideoWindow_fnput_Owner, - IVideoWindow_fnget_Owner, - IVideoWindow_fnput_MessageDrain, - IVideoWindow_fnget_MessageDrain, - IVideoWindow_fnget_BorderColor, - IVideoWindow_fnput_BorderColor, - IVideoWindow_fnget_FullScreenMode, - IVideoWindow_fnput_FullScreenMode, - IVideoWindow_fnSetWindowForeground, - IVideoWindow_fnNotifyOwnerMessage, - IVideoWindow_fnSetWindowPosition, - IVideoWindow_fnGetWindowPosition, - IVideoWindow_fnGetMinIdealImageSize, - IVideoWindow_fnGetMaxIdealImageSize, - IVideoWindow_fnGetRestorePosition, - IVideoWindow_fnHideCursor, - IVideoWindow_fnIsCursorHidden, - -}; - - -HRESULT CVideoRendererImpl_InitIVideoWindow( CVideoRendererImpl* This ) -{ - TRACE("(%p)\n",This); - ICOM_VTBL(&This->vidwin) = &ivideowindow; - - return NOERROR; -} - -void CVideoRendererImpl_UninitIVideoWindow( CVideoRendererImpl* This ) -{ - TRACE("(%p)\n",This); -} - diff --git a/dlls/quartz/vidren.h b/dlls/quartz/vidren.h deleted file mode 100644 index 1fe592442a6..00000000000 --- a/dlls/quartz/vidren.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Implements CLSID_VideoRenderer. - * - * 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_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 */ diff --git a/dlls/quartz/wavparse.c b/dlls/quartz/wavparse.c deleted file mode 100644 index 9c5dea6e28a..00000000000 --- a/dlls/quartz/wavparse.c +++ /dev/null @@ -1,746 +0,0 @@ -/* - * Implements WAVE/AU/AIFF Parser. - * - * 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 "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 ); -} - - diff --git a/dlls/quartz/xform.c b/dlls/quartz/xform.c deleted file mode 100644 index f4272c5fcaa..00000000000 --- a/dlls/quartz/xform.c +++ /dev/null @@ -1,823 +0,0 @@ -/* - * Implements IBaseFilter for transform filters. (internal) - * - * 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 "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; -} - diff --git a/dlls/quartz/xform.h b/dlls/quartz/xform.h deleted file mode 100644 index 2bbc3373a0c..00000000000 --- a/dlls/quartz/xform.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Implements IBaseFilter for transform filters. (internal) - * - * 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_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 */ diff --git a/include/Makefile.in b/include/Makefile.in index e238ab25757..502c0df565f 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -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 \ diff --git a/include/amaudio.h b/include/amaudio.h deleted file mode 100644 index 7125391eeb6..00000000000 --- a/include/amaudio.h +++ /dev/null @@ -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_ */ diff --git a/include/amvideo.h b/include/amvideo.h deleted file mode 100644 index 48600c71472..00000000000 --- a/include/amvideo.h +++ /dev/null @@ -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_ */ diff --git a/include/control.h b/include/control.h deleted file mode 100644 index e000af42303..00000000000 --- a/include/control.h +++ /dev/null @@ -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_ */ diff --git a/include/errors.h b/include/errors.h deleted file mode 100644 index 9efbc87ef69..00000000000 --- a/include/errors.h +++ /dev/null @@ -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 */ diff --git a/include/evcode.h b/include/evcode.h deleted file mode 100644 index da9480a83e6..00000000000 --- a/include/evcode.h +++ /dev/null @@ -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 */ diff --git a/include/strmif.h b/include/strmif.h deleted file mode 100644 index 0f8f96ad117..00000000000 --- a/include/strmif.h +++ /dev/null @@ -1,1521 +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__ -#include "rpc.h" -#include "rpcndr.h" -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif -#endif - -#ifndef __WINE_STRMIF_H_ -#define __WINE_STRMIF_H_ - -#include "wine/obj_base.h" -#include "wine/obj_misc.h" -#include "wine/obj_storage.h" -#include "wine/obj_moniker.h" -#include "wine/obj_oleaut.h" -#include "wine/obj_property.h" -#include "wine/obj_ksproperty.h" - -/* undef GetTimeFormat - FIXME? */ -#undef GetTimeFormat - -/* FIXME - far from complete. */ - -/* forward decls. */ - -typedef struct IAMAnalogVideoDecoder IAMAnalogVideoDecoder; -typedef struct IAMAnalogVideoEncoder IAMAnalogVideoEncoder; -typedef struct IAMAudioInputMixer IAMAudioInputMixer; -typedef struct IAMBufferNegotiation IAMBufferNegotiation; -typedef struct IAMCameraControl IAMCameraControl; -typedef struct IAMCopyCaptureFileProgress IAMCopyCaptureFileProgress; -typedef struct IAMCrossbar IAMCrossbar; -typedef struct IAMDevMemoryAllocator IAMDevMemoryAllocator; -typedef struct IAMDevMemoryControl IAMDevMemoryControl; -typedef struct IAMDroppedFrames IAMDroppedFrames; -typedef struct IAMExtDevice IAMExtDevice; -typedef struct IAMExtTransport IAMExtTransport; -typedef struct IAMovie IAMovie; -typedef struct IAMovieSetup IAMovieSetup; -typedef struct IAMPhysicalPinInfo IAMPhysicalPinInfo; -typedef struct IAMStreamConfig IAMStreamConfig; -typedef struct IAMStreamControl IAMStreamControl; -typedef struct IAMStreamSelect IAMStreamSelect; -typedef struct IAMTimecodeDisplay IAMTimecodeDisplay; -typedef struct IAMTimecodeGenerator IAMTimecodeGenerator; -typedef struct IAMTimecodeReader IAMTimecodeReader; -typedef struct IAMTuner IAMTuner; -typedef struct IAMTunerNotification IAMTunerNotification; -typedef struct IAMTVAudio IAMTVAudio; -typedef struct IAMTVAudioNotification IAMTVAudioNotification; -typedef struct IAMTVTuner IAMTVTuner; -typedef struct IAMVfwCaptureDialogs IAMVfwCaptureDialogs; -typedef struct IAMVfwCompressDialogs IAMVfwCompressDialogs; -typedef struct IAMVideoCompression IAMVideoCompression; -typedef struct IAMVideoProcAmp IAMVideoProcAmp; -typedef struct IAsyncReader IAsyncReader; -typedef struct IMediaFilter IMediaFilter; -typedef struct IBaseFilter IBaseFilter; -typedef struct IBPCSatelliteTuner IBPCSatelliteTuner; -typedef struct ICaptureGraphBuilder ICaptureGraphBuilder; -typedef struct IConfigAviMux IConfigAviMux; -typedef struct IConfigInterleaving IConfigInterleaving; -typedef struct ICreateDevEnum ICreateDevEnum; -typedef struct IDistributorNotify IDistributorNotify; -typedef struct IDvdControl IDvdControl; -typedef struct IDvdGraphBuilder IDvdGraphBuilder; -typedef struct IDvdInfo IDvdInfo; -typedef struct IEnumFilters IEnumFilters; -typedef struct IEnumMediaTypes IEnumMediaTypes; -typedef struct IEnumPins IEnumPins; -typedef struct IEnumRegFilters IEnumRegFilters; -typedef struct IFileSinkFilter IFileSinkFilter; -typedef struct IFileSinkFilter2 IFileSinkFilter2; -typedef struct IFileSourceFilter IFileSourceFilter; -typedef struct IFilterGraph IFilterGraph; -typedef struct IFilterGraph2 IFilterGraph2; -typedef struct IFilterMapper IFilterMapper; -typedef struct IFilterMapper2 IFilterMapper2; -typedef struct IGraphBuilder IGraphBuilder; -typedef struct IGraphVersion IGraphVersion; -typedef struct IMediaEventSink IMediaEventSink; -typedef struct IMediaPropertyBag IMediaPropertyBag; -typedef struct IMediaSample IMediaSample; -typedef struct IMediaSample2 IMediaSample2; -typedef struct IMediaSeeking IMediaSeeking; -typedef struct IMemAllocator IMemAllocator; -typedef struct IMemInputPin IMemInputPin; -typedef struct IOverlay IOverlay; -typedef struct IOverlayNotify IOverlayNotify; -typedef struct IPersistMediaPropertyBag IPersistMediaPropertyBag; -typedef struct IPin IPin; -typedef struct IQualityControl IQualityControl; -typedef struct IReferenceClock IReferenceClock; -typedef struct IReferenceClock2 IReferenceClock2; -typedef struct IResourceConsumer IResourceConsumer; -typedef struct IResourceManager IResourceManager; -typedef struct ISeekingPassThru ISeekingPassThru; -typedef struct IStreamBuilder IStreamBuilder; - -/* GUIDs. */ - -DEFINE_GUID(IID_IAMAnalogVideoDecoder,0xC6E13350,0x30AC,0x11D0,0xA1,0x8C,0x00,0xA0,0xC9,0x11,0x89,0x56); -DEFINE_GUID(IID_IAMAnalogVideoEncoder,0xC6E133B0,0x30AC,0x11D0,0xA1,0x8C,0x00,0xA0,0xC9,0x11,0x89,0x56); -DEFINE_GUID(IID_IAMAudioInputMixer,0x54C39221,0x8380,0x11D0,0xB3,0xF0,0x00,0xAA,0x00,0x37,0x61,0xC5); -DEFINE_GUID(IID_IAMBufferNegotiation,0x56ED71A0,0xAF5F,0x11D0,0xB3,0xF0,0x00,0xAA,0x00,0x37,0x61,0xC5); -DEFINE_GUID(IID_IAMCameraControl,0xC6E13370,0x30AC,0x11D0,0xA1,0x8C,0x00,0xA0,0xC9,0x11,0x89,0x56); -DEFINE_GUID(IID_IAMCopyCaptureFileProgress,0x670D1D20,0xA068,0x11D0,0xB3,0xF0,0x00,0xAA,0x00,0x37,0x61,0xC5); -DEFINE_GUID(IID_IAMCrossbar,0xC6E13380,0x30AC,0x11D0,0xA1,0x8C,0x00,0xA0,0xC9,0x11,0x89,0x56); -DEFINE_GUID(IID_IAMDevMemoryAllocator,0xC6545BF0,0xE76B,0x11D0,0xBD,0x52,0x00,0xA0,0xC9,0x11,0xCE,0x86); -DEFINE_GUID(IID_IAMDevMemoryControl,0xC6545BF1,0xE76B,0x11D0,0xBD,0x52,0x00,0xA0,0xC9,0x11,0xCE,0x86); -DEFINE_GUID(IID_IAMDroppedFrames,0xC6E13344,0x30AC,0x11D0,0xA1,0x8C,0x00,0xA0,0xC9,0x11,0x89,0x56); -DEFINE_GUID(IID_IAMExtDevice,0xB5730A90,0x1A2C,0x11CF,0x8C,0x23,0x00,0xAA,0x00,0x6B,0x68,0x14); -DEFINE_GUID(IID_IAMExtTransport,0xA03CD5F0,0x3045,0x11CF,0x8C,0x44,0x00,0xAA,0x00,0x6B,0x68,0x14); -DEFINE_GUID(IID_IAMovie,0x359ACE10,0x7688,0x11CF,0x8B,0x23,0x00,0x80,0x5F,0x6C,0xEF,0x60); -DEFINE_GUID(IID_IAMovieSetup,0xA3D8CEC0,0x7E5A,0x11CF,0xBB,0xC5,0x00,0x80,0x5F,0x6C,0xEF,0x20); -DEFINE_GUID(IID_IAMPhysicalPinInfo,0xF938C991,0x3029,0x11CF,0x8C,0x44,0x00,0xAA,0x00,0x6B,0x68,0x14); -DEFINE_GUID(IID_IAMStreamConfig,0xC6E13340,0x30AC,0x11D0,0xA1,0x8C,0x00,0xA0,0xC9,0x11,0x89,0x56); -DEFINE_GUID(IID_IAMStreamControl,0x36B73881,0xC2C8,0x11CF,0x8B,0x46,0x00,0x80,0x5F,0x6C,0xEF,0x60); -DEFINE_GUID(IID_IAMStreamSelect,0xC1960960,0x17F5,0x11D1,0xAB,0xE1,0x00,0xA0,0xC9,0x05,0xF3,0x75); -DEFINE_GUID(IID_IAMTimecodeDisplay,0x9B496CE2,0x811B,0x11CF,0x8C,0x77,0x00,0xAA,0x00,0x6B,0x68,0x14); -DEFINE_GUID(IID_IAMTimecodeGenerator,0x9B496CE0,0x811B,0x11CF,0x8C,0x77,0x00,0xAA,0x00,0x6B,0x68,0x14); -DEFINE_GUID(IID_IAMTimecodeReader,0x9B496CE1,0x811B,0x11CF,0x8C,0x77,0x00,0xAA,0x00,0x6B,0x68,0x14); -DEFINE_GUID(IID_IAMTuner,0x211A8761,0x03AC,0x11D1,0x8D,0x13,0x00,0xAA,0x00,0xBD,0x83,0x39); -DEFINE_GUID(IID_IAMTunerNotification,0x211A8760,0x03AC,0x11D1,0x8D,0x13,0x00,0xAA,0x00,0xBD,0x83,0x39); -DEFINE_GUID(IID_IAMTVAudio,0x83EC1C30,0x23D1,0x11D1,0x99,0xE6,0x00,0xA0,0xC9,0x56,0x02,0x66); -DEFINE_GUID(IID_IAMTVAudioNotification,0x83EC1C33,0x23D1,0x11D1,0x99,0xE6,0x00,0xA0,0xC9,0x56,0x02,0x66); -DEFINE_GUID(IID_IAMTVTuner,0x211A8766,0x03AC,0x11D1,0x8D,0x13,0x00,0xAA,0x00,0xBD,0x83,0x39); -DEFINE_GUID(IID_IAMVfwCaptureDialogs,0xD8D715A0,0x6E5E,0x11D0,0xB3,0xF0,0x00,0xAA,0x00,0x37,0x61,0xC5); -DEFINE_GUID(IID_IAMVfwCompressDialogs,0xD8D715A3,0x6E5E,0x11D0,0xB3,0xF0,0x00,0xAA,0x00,0x37,0x61,0xC5); -DEFINE_GUID(IID_IAMVideoCompression,0xC6E13343,0x30AC,0x11D0,0xA1,0x8C,0x00,0xA0,0xC9,0x11,0x89,0x56); -DEFINE_GUID(IID_IAMVideoProcAmp,0xC6E13360,0x30AC,0x11D0,0xA1,0x8C,0x00,0xA0,0xC9,0x11,0x89,0x56); -DEFINE_GUID(IID_IAsyncReader,0x56A868AA,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IMediaFilter,0x56A86899,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IBaseFilter,0x56A86895,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IBPCSatelliteTuner,0x211A8765,0x03AC,0x11D1,0x8D,0x13,0x00,0xAA,0x00,0xBD,0x83,0x39); -DEFINE_GUID(IID_ICaptureGraphBuilder,0xBF87B6E0,0x8C27,0x11D0,0xB3,0xF0,0x00,0xAA,0x00,0x37,0x61,0xC5); -DEFINE_GUID(IID_IConfigAviMux,0x5ACD6AA0,0xF482,0x11CE,0x8B,0x67,0x00,0xAA,0x00,0xA3,0xF1,0xA6); -DEFINE_GUID(IID_IConfigInterleaving,0xBEE3D220,0x157B,0x11D0,0xBD,0x23,0x00,0xA0,0xC9,0x11,0xCE,0x86); -DEFINE_GUID(IID_ICreateDevEnum,0x29840822,0x5B84,0x11D0,0xBD,0x3B,0x00,0xA0,0xC9,0x11,0xCE,0x86); -DEFINE_GUID(IID_IDistributorNotify,0x56A868AF,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IDvdControl,0xA70EFE61,0xE2A3,0x11D0,0xA9,0xBE,0x00,0xAA,0x00,0x61,0xBE,0x93); -DEFINE_GUID(IID_IDvdGraphBuilder,0xFCC152B6,0xF372,0x11D0,0x8E,0x00,0x00,0xC0,0x4F,0xD7,0xC0,0x8B); -DEFINE_GUID(IID_IDvdInfo,0xA70EFE60,0xE2A3,0x11D0,0xA9,0xBE,0x00,0xAA,0x00,0x61,0xBE,0x93); -DEFINE_GUID(IID_IEnumFilters,0x56A86893,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IEnumMediaTypes,0x89C31040,0x846B,0x11CE,0x97,0xD3,0x00,0xAA,0x00,0x55,0x59,0x5A); -DEFINE_GUID(IID_IEnumPins,0x56A86892,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IEnumRegFilters,0x56A868A4,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IFileSinkFilter,0xA2104830,0x7C70,0x11CF,0x8B,0xCE,0x00,0xAA,0x00,0xA3,0xF1,0xA6); -DEFINE_GUID(IID_IFileSinkFilter2,0x00855B90,0xCE1B,0x11D0,0xBD,0x4F,0x00,0xA0,0xC9,0x11,0xCE,0x86); -DEFINE_GUID(IID_IFileSourceFilter,0x56A868A6,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IFilterGraph,0x56A8689F,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IFilterGraph2,0x36B73882,0xC2C8,0x11CF,0x8B,0x46,0x00,0x80,0x5F,0x6C,0xEF,0x60); -DEFINE_GUID(IID_IFilterMapper,0x56A868A3,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IFilterMapper2,0xB79BB0B0,0x33C1,0x11D1,0xAB,0xE1,0x00,0xA0,0xC9,0x05,0xF3,0x75); -DEFINE_GUID(IID_IGraphBuilder,0x56A868A9,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IGraphVersion,0x56A868AB,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IMediaEventSink,0x56A868A2,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IMediaPropertyBag,0x6025A880,0xC0D5,0x11D0,0xBD,0x4E,0x00,0xA0,0xC9,0x11,0xCE,0x86); -DEFINE_GUID(IID_IMediaSample,0x56A8689A,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IMediaSample2,0x36B73884,0xC2C8,0x11CF,0x8B,0x46,0x00,0x80,0x5F,0x6C,0xEF,0x60); -DEFINE_GUID(IID_IMediaSeeking,0x36B73880,0xC2C8,0x11CF,0x8B,0x46,0x00,0x80,0x5F,0x6C,0xEF,0x60); -DEFINE_GUID(IID_IMemAllocator,0x56A8689C,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IMemInputPin,0x56A8689D,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IOverlay,0x56A868A1,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IOverlayNotify,0x56A868A0,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IPersistMediaPropertyBag,0x5738E040,0xB67F,0x11D0,0xBD,0x4D,0x00,0xA0,0xC9,0x11,0xCE,0x86); -DEFINE_GUID(IID_IPin,0x56A86891,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IQualityControl,0x56A868A5,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IReferenceClock,0x56A86897,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IReferenceClock2,0x36B73885,0xC2C8,0x11CF,0x8B,0x46,0x00,0x80,0x5F,0x6C,0xEF,0x60); -DEFINE_GUID(IID_IResourceConsumer,0x56A868AD,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_IResourceManager,0x56A868AC,0x0AD4,0x11CE,0xB0,0x3A,0x00,0x20,0xAF,0x0B,0xA7,0x70); -DEFINE_GUID(IID_ISeekingPassThru,0x36B73883,0xC2C8,0x11CF,0x8B,0x46,0x00,0x80,0x5F,0x6C,0xEF,0x60); -DEFINE_GUID(IID_IStreamBuilder,0x56A868BF,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 LONGLONG REFERENCE_TIME; -typedef DWORD_PTR HSEMAPHORE; -typedef DWORD_PTR HEVENT; - -/* enums. */ - -typedef enum -{ - PINDIR_INPUT = 0, - PINDIR_OUTPUT = 1, -} PIN_DIRECTION; - -typedef enum -{ - State_Stopped = 0, - State_Paused = 1, - State_Running = 2, -} FILTER_STATE; - -typedef enum -{ - Famine = 0, - Flood = 1, -} QualityMessageType; - -typedef enum -{ - REG_PINFLAG_B_ZERO = 0x1, - REG_PINFLAG_B_RENDERER = 0x2, - REG_PINFLAG_B_MANY = 0x4, - REG_PINFLAG_B_OUTPUT = 0x8, -} REG_PINFLAG; - -typedef enum -{ - AM_SAMPLE_SPLICEPOINT = 0x1, - AM_SAMPLE_PREROLL = 0x2, - AM_SAMPLE_DATADISCONTINUITY = 0x4, - AM_SAMPLE_TYPECHANGED = 0x8, - AM_SAMPLE_TIMEVALID = 0x10, - AM_SAMPLE_TIMEDISCONTINUITY = 0x40, - AM_SAMPLE_FLUSH_ON_PAUSE = 0x80, - AM_SAMPLE_STOPVALID = 0x100, - AM_SAMPLE_ENDOFSTREAM = 0x200, - - AM_STREAM_MEDIA = 0, - AM_STREAM_CONTROL = 1 -} AM_SAMPLE_PROPERTY_FLAGS; - -enum __MIDL_IFilterMapper_0001 -{ - MERIT_PREFERRED = 0x800000, - MERIT_NORMAL = 0x600000, - MERIT_UNLIKELY = 0x400000, - MERIT_DO_NOT_USE = 0x200000, - MERIT_HW_COMPRESSOR = 0x100050, - MERIT_SW_COMPRESSOR = 0x100000, -}; - -typedef enum -{ - AM_FILE_OVERWRITE = 0x0001, -} AM_FILESINK_FLAGS; - -typedef enum -{ - AM_SEEKING_NoPositioning = 0x0000, - AM_SEEKING_AbsolutePositioning = 0x0001, - AM_SEEKING_RelativePositioning = 0x0002, - AM_SEEKING_IncrementalPositioning = 0x0003, - AM_SEEKING_PositioningBitsMask = 0x0003, - - AM_SEEKING_SeekToKeyFrame = 0x0004, - AM_SEEKING_ReturnTime = 0x0008, - AM_SEEKING_Segment = 0x0010, - AM_SEEKING_NoFlush = 0x0020, -} AM_SEEKING_SEEKING_FLAGS; - -typedef enum -{ - AM_SEEKING_CanSeekAbsolute = 0x0001, - AM_SEEKING_CanSeekForwards = 0x0002, - AM_SEEKING_CanSeekBackwards = 0x0004, - AM_SEEKING_CanGetCurrentPos = 0x0008, - AM_SEEKING_CanGetStopPos = 0x0010, - AM_SEEKING_CanGetDuration = 0x0020, - AM_SEEKING_CanPlayBackwards = 0x0040, - AM_SEEKING_CanDoSegments = 0x0080, - AM_SEEKING_Source = 0x0100, -} AM_SEEKING_SEEKING_CAPABILITIES; - -enum _AM_RENSDEREXFLAGS -{ - AM_RENDEREX_RENDERTOEXISTINGRENDERERS = 0x0001, -}; - - - -/* structs. */ - -typedef struct -{ - GUID majortype; - GUID subtype; - BOOL bFixedSizeSamples; - BOOL bTemporalCompression; - ULONG lSampleSize; - GUID formattype; - IUnknown* pUnk; - ULONG cbFormat; - BYTE* pbFormat; -} AM_MEDIA_TYPE; - -typedef struct -{ - long cBuffers; - long cbBuffer; - long cbAlign; - long cbPrefix; -} ALLOCATOR_PROPERTIES; - -typedef struct -{ - IBaseFilter* pFilter; - PIN_DIRECTION dir; - WCHAR achName[ 128 ]; -} PIN_INFO; - -typedef struct -{ - WCHAR achName[ 128 ]; - IFilterGraph* pGraph; -} FILTER_INFO; - -typedef struct -{ - REFERENCE_TIME tStart; - REFERENCE_TIME tStop; - DWORD dwStartCookie; - DWORD dwStopCookie; - DWORD dwFlags; -} AM_STREAM_INFO; - -typedef struct tagCOLORKEY -{ - DWORD KeyType; - DWORD PaletteIndex; - COLORREF LowColorValue; - COLORREF HighColorValue; -} COLORKEY; - -typedef struct -{ - QualityMessageType Type; - long Proportion; - REFERENCE_TIME Late; - REFERENCE_TIME TimeStamp; -} Quality; - -typedef struct -{ - const CLSID* clsMajorType; - const CLSID* clsMinorType; -} REGPINTYPES; - -typedef struct -{ - LPWSTR strName; - BOOL bRendered; - BOOL bOutput; - BOOL bZero; - BOOL bMany; - const CLSID* clsConnectsToFilter; - const WCHAR* strConnectsToPin; - UINT nMediaTypes; - const REGPINTYPES* lpMediaType; -} REGFILTERPINS; - -typedef struct -{ - CLSID clsMedium; - DWORD dw1; - DWORD dw2; -} REGPINMEDIUM; - -typedef struct -{ - DWORD dwFlags; - UINT cInstances; - UINT nMediaTypes; - const REGPINTYPES* lpMediaType; - UINT nMediums; - const REGPINMEDIUM* lpMedium; - const CLSID* clsPinCategory; -} REGFILTERPINS2; - -typedef struct -{ - DWORD dwVersion; - DWORD dwMerit; - union { - struct { - ULONG cPins; - const REGFILTERPINS* rgPins; - } DUMMYSTRUCTNAME1; - struct { - ULONG cPins2; - const REGFILTERPINS2* rgPins2; - } DUMMYSTRUCTNAME2; - } DUMMYUNIONNAME; -} REGFILTER2; - -typedef struct -{ - DWORD cbData; - DWORD dwTypeSpecificFlags; - DWORD dwSampleFlags; - LONG lActual; - REFERENCE_TIME tStart; - REFERENCE_TIME tStop; - DWORD dwStreamId; - AM_MEDIA_TYPE* pMediaType; - BYTE* pbBuffer; - LONG cbBuffer; -} AM_SAMPLE2_PROPERTIES; - - - -/* defines. */ - -#define CHARS_IN_GUID 39 -#define MAX_PIN_NAME 128 -#define MAX_FILTER_NAME 128 - -#define AM_GBF_PREVFRAMESKIPPED 1 -#define AM_GBF_NOTASYNCPOINT 2 -#define AM_GBF_NOWAIT 4 - - -/* interfaces. */ - -/************************************************************************** - * - * IAsyncReader interface - * - */ - -#define ICOM_INTERFACE IAsyncReader -#define IAsyncReader_METHODS \ - ICOM_METHOD3(HRESULT,RequestAllocator,IMemAllocator*,a1,ALLOCATOR_PROPERTIES*,a2,IMemAllocator**,a3) \ - ICOM_METHOD2(HRESULT,Request,IMediaSample*,a1,DWORD_PTR,a2) \ - ICOM_METHOD3(HRESULT,WaitForNext,DWORD,a1,IMediaSample**,a2,DWORD_PTR*,a3) \ - ICOM_METHOD1(HRESULT,SyncReadAligned,IMediaSample*,a1) \ - ICOM_METHOD3(HRESULT,SyncRead,LONGLONG,a1,LONG,a2,BYTE*,a3) \ - ICOM_METHOD2(HRESULT,Length,LONGLONG*,a1,LONGLONG*,a2) \ - ICOM_METHOD (HRESULT,BeginFlush) \ - ICOM_METHOD (HRESULT,EndFlush) - -#define IAsyncReader_IMETHODS \ - IUnknown_IMETHODS \ - IAsyncReader_METHODS - -ICOM_DEFINE(IAsyncReader,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IAsyncReader_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IAsyncReader_AddRef(p) ICOM_CALL (AddRef,p) -#define IAsyncReader_Release(p) ICOM_CALL (Release,p) - /*** IAsyncReader methods ***/ -#define IAsyncReader_RequestAllocator(p,a1,a2,a3) ICOM_CALL3(RequestAllocator,p,a1,a2,a3) -#define IAsyncReader_Request(p,a1,a2) ICOM_CALL2(Request,p,a1,a2) -#define IAsyncReader_WaitForNext(p,a1,a2,a3) ICOM_CALL3(WaitForNext,p,a1,a2,a3) -#define IAsyncReader_SyncReadAligned(p,a1) ICOM_CALL1(SyncReadAligned,p,a1) -#define IAsyncReader_SyncRead(p,a1,a2,a3) ICOM_CALL3(SyncRead,p,a1,a2,a3) -#define IAsyncReader_Length(p,a1,a2) ICOM_CALL2(Length,p,a1,a2) -#define IAsyncReader_BeginFlush(p) ICOM_CALL (BeginFlush,p) -#define IAsyncReader_EndFlush(p) ICOM_CALL (EndFlush,p) - -/************************************************************************** - * - * IMediaFilter interface - * - */ - -#define ICOM_INTERFACE IMediaFilter -#define IMediaFilter_METHODS \ - ICOM_METHOD (HRESULT,Stop) \ - ICOM_METHOD (HRESULT,Pause) \ - ICOM_METHOD1(HRESULT,Run,REFERENCE_TIME,a1) \ - ICOM_METHOD2(HRESULT,GetState,DWORD,a1,FILTER_STATE*,a2) \ - ICOM_METHOD1(HRESULT,SetSyncSource,IReferenceClock*,a1) \ - ICOM_METHOD1(HRESULT,GetSyncSource,IReferenceClock**,a1) - -#define IMediaFilter_IMETHODS \ - IPersist_IMETHODS \ - IMediaFilter_METHODS - -ICOM_DEFINE(IMediaFilter,IPersist) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IMediaFilter_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IMediaFilter_AddRef(p) ICOM_CALL (AddRef,p) -#define IMediaFilter_Release(p) ICOM_CALL (Release,p) - /*** IPersist methods ***/ -#define IMediaFilter_GetClassID(p,a1) ICOM_CALL1(GetClassID,p,a1) - /*** IMediaFilter methods ***/ -#define IMediaFilter_Stop(p) ICOM_CALL (Stop,p) -#define IMediaFilter_Pause(p) ICOM_CALL (Pause,p) -#define IMediaFilter_Run(p,a1) ICOM_CALL1(Run,p,a1) -#define IMediaFilter_GetState(p,a1,a2) ICOM_CALL2(GetState,p,a1,a2) -#define IMediaFilter_SetSyncSource(p,a1) ICOM_CALL1(SetSyncSource,p,a1) -#define IMediaFilter_GetSyncSource(p,a1) ICOM_CALL1(GetSyncSource,p,a1) - -/************************************************************************** - * - * IBaseFilter interface - * - */ - -#define ICOM_INTERFACE IBaseFilter -#define IBaseFilter_METHODS \ - ICOM_METHOD1(HRESULT,EnumPins,IEnumPins**,a1) \ - ICOM_METHOD2(HRESULT,FindPin,LPCWSTR,a1,IPin**,a2) \ - ICOM_METHOD1(HRESULT,QueryFilterInfo,FILTER_INFO*,a1) \ - ICOM_METHOD2(HRESULT,JoinFilterGraph,IFilterGraph*,a1,LPCWSTR,a2) \ - ICOM_METHOD1(HRESULT,QueryVendorInfo,LPWSTR*,a1) - -#define IBaseFilter_IMETHODS \ - IMediaFilter_IMETHODS \ - IBaseFilter_METHODS - -ICOM_DEFINE(IBaseFilter,IMediaFilter) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IBaseFilter_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IBaseFilter_AddRef(p) ICOM_CALL (AddRef,p) -#define IBaseFilter_Release(p) ICOM_CALL (Release,p) - /*** IPersist methods ***/ -#define IBaseFilter_GetClassID(p,a1) ICOM_CALL1(GetClassID,p,a1) - /*** IMediaFilter methods ***/ -#define IBaseFilter_Stop(p) ICOM_CALL (Stop,p) -#define IBaseFilter_Pause(p) ICOM_CALL (Pause,p) -#define IBaseFilter_Run(p,a1) ICOM_CALL1(Run,p,a1) -#define IBaseFilter_GetState(p,a1,a2) ICOM_CALL2(GetState,p,a1,a2) -#define IBaseFilter_SetSyncSource(p,a1) ICOM_CALL1(SetSyncSource,p,a1) -#define IBaseFilter_GetSyncSource(p,a1) ICOM_CALL1(GetSyncSource,p,a1) - /*** IBaseFilter methods ***/ -#define IBaseFilter_EnumPins(p,a1) ICOM_CALL1(EnumPins,p,a1) -#define IBaseFilter_FindPin(p,a1,a2) ICOM_CALL2(FindPin,p,a1,a2) -#define IBaseFilter_QueryFilterInfo(p,a1) ICOM_CALL1(QueryFilterInfo,p,a1) -#define IBaseFilter_JoinFilterGraph(p,a1,a2) ICOM_CALL2(JoinFilterGraph,p,a1,a2) -#define IBaseFilter_QueryVendorInfo(p,a1) ICOM_CALL1(QueryVendorInfo,p,a1) - -/************************************************************************** - * - * ICaptureGraphBuilder interface - * - */ - -#define ICOM_INTERFACE ICaptureGraphBuilder -#define ICaptureGraphBuilder_METHODS \ - ICOM_METHOD1(HRESULT,SetFiltergraph,IGraphBuilder*,a1) \ - ICOM_METHOD1(HRESULT,GetFiltergraph,IGraphBuilder**,a1) \ - ICOM_METHOD4(HRESULT,SetOutputFileName,const GUID*,a1,LPCOLESTR,a2,IBaseFilter**,a3,IFileSinkFilter**,a4) \ - ICOM_METHOD4(HRESULT,FindInterface,const GUID*,a1,IBaseFilter*,a2,REFIID,a3,void**,a4) \ - ICOM_METHOD4(HRESULT,RenderStream,const GUID*,a1,IUnknown*,a2,IBaseFilter*,a3,IBaseFilter*,a4) \ - ICOM_METHOD6(HRESULT,ControlStream,const GUID*,a1,IBaseFilter*,a2,REFERENCE_TIME*,a3,REFERENCE_TIME*,a4,WORD,a5,WORD,a6) \ - ICOM_METHOD2(HRESULT,AllocCapFile,LPCOLESTR,a1,DWORDLONG,a2) \ - ICOM_METHOD4(HRESULT,CopyCaptureFile,LPOLESTR,a1,LPOLESTR,a2,int,a3,IAMCopyCaptureFileProgress*,a4) - -#define ICaptureGraphBuilder_IMETHODS \ - IUnknown_IMETHODS \ - ICaptureGraphBuilder_METHODS - -ICOM_DEFINE(ICaptureGraphBuilder,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define ICaptureGraphBuilder_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define ICaptureGraphBuilder_AddRef(p) ICOM_CALL (AddRef,p) -#define ICaptureGraphBuilder_Release(p) ICOM_CALL (Release,p) - /*** ICaptureGraphBuilder methods ***/ -#define ICaptureGraphBuilder_SetFiltergraph(p,a1) ICOM_CALL1(SetFiltergraph,p,a1) -#define ICaptureGraphBuilder_GetFiltergraph(p,a1) ICOM_CALL1(GetFiltergraph,p,a1) -#define ICaptureGraphBuilder_SetOutputFileName(p,a1,a2,a3,a4) ICOM_CALL4(SetOutputFileName,p,a1,a2,a3,a4) -#define ICaptureGraphBuilder_FindInterface(p,a1,a2,a3,a4) ICOM_CALL4(FindInterface,p,a1,a2,a3,a4) -#define ICaptureGraphBuilder_RenderStream(p,a1,a2,a3,a4) ICOM_CALL4(RenderStream,p,a1,a2,a3,a4) -#define ICaptureGraphBuilder_ControlStream(p,a1,a2,a3,a4,a5,a6) ICOM_CALL6(ControlStream,p,a1,a2,a3,a4,a5,a6) -#define ICaptureGraphBuilder_AllocCapFile(p,a1,a2) ICOM_CALL2(AllocCapFile,p,a1,a2) -#define ICaptureGraphBuilder_CopyCaptureFile(p,a1,a2,a3,a4) ICOM_CALL4(CopyCaptureFile,p,a1,a2,a3,a4) - -/************************************************************************** - * - * ICreateDevEnum interface - * - */ - -#define ICOM_INTERFACE ICreateDevEnum -#define ICreateDevEnum_METHODS \ - ICOM_METHOD3(HRESULT,CreateClassEnumerator,REFCLSID,a1,IEnumMoniker**,a2,DWORD,a3) - -#define ICreateDevEnum_IMETHODS \ - IUnknown_IMETHODS \ - ICreateDevEnum_METHODS - -ICOM_DEFINE(ICreateDevEnum,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define ICreateDevEnum_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define ICreateDevEnum_AddRef(p) ICOM_CALL (AddRef,p) -#define ICreateDevEnum_Release(p) ICOM_CALL (Release,p) - /*** ICreateDevEnum methods ***/ -#define ICreateDevEnum_CreateClassEnumerator(p,a1,a2,a3) ICOM_CALL3(CreateClassEnumerator,p,a1,a2,a3) - -/************************************************************************** - * - * IDistributorNotify interface - * - */ - -#define ICOM_INTERFACE IDistributorNotify -#define IDistributorNotify_METHODS \ - ICOM_METHOD (HRESULT,Stop) \ - ICOM_METHOD (HRESULT,Pause) \ - ICOM_METHOD1(HRESULT,Run,REFERENCE_TIME,a1) \ - ICOM_METHOD1(HRESULT,SetSyncSource,IReferenceClock*,a1) \ - ICOM_METHOD (HRESULT,NotifyGraphChange) - -#define IDistributorNotify_IMETHODS \ - IUnknown_IMETHODS \ - IDistributorNotify_METHODS - -ICOM_DEFINE(IDistributorNotify,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IDistributorNotify_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IDistributorNotify_AddRef(p) ICOM_CALL (AddRef,p) -#define IDistributorNotify_Release(p) ICOM_CALL (Release,p) - /*** IDistributorNotify methods ***/ -#define IDistributorNotify_Stop(p) ICOM_CALL (Stop,p) -#define IDistributorNotify_Pause(p) ICOM_CALL (Pause,p) -#define IDistributorNotify_Run(p,a1) ICOM_CALL1(Run,p,a1) -#define IDistributorNotify_SetSyncSource(p,a1) ICOM_CALL1(SetSyncSource,p,a1) -#define IDistributorNotify_NotifyGraphChange(p) ICOM_CALL (NotifyGraphChange,p) - -/************************************************************************** - * - * IEnumFilters interface - * - */ - -#define ICOM_INTERFACE IEnumFilters -#define IEnumFilters_METHODS \ - ICOM_METHOD3(HRESULT,Next,ULONG,a1,IBaseFilter**,a2,ULONG*,a3) \ - ICOM_METHOD1(HRESULT,Skip,ULONG,a1) \ - ICOM_METHOD (HRESULT,Reset) \ - ICOM_METHOD1(HRESULT,Clone,IEnumFilters**,a1) - -#define IEnumFilters_IMETHODS \ - IUnknown_IMETHODS \ - IEnumFilters_METHODS - -ICOM_DEFINE(IEnumFilters,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IEnumFilters_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IEnumFilters_AddRef(p) ICOM_CALL (AddRef,p) -#define IEnumFilters_Release(p) ICOM_CALL (Release,p) - /*** IEnumFilters methods ***/ -#define IEnumFilters_Next(p,a1,a2,a3) ICOM_CALL3(Next,p,a1,a2,a3) -#define IEnumFilters_Skip(p,a1) ICOM_CALL1(Skip,p,a1) -#define IEnumFilters_Reset(p) ICOM_CALL (Reset,p) -#define IEnumFilters_Clone(p,a1) ICOM_CALL1(Clone,p,a1) - -/************************************************************************** - * - * IEnumMediaTypes interface - * - */ - -#define ICOM_INTERFACE IEnumMediaTypes -#define IEnumMediaTypes_METHODS \ - ICOM_METHOD3(HRESULT,Next,ULONG,a1,AM_MEDIA_TYPE**,a2,ULONG*,a3) \ - ICOM_METHOD1(HRESULT,Skip,ULONG,a1) \ - ICOM_METHOD (HRESULT,Reset) \ - ICOM_METHOD1(HRESULT,Clone,IEnumMediaTypes**,a1) - -#define IEnumMediaTypes_IMETHODS \ - IUnknown_IMETHODS \ - IEnumMediaTypes_METHODS - -ICOM_DEFINE(IEnumMediaTypes,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IEnumMediaTypes_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IEnumMediaTypes_AddRef(p) ICOM_CALL (AddRef,p) -#define IEnumMediaTypes_Release(p) ICOM_CALL (Release,p) - /*** IEnumMediaTypes methods ***/ -#define IEnumMediaTypes_Next(p,a1,a2,a3) ICOM_CALL3(Next,p,a1,a2,a3) -#define IEnumMediaTypes_Skip(p,a1) ICOM_CALL1(Skip,p,a1) -#define IEnumMediaTypes_Reset(p) ICOM_CALL (Reset,p) -#define IEnumMediaTypes_Clone(p,a1) ICOM_CALL1(Clone,p,a1) - -/************************************************************************** - * - * IEnumPins interface - * - */ - -#define ICOM_INTERFACE IEnumPins -#define IEnumPins_METHODS \ - ICOM_METHOD3(HRESULT,Next,ULONG,a1,IPin**,a2,ULONG*,a3) \ - ICOM_METHOD1(HRESULT,Skip,ULONG,a1) \ - ICOM_METHOD (HRESULT,Reset) \ - ICOM_METHOD1(HRESULT,Clone,IEnumPins**,a1) - -#define IEnumPins_IMETHODS \ - IUnknown_IMETHODS \ - IEnumPins_METHODS - -ICOM_DEFINE(IEnumPins,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IEnumPins_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IEnumPins_AddRef(p) ICOM_CALL (AddRef,p) -#define IEnumPins_Release(p) ICOM_CALL (Release,p) - /*** IEnumPins methods ***/ -#define IEnumPins_Next(p,a1,a2,a3) ICOM_CALL3(Next,p,a1,a2,a3) -#define IEnumPins_Skip(p,a1) ICOM_CALL1(Skip,p,a1) -#define IEnumPins_Reset(p) ICOM_CALL (Reset,p) -#define IEnumPins_Clone(p,a1) ICOM_CALL1(Clone,p,a1) - -/************************************************************************** - * - * IFileSinkFilter interface - * - */ - -#define ICOM_INTERFACE IFileSinkFilter -#define IFileSinkFilter_METHODS \ - ICOM_METHOD2(HRESULT,SetFileName,LPCOLESTR,a1,const AM_MEDIA_TYPE*,a2) \ - ICOM_METHOD2(HRESULT,GetCurFile,LPOLESTR*,a1,AM_MEDIA_TYPE*,a2) - -#define IFileSinkFilter_IMETHODS \ - IUnknown_IMETHODS \ - IFileSinkFilter_METHODS - -ICOM_DEFINE(IFileSinkFilter,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IFileSinkFilter_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IFileSinkFilter_AddRef(p) ICOM_CALL (AddRef,p) -#define IFileSinkFilter_Release(p) ICOM_CALL (Release,p) - /*** IFileSinkFilter methods ***/ -#define IFileSinkFilter_SetFileName(p,a1,a2) ICOM_CALL2(SetFileName,p,a1,a2) -#define IFileSinkFilter_GetCurFile(p,a1,a2) ICOM_CALL2(GetCurFile,p,a1,a2) - -/************************************************************************** - * - * IFileSinkFilter2 interface - * - */ - -#define ICOM_INTERFACE IFileSinkFilter2 -#define IFileSinkFilter2_METHODS \ - ICOM_METHOD1(HRESULT,SetMode,DWORD,a1) \ - ICOM_METHOD1(HRESULT,GetMode,DWORD*,a1) - -#define IFileSinkFilter2_IMETHODS \ - IFileSinkFilter_IMETHODS \ - IFileSinkFilter2_METHODS - -ICOM_DEFINE(IFileSinkFilter2,IFileSinkFilter) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IFileSinkFilter2_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IFileSinkFilter2_AddRef(p) ICOM_CALL (AddRef,p) -#define IFileSinkFilter2_Release(p) ICOM_CALL (Release,p) - /*** IFileSinkFilter methods ***/ -#define IFileSinkFilter2_SetFileName(p,a1,a2) ICOM_CALL2(SetFileName,p,a1,a2) -#define IFileSinkFilter2_GetCurFile(p,a1,a2) ICOM_CALL2(GetCurFile,p,a1,a2) - /*** IFileSinkFilter2 methods ***/ -#define IFileSinkFilter2_SetMode(p,a1) ICOM_CALL1(SetMode,p,a1) -#define IFileSinkFilter2_GetMode(p,a1) ICOM_CALL1(GetMode,p,a1) - -/************************************************************************** - * - * IFileSourceFilter interface - * - */ - -#define ICOM_INTERFACE IFileSourceFilter -#define IFileSourceFilter_METHODS \ - ICOM_METHOD2(HRESULT,Load,LPCOLESTR,a1,const AM_MEDIA_TYPE*,a2) \ - ICOM_METHOD2(HRESULT,GetCurFile,LPOLESTR*,a1,AM_MEDIA_TYPE*,a2) - -#define IFileSourceFilter_IMETHODS \ - IUnknown_IMETHODS \ - IFileSourceFilter_METHODS - -ICOM_DEFINE(IFileSourceFilter,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IFileSourceFilter_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IFileSourceFilter_AddRef(p) ICOM_CALL (AddRef,p) -#define IFileSourceFilter_Release(p) ICOM_CALL (Release,p) - /*** IFileSourceFilter methods ***/ -#define IFileSourceFilter_Load(p,a1,a2) ICOM_CALL2(Load,p,a1,a2) -#define IFileSourceFilter_GetCurFile(p,a1,a2) ICOM_CALL2(GetCurFile,p,a1,a2) - -/************************************************************************** - * - * IFilterMapper interface - * - */ - -#define ICOM_INTERFACE IFilterMapper -#define IFilterMapper_METHODS \ - ICOM_METHOD3(HRESULT,RegisterFilter,CLSID,a1,LPCWSTR,a2,DWORD,a3) \ - ICOM_METHOD3(HRESULT,RegisterFilterInstance,CLSID,a1,LPCWSTR,a2,CLSID*,a3) \ - ICOM_METHOD8(HRESULT,RegisterPin,CLSID,a1,LPCWSTR,a2,BOOL,a3,BOOL,a4,BOOL,a5,BOOL,a6,CLSID,a7,LPCWSTR,a8) \ - ICOM_METHOD4(HRESULT,RegisterPinType,CLSID,a1,LPCWSTR,a2,CLSID,a3,CLSID,a4) \ - ICOM_METHOD1(HRESULT,UnregisterFilter,CLSID,a1) \ - ICOM_METHOD1(HRESULT,UnregisterFilterInstance,CLSID,a1) \ - ICOM_METHOD2(HRESULT,UnregisterPin,CLSID,a1,LPCWSTR,a2) \ - ICOM_METHOD9(HRESULT,EnumMatchingFilters,IEnumRegFilters**,a1,DWORD,a2,BOOL,a3,CLSID,a4,CLSID,a5,BOOL,a6,BOOL,a7,CLSID,a8,CLSID,a9) - -#define IFilterMapper_IMETHODS \ - IUnknown_IMETHODS \ - IFilterMapper_METHODS - -ICOM_DEFINE(IFilterMapper,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IFilterMapper_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IFilterMapper_AddRef(p) ICOM_CALL (AddRef,p) -#define IFilterMapper_Release(p) ICOM_CALL (Release,p) - /*** IFilterMapper methods ***/ -#define IFilterMapper_RegisterFilter(p,a1,a2,a3) ICOM_CALL3(RegisterFilter,p,a1,a2,a3) -#define IFilterMapper_RegisterFilterInstance(p,a1,a2,a3) ICOM_CALL3(RegisterFilterInstance,p,a1,a2,a3) -#define IFilterMapper_RegisterPin(p,a1,a2,a3,a4,a5,a6,a7,a8) ICOM_CALL8(RegisterPin,p,a1,a2,a3,a4,a5,a6,a7,a8) -#define IFilterMapper_RegisterPinType(p,a1,a2,a3,a4) ICOM_CALL4(RegisterPinType,p,a1,a2,a3,a4) -#define IFilterMapper_UnregisterFilter(p,a1) ICOM_CALL1(UnregisterFilter,p,a1) -#define IFilterMapper_UnregisterFilterInstance(p,a1) ICOM_CALL1(UnregisterFilterInstance,p,a1) -#define IFilterMapper_UnregisterPin(p,a1,a2) ICOM_CALL2(UnregisterPin,p,a1,a2) -#define IFilterMapper_EnumMatchingFilters(p,a1,a2,a3,a4,a5,a6,a7,a8,a9) ICOM_CALL9(EnumMatchingFilters,p,a1,a2,a3,a4,a5,a6,a7,a8,a9) - -/************************************************************************** - * - * IFilterMapper2 interface - * - */ - -#define ICOM_INTERFACE IFilterMapper2 -#define IFilterMapper2_METHODS \ - ICOM_METHOD3(HRESULT,CreateCategory,REFCLSID,a1,DWORD,a2,LPCWSTR,a3) \ - ICOM_METHOD3(HRESULT,UnregisterFilter,const CLSID*,a1,const OLECHAR*,a2,REFCLSID,a3) \ - ICOM_METHOD6(HRESULT,RegisterFilter,REFCLSID,a1,LPCWSTR,a2,IMoniker**,a3,const CLSID*,a4,const OLECHAR*,a5,const REGFILTER2*,a6) \ - ICOM_METHOD15(HRESULT,EnumMatchingFilters,IEnumMoniker**,a1,DWORD,a2,BOOL,a3,DWORD,a4,BOOL,a5,DWORD,a6,const GUID*,a7,const REGPINMEDIUM*,a8,const CLSID*,a9,BOOL,a10,BOOL,a11,DWORD,a12,const GUID*,a13,const REGPINMEDIUM*,a14,const CLSID*,a15) - -#define IFilterMapper2_IMETHODS \ - IUnknown_IMETHODS \ - IFilterMapper2_METHODS - -ICOM_DEFINE(IFilterMapper2,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IFilterMapper2_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IFilterMapper2_AddRef(p) ICOM_CALL (AddRef,p) -#define IFilterMapper2_Release(p) ICOM_CALL (Release,p) - /*** IFilterMapper2 methods ***/ -#define IFilterMapper2_CreateCategory(p,a1,a2,a3) ICOM_CALL3(CreateCategory,p,a1,a2,a3) -#define IFilterMapper2_UnregisterFilter(p,a1,a2,a3) ICOM_CALL3(UnregisterFilter,p,a1,a2,a3) -#define IFilterMapper2_RegisterFilter(p,a1,a2,a3,a4,a5,a6) ICOM_CALL6(RegisterFilter,p,a1,a2,a3,a4,a5,a6) -#define IFilterMapper2_EnumMatchingFilters(p,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15) ICOM_CALL15(EnumMatchingFilters,p,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15) - -/************************************************************************** - * - * IFilterGraph interface - * - */ - -#define ICOM_INTERFACE IFilterGraph -#define IFilterGraph_METHODS \ - ICOM_METHOD2(HRESULT,AddFilter,IBaseFilter*,a1,LPCWSTR,a2) \ - ICOM_METHOD1(HRESULT,RemoveFilter,IBaseFilter*,a1) \ - ICOM_METHOD1(HRESULT,EnumFilters,IEnumFilters**,a1) \ - ICOM_METHOD2(HRESULT,FindFilterByName,LPCWSTR,a1,IBaseFilter**,a2) \ - ICOM_METHOD3(HRESULT,ConnectDirect,IPin*,a1,IPin*,a2,const AM_MEDIA_TYPE*,a3) \ - ICOM_METHOD1(HRESULT,Reconnect,IPin*,a1) \ - ICOM_METHOD1(HRESULT,Disconnect,IPin*,a1) \ - ICOM_METHOD (HRESULT,SetDefaultSyncSource) - -#define IFilterGraph_IMETHODS \ - IUnknown_IMETHODS \ - IFilterGraph_METHODS - -ICOM_DEFINE(IFilterGraph,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IFilterGraph_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IFilterGraph_AddRef(p) ICOM_CALL (AddRef,p) -#define IFilterGraph_Release(p) ICOM_CALL (Release,p) - /*** IFilterGraph methods ***/ -#define IFilterGraph_AddFilter(p,a1,a2) ICOM_CALL2(AddFilter,p,a1,a2) -#define IFilterGraph_RemoveFilter(p,a1) ICOM_CALL1(RemoveFilter,p,a1) -#define IFilterGraph_EnumFilters(p,a1) ICOM_CALL1(EnumFilters,p,a1) -#define IFilterGraph_FindFilterByName(p,a1,a2) ICOM_CALL2(FindFilterByName,p,a1,a2) -#define IFilterGraph_ConnectDirect(p,a1,a2,a3) ICOM_CALL3(ConnectDirect,p,a1,a2,a3) -#define IFilterGraph_Reconnect(p,a1) ICOM_CALL1(Reconnect,p,a1) -#define IFilterGraph_Disconnect(p,a1) ICOM_CALL1(Disconnect,p,a1) -#define IFilterGraph_SetDefaultSyncSource(p) ICOM_CALL (SetDefaultSyncSource,p) - -/************************************************************************** - * - * IGraphBuilder interface - * - */ - -#define ICOM_INTERFACE IGraphBuilder -#define IGraphBuilder_METHODS \ - ICOM_METHOD2(HRESULT,Connect,IPin*,a1,IPin*,a2) \ - ICOM_METHOD1(HRESULT,Render,IPin*,a1) \ - ICOM_METHOD2(HRESULT,RenderFile,LPCWSTR,a1,LPCWSTR,a2) \ - ICOM_METHOD3(HRESULT,AddSourceFilter,LPCWSTR,a1,LPCWSTR,a2,IBaseFilter**,a3) \ - ICOM_METHOD1(HRESULT,SetLogFile,DWORD_PTR,a1) \ - ICOM_METHOD (HRESULT,Abort) \ - ICOM_METHOD (HRESULT,ShouldOperationContinue) - -#define IGraphBuilder_IMETHODS \ - IFilterGraph_IMETHODS \ - IGraphBuilder_METHODS - -ICOM_DEFINE(IGraphBuilder,IFilterGraph) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IGraphBuilder_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IGraphBuilder_AddRef(p) ICOM_CALL (AddRef,p) -#define IGraphBuilder_Release(p) ICOM_CALL (Release,p) - /*** IFilterGraph methods ***/ -#define IGraphBuilder_AddFilter(p,a1,a2) ICOM_CALL2(AddFilter,p,a1,a2) -#define IGraphBuilder_RemoveFilter(p,a1) ICOM_CALL1(RemoveFilter,p,a1) -#define IGraphBuilder_EnumFilters(p,a1) ICOM_CALL1(EnumFilters,p,a1) -#define IGraphBuilder_FindFilterByName(p,a1,a2) ICOM_CALL2(FindFilterByName,p,a1,a2) -#define IGraphBuilder_ConnectDirect(p,a1,a2,a3) ICOM_CALL3(ConnectDirect,p,a1,a2,a3) -#define IGraphBuilder_Reconnect(p,a1) ICOM_CALL1(Reconnect,p,a1) -#define IGraphBuilder_Disconnect(p,a1) ICOM_CALL1(Disconnect,p,a1) -#define IGraphBuilder_SetDefaultSyncSource(p,a1) ICOM_CALL1(SetDefaultSyncSource,p,a1) - /*** IGraphBuilder methods ***/ -#define IGraphBuilder_Connect(p,a1,a2) ICOM_CALL2(Connect,p,a1,a2) -#define IGraphBuilder_Render(p,a1) ICOM_CALL1(Render,p,a1) -#define IGraphBuilder_RenderFile(p,a1,a2) ICOM_CALL2(RenderFile,p,a1,a2) -#define IGraphBuilder_AddSourceFilter(p,a1,a2,a3) ICOM_CALL3(AddSourceFilter,p,a1,a2,a3) -#define IGraphBuilder_SetLogFile(p,a1) ICOM_CALL1(SetLogFile,p,a1) -#define IGraphBuilder_Abort(p) ICOM_CALL (Abort,p) -#define IGraphBuilder_ShouldOperationContinue(p) ICOM_CALL (ShouldOperationContinue,p) - -/************************************************************************** - * - * IFilterGraph2 interface - * - */ - -#define ICOM_INTERFACE IFilterGraph2 -#define IFilterGraph2_METHODS \ - ICOM_METHOD4(HRESULT,AddSourceFilterForMoniker,IMoniker*,a1,IBindCtx*,a2,LPCWSTR,a3,IBaseFilter**,a4) \ - ICOM_METHOD2(HRESULT,ReconnectEx,IPin*,a1,const AM_MEDIA_TYPE*,a2) \ - ICOM_METHOD3(HRESULT,RenderEx,IPin*,a1,DWORD,a2,DWORD*,a3) - -#define IFilterGraph2_IMETHODS \ - IGraphBuilder_IMETHODS \ - IFilterGraph2_METHODS - -ICOM_DEFINE(IFilterGraph2,IGraphBuilder) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IFilterGraph2_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IFilterGraph2_AddRef(p) ICOM_CALL (AddRef,p) -#define IFilterGraph2_Release(p) ICOM_CALL (Release,p) - /*** IFilterGraph methods ***/ -#define IFilterGraph2_AddFilter(p,a1,a2) ICOM_CALL2(AddFilter,p,a1,a2) -#define IFilterGraph2_RemoveFilter(p,a1) ICOM_CALL1(RemoveFilter,p,a1) -#define IFilterGraph2_EnumFilters(p,a1) ICOM_CALL1(EnumFilters,p,a1) -#define IFilterGraph2_FindFilterByName(p,a1,a2) ICOM_CALL2(FindFilterByName,p,a1,a2) -#define IFilterGraph2_ConnectDirect(p,a1,a2,a3) ICOM_CALL3(ConnectDirect,p,a1,a2,a3) -#define IFilterGraph2_Reconnect(p,a1) ICOM_CALL1(Reconnect,p,a1) -#define IFilterGraph2_Disconnect(p,a1) ICOM_CALL1(Disconnect,p,a1) -#define IFilterGraph2_SetDefaultSyncSource(p,a1) ICOM_CALL1(SetDefaultSyncSource,p,a1) - /*** IGraphBuilder methods ***/ -#define IFilterGraph2_Connect(p,a1,a2) ICOM_CALL2(Connect,p,a1,a2) -#define IFilterGraph2_Render(p,a1) ICOM_CALL1(Render,p,a1) -#define IFilterGraph2_RenderFile(p,a1,a2) ICOM_CALL2(RenderFile,p,a1,a2) -#define IFilterGraph2_AddSourceFilter(p,a1,a2,a3) ICOM_CALL3(AddSourceFilter,p,a1,a2,a3) -#define IFilterGraph2_SetLogFile(p,a1) ICOM_CALL1(SetLogFile,p,a1) -#define IFilterGraph2_Abort(p) ICOM_CALL (Abort,p) -#define IFilterGraph2_ShouldOperationContinue(p) ICOM_CALL (ShouldOperationContinue,p) - /*** IFilterGraph2 methods ***/ -#define IFilterGraph2_AddSourceFilterForMoniker(p,a1,a2,a3,a4) ICOM_CALL4(AddSourceFilterForMoniker,p,a1,a2,a3,a4) -#define IFilterGraph2_ReconnectEx(p,a1,a2) ICOM_CALL2(ReconnectEx,p,a1,a2) -#define IFilterGraph2_RenderEx(p,a1,a2,a3) ICOM_CALL3(RenderEx,p,a1,a2,a3) - -/************************************************************************** - * - * IGraphVersion interface - * - */ - -#define ICOM_INTERFACE IGraphVersion -#define IGraphVersion_METHODS \ - ICOM_METHOD1(HRESULT,QueryVersion,LONG*,a1) - -#define IGraphVersion_IMETHODS \ - IUnknown_IMETHODS \ - IGraphVersion_METHODS - -ICOM_DEFINE(IGraphVersion,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IGraphVersion_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IGraphVersion_AddRef(p) ICOM_CALL (AddRef,p) -#define IGraphVersion_Release(p) ICOM_CALL (Release,p) - /*** IGraphVersion methods ***/ -#define IGraphVersion_QueryVersion(p,a1) ICOM_CALL1(QueryVersion,p,a1) - - -/************************************************************************** - * - * IMediaEventSink interface - * - */ - -#define ICOM_INTERFACE IMediaEventSink -#define IMediaEventSink_METHODS \ - ICOM_METHOD3(HRESULT,Notify,long,a1,LONG_PTR,a2,LONG_PTR,a3) - -#define IMediaEventSink_IMETHODS \ - IUnknown_IMETHODS \ - IMediaEventSink_METHODS - -ICOM_DEFINE(IMediaEventSink,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IMediaEventSink_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IMediaEventSink_AddRef(p) ICOM_CALL (AddRef,p) -#define IMediaEventSink_Release(p) ICOM_CALL (Release,p) - /*** IMediaEventSink methods ***/ -#define IMediaEventSink_Notify(p,a1,a2,a3) ICOM_CALL3(Notify,p,a1,a2,a3) - -/************************************************************************** - * - * IMediaPropertyBag interface - * - */ - -#define ICOM_INTERFACE IMediaPropertyBag -#define IMediaPropertyBag_METHODS \ - ICOM_METHOD3(HRESULT,EnumProperty,ULONG,a1,VARIANT*,a2,VARIANT*,a3) - -#define IMediaPropertyBag_IMETHODS \ - IPropertyBag_IMETHODS \ - IMediaPropertyBag_METHODS - -ICOM_DEFINE(IMediaPropertyBag,IPropertyBag) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IMediaPropertyBag_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IMediaPropertyBag_AddRef(p) ICOM_CALL (AddRef,p) -#define IMediaPropertyBag_Release(p) ICOM_CALL (Release,p) - /*** IPropertyBag methods ***/ -#define IMediaPropertyBag_Read(p,a1,a2,a3) ICOM_CALL3(Read,p,a1,a2,a3) -#define IMediaPropertyBag_Write(p,a1,a2) ICOM_CALL2(Write,p,a1,a2) - /*** IMediaPropertyBag methods ***/ -#define IMediaPropertyBag_EnumProperty(p,a1,a2,a3) ICOM_CALL3(EnumProperty,p,a1,a2,a3) - -/************************************************************************** - * - * IMediaSample interface - * - */ - -#define ICOM_INTERFACE IMediaSample -#define IMediaSample_METHODS \ - ICOM_METHOD1(HRESULT,GetPointer,BYTE**,a1) \ - ICOM_METHOD (long,GetSize) \ - ICOM_METHOD2(HRESULT,GetTime,REFERENCE_TIME*,a1,REFERENCE_TIME*,a2) \ - ICOM_METHOD2(HRESULT,SetTime,REFERENCE_TIME*,a1,REFERENCE_TIME*,a2) \ - ICOM_METHOD (HRESULT,IsSyncPoint) \ - ICOM_METHOD1(HRESULT,SetSyncPoint,BOOL,a1) \ - ICOM_METHOD (HRESULT,IsPreroll) \ - ICOM_METHOD1(HRESULT,SetPreroll,BOOL,a1) \ - ICOM_METHOD (long,GetActualDataLength) \ - ICOM_METHOD1(HRESULT,SetActualDataLength,long,a1) \ - ICOM_METHOD1(HRESULT,GetMediaType,AM_MEDIA_TYPE**,a1) \ - ICOM_METHOD1(HRESULT,SetMediaType,AM_MEDIA_TYPE*,a1) \ - ICOM_METHOD (HRESULT,IsDiscontinuity) \ - ICOM_METHOD1(HRESULT,SetDiscontinuity,BOOL,a1) \ - ICOM_METHOD2(HRESULT,GetMediaTime,LONGLONG*,a1,LONGLONG*,a2) \ - ICOM_METHOD2(HRESULT,SetMediaTime,LONGLONG*,a1,LONGLONG*,a2) - -#define IMediaSample_IMETHODS \ - IUnknown_IMETHODS \ - IMediaSample_METHODS - -ICOM_DEFINE(IMediaSample,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IMediaSample_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IMediaSample_AddRef(p) ICOM_CALL (AddRef,p) -#define IMediaSample_Release(p) ICOM_CALL (Release,p) - /*** IMediaSample methods ***/ -#define IMediaSample_GetPointer(p,a1) ICOM_CALL1(GetPointer,p,a1) -#define IMediaSample_GetSize(p) ICOM_CALL (GetSize,p) -#define IMediaSample_GetTime(p,a1,a2) ICOM_CALL2(GetTime,p,a1,a2) -#define IMediaSample_SetTime(p,a1,a2) ICOM_CALL2(SetTime,p,a1,a2) -#define IMediaSample_IsSyncPoint(p) ICOM_CALL (IsSyncPoint,p) -#define IMediaSample_SetSyncPoint(p,a1) ICOM_CALL1(SetSyncPoint,p,a1) -#define IMediaSample_IsPreroll(p) ICOM_CALL (IsPreroll,p) -#define IMediaSample_SetPreroll(p,a1) ICOM_CALL1(SetPreroll,p,a1) -#define IMediaSample_GetActualDataLength(p) ICOM_CALL (GetActualDataLength,p) -#define IMediaSample_SetActualDataLength(p,a1) ICOM_CALL1(SetActualDataLength,p,a1) -#define IMediaSample_GetMediaType(p,a1) ICOM_CALL1(GetMediaType,p,a1) -#define IMediaSample_SetMediaType(p,a1) ICOM_CALL1(SetMediaType,p,a1) -#define IMediaSample_IsDiscontinuity(p) ICOM_CALL (IsDiscontinuity,p) -#define IMediaSample_SetDiscontinuity(p,a1) ICOM_CALL1(SetDiscontinuity,p,a1) -#define IMediaSample_GetMediaTime(p,a1,a2) ICOM_CALL2(GetMediaTime,p,a1,a2) -#define IMediaSample_SetMediaTime(p,a1,a2) ICOM_CALL2(SetMediaTime,p,a1,a2) - -/************************************************************************** - * - * IMediaSample2 interface - * - */ - -#define ICOM_INTERFACE IMediaSample2 -#define IMediaSample2_METHODS \ - ICOM_METHOD2(HRESULT,GetProperties,DWORD,a1,BYTE*,a2) \ - ICOM_METHOD2(HRESULT,SetProperties,DWORD,a1,const BYTE*,a2) - -#define IMediaSample2_IMETHODS \ - IMediaSample_IMETHODS \ - IMediaSample2_METHODS - -ICOM_DEFINE(IMediaSample2,IMediaSample) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IMediaSample2_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IMediaSample2_AddRef(p) ICOM_CALL (AddRef,p) -#define IMediaSample2_Release(p) ICOM_CALL (Release,p) - /*** IMediaSample methods ***/ -#define IMediaSample2_GetPointer(p,a1) ICOM_CALL1(GetPointer,p,a1) -#define IMediaSample2_GetSize(p,a1) ICOM_CALL1(GetSize,p,a1) -#define IMediaSample2_GetTime(p,a1,a2) ICOM_CALL2(GetTime,p,a1,a2) -#define IMediaSample2_SetTime(p,a1,a2) ICOM_CALL2(SetTime,p,a1,a2) -#define IMediaSample2_IsSyncPoint(p,a1) ICOM_CALL1(IsSyncPoint,p,a1) -#define IMediaSample2_SetSyncPoint(p,a1) ICOM_CALL1(SetSyncPoint,p,a1) -#define IMediaSample2_IsPreroll(p,a1) ICOM_CALL1(IsPreroll,p,a1) -#define IMediaSample2_SetPreroll(p,a1) ICOM_CALL1(SetPreroll,p,a1) -#define IMediaSample2_GetActualDataLength(p,a1) ICOM_CALL1(GetActualDataLength,p,a1) -#define IMediaSample2_SetActualDataLength(p,a1) ICOM_CALL1(SetActualDataLength,p,a1) -#define IMediaSample2_GetMediaType(p,a1) ICOM_CALL1(GetMediaType,p,a1) -#define IMediaSample2_SetMediaType(p,a1) ICOM_CALL1(SetMediaType,p,a1) -#define IMediaSample2_IsDiscontinuity(p,a1) ICOM_CALL1(IsDiscontinuity,p,a1) -#define IMediaSample2_SetDiscontinuity(p,a1) ICOM_CALL1(SetDiscontinuity,p,a1) -#define IMediaSample2_GetMediaTime(p,a1,a2) ICOM_CALL2(GetMediaTime,p,a1,a2) -#define IMediaSample2_SetMediaTime(p,a1,a2) ICOM_CALL2(SetMediaTime,p,a1,a2) - /*** IMediaSample2 methods ***/ -#define IMediaSample2_GetProperties(p,a1,a2) ICOM_CALL2(GetProperties,p,a1,a2) -#define IMediaSample2_SetProperties(p,a1,a2) ICOM_CALL2(SetProperties,p,a1,a2) - -/************************************************************************** - * - * IMediaSeeking interface - * - */ - -#define ICOM_INTERFACE IMediaSeeking -#define IMediaSeeking_METHODS \ - ICOM_METHOD1(HRESULT,GetCapabilities,DWORD*,a1) \ - ICOM_METHOD1(HRESULT,CheckCapabilities,DWORD*,a1) \ - ICOM_METHOD1(HRESULT,IsFormatSupported,const GUID*,a1) \ - ICOM_METHOD1(HRESULT,QueryPreferredFormat,GUID*,a1) \ - ICOM_METHOD1(HRESULT,GetTimeFormat,GUID*,a1) \ - ICOM_METHOD1(HRESULT,IsUsingTimeFormat,const GUID*,a1) \ - ICOM_METHOD1(HRESULT,SetTimeFormat,const GUID*,a1) \ - ICOM_METHOD1(HRESULT,GetDuration,LONGLONG*,a1) \ - ICOM_METHOD1(HRESULT,GetStopPosition,LONGLONG*,a1) \ - ICOM_METHOD1(HRESULT,GetCurrentPosition,LONGLONG*,a1) \ - ICOM_METHOD4(HRESULT,ConvertTimeFormat,LONGLONG*,a1,const GUID*,a2,LONGLONG,a3,const GUID*,a4) \ - ICOM_METHOD4(HRESULT,SetPositions,LONGLONG*,a1,DWORD,a2,LONGLONG*,a3,DWORD,a4) \ - ICOM_METHOD2(HRESULT,GetPositions,LONGLONG*,a1,LONGLONG*,a2) \ - ICOM_METHOD2(HRESULT,GetAvailable,LONGLONG*,a1,LONGLONG*,a2) \ - ICOM_METHOD1(HRESULT,SetRate,double,a1) \ - ICOM_METHOD1(HRESULT,GetRate,double*,a1) \ - ICOM_METHOD1(HRESULT,GetPreroll,LONGLONG*,a1) - -#define IMediaSeeking_IMETHODS \ - IUnknown_IMETHODS \ - IMediaSeeking_METHODS - -ICOM_DEFINE(IMediaSeeking,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IMediaSeeking_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IMediaSeeking_AddRef(p) ICOM_CALL (AddRef,p) -#define IMediaSeeking_Release(p) ICOM_CALL (Release,p) - /*** IMediaSeeking methods ***/ -#define IMediaSeeking_GetCapabilities(p,a1) ICOM_CALL1(GetCapabilities,p,a1) -#define IMediaSeeking_CheckCapabilities(p,a1) ICOM_CALL1(CheckCapabilities,p,a1) -#define IMediaSeeking_IsFormatSupported(p,a1) ICOM_CALL1(IsFormatSupported,p,a1) -#define IMediaSeeking_QueryPreferredFormat(p,a1) ICOM_CALL1(QueryPreferredFormat,p,a1) -#define IMediaSeeking_GetTimeFormat(p,a1) ICOM_CALL1(GetTimeFormat,p,a1) -#define IMediaSeeking_IsUsingTimeFormat(p,a1) ICOM_CALL1(IsUsingTimeFormat,p,a1) -#define IMediaSeeking_SetTimeFormat(p,a1) ICOM_CALL1(SetTimeFormat,p,a1) -#define IMediaSeeking_GetDuration(p,a1) ICOM_CALL1(GetDuration,p,a1) -#define IMediaSeeking_GetStopPosition(p,a1) ICOM_CALL1(GetStopPosition,p,a1) -#define IMediaSeeking_GetCurrentPosition(p,a1) ICOM_CALL1(GetCurrentPosition,p,a1) -#define IMediaSeeking_ConvertTimeFormat(p,a1,a2,a3,a4) ICOM_CALL4(ConvertTimeFormat,p,a1,a2,a3,a4) -#define IMediaSeeking_SetPositions(p,a1,a2,a3,a4) ICOM_CALL4(SetPositions,p,a1,a2,a3,a4) -#define IMediaSeeking_GetPositions(p,a1,a2) ICOM_CALL2(GetPositions,p,a1,a2) -#define IMediaSeeking_GetAvailable(p,a1,a2) ICOM_CALL2(GetAvailable,p,a1,a2) -#define IMediaSeeking_SetRate(p,a1) ICOM_CALL1(SetRate,p,a1) -#define IMediaSeeking_GetRate(p,a1) ICOM_CALL1(GetRate,p,a1) -#define IMediaSeeking_GetPreroll(p,a1) ICOM_CALL1(GetPreroll,p,a1) - -/************************************************************************** - * - * IMemAllocator interface - * - */ - -#define ICOM_INTERFACE IMemAllocator -#define IMemAllocator_METHODS \ - ICOM_METHOD2(HRESULT,SetProperties,ALLOCATOR_PROPERTIES*,a1,ALLOCATOR_PROPERTIES*,a2) \ - ICOM_METHOD1(HRESULT,GetProperties,ALLOCATOR_PROPERTIES*,a1) \ - ICOM_METHOD (HRESULT,Commit) \ - ICOM_METHOD (HRESULT,Decommit) \ - ICOM_METHOD4(HRESULT,GetBuffer,IMediaSample**,a1,REFERENCE_TIME*,a2,REFERENCE_TIME*,a3,DWORD,a4) \ - ICOM_METHOD1(HRESULT,ReleaseBuffer,IMediaSample*,a1) - -#define IMemAllocator_IMETHODS \ - IUnknown_IMETHODS \ - IMemAllocator_METHODS - -ICOM_DEFINE(IMemAllocator,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IMemAllocator_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IMemAllocator_AddRef(p) ICOM_CALL (AddRef,p) -#define IMemAllocator_Release(p) ICOM_CALL (Release,p) - /*** IMemAllocator methods ***/ -#define IMemAllocator_SetProperties(p,a1,a2) ICOM_CALL2(SetProperties,p,a1,a2) -#define IMemAllocator_GetProperties(p,a1) ICOM_CALL1(GetProperties,p,a1) -#define IMemAllocator_Commit(p) ICOM_CALL (Commit,p) -#define IMemAllocator_Decommit(p) ICOM_CALL (Decommit,p) -#define IMemAllocator_GetBuffer(p,a1,a2,a3,a4) ICOM_CALL4(GetBuffer,p,a1,a2,a3,a4) -#define IMemAllocator_ReleaseBuffer(p,a1) ICOM_CALL1(ReleaseBuffer,p,a1) - - -/************************************************************************** - * - * IMemInputPin interface - * - */ - -#define ICOM_INTERFACE IMemInputPin -#define IMemInputPin_METHODS \ - ICOM_METHOD1(HRESULT,GetAllocator,IMemAllocator**,a1) \ - ICOM_METHOD2(HRESULT,NotifyAllocator,IMemAllocator*,a1,BOOL,a2) \ - ICOM_METHOD1(HRESULT,GetAllocatorRequirements,ALLOCATOR_PROPERTIES*,a1) \ - ICOM_METHOD1(HRESULT,Receive,IMediaSample*,a1) \ - ICOM_METHOD3(HRESULT,ReceiveMultiple,IMediaSample**,a1,long,a2,long*,a3) \ - ICOM_METHOD (HRESULT,ReceiveCanBlock) - -#define IMemInputPin_IMETHODS \ - IUnknown_IMETHODS \ - IMemInputPin_METHODS - -ICOM_DEFINE(IMemInputPin,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IMemInputPin_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IMemInputPin_AddRef(p) ICOM_CALL (AddRef,p) -#define IMemInputPin_Release(p) ICOM_CALL (Release,p) - /*** IMemInputPin methods ***/ -#define IMemInputPin_GetAllocator(p,a1) ICOM_CALL1(GetAllocator,p,a1) -#define IMemInputPin_NotifyAllocator(p,a1,a2) ICOM_CALL2(NotifyAllocator,p,a1,a2) -#define IMemInputPin_GetAllocatorRequirements(p,a1) ICOM_CALL1(GetAllocatorRequirements,p,a1) -#define IMemInputPin_Receive(p,a1) ICOM_CALL1(Receive,p,a1) -#define IMemInputPin_ReceiveMultiple(p,a1,a2,a3) ICOM_CALL3(ReceiveMultiple,p,a1,a2,a3) -#define IMemInputPin_ReceiveCanBlock(p) ICOM_CALL (ReceiveCanBlock,p) - -/************************************************************************** - * - * IOverlay interface - * - */ - -#define ICOM_INTERFACE IOverlay -#define IOverlay_METHODS \ - ICOM_METHOD2(HRESULT,GetPalette,DWORD*,a1,PALETTEENTRY**,a2) \ - ICOM_METHOD2(HRESULT,SetPalette,DWORD,a1,PALETTEENTRY*,a2) \ - ICOM_METHOD1(HRESULT,GetDefaultColorKey,COLORKEY*,a1) \ - ICOM_METHOD1(HRESULT,GetColorKey,COLORKEY*,a1) \ - ICOM_METHOD1(HRESULT,SetColorKey,COLORKEY*,a1) \ - ICOM_METHOD1(HRESULT,GetWindowHandle,HWND*,a1) \ - ICOM_METHOD3(HRESULT,GetClipList,RECT*,a1,RECT*,a2,RGNDATA**,a3) \ - ICOM_METHOD2(HRESULT,GetVideoPosition,RECT*,a1,RECT*,a2) \ - ICOM_METHOD2(HRESULT,Advise,IOverlayNotify*,a1,DWORD,a2) \ - ICOM_METHOD (HRESULT,Unadvise) - -#define IOverlay_IMETHODS \ - IUnknown_IMETHODS \ - IOverlay_METHODS - -ICOM_DEFINE(IOverlay,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IOverlay_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IOverlay_AddRef(p) ICOM_CALL (AddRef,p) -#define IOverlay_Release(p) ICOM_CALL (Release,p) - /*** IOverlay methods ***/ -#define IOverlay_GetPalette(p,a1,a2) ICOM_CALL2(GetPalette,p,a1,a2) -#define IOverlay_SetPalette(p,a1,a2) ICOM_CALL2(SetPalette,p,a1,a2) -#define IOverlay_GetDefaultColorKey(p,a1) ICOM_CALL1(GetDefaultColorKey,p,a1) -#define IOverlay_GetColorKey(p,a1) ICOM_CALL1(GetColorKey,p,a1) -#define IOverlay_SetColorKey(p,a1) ICOM_CALL1(SetColorKey,p,a1) -#define IOverlay_GetWindowHandle(p,a1) ICOM_CALL1(GetWindowHandle,p,a1) -#define IOverlay_GetClipList(p,a1,a2,a3) ICOM_CALL3(GetClipList,p,a1,a2,a3) -#define IOverlay_GetVideoPosition(p,a1,a2) ICOM_CALL2(GetVideoPosition,p,a1,a2) -#define IOverlay_Advise(p,a1,a2) ICOM_CALL2(Advise,p,a1,a2) -#define IOverlay_Unadvise(p) ICOM_CALL1(Unadvise,p) - -/************************************************************************** - * - * IPin interface - * - */ - -#define ICOM_INTERFACE IPin -#define IPin_METHODS \ - ICOM_METHOD2(HRESULT,Connect,IPin*,a1,const AM_MEDIA_TYPE*,a2) \ - ICOM_METHOD2(HRESULT,ReceiveConnection,IPin*,a1,const AM_MEDIA_TYPE*,a2) \ - ICOM_METHOD (HRESULT,Disconnect) \ - ICOM_METHOD1(HRESULT,ConnectedTo,IPin**,a1) \ - ICOM_METHOD1(HRESULT,ConnectionMediaType,AM_MEDIA_TYPE*,a1) \ - ICOM_METHOD1(HRESULT,QueryPinInfo,PIN_INFO*,a1) \ - ICOM_METHOD1(HRESULT,QueryDirection,PIN_DIRECTION*,a1) \ - ICOM_METHOD1(HRESULT,QueryId,LPWSTR*,a1) \ - ICOM_METHOD1(HRESULT,QueryAccept,const AM_MEDIA_TYPE*,a1) \ - ICOM_METHOD1(HRESULT,EnumMediaTypes,IEnumMediaTypes**,a1) \ - ICOM_METHOD2(HRESULT,QueryInternalConnections,IPin**,a1,ULONG*,a2) \ - ICOM_METHOD (HRESULT,EndOfStream) \ - ICOM_METHOD (HRESULT,BeginFlush) \ - ICOM_METHOD (HRESULT,EndFlush) \ - ICOM_METHOD3(HRESULT,NewSegment,REFERENCE_TIME,a1,REFERENCE_TIME,a2,double,a3) - -#define IPin_IMETHODS \ - IUnknown_IMETHODS \ - IPin_METHODS - -ICOM_DEFINE(IPin,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IPin_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IPin_AddRef(p) ICOM_CALL (AddRef,p) -#define IPin_Release(p) ICOM_CALL (Release,p) - /*** IPin methods ***/ -#define IPin_Connect(p,a1,a2) ICOM_CALL2(Connect,p,a1,a2) -#define IPin_ReceiveConnection(p,a1,a2) ICOM_CALL2(ReceiveConnection,p,a1,a2) -#define IPin_Disconnect(p) ICOM_CALL (Disconnect,p) -#define IPin_ConnectedTo(p,a1) ICOM_CALL1(ConnectedTo,p,a1) -#define IPin_ConnectionMediaType(p,a1) ICOM_CALL1(ConnectionMediaType,p,a1) -#define IPin_QueryPinInfo(p,a1) ICOM_CALL1(QueryPinInfo,p,a1) -#define IPin_QueryDirection(p,a1) ICOM_CALL1(QueryDirection,p,a1) -#define IPin_QueryId(p,a1) ICOM_CALL1(QueryId,p,a1) -#define IPin_QueryAccept(p,a1) ICOM_CALL1(QueryAccept,p,a1) -#define IPin_EnumMediaTypes(p,a1) ICOM_CALL1(EnumMediaTypes,p,a1) -#define IPin_QueryInternalConnections(p,a1,a2) ICOM_CALL2(QueryInternalConnections,p,a1,a2) -#define IPin_EndOfStream(p) ICOM_CALL (EndOfStream,p) -#define IPin_BeginFlush(p) ICOM_CALL (BeginFlush,p) -#define IPin_EndFlush(p) ICOM_CALL (EndFlush,p) -#define IPin_NewSegment(p,a1,a2,a3) ICOM_CALL3(NewSegment,p,a1,a2,a3) - -/************************************************************************** - * - * IQualityControl interface - * - */ - -#define ICOM_INTERFACE IQualityControl -#define IQualityControl_METHODS \ - ICOM_METHOD2(HRESULT,Notify,IBaseFilter*,a1,Quality,a2) \ - ICOM_METHOD1(HRESULT,SetSink,IQualityControl*,a1) - -#define IQualityControl_IMETHODS \ - IUnknown_IMETHODS \ - IQualityControl_METHODS - -ICOM_DEFINE(IQualityControl,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IQualityControl_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IQualityControl_AddRef(p) ICOM_CALL (AddRef,p) -#define IQualityControl_Release(p) ICOM_CALL (Release,p) - /*** IQualityControl methods ***/ -#define IQualityControl_Notify(p,a1,a2) ICOM_CALL2(Notify,p,a1,a2) -#define IQualityControl_SetSink(p,a1) ICOM_CALL1(SetSink,p,a1) - -/************************************************************************** - * - * IReferenceClock interface - * - */ - -#define ICOM_INTERFACE IReferenceClock -#define IReferenceClock_METHODS \ - ICOM_METHOD1(HRESULT,GetTime,REFERENCE_TIME*,a1) \ - ICOM_METHOD4(HRESULT,AdviseTime,REFERENCE_TIME,a1,REFERENCE_TIME,a2,HEVENT,a3,DWORD_PTR*,a4) \ - ICOM_METHOD4(HRESULT,AdvisePeriodic,REFERENCE_TIME,a1,REFERENCE_TIME,a2,HSEMAPHORE,a3,DWORD_PTR*,a4) \ - ICOM_METHOD1(HRESULT,Unadvise,DWORD_PTR,a1) - -#define IReferenceClock_IMETHODS \ - IUnknown_IMETHODS \ - IReferenceClock_METHODS - -ICOM_DEFINE(IReferenceClock,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IReferenceClock_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IReferenceClock_AddRef(p) ICOM_CALL (AddRef,p) -#define IReferenceClock_Release(p) ICOM_CALL (Release,p) - /*** IReferenceClock methods ***/ -#define IReferenceClock_GetTime(p,a1) ICOM_CALL1(GetTime,p,a1) -#define IReferenceClock_AdviseTime(p,a1,a2,a3,a4) ICOM_CALL4(AdviseTime,p,a1,a2,a3,a4) -#define IReferenceClock_AdvisePeriodic(p,a1,a2,a3,a4) ICOM_CALL4(AdvisePeriodic,p,a1,a2,a3,a4) -#define IReferenceClock_Unadvise(p,a1) ICOM_CALL1(Unadvise,p,a1) - -/************************************************************************** - * - * IReferenceClock2 interface - * - */ - -#define ICOM_INTERFACE IReferenceClock2 -#define IReferenceClock2_METHODS - -#define IReferenceClock2_IMETHODS \ - IReferenceClock_IMETHODS \ - IReferenceClock2_METHODS - -ICOM_DEFINE(IReferenceClock2,IReferenceClock) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define IReferenceClock2_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define IReferenceClock2_AddRef(p) ICOM_CALL (AddRef,p) -#define IReferenceClock2_Release(p) ICOM_CALL (Release,p) - /*** IReferenceClock methods ***/ -#define IReferenceClock2_GetTime(p,a1) ICOM_CALL1(GetTime,p,a1) -#define IReferenceClock2_AdviseTime(p,a1,a2,a3,a4) ICOM_CALL4(AdviseTime,p,a1,a2,a3,a4) -#define IReferenceClock2_AdvisePeriodic(p,a1,a2,a3,a4) ICOM_CALL4(AdvisePeriodic,p,a1,a2,a3,a4) -#define IReferenceClock2_Unadvise(p,a1) ICOM_CALL1(Unadvise,p,a1) - /*** IReferenceClock2 methods ***/ - -/************************************************************************** - * - * ISeekingPassThru interface - * - */ - -#define ICOM_INTERFACE ISeekingPassThru -#define ISeekingPassThru_METHODS \ - ICOM_METHOD2(HRESULT,Init,BOOL,a1,IPin*,a2) - -#define ISeekingPassThru_IMETHODS \ - IUnknown_IMETHODS \ - ISeekingPassThru_METHODS - -ICOM_DEFINE(ISeekingPassThru,IUnknown) -#undef ICOM_INTERFACE - - /*** IUnknown methods ***/ -#define ISeekingPassThru_QueryInterface(p,a1,a2) ICOM_CALL2(QueryInterface,p,a1,a2) -#define ISeekingPassThru_AddRef(p) ICOM_CALL (AddRef,p) -#define ISeekingPassThru_Release(p) ICOM_CALL (Release,p) - /*** ISeekingPassThru methods ***/ -#define ISeekingPassThru_Init(p,a1,a2) ICOM_CALL2(Init,p,a1,a2) - - - - -#endif /* __WINE_STRMIF_H_ */ diff --git a/ole/uuid.c b/ole/uuid.c index 84cbef5db68..249371cd2cc 100644 --- a/ole/uuid.c +++ b/ole/uuid.c @@ -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 */ diff --git a/winedefault.reg b/winedefault.reg index 7b1cfb92195..630d9256134 100644 --- a/winedefault.reg +++ b/winedefault.reg @@ -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