Commit b6a7ca58 authored by Alexandre Julliard's avatar Alexandre Julliard

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

parent d1d63927
......@@ -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)
......
......@@ -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:
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
......
/*
* Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __WINE_AVIFILE_PRIVATE_H
#define __WINE_AVIFILE_PRIVATE_H
typedef struct
{
HANDLE hHeap;
DWORD dwAVIFileRef;
DWORD dwClassObjRef;
BOOL fInitCOM;
} WINE_AVIFILE_DATA;
extern WINE_AVIFILE_DATA AVIFILE_data;
INT AVIFILE_strlenAtoW( LPCSTR lpstr );
INT AVIFILE_strlenWtoA( LPCWSTR lpwstr );
LPWSTR AVIFILE_strncpyAtoW( LPWSTR lpwstr, LPCSTR lpstr, INT wbuflen );
LPSTR AVIFILE_strncpyWtoA( LPSTR lpstr, LPCWSTR lpwstr, INT abuflen );
LPWSTR AVIFILE_strdupAtoW( LPCSTR lpstr );
LPSTR AVIFILE_strdupWtoA( LPCWSTR lpwstr );
HRESULT WINAPI AVIFILE_DllGetClassObject(const CLSID* pclsid,const IID* piid,void** ppv);
HRESULT AVIFILE_CreateIAVIFile(void** ppobj);
HRESULT AVIFILE_IAVIFile_Open( PAVIFILE paf, LPCWSTR szFile, UINT uMode );
HRESULT AVIFILE_IAVIFile_GetIndexTable( PAVIFILE paf, DWORD dwStreamIndex,
AVIINDEXENTRY** ppIndexEntry,
DWORD* pdwCountOfIndexEntry );
HRESULT AVIFILE_IAVIFile_ReadMovieData( PAVIFILE paf, DWORD dwOffset,
DWORD dwLength, LPVOID lpvBuf );
HRESULT AVIFILE_CreateIAVIStream(void** ppobj);
HRESULT AVIFILE_CreateIGetFrame(void** ppobj,
IAVIStream* pstr,LPBITMAPINFOHEADER lpbi);
typedef struct
{
DWORD dwStreamIndex;
AVIStreamHeader* pstrhdr;
BYTE* pbFmt;
DWORD dwFmtLen;
} WINE_AVISTREAM_DATA;
WINE_AVISTREAM_DATA* AVIFILE_Alloc_IAVIStreamData( DWORD dwFmtLen );
void AVIFILE_Free_IAVIStreamData( WINE_AVISTREAM_DATA* pData );
/* this should be moved to vfw.h */
#ifndef FIND_DIR
#define FIND_DIR 0x0000000FL
#define FIND_NEXT 0x00000001L
#define FIND_PREV 0x00000004L
#define FIND_FROM_START 0x00000008L
#define FIND_TYPE 0x000000F0L
#define FIND_KEY 0x00000010L
#define FIND_ANY 0x00000020L
#define FIND_FORMAT 0x00000040L
#define FIND_RET 0x0000F000L
#define FIND_POS 0x00000000L
#define FIND_LENGTH 0x00001000L
#define FIND_OFFSET 0x00002000L
#define FIND_SIZE 0x00003000L
#define FIND_INDEX 0x00004000L
#endif
#endif /* __WINE_AVIFILE_PRIVATE_H */
/*
* Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "winbase.h"
#include "winnls.h"
#include "mmsystem.h"
#include "winerror.h"
#include "ole2.h"
#include "vfw.h"
#include "wine/debug.h"
#include "avifile_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(avifile);
static HRESULT WINAPI
IClassFactory_fnQueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj);
static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface);
static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface);
static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj);
static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface,BOOL dolock);
static ICOM_VTABLE(IClassFactory) iclassfact =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
IClassFactory_fnQueryInterface,
IClassFactory_fnAddRef,
IClassFactory_fnRelease,
IClassFactory_fnCreateInstance,
IClassFactory_fnLockServer
};
typedef struct
{
/* IUnknown fields */
ICOM_VFIELD(IClassFactory);
DWORD ref;
} IClassFactoryImpl;
static IClassFactoryImpl AVIFILE_GlobalCF = {&iclassfact, 0 };
static HRESULT WINAPI
IClassFactory_fnQueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj)
{
ICOM_THIS(IClassFactoryImpl,iface);
TRACE("(%p)->(%p,%p)\n",This,riid,ppobj);
if ( ( IsEqualGUID( &IID_IUnknown, riid ) ) ||
( IsEqualGUID( &IID_IClassFactory, riid ) ) )
{
*ppobj = iface;
IClassFactory_AddRef(iface);
return S_OK;
}
return E_NOINTERFACE;
}
static ULONG WINAPI IClassFactory_fnAddRef(LPCLASSFACTORY iface)
{
ICOM_THIS(IClassFactoryImpl,iface);
TRACE("(%p)->()\n",This);
if ( (This->ref) == 0 )
AVIFILE_data.dwClassObjRef ++;
return ++(This->ref);
}
static ULONG WINAPI IClassFactory_fnRelease(LPCLASSFACTORY iface)
{
ICOM_THIS(IClassFactoryImpl,iface);
TRACE("(%p)->()\n",This);
if ( (--(This->ref)) > 0 )
return This->ref;
AVIFILE_data.dwClassObjRef --;
return 0;
}
static HRESULT WINAPI IClassFactory_fnCreateInstance(LPCLASSFACTORY iface,LPUNKNOWN pOuter,REFIID riid,LPVOID *ppobj)
{
/*ICOM_THIS(IClassFactoryImpl,iface);*/
*ppobj = NULL;
if ( pOuter != NULL )
return E_FAIL;
if ( IsEqualGUID( &IID_IAVIFile, riid ) )
return AVIFILE_CreateIAVIFile(ppobj);
if ( IsEqualGUID( &IID_IAVIStream, riid ) )
return AVIFILE_CreateIAVIStream(ppobj);
return E_NOINTERFACE;
}
static HRESULT WINAPI IClassFactory_fnLockServer(LPCLASSFACTORY iface,BOOL dolock)
{
ICOM_THIS(IClassFactoryImpl,iface);
HRESULT hr;
FIXME("(%p)->(%d),stub!\n",This,dolock);
if (dolock)
hr = IClassFactory_AddRef(iface);
else
hr = IClassFactory_Release(iface);
return hr;
}
/***********************************************************************
* DllGetClassObject (AVIFIL32.@)
*/
HRESULT WINAPI AVIFILE_DllGetClassObject(const CLSID* pclsid,const IID* piid,void** ppv)
{
*ppv = NULL;
if ( IsEqualCLSID( &IID_IClassFactory, piid ) )
{
*ppv = (LPVOID)&AVIFILE_GlobalCF;
IClassFactory_AddRef((IClassFactory*)*ppv);
return S_OK;
}
return CLASS_E_CLASSNOTAVAILABLE;
}
/*****************************************************************************
* DllCanUnloadNow (AVIFIL32.@)
*/
DWORD WINAPI AVIFILE_DllCanUnloadNow(void)
{
return ( AVIFILE_data.dwClassObjRef == 0 ) ? S_OK : S_FALSE;
}
/*
* Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "winbase.h"
#include "winnls.h"
#include "mmsystem.h"
#include "winerror.h"
#include "vfw.h"
#include "wine/debug.h"
#include "avifile_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(avifile);
WINE_AVIFILE_DATA AVIFILE_data;
/***********************************************************************
* AVIFILE_InitProcess (internal)
*/
static BOOL AVIFILE_InitProcess( void )
{
TRACE("()\n");
AVIFILE_data.dwAVIFileRef = 0;
AVIFILE_data.dwClassObjRef = 0;
AVIFILE_data.hHeap = (HANDLE)NULL;
AVIFILE_data.hHeap = HeapCreate( 0, 0x10000, 0 );
if ( AVIFILE_data.hHeap == (HANDLE)NULL )
{
ERR( "cannot allocate heap for AVIFILE.\n" );
return FALSE;
}
return TRUE;
}
/***********************************************************************
* AVIFILE_UninitProcess (internal)
*/
static void AVIFILE_UninitProcess( void )
{
TRACE("()\n");
if ( AVIFILE_data.dwAVIFileRef != 0 )
ERR( "you must call AVIFileExit()\n" );
if ( AVIFILE_data.dwClassObjRef != 0 )
ERR( "you must release some objects allocated from AVIFile.\n" );
if ( AVIFILE_data.hHeap != (HANDLE)NULL )
{
HeapDestroy( AVIFILE_data.hHeap );
AVIFILE_data.hHeap = (HANDLE)NULL;
}
}
/***********************************************************************
* AVIFILE_DllMain
*/
BOOL WINAPI AVIFILE_DllMain(
HINSTANCE hInstDLL,
DWORD fdwReason,
LPVOID lpvReserved )
{
switch ( fdwReason )
{
case DLL_PROCESS_ATTACH:
if ( !AVIFILE_InitProcess() )
return FALSE;
break;
case DLL_PROCESS_DETACH:
AVIFILE_UninitProcess();
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
return TRUE;
}
/*
* Copyright 2001 Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "winbase.h"
#include "winnls.h"
#include "mmsystem.h"
#include "winerror.h"
#include "vfw.h"
#include "wine/debug.h"
#include "avifile_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(avifile);
/****************************************************************************
* string APIs (internal) - Copied from wine/dlls/imm32/string.c
*/
INT AVIFILE_strlenAtoW( LPCSTR lpstr )
{
INT len;
len = MultiByteToWideChar( CP_ACP, 0, lpstr, -1, NULL, 0 );
return ( len > 0 ) ? (len-1) : 0;
}
INT AVIFILE_strlenWtoA( LPCWSTR lpwstr )
{
INT len;
len = WideCharToMultiByte( CP_ACP, 0, lpwstr, -1,
NULL, 0, NULL, NULL );
return ( len > 0 ) ? (len-1) : 0;
}
LPWSTR AVIFILE_strncpyAtoW( LPWSTR lpwstr, LPCSTR lpstr, INT wbuflen )
{
INT len;
len = MultiByteToWideChar( CP_ACP, 0, lpstr, -1, lpwstr, wbuflen );
if ( len == 0 )
*lpwstr = 0;
return lpwstr;
}
LPSTR AVIFILE_strncpyWtoA( LPSTR lpstr, LPCWSTR lpwstr, INT abuflen )
{
INT len;
len = WideCharToMultiByte( CP_ACP, 0, lpwstr, -1,
lpstr, abuflen, NULL, NULL );
if ( len == 0 )
*lpstr = 0;
return lpstr;
}
LPWSTR AVIFILE_strdupAtoW( LPCSTR lpstr )
{
INT len;
LPWSTR lpwstr = NULL;
len = AVIFILE_strlenAtoW( lpstr );
if ( len > 0 )
{
lpwstr = (LPWSTR)HeapAlloc( AVIFILE_data.hHeap, 0, sizeof(WCHAR)*(len+1) );
if ( lpwstr != NULL )
(void)AVIFILE_strncpyAtoW( lpwstr, lpstr, len+1 );
}
return lpwstr;
}
LPSTR AVIFILE_strdupWtoA( LPCWSTR lpwstr )
{
INT len;
LPSTR lpstr = NULL;
len = AVIFILE_strlenWtoA( lpwstr );
if ( len > 0 )
{
lpstr = (LPSTR)HeapAlloc( AVIFILE_data.hHeap, 0, sizeof(CHAR)*(len+1) );
if ( lpstr != NULL )
(void)AVIFILE_strncpyWtoA( lpstr, lpwstr, len+1 );
}
return lpstr;
}
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
/*
* 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 */
......@@ -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@
......
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
/*
* Copyright (C) Hidenori TAKESHIMA
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <math.h>
#include "windef.h"
#include "wine/obj_base.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
/***********************************************************************
* AmpFactorToDB (QUARTZ.@)
*
* undocumented.
* converting from Amp to dB?
*
*/
LONG WINAPI QUARTZ_AmpFactorToDB( LONG amp )
{
LONG dB;
TRACE( "(%ld)\n", amp );
if ( amp <= 0 || amp > 65536 )
return 0;
dB = (LONG)(2000.0 * log10((double)amp / 65536.0) + 0.5);
if ( dB >= 0 ) dB = 0;
if ( dB < -10000 ) dB = -10000;
return dB;
}
/***********************************************************************
* DBToAmpFactor (QUARTZ.@)
*
* undocumented.
* converting from dB to Amp?
*/
LONG WINAPI QUARTZ_DBToAmpFactor( LONG dB )
{
LONG amp;
TRACE( "(%ld)\n", dB );
if ( dB >= 0 )
return 65535;
if ( dB < -10000 )
return 0;
amp = (LONG)(pow(10.0,dB / 2000.0) * 65536.0 + 0.5);
if ( amp <= 0 ) amp = 1;
if ( amp >= 65536 ) amp = 65535;
return amp;
}
/*
* Implements Asynchronous File/URL Source.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef WINE_DSHOW_ASYNCSRC_H
#define WINE_DSHOW_ASYNCSRC_H
#include "iunk.h"
#include "basefilt.h"
typedef struct CAsyncSourceImpl CAsyncSourceImpl;
typedef struct CAsyncSourcePinImpl CAsyncSourcePinImpl;
typedef struct AsyncSourceRequest AsyncSourceRequest;
typedef struct AsyncSourceHandlers AsyncSourceHandlers;
typedef struct CAsyncReaderImpl
{
ICOM_VFIELD(IAsyncReader);
/* IUnknown fields */
IUnknown* punkControl;
/* IAsyncReader fields */
CAsyncSourceImpl* pSource;
CRITICAL_SECTION m_csReader;
BOOL m_bInFlushing;
CRITICAL_SECTION m_csRequest;
CRITICAL_SECTION m_csReply;
AsyncSourceRequest* m_pReplyFirst;
CRITICAL_SECTION m_csFree;
AsyncSourceRequest* m_pFreeFirst;
} CAsyncReaderImpl;
typedef struct CFileSourceFilterImpl
{
ICOM_VFIELD(IFileSourceFilter);
/* IUnknown fields */
IUnknown* punkControl;
/* IFileSourceFilter fields */
CAsyncSourceImpl* pSource;
CRITICAL_SECTION* pcsFileSource;
WCHAR* m_pwszFileName;
DWORD m_cbFileName;
AM_MEDIA_TYPE m_mt;
} CFileSourceFilterImpl;
struct CAsyncSourceImpl
{
QUARTZ_IUnkImpl unk;
CBaseFilterImpl basefilter;
CFileSourceFilterImpl filesrc;
CRITICAL_SECTION csFilter;
CAsyncSourcePinImpl* pPin;
const AsyncSourceHandlers* m_pHandler;
void* m_pUserData;
};
struct CAsyncSourcePinImpl
{
QUARTZ_IUnkImpl unk;
CPinBaseImpl pin;
CAsyncReaderImpl async;
QUARTZ_IFDelegation qiext;
BOOL bAsyncReaderQueried;
CAsyncSourceImpl* pSource;
};
struct AsyncSourceRequest
{
AsyncSourceRequest* pNext;
IMediaSample* pSample; /* for async req. */
DWORD_PTR dwContext; /* for async req. */
HRESULT hr;
};
struct AsyncSourceHandlers
{
/* all handlers MUST be implemented. */
HRESULT (*pLoad)( CAsyncSourceImpl* pImpl, LPCWSTR lpwszSourceName );
HRESULT (*pCleanup)( CAsyncSourceImpl* pImpl );
HRESULT (*pGetLength)( CAsyncSourceImpl* pImpl, LONGLONG* pllTotal, LONGLONG* pllAvailable );
/* S_OK = OK / S_FALSE = Canceled / other = error */
/* hEventCancel may be NULL */
HRESULT (*pRead)( CAsyncSourceImpl* pImpl, LONGLONG llOfsStart, LONG lLength, BYTE* pBuf, LONG* plReturned, HANDLE hEventCancel );
};
#define CAsyncSourceImpl_THIS(iface,member) CAsyncSourceImpl* This = ((CAsyncSourceImpl*)(((char*)iface)-offsetof(CAsyncSourceImpl,member)))
#define CAsyncSourcePinImpl_THIS(iface,member) CAsyncSourcePinImpl* This = ((CAsyncSourcePinImpl*)(((char*)iface)-offsetof(CAsyncSourcePinImpl,member)))
HRESULT CAsyncReaderImpl_InitIAsyncReader(
CAsyncReaderImpl* This, IUnknown* punkControl,
CAsyncSourceImpl* pSource );
void CAsyncReaderImpl_UninitIAsyncReader(
CAsyncReaderImpl* This );
HRESULT CFileSourceFilterImpl_InitIFileSourceFilter(
CFileSourceFilterImpl* This, IUnknown* punkControl,
CAsyncSourceImpl* pSource,
CRITICAL_SECTION* pcsFileSource );
void CFileSourceFilterImpl_UninitIFileSourceFilter(
CFileSourceFilterImpl* This );
HRESULT QUARTZ_CreateAsyncSource(
IUnknown* punkOuter,void** ppobj,
const CLSID* pclsidAsyncSource,
LPCWSTR pwszAsyncSourceName,
LPCWSTR pwszOutPinName,
const AsyncSourceHandlers* pHandler );
HRESULT QUARTZ_CreateAsyncSourcePin(
CAsyncSourceImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CAsyncSourcePinImpl** ppPin,
LPCWSTR pwszPinName );
HRESULT QUARTZ_CreateAsyncReader(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateURLReader(IUnknown* punkOuter,void** ppobj);
#define ASYNCSRC_FILE_BLOCKSIZE 16384
#endif /* WINE_DSHOW_ASYNCSRC_H */
/*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "windef.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "audioutl.h"
void AUDIOUTL_ChangeSign8( BYTE* pbData, DWORD cbData )
{
BYTE* pbEnd = pbData + cbData;
while ( pbData < pbEnd )
{
*pbData ^= 0x80;
pbData ++;
}
}
void AUDIOUTL_ChangeSign16LE( BYTE* pbData, DWORD cbData )
{
BYTE* pbEnd = pbData + cbData;
pbData ++;
while ( pbData < pbEnd )
{
*pbData ^= 0x80;
pbData += 2;
}
}
void AUDIOUTL_ChangeSign16BE( BYTE* pbData, DWORD cbData )
{
BYTE* pbEnd = pbData + cbData;
while ( pbData < pbEnd )
{
*pbData ^= 0x80;
pbData += 2;
}
}
void AUDIOUTL_ByteSwap( BYTE* pbData, DWORD cbData )
{
BYTE* pbEnd = pbData + cbData - 1;
BYTE bTemp;
while ( pbData < pbEnd )
{
bTemp = pbData[0];
pbData[0] = pbData[1];
pbData[1] = bTemp;
pbData += 2;
}
}
/*
* 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 */
/*
* Audio Renderer (CLSID_AudioRender)
*
* FIXME
* - implements IRefereneceClock.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef WINE_DSHOW_AUDREN_H
#define WINE_DSHOW_AUDREN_H
#include "iunk.h"
#include "basefilt.h"
#include "seekpass.h"
#define WINE_QUARTZ_WAVEOUT_COUNT 4
typedef struct CAudioRendererImpl CAudioRendererImpl;
typedef struct CAudioRendererPinImpl CAudioRendererPinImpl;
typedef struct AudRen_IBasicAudioImpl
{
ICOM_VFIELD(IBasicAudio);
} AudRen_IBasicAudioImpl;
struct CAudioRendererImpl
{
QUARTZ_IUnkImpl unk;
CBaseFilterImpl basefilter;
AudRen_IBasicAudioImpl basaud;
QUARTZ_IFDelegation qiext;
CSeekingPassThru* pSeekPass;
CAudioRendererPinImpl* pPin;
CRITICAL_SECTION m_csReceive;
BOOL m_fInFlush;
/* for waveOut */
long m_lAudioVolume;
long m_lAudioBalance;
BOOL m_fWaveOutInit;
HANDLE m_hEventRender;
HWAVEOUT m_hWaveOut;
DWORD m_dwBlockSize;
WAVEHDR* m_phdrCur;
WAVEHDR m_hdr[WINE_QUARTZ_WAVEOUT_COUNT];
};
struct CAudioRendererPinImpl
{
QUARTZ_IUnkImpl unk;
CPinBaseImpl pin;
CMemInputPinBaseImpl meminput;
CAudioRendererImpl* pRender;
};
#define CAudioRendererImpl_THIS(iface,member) CAudioRendererImpl* This = ((CAudioRendererImpl*)(((char*)iface)-offsetof(CAudioRendererImpl,member)))
#define CAudioRendererPinImpl_THIS(iface,member) CAudioRendererPinImpl* This = ((CAudioRendererPinImpl*)(((char*)iface)-offsetof(CAudioRendererPinImpl,member)))
HRESULT CAudioRendererImpl_InitIBasicAudio( CAudioRendererImpl* This );
void CAudioRendererImpl_UninitIBasicAudio( CAudioRendererImpl* This );
HRESULT QUARTZ_CreateAudioRenderer(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateAudioRendererPin(
CAudioRendererImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CRITICAL_SECTION* pcsPinReceive,
CAudioRendererPinImpl** ppPin);
#endif /* WINE_DSHOW_AUDREN_H */
/*
* 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 */
/*
* Implementation of CLSID_CaptureGraphBuilder[2].
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* FIXME - stub
* FIXME - not tested
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "strmif.h"
#include "control.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "capgraph.h"
/***************************************************************************
*
* CCaptureGraph::ICaptureGraphBuilder
*
*/
static HRESULT WINAPI
ICaptureGraphBuilder_fnQueryInterface(ICaptureGraphBuilder* iface,REFIID riid,void** ppobj)
{
CCaptureGraph_THIS(iface,capgraph1);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
ICaptureGraphBuilder_fnAddRef(ICaptureGraphBuilder* iface)
{
CCaptureGraph_THIS(iface,capgraph1);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
ICaptureGraphBuilder_fnRelease(ICaptureGraphBuilder* iface)
{
CCaptureGraph_THIS(iface,capgraph1);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
ICaptureGraphBuilder_fnSetFiltergraph(ICaptureGraphBuilder* iface,IGraphBuilder* pgb)
{
CCaptureGraph_THIS(iface,capgraph1);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
ICaptureGraphBuilder_fnGetFiltergraph(ICaptureGraphBuilder* iface,IGraphBuilder** ppgb)
{
CCaptureGraph_THIS(iface,capgraph1);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
ICaptureGraphBuilder_fnSetOutputFileName(ICaptureGraphBuilder* iface,const GUID* pguidType,LPCOLESTR pName,IBaseFilter** ppFilter,IFileSinkFilter** ppSink)
{
CCaptureGraph_THIS(iface,capgraph1);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
ICaptureGraphBuilder_fnFindInterface(ICaptureGraphBuilder* iface,const GUID* pguidCat,IBaseFilter* pFilter,REFIID riid,void** ppvobj)
{
CCaptureGraph_THIS(iface,capgraph1);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
ICaptureGraphBuilder_fnRenderStream(ICaptureGraphBuilder* iface,const GUID* pguidCat,IUnknown* pSource,IBaseFilter* pCompressor,IBaseFilter* pRenderer)
{
CCaptureGraph_THIS(iface,capgraph1);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
ICaptureGraphBuilder_fnControlStream(ICaptureGraphBuilder* iface,const GUID* pguidCat,IBaseFilter* pFilter,REFERENCE_TIME* prtStart,REFERENCE_TIME* prtStop,WORD wStartCookie,WORD wStopCookie)
{
CCaptureGraph_THIS(iface,capgraph1);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
ICaptureGraphBuilder_fnAllocCapFile(ICaptureGraphBuilder* iface,LPCOLESTR pName,DWORDLONG llSize)
{
CCaptureGraph_THIS(iface,capgraph1);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
ICaptureGraphBuilder_fnCopyCaptureFile(ICaptureGraphBuilder* iface,LPOLESTR pOrgName,LPOLESTR pNewName,int fAllowEscAbort,IAMCopyCaptureFileProgress* pCallback)
{
CCaptureGraph_THIS(iface,capgraph1);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static ICOM_VTABLE(ICaptureGraphBuilder) icapgraph1 =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
ICaptureGraphBuilder_fnQueryInterface,
ICaptureGraphBuilder_fnAddRef,
ICaptureGraphBuilder_fnRelease,
/* ICaptureGraphBuilder fields */
ICaptureGraphBuilder_fnSetFiltergraph,
ICaptureGraphBuilder_fnGetFiltergraph,
ICaptureGraphBuilder_fnSetOutputFileName,
ICaptureGraphBuilder_fnFindInterface,
ICaptureGraphBuilder_fnRenderStream,
ICaptureGraphBuilder_fnControlStream,
ICaptureGraphBuilder_fnAllocCapFile,
ICaptureGraphBuilder_fnCopyCaptureFile,
};
static HRESULT CCaptureGraph_InitICaptureGraphBuilder( CCaptureGraph* This )
{
TRACE("(%p)\n",This);
ICOM_VTBL(&This->capgraph1) = &icapgraph1;
return NOERROR;
}
static void CCaptureGraph_UninitICaptureGraphBuilder( CCaptureGraph* This )
{
TRACE("(%p)\n",This);
}
/***************************************************************************
*
* new/delete for CCaptureGraph
*
*/
/* can I use offsetof safely? - FIXME? */
static QUARTZ_IFEntry IFEntries[] =
{
{ &IID_ICaptureGraphBuilder, offsetof(CCaptureGraph,capgraph1)-offsetof(CCaptureGraph,unk) },
};
static void QUARTZ_DestroyCaptureGraph(IUnknown* punk)
{
CCaptureGraph_THIS(punk,unk);
TRACE( "(%p)\n", This );
CCaptureGraph_UninitICaptureGraphBuilder(This);
}
HRESULT QUARTZ_CreateCaptureGraph(IUnknown* punkOuter,void** ppobj)
{
CCaptureGraph* pcg;
HRESULT hr;
TRACE("(%p,%p)\n",punkOuter,ppobj);
pcg = (CCaptureGraph*)QUARTZ_AllocObj( sizeof(CCaptureGraph) );
if ( pcg == NULL )
return E_OUTOFMEMORY;
QUARTZ_IUnkInit( &pcg->unk, punkOuter );
pcg->m_pfg = NULL;
hr = CCaptureGraph_InitICaptureGraphBuilder(pcg);
if ( FAILED(hr) )
{
QUARTZ_FreeObj(pcg);
return hr;
}
pcg->unk.pEntries = IFEntries;
pcg->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
pcg->unk.pOnFinalRelease = QUARTZ_DestroyCaptureGraph;
*ppobj = (void*)(&pcg->unk);
return S_OK;
}
/*
* Implementation of CLSID_CaptureGraphBuilder[2].
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef WINE_DSHOW_CAPGRAPH_H
#define WINE_DSHOW_CAPGRAPH_H
#include "iunk.h"
typedef struct CapGraph_ICaptureGraphBuilderImpl
{
ICOM_VFIELD(ICaptureGraphBuilder);
} CapGraph_ICaptureGraphBuilderImpl;
typedef struct CCaptureGraph
{
QUARTZ_IUnkImpl unk;
CapGraph_ICaptureGraphBuilderImpl capgraph1;
/* ICaptureGraphBuilder fields. */
IGraphBuilder* m_pfg;
} CCaptureGraph;
#define CCaptureGraph_THIS(iface,member) CCaptureGraph* This = ((CCaptureGraph*)(((char*)iface)-offsetof(CCaptureGraph,member)))
#define CCaptureGraph_ICaptureGraphBuilder(th) ((ICaptureGraphBuilder*)&((th)->capgraph1))
HRESULT QUARTZ_CreateCaptureGraph(IUnknown* punkOuter,void** ppobj);
#endif /* WINE_DSHOW_CAPGRAPH_H */
/*
* List of components. (for internal use)
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wine/obj_base.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "complist.h"
struct QUARTZ_CompList
{
QUARTZ_CompListItem* pFirst;
QUARTZ_CompListItem* pLast;
CRITICAL_SECTION csList;
};
struct QUARTZ_CompListItem
{
IUnknown* punk;
QUARTZ_CompListItem* pNext;
QUARTZ_CompListItem* pPrev;
void* pvData;
DWORD dwDataLen;
};
QUARTZ_CompList* QUARTZ_CompList_Alloc( void )
{
QUARTZ_CompList* pList;
pList = (QUARTZ_CompList*)QUARTZ_AllocMem( sizeof(QUARTZ_CompList) );
if ( pList != NULL )
{
/* construct. */
pList->pFirst = NULL;
pList->pLast = NULL;
InitializeCriticalSection( &pList->csList );
}
return pList;
}
void QUARTZ_CompList_Free( QUARTZ_CompList* pList )
{
QUARTZ_CompListItem* pCur;
QUARTZ_CompListItem* pNext;
if ( pList != NULL )
{
pCur = pList->pFirst;
while ( pCur != NULL )
{
pNext = pCur->pNext;
if ( pCur->punk != NULL )
IUnknown_Release( pCur->punk );
if ( pCur->pvData != NULL )
QUARTZ_FreeMem( pCur->pvData );
QUARTZ_FreeMem( pCur );
pCur = pNext;
}
DeleteCriticalSection( &pList->csList );
QUARTZ_FreeMem( pList );
}
}
void QUARTZ_CompList_Lock( QUARTZ_CompList* pList )
{
EnterCriticalSection( &pList->csList );
}
void QUARTZ_CompList_Unlock( QUARTZ_CompList* pList )
{
LeaveCriticalSection( &pList->csList );
}
QUARTZ_CompList* QUARTZ_CompList_Dup(
const QUARTZ_CompList* pList, BOOL fDupData )
{
QUARTZ_CompList* pNewList;
const QUARTZ_CompListItem* pCur;
HRESULT hr;
pNewList = QUARTZ_CompList_Alloc();
if ( pNewList == NULL )
return NULL;
pCur = pList->pFirst;
while ( pCur != NULL )
{
if ( pCur->punk != NULL )
{
if ( fDupData )
hr = QUARTZ_CompList_AddComp(
pNewList, pCur->punk,
pCur->pvData, pCur->dwDataLen );
else
hr = QUARTZ_CompList_AddComp(
pNewList, pCur->punk, NULL, 0 );
if ( FAILED(hr) )
{
QUARTZ_CompList_Free( pNewList );
return NULL;
}
}
pCur = pCur->pNext;
}
return pNewList;
}
static QUARTZ_CompListItem* QUARTZ_CompList_AllocComp(
QUARTZ_CompList* pList, IUnknown* punk,
const void* pvData, DWORD dwDataLen )
{
QUARTZ_CompListItem* pItem;
pItem = (QUARTZ_CompListItem*)QUARTZ_AllocMem( sizeof(QUARTZ_CompListItem) );
if ( pItem == NULL )
return NULL;
pItem->pvData = NULL;
pItem->dwDataLen = 0;
if ( pvData != NULL )
{
pItem->pvData = (void*)QUARTZ_AllocMem( dwDataLen );
if ( pItem->pvData == NULL )
{
QUARTZ_FreeMem( pItem );
return NULL;
}
memcpy( pItem->pvData, pvData, dwDataLen );
pItem->dwDataLen = dwDataLen;
}
pItem->punk = punk; IUnknown_AddRef(punk);
return pItem;
}
HRESULT QUARTZ_CompList_AddComp(
QUARTZ_CompList* pList, IUnknown* punk,
const void* pvData, DWORD dwDataLen )
{
QUARTZ_CompListItem* pItem;
pItem = QUARTZ_CompList_AllocComp( pList, punk, pvData, dwDataLen );
if ( pItem == NULL )
return E_OUTOFMEMORY;
if ( pList->pFirst != NULL )
pList->pFirst->pPrev = pItem;
else
pList->pLast = pItem;
pItem->pNext = pList->pFirst;
pList->pFirst = pItem;
pItem->pPrev = NULL;
return S_OK;
}
HRESULT QUARTZ_CompList_AddTailComp(
QUARTZ_CompList* pList, IUnknown* punk,
const void* pvData, DWORD dwDataLen )
{
QUARTZ_CompListItem* pItem;
pItem = QUARTZ_CompList_AllocComp( pList, punk, pvData, dwDataLen );
if ( pItem == NULL )
return E_OUTOFMEMORY;
if ( pList->pLast != NULL )
pList->pLast->pNext = pItem;
else
pList->pFirst = pItem;
pItem->pPrev = pList->pLast;
pList->pLast = pItem;
pItem->pNext = NULL;
return S_OK;
}
HRESULT QUARTZ_CompList_RemoveComp( QUARTZ_CompList* pList, IUnknown* punk )
{
QUARTZ_CompListItem* pCur;
pCur = QUARTZ_CompList_SearchComp( pList, punk );
if ( pCur == NULL )
return S_FALSE; /* already removed. */
/* remove from list. */
if ( pCur->pNext != NULL )
pCur->pNext->pPrev = pCur->pPrev;
else
pList->pLast = pCur->pPrev;
if ( pCur->pPrev != NULL )
pCur->pPrev->pNext = pCur->pNext;
else
pList->pFirst = pCur->pNext;
/* release this item. */
if ( pCur->punk != NULL )
IUnknown_Release( pCur->punk );
if ( pCur->pvData != NULL )
QUARTZ_FreeMem( pCur->pvData );
QUARTZ_FreeMem( pCur );
return S_OK;
}
QUARTZ_CompListItem* QUARTZ_CompList_SearchComp(
QUARTZ_CompList* pList, IUnknown* punk )
{
QUARTZ_CompListItem* pCur;
pCur = pList->pFirst;
while ( pCur != NULL )
{
if ( pCur->punk == punk )
return pCur;
pCur = pCur->pNext;
}
return NULL;
}
QUARTZ_CompListItem* QUARTZ_CompList_SearchData(
QUARTZ_CompList* pList, const void* pvData, DWORD dwDataLen )
{
QUARTZ_CompListItem* pCur;
pCur = pList->pFirst;
while ( pCur != NULL )
{
if ( pCur->dwDataLen == dwDataLen &&
!memcmp( pCur->pvData, pvData, dwDataLen ) )
return pCur;
pCur = pCur->pNext;
}
return NULL;
}
QUARTZ_CompListItem* QUARTZ_CompList_GetFirst(
QUARTZ_CompList* pList )
{
return pList->pFirst;
}
QUARTZ_CompListItem* QUARTZ_CompList_GetLast(
QUARTZ_CompList* pList )
{
return pList->pLast;
}
QUARTZ_CompListItem* QUARTZ_CompList_GetNext(
QUARTZ_CompList* pList, QUARTZ_CompListItem* pPrev )
{
return pPrev->pNext;
}
QUARTZ_CompListItem* QUARTZ_CompList_GetPrev(
QUARTZ_CompList* pList, QUARTZ_CompListItem* pNext )
{
return pNext->pPrev;
}
IUnknown* QUARTZ_CompList_GetItemPtr( QUARTZ_CompListItem* pItem )
{
return pItem->punk;
}
const void* QUARTZ_CompList_GetDataPtr( QUARTZ_CompListItem* pItem )
{
return pItem->pvData;
}
DWORD QUARTZ_CompList_GetDataLength( QUARTZ_CompListItem* pItem )
{
return pItem->dwDataLen;
}
/*
* List of components. (for internal use)
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef QUARTZ_COMPLIST_H
#define QUARTZ_COMPLIST_H
typedef struct QUARTZ_CompList QUARTZ_CompList;
typedef struct QUARTZ_CompListItem QUARTZ_CompListItem;
QUARTZ_CompList* QUARTZ_CompList_Alloc( void );
void QUARTZ_CompList_Free( QUARTZ_CompList* pList );
void QUARTZ_CompList_Lock( QUARTZ_CompList* pList );
void QUARTZ_CompList_Unlock( QUARTZ_CompList* pList );
QUARTZ_CompList* QUARTZ_CompList_Dup(
const QUARTZ_CompList* pList, BOOL fDupData );
HRESULT QUARTZ_CompList_AddComp(
QUARTZ_CompList* pList, IUnknown* punk,
const void* pvData, DWORD dwDataLen );
HRESULT QUARTZ_CompList_AddTailComp(
QUARTZ_CompList* pList, IUnknown* punk,
const void* pvData, DWORD dwDataLen );
HRESULT QUARTZ_CompList_RemoveComp( QUARTZ_CompList* pList, IUnknown* punk );
QUARTZ_CompListItem* QUARTZ_CompList_SearchComp(
QUARTZ_CompList* pList, IUnknown* punk );
QUARTZ_CompListItem* QUARTZ_CompList_SearchData(
QUARTZ_CompList* pList, const void* pvData, DWORD dwDataLen );
QUARTZ_CompListItem* QUARTZ_CompList_GetFirst(
QUARTZ_CompList* pList );
QUARTZ_CompListItem* QUARTZ_CompList_GetLast(
QUARTZ_CompList* pList );
QUARTZ_CompListItem* QUARTZ_CompList_GetNext(
QUARTZ_CompList* pList, QUARTZ_CompListItem* pPrev );
QUARTZ_CompListItem* QUARTZ_CompList_GetPrev(
QUARTZ_CompList* pList, QUARTZ_CompListItem* pNext );
IUnknown* QUARTZ_CompList_GetItemPtr( QUARTZ_CompListItem* pItem );
const void* QUARTZ_CompList_GetDataPtr( QUARTZ_CompListItem* pItem );
DWORD QUARTZ_CompList_GetDataLength( QUARTZ_CompListItem* pItem );
#endif /* QUARTZ_COMPLIST_H */
/*
* 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 */
/*
* Implementation of IEnumUnknown (for internal use).
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wine/obj_base.h"
#include "wine/obj_misc.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "enumunk.h"
#include "iunk.h"
typedef struct IEnumUnknownImpl
{
ICOM_VFIELD(IEnumUnknown);
} IEnumUnknownImpl;
typedef struct
{
QUARTZ_IUnkImpl unk;
IEnumUnknownImpl enumunk;
struct QUARTZ_IFEntry IFEntries[1];
QUARTZ_CompList* pCompList;
QUARTZ_CompListItem* pItemCur;
} CEnumUnknown;
#define CEnumUnknown_THIS(iface,member) CEnumUnknown* This = ((CEnumUnknown*)(((char*)iface)-offsetof(CEnumUnknown,member)))
static HRESULT WINAPI
IEnumUnknown_fnQueryInterface(IEnumUnknown* iface,REFIID riid,void** ppobj)
{
CEnumUnknown_THIS(iface,enumunk);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IEnumUnknown_fnAddRef(IEnumUnknown* iface)
{
CEnumUnknown_THIS(iface,enumunk);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IEnumUnknown_fnRelease(IEnumUnknown* iface)
{
CEnumUnknown_THIS(iface,enumunk);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IEnumUnknown_fnNext(IEnumUnknown* iface,ULONG cReq,IUnknown** ppunk,ULONG* pcFetched)
{
CEnumUnknown_THIS(iface,enumunk);
HRESULT hr;
ULONG cFetched;
TRACE("(%p)->(%lu,%p,%p)\n",This,cReq,ppunk,pcFetched);
if ( pcFetched == NULL && cReq > 1 )
return E_INVALIDARG;
if ( ppunk == NULL )
return E_POINTER;
QUARTZ_CompList_Lock( This->pCompList );
hr = NOERROR;
cFetched = 0;
while ( cReq > 0 )
{
if ( This->pItemCur == NULL )
{
hr = S_FALSE;
break;
}
ppunk[ cFetched ++ ] = QUARTZ_CompList_GetItemPtr( This->pItemCur );
IUnknown_AddRef( *ppunk );
This->pItemCur =
QUARTZ_CompList_GetNext( This->pCompList, This->pItemCur );
cReq --;
}
QUARTZ_CompList_Unlock( This->pCompList );
if ( pcFetched != NULL )
*pcFetched = cFetched;
return hr;
}
static HRESULT WINAPI
IEnumUnknown_fnSkip(IEnumUnknown* iface,ULONG cSkip)
{
CEnumUnknown_THIS(iface,enumunk);
HRESULT hr;
TRACE("(%p)->()\n",This);
QUARTZ_CompList_Lock( This->pCompList );
hr = NOERROR;
while ( cSkip > 0 )
{
if ( This->pItemCur == NULL )
{
hr = S_FALSE;
break;
}
This->pItemCur =
QUARTZ_CompList_GetNext( This->pCompList, This->pItemCur );
cSkip --;
}
QUARTZ_CompList_Unlock( This->pCompList );
return hr;
}
static HRESULT WINAPI
IEnumUnknown_fnReset(IEnumUnknown* iface)
{
CEnumUnknown_THIS(iface,enumunk);
TRACE("(%p)->()\n",This);
QUARTZ_CompList_Lock( This->pCompList );
This->pItemCur = QUARTZ_CompList_GetFirst( This->pCompList );
QUARTZ_CompList_Unlock( This->pCompList );
return NOERROR;
}
static HRESULT WINAPI
IEnumUnknown_fnClone(IEnumUnknown* iface,IEnumUnknown** ppunk)
{
CEnumUnknown_THIS(iface,enumunk);
HRESULT hr;
TRACE("(%p)->()\n",This);
if ( ppunk == NULL )
return E_POINTER;
QUARTZ_CompList_Lock( This->pCompList );
hr = QUARTZ_CreateEnumUnknown(
This->IFEntries[0].piid,
(void**)ppunk,
This->pCompList );
FIXME( "current pointer must be seeked correctly\n" );
QUARTZ_CompList_Unlock( This->pCompList );
return hr;
}
static ICOM_VTABLE(IEnumUnknown) ienumunk =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IEnumUnknown_fnQueryInterface,
IEnumUnknown_fnAddRef,
IEnumUnknown_fnRelease,
/* IEnumUnknown fields */
IEnumUnknown_fnNext,
IEnumUnknown_fnSkip,
IEnumUnknown_fnReset,
IEnumUnknown_fnClone,
};
void QUARTZ_DestroyEnumUnknown(IUnknown* punk)
{
CEnumUnknown_THIS(punk,unk);
if ( This->pCompList != NULL )
QUARTZ_CompList_Free( This->pCompList );
}
HRESULT QUARTZ_CreateEnumUnknown(
REFIID riidEnum, void** ppobj, const QUARTZ_CompList* pCompList )
{
CEnumUnknown* penum;
QUARTZ_CompList* pCompListDup;
TRACE("(%s,%p,%p)\n",debugstr_guid(riidEnum),ppobj,pCompList);
pCompListDup = QUARTZ_CompList_Dup( pCompList, FALSE );
if ( pCompListDup == NULL )
return E_OUTOFMEMORY;
penum = (CEnumUnknown*)QUARTZ_AllocObj( sizeof(CEnumUnknown) );
if ( penum == NULL )
{
QUARTZ_CompList_Free( pCompListDup );
return E_OUTOFMEMORY;
}
QUARTZ_IUnkInit( &penum->unk, NULL );
ICOM_VTBL(&penum->enumunk) = &ienumunk;
penum->IFEntries[0].piid = riidEnum;
penum->IFEntries[0].ofsVTPtr =
offsetof(CEnumUnknown,enumunk)-offsetof(CEnumUnknown,unk);
penum->pCompList = pCompListDup;
penum->pItemCur = QUARTZ_CompList_GetFirst( pCompListDup );
penum->unk.pEntries = penum->IFEntries;
penum->unk.dwEntries = 1;
penum->unk.pOnFinalRelease = QUARTZ_DestroyEnumUnknown;
*ppobj = (void*)(&penum->enumunk);
return S_OK;
}
/*
* Implementation of IEnumUnknown (for internal use).
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef QUARTZ_ENUMUNK_H
#define QUARTZ_ENUMUNK_H
#include "complist.h"
HRESULT QUARTZ_CreateEnumUnknown(
REFIID riidEnum, void** ppobj, const QUARTZ_CompList* pCompList );
#endif /* QUARTZ_ENUMUNK_H */
/*
* Implementation of CLSID_FilterGraph.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "strmif.h"
#include "control.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "fgraph.h"
/***************************************************************************
*
* new/delete for CFilterGraph
*
*/
/* can I use offsetof safely? - FIXME? */
static QUARTZ_IFEntry IFEntries[] =
{
{ &IID_IPersist, offsetof(CFilterGraph,persist)-offsetof(CFilterGraph,unk) },
{ &IID_IDispatch, offsetof(CFilterGraph,disp)-offsetof(CFilterGraph,unk) },
{ &IID_IFilterGraph, offsetof(CFilterGraph,fgraph)-offsetof(CFilterGraph,unk) },
{ &IID_IGraphBuilder, offsetof(CFilterGraph,fgraph)-offsetof(CFilterGraph,unk) },
{ &IID_IFilterGraph2, offsetof(CFilterGraph,fgraph)-offsetof(CFilterGraph,unk) },
{ &IID_IGraphVersion, offsetof(CFilterGraph,graphversion)-offsetof(CFilterGraph,unk) },
{ &IID_IMediaControl, offsetof(CFilterGraph,mediacontrol)-offsetof(CFilterGraph,unk) },
{ &IID_IMediaFilter, offsetof(CFilterGraph,mediafilter)-offsetof(CFilterGraph,unk) },
{ &IID_IMediaEvent, offsetof(CFilterGraph,mediaevent)-offsetof(CFilterGraph,unk) },
{ &IID_IMediaEventEx, offsetof(CFilterGraph,mediaevent)-offsetof(CFilterGraph,unk) },
{ &IID_IMediaEventSink, offsetof(CFilterGraph,mediaeventsink)-offsetof(CFilterGraph,unk) },
{ &IID_IMediaPosition, offsetof(CFilterGraph,mediaposition)-offsetof(CFilterGraph,unk) },
{ &IID_IMediaSeeking, offsetof(CFilterGraph,mediaseeking)-offsetof(CFilterGraph,unk) },
{ &IID_IBasicVideo, offsetof(CFilterGraph,basvid)-offsetof(CFilterGraph,unk) },
{ &IID_IBasicAudio, offsetof(CFilterGraph,basaud)-offsetof(CFilterGraph,unk) },
{ &IID_IVideoWindow, offsetof(CFilterGraph,vidwin)-offsetof(CFilterGraph,unk) },
};
struct FGInitEntry
{
HRESULT (*pInit)(CFilterGraph*);
void (*pUninit)(CFilterGraph*);
};
static const struct FGInitEntry FGRAPH_Init[] =
{
#define FGENT(a) {&CFilterGraph_Init##a,&CFilterGraph_Uninit##a},
FGENT(IPersist)
FGENT(IDispatch)
FGENT(IFilterGraph2)
FGENT(IGraphVersion)
FGENT(IMediaControl)
FGENT(IMediaFilter)
FGENT(IMediaEventEx)
FGENT(IMediaEventSink)
FGENT(IMediaPosition)
FGENT(IMediaSeeking)
FGENT(IBasicVideo)
FGENT(IBasicAudio)
FGENT(IVideoWindow)
#undef FGENT
{ NULL, NULL },
};
static void QUARTZ_DestroyFilterGraph(IUnknown* punk)
{
CFilterGraph_THIS(punk,unk);
int i;
TRACE( "(%p)\n", punk );
/* At first, call Stop. */
IMediaControl_Stop( CFilterGraph_IMediaControl(This) );
IMediaFilter_Stop( CFilterGraph_IMediaFilter(This) );
i = 0;
while ( FGRAPH_Init[i].pInit != NULL )
{
FGRAPH_Init[i].pUninit( This );
i++;
}
TRACE( "succeeded.\n" );
}
HRESULT QUARTZ_CreateFilterGraph(IUnknown* punkOuter,void** ppobj)
{
CFilterGraph* pfg;
HRESULT hr;
int i;
TRACE("(%p,%p)\n",punkOuter,ppobj);
pfg = (CFilterGraph*)QUARTZ_AllocObj( sizeof(CFilterGraph) );
if ( pfg == NULL )
return E_OUTOFMEMORY;
QUARTZ_IUnkInit( &pfg->unk, punkOuter );
i = 0;
hr = NOERROR;
while ( FGRAPH_Init[i].pInit != NULL )
{
hr = FGRAPH_Init[i].pInit( pfg );
if ( FAILED(hr) )
break;
i++;
}
if ( FAILED(hr) )
{
while ( --i >= 0 )
FGRAPH_Init[i].pUninit( pfg );
QUARTZ_FreeObj( pfg );
return hr;
}
pfg->unk.pEntries = IFEntries;
pfg->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]);
pfg->unk.pOnFinalRelease = QUARTZ_DestroyFilterGraph;
*ppobj = (void*)(&pfg->unk);
return S_OK;
}
/***************************************************************************
*
* CFilterGraph::IPersist
*
*/
static HRESULT WINAPI
IPersist_fnQueryInterface(IPersist* iface,REFIID riid,void** ppobj)
{
CFilterGraph_THIS(iface,persist);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IPersist_fnAddRef(IPersist* iface)
{
CFilterGraph_THIS(iface,persist);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IPersist_fnRelease(IPersist* iface)
{
CFilterGraph_THIS(iface,persist);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IPersist_fnGetClassID(IPersist* iface,CLSID* pclsid)
{
CFilterGraph_THIS(iface,persist);
TRACE("(%p)->()\n",This);
if ( pclsid == NULL )
return E_POINTER;
memcpy( pclsid, &CLSID_FilterGraph, sizeof(CLSID) );
return E_NOTIMPL;
}
static ICOM_VTABLE(IPersist) ipersist =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IPersist_fnQueryInterface,
IPersist_fnAddRef,
IPersist_fnRelease,
/* IPersist fields */
IPersist_fnGetClassID,
};
HRESULT CFilterGraph_InitIPersist( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
ICOM_VTBL(&pfg->persist) = &ipersist;
return NOERROR;
}
void CFilterGraph_UninitIPersist( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
}
/***************************************************************************
*
* CFilterGraph::IDispatch
*
*/
static HRESULT WINAPI
IDispatch_fnQueryInterface(IDispatch* iface,REFIID riid,void** ppobj)
{
CFilterGraph_THIS(iface,disp);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IDispatch_fnAddRef(IDispatch* iface)
{
CFilterGraph_THIS(iface,disp);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IDispatch_fnRelease(IDispatch* iface)
{
CFilterGraph_THIS(iface,disp);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IDispatch_fnGetTypeInfoCount(IDispatch* iface,UINT* pcTypeInfo)
{
CFilterGraph_THIS(iface,disp);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IDispatch_fnGetTypeInfo(IDispatch* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
{
CFilterGraph_THIS(iface,disp);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IDispatch_fnGetIDsOfNames(IDispatch* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
{
CFilterGraph_THIS(iface,disp);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IDispatch_fnInvoke(IDispatch* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
CFilterGraph_THIS(iface,disp);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static ICOM_VTABLE(IDispatch) idispatch =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IDispatch_fnQueryInterface,
IDispatch_fnAddRef,
IDispatch_fnRelease,
/* IDispatch fields */
IDispatch_fnGetTypeInfoCount,
IDispatch_fnGetTypeInfo,
IDispatch_fnGetIDsOfNames,
IDispatch_fnInvoke,
};
HRESULT CFilterGraph_InitIDispatch( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
ICOM_VTBL(&pfg->disp) = &idispatch;
return NOERROR;
}
void CFilterGraph_UninitIDispatch( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
}
/*
* 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 */
/*
* Implements CLSID_FileWriter.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef WINE_DSHOW_FILESINK_H
#define WINE_DSHOW_FILESINK_H
#include "iunk.h"
#include "basefilt.h"
#include "seekpass.h"
typedef struct CFileWriterImpl CFileWriterImpl;
typedef struct CFileWriterPinImpl CFileWriterPinImpl;
typedef struct FileWriterPin_IStreamImpl
{
ICOM_VFIELD(IStream);
} FileWriterPin_IStreamImpl;
typedef struct FileWriter_IFileSinkFilter2Impl
{
ICOM_VFIELD(IFileSinkFilter2);
} FileWriter_IFileSinkFilter2Impl;
struct CFileWriterImpl
{
QUARTZ_IUnkImpl unk;
CBaseFilterImpl basefilter;
FileWriter_IFileSinkFilter2Impl filesink;
QUARTZ_IFDelegation qiext;
CSeekingPassThru* pSeekPass;
CFileWriterPinImpl* pPin;
CRITICAL_SECTION m_csReceive;
BOOL m_fInFlush;
/* for writing */
HANDLE m_hFile;
WCHAR* m_pszFileName;
DWORD m_cbFileName;
DWORD m_dwMode;
AM_MEDIA_TYPE m_mt;
};
struct CFileWriterPinImpl
{
QUARTZ_IUnkImpl unk;
CPinBaseImpl pin;
CMemInputPinBaseImpl meminput;
FileWriterPin_IStreamImpl stream;
CFileWriterImpl* pRender;
};
#define CFileWriterImpl_THIS(iface,member) CFileWriterImpl* This = ((CFileWriterImpl*)(((char*)iface)-offsetof(CFileWriterImpl,member)))
#define CFileWriterPinImpl_THIS(iface,member) CFileWriterPinImpl* This = ((CFileWriterPinImpl*)(((char*)iface)-offsetof(CFileWriterPinImpl,member)))
#define CFileWriterPinImpl_IStream(th) ((IStream*)&((th)->stream))
HRESULT CFileWriterPinImpl_InitIStream( CFileWriterPinImpl* This );
HRESULT CFileWriterPinImpl_UninitIStream( CFileWriterPinImpl* This );
HRESULT CFileWriterImpl_InitIFileSinkFilter2( CFileWriterImpl* This );
HRESULT CFileWriterImpl_UninitIFileSinkFilter2( CFileWriterImpl* This );
HRESULT QUARTZ_CreateFileWriter(IUnknown* punkOuter,void** ppobj);
HRESULT QUARTZ_CreateFileWriterPin(
CFileWriterImpl* pFilter,
CRITICAL_SECTION* pcsPin,
CRITICAL_SECTION* pcsPinReceive,
CFileWriterPinImpl** ppPin);
#endif /* WINE_DSHOW_FILESINK_H */
/*
* 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 */
/*
* A simple wrapper of JPEG decoder.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "ijgdec.h"
#if defined(HAVE_LIBJPEG) && defined(HAVE_JPEGLIB_H)
#include <jpeglib.h>
#include <jerror.h>
#include <setjmp.h>
typedef struct IJGSrcImpl IJGSrcImpl;
typedef struct IJGErrImpl IJGErrImpl;
struct IJGSrcImpl
{
struct jpeg_source_mgr pub; /* must be first */
const char** ppsrcs;
const int* plenofsrcs;
int srccount;
int srcindex;
};
struct IJGErrImpl
{
struct jpeg_error_mgr err;
jmp_buf env;
};
/* for the jpeg decompressor source manager. */
static void IJGDec_init_source(j_decompress_ptr cinfo) {}
static boolean IJGDec_fill_input_buffer(j_decompress_ptr cinfo)
{
IJGSrcImpl* pImpl = (IJGSrcImpl*)cinfo->src;
if ( pImpl->srcindex >= pImpl->srccount )
{
ERREXIT(cinfo, JERR_INPUT_EMPTY);
}
pImpl->pub.next_input_byte = pImpl->ppsrcs[pImpl->srcindex];
pImpl->pub.bytes_in_buffer = pImpl->plenofsrcs[pImpl->srcindex];
pImpl->srcindex ++;
return TRUE;
}
static void IJGDec_skip_input_data(j_decompress_ptr cinfo,long num_bytes)
{
IJGSrcImpl* pImpl = (IJGSrcImpl*)cinfo->src;
if ( num_bytes <= 0 ) return;
while ( num_bytes > pImpl->pub.bytes_in_buffer )
{
num_bytes -= pImpl->pub.bytes_in_buffer;
if ( !IJGDec_fill_input_buffer(cinfo) )
{
ERREXIT(cinfo, JERR_INPUT_EMPTY);
}
}
pImpl->pub.next_input_byte += num_bytes;
pImpl->pub.bytes_in_buffer -= num_bytes;
}
static void IJGDec_term_source(j_decompress_ptr cinfo)
{
}
static void IJGDec_error_exit(j_common_ptr cinfo)
{
IJGErrImpl* pImpl = (IJGErrImpl*)cinfo->err;
longjmp(pImpl->env,1);
}
static void rgb_to_bgr(char* pdata,int width)
{
int x;
char c;
for(x=0;x<width;x++)
{
c = pdata[0];
pdata[0] = pdata[2];
pdata[2] = c;
pdata += 3;
}
}
int IJGDEC_Decode( char* pdst, int dstpitch, int dstwidth, int dstheight, int dstbpp, const char** ppsrcs, const int* plenofsrcs, int srccount )
{
IJGSrcImpl jsrc;
IJGErrImpl jerr;
struct jpeg_decompress_struct jdec;
int ret = -1;
jsrc.ppsrcs = ppsrcs;
jsrc.plenofsrcs = plenofsrcs;
jsrc.srccount = srccount;
jsrc.srcindex = 0;
jsrc.pub.bytes_in_buffer = 0;
jsrc.pub.next_input_byte = NULL;
jsrc.pub.init_source = IJGDec_init_source;
jsrc.pub.fill_input_buffer = IJGDec_fill_input_buffer;
jsrc.pub.skip_input_data = IJGDec_skip_input_data;
jsrc.pub.resync_to_restart = jpeg_resync_to_restart;
jsrc.pub.term_source = IJGDec_term_source;
jdec.err = jpeg_std_error(&jerr.err);
jerr.err.error_exit = IJGDec_error_exit;
if ( setjmp(jerr.env) != 0 )
{
jpeg_destroy_decompress(&jdec);
return -1;
}
jpeg_create_decompress(&jdec);
jdec.src = &jsrc.pub;
ret = jpeg_read_header(&jdec,TRUE);
if ( ret != JPEG_HEADER_OK ) goto err;
jpeg_start_decompress(&jdec);
if ( jdec.output_width != dstwidth ||
jdec.output_height != dstheight ||
(jdec.output_components*8) != dstbpp ) goto err;
while (jdec.output_scanline < jdec.output_height)
{
jpeg_read_scanlines(&jdec,(JSAMPLE**)&pdst,1);
rgb_to_bgr(pdst,dstwidth);
pdst += dstpitch;
}
jpeg_finish_decompress(&jdec);
ret = 0;
err:
jpeg_destroy_decompress(&jdec);
return ret;
}
#else
int IJGDEC_Decode( char* pdst, int dstpitch, int dstwidth, int dstheight, int dstbpp, const char** ppsrcs, const int* plenofsrcs, int srccount )
{
return -1;
}
#endif
/*
* A simple wrapper of JPEG decoder.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
int IJGDEC_Decode( char* pdst, int dstpitch, int dstwidth, int dstheight, int dstbpp, const char** ppsrcs, const int* plenofsrcs, int srccount );
/*
* Implementation of IMediaControl for FilterGraph.
*
* FIXME - stub.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "oleauto.h"
#include "strmif.h"
#include "control.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "fgraph.h"
static HRESULT WINAPI
IMediaControl_fnQueryInterface(IMediaControl* iface,REFIID riid,void** ppobj)
{
CFilterGraph_THIS(iface,mediacontrol);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
}
static ULONG WINAPI
IMediaControl_fnAddRef(IMediaControl* iface)
{
CFilterGraph_THIS(iface,mediacontrol);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->unk.punkControl);
}
static ULONG WINAPI
IMediaControl_fnRelease(IMediaControl* iface)
{
CFilterGraph_THIS(iface,mediacontrol);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->unk.punkControl);
}
static HRESULT WINAPI
IMediaControl_fnGetTypeInfoCount(IMediaControl* iface,UINT* pcTypeInfo)
{
CFilterGraph_THIS(iface,mediacontrol);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaControl_fnGetTypeInfo(IMediaControl* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
{
CFilterGraph_THIS(iface,mediacontrol);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaControl_fnGetIDsOfNames(IMediaControl* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
{
CFilterGraph_THIS(iface,mediacontrol);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaControl_fnInvoke(IMediaControl* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
CFilterGraph_THIS(iface,mediacontrol);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaControl_fnRun(IMediaControl* iface)
{
CFilterGraph_THIS(iface,mediacontrol);
TRACE("(%p)->()\n",This);
return IMediaFilter_Run( CFilterGraph_IMediaFilter(This),
(REFERENCE_TIME)0 );
}
static HRESULT WINAPI
IMediaControl_fnPause(IMediaControl* iface)
{
CFilterGraph_THIS(iface,mediacontrol);
TRACE("(%p)->()\n",This);
return IMediaFilter_Pause( CFilterGraph_IMediaFilter(This) );
}
static HRESULT WINAPI
IMediaControl_fnStop(IMediaControl* iface)
{
CFilterGraph_THIS(iface,mediacontrol);
HRESULT hr;
FILTER_STATE fs;
TRACE("(%p)->()\n",This);
hr = IMediaControl_GetState(iface,INFINITE,(OAFilterState*)&fs);
if ( SUCCEEDED(hr) && fs == State_Running )
{
hr = IMediaControl_Pause(iface);
if ( SUCCEEDED(hr) )
hr = IMediaControl_GetState(iface,INFINITE,(OAFilterState*)&fs);
}
if ( SUCCEEDED(hr) && fs == State_Paused )
{
hr = IMediaFilter_Stop(CFilterGraph_IMediaFilter(This));
if ( SUCCEEDED(hr) )
hr = IMediaControl_GetState(iface,INFINITE,(OAFilterState*)&fs);
}
return hr;
}
static HRESULT WINAPI
IMediaControl_fnGetState(IMediaControl* iface,LONG lTimeOut,OAFilterState* pFilterState)
{
CFilterGraph_THIS(iface,mediacontrol);
TRACE("(%p)->()\n",This);
return IMediaFilter_GetState( CFilterGraph_IMediaFilter(This), (DWORD)lTimeOut, (FILTER_STATE*)pFilterState );
}
static HRESULT WINAPI
IMediaControl_fnRenderFile(IMediaControl* iface,BSTR bstrFileName)
{
CFilterGraph_THIS(iface,mediacontrol);
UINT uLen;
WCHAR* pwszName;
HRESULT hr;
TRACE("(%p)->()\n",This);
uLen = SysStringLen(bstrFileName);
pwszName = (WCHAR*)QUARTZ_AllocMem( sizeof(WCHAR) * (uLen+1) );
if ( pwszName == NULL )
return E_OUTOFMEMORY;
memcpy( pwszName, bstrFileName, sizeof(WCHAR)*uLen );
pwszName[uLen] = (WCHAR)0;
hr = IFilterGraph2_RenderFile(
CFilterGraph_IFilterGraph2(This), pwszName, NULL );
QUARTZ_FreeMem( pwszName );
return hr;
}
static HRESULT WINAPI
IMediaControl_fnAddSourceFilter(IMediaControl* iface,BSTR bstrFileName,IDispatch** ppobj)
{
CFilterGraph_THIS(iface,mediacontrol);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaControl_fnget_FilterCollection(IMediaControl* iface,IDispatch** ppobj)
{
CFilterGraph_THIS(iface,mediacontrol);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaControl_fnget_RegFilterCollection(IMediaControl* iface,IDispatch** ppobj)
{
CFilterGraph_THIS(iface,mediacontrol);
FIXME("(%p)->()\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaControl_fnStopWhenReady(IMediaControl* iface)
{
CFilterGraph_THIS(iface,mediacontrol);
TRACE("(%p)->()\n",This);
return IMediaFilter_Stop( CFilterGraph_IMediaFilter(This) );
}
static ICOM_VTABLE(IMediaControl) imediacontrol =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IMediaControl_fnQueryInterface,
IMediaControl_fnAddRef,
IMediaControl_fnRelease,
/* IDispatch fields */
IMediaControl_fnGetTypeInfoCount,
IMediaControl_fnGetTypeInfo,
IMediaControl_fnGetIDsOfNames,
IMediaControl_fnInvoke,
/* IMediaControl fields */
IMediaControl_fnRun,
IMediaControl_fnPause,
IMediaControl_fnStop,
IMediaControl_fnGetState,
IMediaControl_fnRenderFile,
IMediaControl_fnAddSourceFilter,
IMediaControl_fnget_FilterCollection,
IMediaControl_fnget_RegFilterCollection,
IMediaControl_fnStopWhenReady,
};
HRESULT CFilterGraph_InitIMediaControl( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
ICOM_VTBL(&pfg->mediacontrol) = &imediacontrol;
return NOERROR;
}
void CFilterGraph_UninitIMediaControl( CFilterGraph* pfg )
{
TRACE("(%p)\n",pfg);
}
/*
* An implementation of IUnknown.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "wine/port.h"
#include "windef.h"
#include "winerror.h"
#include "winbase.h"
#include "wine/obj_base.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "iunk.h"
static HRESULT WINAPI
IUnknown_fnQueryInterface(IUnknown* iface,REFIID riid,LPVOID *ppobj)
{
ICOM_THIS(QUARTZ_IUnkImpl,iface);
size_t ofs;
DWORD dwIndex;
QUARTZ_IFDelegation* pDelegation;
HRESULT hr;
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
if ( ppobj == NULL )
return E_POINTER;
*ppobj = NULL;
ofs = 0;
if ( IsEqualGUID( &IID_IUnknown, riid ) )
{
TRACE("IID_IUnknown - returns inner object.\n");
}
else
{
for ( dwIndex = 0; dwIndex < This->dwEntries; dwIndex++ )
{
if ( IsEqualGUID( This->pEntries[dwIndex].piid, riid ) )
{
ofs = This->pEntries[dwIndex].ofsVTPtr;
break;
}
}
if ( dwIndex == This->dwEntries )
{
hr = E_NOINTERFACE;
/* delegation */
pDelegation = This->pDelegationFirst;
while ( pDelegation != NULL )
{
hr = (*pDelegation->pOnQueryInterface)( iface, riid, ppobj );
if ( hr != E_NOINTERFACE )
break;
pDelegation = pDelegation->pNext;
}
if ( hr == E_NOINTERFACE )
{
WARN("(%p) unknown interface: %s\n",This,debugstr_guid(riid));
}
return hr;
}
}
*ppobj = (LPVOID)(((char*)This) + ofs);
IUnknown_AddRef((IUnknown*)(*ppobj));
return S_OK;
}
static ULONG WINAPI
IUnknown_fnAddRef(IUnknown* iface)
{
ICOM_THIS(QUARTZ_IUnkImpl,iface);
TRACE("(%p)->()\n",This);
return InterlockedExchangeAdd(&(This->ref),1) + 1;
}
static ULONG WINAPI
IUnknown_fnRelease(IUnknown* iface)
{
ICOM_THIS(QUARTZ_IUnkImpl,iface);
LONG ref;
TRACE("(%p)->()\n",This);
ref = InterlockedExchangeAdd(&(This->ref),-1) - 1;
if ( ref > 0 )
return (ULONG)ref;
This->ref ++;
if ( This->pOnFinalRelease != NULL )
(*(This->pOnFinalRelease))(iface);
This->ref --;
QUARTZ_FreeObj(This);
return 0;
}
static ICOM_VTABLE(IUnknown) iunknown =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IUnknown_fnQueryInterface,
IUnknown_fnAddRef,
IUnknown_fnRelease,
};
void QUARTZ_IUnkInit( QUARTZ_IUnkImpl* pImpl, IUnknown* punkOuter )
{
TRACE("(%p)\n",pImpl);
ICOM_VTBL(pImpl) = &iunknown;
pImpl->pEntries = NULL;
pImpl->dwEntries = 0;
pImpl->pDelegationFirst = NULL;
pImpl->pOnFinalRelease = NULL;
pImpl->ref = 1;
pImpl->punkControl = (IUnknown*)pImpl;
/* for implementing aggregation. */
if ( punkOuter != NULL )
pImpl->punkControl = punkOuter;
}
void QUARTZ_IUnkAddDelegation(
QUARTZ_IUnkImpl* pImpl, QUARTZ_IFDelegation* pDelegation )
{
pDelegation->pNext = pImpl->pDelegationFirst;
pImpl->pDelegationFirst = pDelegation;
}
/*
* An implementation of IUnknown.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef WINE_DSHOW_IUNK_H
#define WINE_DSHOW_IUNK_H
/*
To avoid implementing IUnknown for all interfaces,
1) To give a method to get rel-offset of IUnknown.
2) The IUnknown knows all IIDs and offsets of interfaces.
So each implementation must have following two members
with the following order:
typedef struct IDispatchImpl
{
ICOM_VFIELD(IDispatch); <-pointer of the interface.
size_t ofsIUnknown; <-ofs<IDispatchImpl> - ofs<QUARTZ_IUnkImpl>
};
*/
/* for InterlockedExchangeAdd. */
#include <pshpack4.h>
typedef struct QUARTZ_IFEntry
{
const IID* piid; /* interface ID. */
size_t ofsVTPtr; /* offset from IUnknown. */
} QUARTZ_IFEntry;
typedef struct QUARTZ_IFDelegation
{
struct QUARTZ_IFDelegation* pNext;
HRESULT (*pOnQueryInterface)(
IUnknown* punk, const IID* piid, void** ppobj );
} QUARTZ_IFDelegation;
typedef struct QUARTZ_IUnkImpl
{
/* pointer of IUnknown interface. */
ICOM_VFIELD(IUnknown);
/* array of supported IIDs and offsets. */
const QUARTZ_IFEntry* pEntries;
DWORD dwEntries;
/* list of delegation handlers. */
QUARTZ_IFDelegation* pDelegationFirst;
/* called on final release. */
void (*pOnFinalRelease)(IUnknown* punk);
/* IUnknown fields. */
LONG ref;
IUnknown* punkControl;
} QUARTZ_IUnkImpl;
#include <poppack.h>
void QUARTZ_IUnkInit( QUARTZ_IUnkImpl* pImpl, IUnknown* punkOuter );
void QUARTZ_IUnkAddDelegation(
QUARTZ_IUnkImpl* pImpl, QUARTZ_IFDelegation* pDelegation );
#endif /* WINE_DSHOW_IUNK_H */
/*
* 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 */
/*
* Implements MIDI Parser.
*
* FIXME - stub
* FIXME - no seeking
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "mmsystem.h"
#include "vfw.h"
#include "winerror.h"
#include "strmif.h"
#include "control.h"
#include "vfwmsgs.h"
#include "amvideo.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "parser.h"
#include "mtype.h"
static const WCHAR QUARTZ_MIDIParser_Name[] =
{ 'Q','u','i','c','k','T','i','m','e',' ','M','o','v','i','e',' ','P','a','r','s','e','r',0 };
static const WCHAR QUARTZ_MIDIParserInPin_Name[] =
{ 'I','n',0 };
static const WCHAR QUARTZ_MIDIParserOutPin_Name[] =
{ 'O','u','t',0 };
/****************************************************************************
*
* CMIDIParseImpl
*/
typedef struct CMIDIParseImpl CMIDIParseImpl;
struct CMIDIParseImpl
{
};
static HRESULT CMIDIParseImpl_InitParser( CParserImpl* pImpl, ULONG* pcStreams )
{
WARN("(%p,%p) stub\n",pImpl,pcStreams);
return E_NOTIMPL;
}
static HRESULT CMIDIParseImpl_UninitParser( CParserImpl* pImpl )
{
CMIDIParseImpl* This = (CMIDIParseImpl*)pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This == NULL )
return NOERROR;
/* destruct */
QUARTZ_FreeMem( This );
pImpl->m_pUserData = NULL;
return NOERROR;
}
static LPCWSTR CMIDIParseImpl_GetOutPinName( CParserImpl* pImpl, ULONG nStreamIndex )
{
CMIDIParseImpl* This = (CMIDIParseImpl*)pImpl->m_pUserData;
TRACE("(%p,%lu)\n",This,nStreamIndex);
return QUARTZ_MIDIParserOutPin_Name;
}
static HRESULT CMIDIParseImpl_GetStreamType( CParserImpl* pImpl, ULONG nStreamIndex, AM_MEDIA_TYPE* pmt )
{
CMIDIParseImpl* This = (CMIDIParseImpl*)pImpl->m_pUserData;
FIXME("(%p) stub\n",This);
return E_NOTIMPL;
}
static HRESULT CMIDIParseImpl_CheckStreamType( CParserImpl* pImpl, ULONG nStreamIndex, const AM_MEDIA_TYPE* pmt )
{
CMIDIParseImpl* This = (CMIDIParseImpl*)pImpl->m_pUserData;
FIXME("(%p) stub\n",This);
return E_NOTIMPL;
}
static HRESULT CMIDIParseImpl_GetAllocProp( CParserImpl* pImpl, ALLOCATOR_PROPERTIES* pReqProp )
{
CMIDIParseImpl* This = (CMIDIParseImpl*)pImpl->m_pUserData;
FIXME("(%p,%p) stub\n",This,pReqProp);
if ( This == NULL )
return E_UNEXPECTED;
return E_NOTIMPL;
}
static HRESULT CMIDIParseImpl_GetNextRequest( CParserImpl* pImpl, ULONG* pnStreamIndex, LONGLONG* pllStart, LONG* plLength, REFERENCE_TIME* prtStart, REFERENCE_TIME* prtStop, DWORD* pdwSampleFlags )
{
CMIDIParseImpl* This = (CMIDIParseImpl*)pImpl->m_pUserData;
FIXME("(%p) stub\n",This);
if ( This == NULL )
return E_UNEXPECTED;
return E_NOTIMPL;
}
static HRESULT CMIDIParseImpl_ProcessSample( CParserImpl* pImpl, ULONG nStreamIndex, LONGLONG llStart, LONG lLength, IMediaSample* pSample )
{
CMIDIParseImpl* This = (CMIDIParseImpl*)pImpl->m_pUserData;
FIXME("(%p,%lu,%ld,%ld,%p)\n",This,nStreamIndex,(long)llStart,lLength,pSample);
if ( This == NULL )
return E_UNEXPECTED;
return E_NOTIMPL;
}
static const struct ParserHandlers CMIDIParseImpl_Handlers =
{
CMIDIParseImpl_InitParser,
CMIDIParseImpl_UninitParser,
CMIDIParseImpl_GetOutPinName,
CMIDIParseImpl_GetStreamType,
CMIDIParseImpl_CheckStreamType,
CMIDIParseImpl_GetAllocProp,
CMIDIParseImpl_GetNextRequest,
CMIDIParseImpl_ProcessSample,
/* for IQualityControl */
NULL, /* pQualityNotify */
/* for seeking */
NULL, /* pGetSeekingCaps */
NULL, /* pIsTimeFormatSupported */
NULL, /* pGetCurPos */
NULL, /* pSetCurPos */
NULL, /* pGetDuration */
NULL, /* pGetStopPos */
NULL, /* pSetStopPos */
NULL, /* pGetPreroll */
};
HRESULT QUARTZ_CreateMIDIParser(IUnknown* punkOuter,void** ppobj)
{
return QUARTZ_CreateParser(
punkOuter,ppobj,
&CLSID_quartzMIDIParser,
QUARTZ_MIDIParser_Name,
QUARTZ_MIDIParserInPin_Name,
&CMIDIParseImpl_Handlers );
}
/*
* Implements MPEG Audio Decoder(CLSID_CMpegAudioCodec)
*
* FIXME - what library can we use? SMPEG??
*
* FIXME - stub
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "mmsystem.h"
#include "mmreg.h"
#include "strmif.h"
#include "control.h"
#include "amvideo.h"
#include "vfwmsgs.h"
#include "uuids.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "xform.h"
#include "mtype.h"
static const WCHAR CMPEGAudioDecoderImpl_FilterName[] =
{'M','P','E','G',' ','A','u','d','i','o',' ','D','e','c','o','d','e','r',0};
typedef struct CMPEGAudioDecoderImpl
{
AM_MEDIA_TYPE* pmt;
DWORD cmt;
WAVEFORMATEX wfxOut;
/* codec stuffs */
} CMPEGAudioDecoderImpl;
/*****************************************************************************
*
* codec-dependent stuffs - no codec
*
*/
#define NO_CODEC_IMPL
static void Codec_OnConstruct(CMPEGAudioDecoderImpl* This)
{
}
static void Codec_OnCleanup(CMPEGAudioDecoderImpl* This)
{
}
static HRESULT Codec_BeginTransform(CTransformBaseImpl* pImpl,CMPEGAudioDecoderImpl* This)
{
FIXME("no codec\n");
return E_NOTIMPL;
}
static HRESULT Codec_ProcessReceive(CTransformBaseImpl* pImpl,CMPEGAudioDecoderImpl* This,IMediaSample* pSampIn)
{
FIXME("no codec\n");
return E_NOTIMPL;
}
static HRESULT Codec_EndTransform(CTransformBaseImpl* pImpl,CMPEGAudioDecoderImpl* This)
{
FIXME("no codec\n");
return E_NOTIMPL;
}
/***************************************************************************
*
* CMPEGAudioDecoderImpl methods
*
*/
static void CMPEGAudioDecoderImpl_CleanupOutTypes(CMPEGAudioDecoderImpl* This)
{
DWORD i;
if ( This->pmt != NULL )
{
for ( i = 0; i < This->cmt; i++ )
{
QUARTZ_MediaType_Free(&This->pmt[i]);
}
QUARTZ_FreeMem(This->pmt);
This->pmt = NULL;
}
This->cmt = 0;
}
static HRESULT CMPEGAudioDecoderImpl_Init( CTransformBaseImpl* pImpl )
{
CMPEGAudioDecoderImpl* This = (CMPEGAudioDecoderImpl*)pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This != NULL )
return NOERROR;
This = (CMPEGAudioDecoderImpl*)QUARTZ_AllocMem( sizeof(CMPEGAudioDecoderImpl) );
if ( This == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This, sizeof(CMPEGAudioDecoderImpl) );
pImpl->m_pUserData = This;
/* construct */
This->pmt = NULL;
This->cmt = 0;
Codec_OnConstruct(This);
return S_OK;
}
static HRESULT CMPEGAudioDecoderImpl_Cleanup( CTransformBaseImpl* pImpl )
{
CMPEGAudioDecoderImpl* This = (CMPEGAudioDecoderImpl*)pImpl->m_pUserData;
TRACE("(%p)\n",This);
if ( This == NULL )
return S_OK;
/* destruct */
Codec_OnCleanup(This);
CMPEGAudioDecoderImpl_CleanupOutTypes(This);
QUARTZ_FreeMem( This );
pImpl->m_pUserData = NULL;
return S_OK;
}
static HRESULT CMPEGAudioDecoderImpl_CheckMediaType( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut )
{
CMPEGAudioDecoderImpl* This = (CMPEGAudioDecoderImpl*)pImpl->m_pUserData;
const WAVEFORMATEX* pwfxIn;
const WAVEFORMATEX* pwfxOut;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
if ( !IsEqualGUID( &pmtIn->majortype, &MEDIATYPE_Audio ) )
return E_FAIL;
if ( !IsEqualGUID( &pmtIn->formattype, &FORMAT_WaveFormatEx ) )
return E_FAIL;
if ( pmtIn->pbFormat == NULL ||
pmtIn->cbFormat < sizeof(WAVEFORMATEX) )
return E_FAIL;
pwfxIn = (const WAVEFORMATEX*)pmtIn->pbFormat;
if ( pwfxIn->wFormatTag != WAVE_FORMAT_MPEG &&
pwfxIn->wFormatTag != WAVE_FORMAT_MPEGLAYER3 )
return E_FAIL;
if ( pwfxIn->nChannels != 1 && pwfxIn->nChannels != 2 )
return E_FAIL;
if ( pwfxIn->nBlockAlign < 1 )
return E_FAIL;
if ( pmtOut != NULL )
{
if ( !IsEqualGUID( &pmtOut->majortype, &MEDIATYPE_Audio ) )
return E_FAIL;
if ( !IsEqualGUID( &pmtOut->formattype, &FORMAT_WaveFormatEx ) )
return E_FAIL;
if ( pmtOut->pbFormat == NULL ||
pmtOut->cbFormat < sizeof(WAVEFORMATEX) )
return E_FAIL;
pwfxOut = (const WAVEFORMATEX*)pmtOut->pbFormat;
if ( pwfxOut->wFormatTag != WAVE_FORMAT_PCM )
return E_FAIL;
if ( pwfxOut->nChannels != pwfxIn->nChannels ||
pwfxOut->nSamplesPerSec != pwfxIn->nSamplesPerSec )
return E_FAIL;
if ( pwfxOut->wBitsPerSample != 16 )
return E_FAIL;
if ( pwfxOut->nBlockAlign != (pwfxOut->nChannels * pwfxOut->wBitsPerSample >> 3 ) )
return E_FAIL;
}
#ifdef NO_CODEC_IMPL
WARN("no codec implementation\n");
return E_NOTIMPL;
#else
return S_OK;
#endif
}
static HRESULT CMPEGAudioDecoderImpl_GetOutputTypes( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE** ppmtAcceptTypes, ULONG* pcAcceptTypes )
{
CMPEGAudioDecoderImpl* This = (CMPEGAudioDecoderImpl*)pImpl->m_pUserData;
HRESULT hr;
const WAVEFORMATEX* pwfxIn;
AM_MEDIA_TYPE* pmtOut;
WAVEFORMATEX* pwfxOut;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = CMPEGAudioDecoderImpl_CheckMediaType( pImpl, pmtIn, NULL );
if ( FAILED(hr) )
return hr;
pwfxIn = (const WAVEFORMATEX*)pmtIn->pbFormat;
CMPEGAudioDecoderImpl_CleanupOutTypes(This);
This->cmt = 1;
This->pmt = (AM_MEDIA_TYPE*)QUARTZ_AllocMem(
sizeof(AM_MEDIA_TYPE) * This->cmt );
if ( This->pmt == NULL )
return E_OUTOFMEMORY;
ZeroMemory( This->pmt, sizeof(AM_MEDIA_TYPE) * This->cmt );
pmtOut = &This->pmt[0];
memcpy( &pmtOut->majortype, &MEDIATYPE_Audio, sizeof(GUID) );
memcpy( &pmtOut->subtype, &MEDIASUBTYPE_PCM, sizeof(GUID) );
memcpy( &pmtOut->formattype, &FORMAT_WaveFormatEx, sizeof(GUID) );
pmtOut->bFixedSizeSamples = 1;
pmtOut->bTemporalCompression = 0;
pmtOut->lSampleSize = pwfxIn->nChannels * 16 >> 3;
pmtOut->pbFormat = (BYTE*)CoTaskMemAlloc( sizeof(WAVEFORMATEX) );
if ( pmtOut->pbFormat == NULL )
return E_OUTOFMEMORY;
pwfxOut = (WAVEFORMATEX*)pmtOut->pbFormat;
pmtOut->cbFormat = sizeof(WAVEFORMATEX);
pwfxOut->wFormatTag = WAVE_FORMAT_PCM;
pwfxOut->nChannels = pwfxIn->nChannels;
pwfxOut->nSamplesPerSec = pwfxIn->nSamplesPerSec;
pwfxOut->nAvgBytesPerSec = pwfxOut->nSamplesPerSec * pmtOut->lSampleSize;
pwfxOut->nBlockAlign = pmtOut->lSampleSize;
pwfxOut->wBitsPerSample = 16;
pwfxOut->cbSize = 0;
*ppmtAcceptTypes = This->pmt;
*pcAcceptTypes = This->cmt;
return S_OK;
}
static HRESULT CMPEGAudioDecoderImpl_GetAllocProp( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, ALLOCATOR_PROPERTIES* pProp, BOOL* pbTransInPlace, BOOL* pbTryToReuseSample )
{
CMPEGAudioDecoderImpl* This = (CMPEGAudioDecoderImpl*)pImpl->m_pUserData;
const WAVEFORMATEX* pwfxIn;
const WAVEFORMATEX* pwfxOut;
HRESULT hr;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = CMPEGAudioDecoderImpl_CheckMediaType( pImpl, pmtIn, pmtOut );
if ( FAILED(hr) )
return hr;
pwfxIn = (const WAVEFORMATEX*)pmtIn->pbFormat;
pwfxOut = (const WAVEFORMATEX*)pmtOut->pbFormat;
pProp->cBuffers = 1;
pProp->cbBuffer = pwfxOut->nAvgBytesPerSec;
TRACE("cbBuffer %ld\n",pProp->cbBuffer);
*pbTransInPlace = FALSE;
*pbTryToReuseSample = FALSE;
return S_OK;
}
static HRESULT CMPEGAudioDecoderImpl_BeginTransform( CTransformBaseImpl* pImpl, const AM_MEDIA_TYPE* pmtIn, const AM_MEDIA_TYPE* pmtOut, BOOL bReuseSample )
{
CMPEGAudioDecoderImpl* This = (CMPEGAudioDecoderImpl*)pImpl->m_pUserData;
HRESULT hr;
TRACE("(%p,%p,%p,%d)\n",This,pmtIn,pmtOut,bReuseSample);
if ( This == NULL )
return E_UNEXPECTED;
hr = CMPEGAudioDecoderImpl_CheckMediaType( pImpl, pmtIn, pmtOut );
if ( FAILED(hr) )
return hr;
memcpy( &This->wfxOut, (const WAVEFORMATEX*)pmtOut->pbFormat, sizeof(WAVEFORMATEX) );
return Codec_BeginTransform(pImpl,This);
}
static HRESULT CMPEGAudioDecoderImpl_ProcessReceive( CTransformBaseImpl* pImpl, IMediaSample* pSampIn )
{
CMPEGAudioDecoderImpl* This = (CMPEGAudioDecoderImpl*)pImpl->m_pUserData;
TRACE("(%p,%p)\n",This,pSampIn);
if ( This == NULL )
return E_UNEXPECTED;
return Codec_ProcessReceive(pImpl,This,pSampIn);
}
static HRESULT CMPEGAudioDecoderImpl_EndTransform( CTransformBaseImpl* pImpl )
{
CMPEGAudioDecoderImpl* This = (CMPEGAudioDecoderImpl*)pImpl->m_pUserData;
HRESULT hr;
TRACE("(%p)\n",This);
if ( This == NULL )
return E_UNEXPECTED;
hr = Codec_EndTransform(pImpl,This);
if ( FAILED(hr) )
return hr;
ZeroMemory( &This->wfxOut, sizeof(WAVEFORMATEX) );
return S_OK;
}
static const TransformBaseHandlers transhandlers =
{
CMPEGAudioDecoderImpl_Init,
CMPEGAudioDecoderImpl_Cleanup,
CMPEGAudioDecoderImpl_CheckMediaType,
CMPEGAudioDecoderImpl_GetOutputTypes,
CMPEGAudioDecoderImpl_GetAllocProp,
CMPEGAudioDecoderImpl_BeginTransform,
CMPEGAudioDecoderImpl_ProcessReceive,
NULL,
CMPEGAudioDecoderImpl_EndTransform,
};
HRESULT QUARTZ_CreateCMpegAudioCodec(IUnknown* punkOuter,void** ppobj)
{
return QUARTZ_CreateTransformBase(
punkOuter,ppobj,
&CLSID_CMpegAudioCodec,
CMPEGAudioDecoderImpl_FilterName,
NULL, NULL,
&transhandlers );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment