Implemented some APIs.

Added some stubs.
oldstable
Hidenori Takeshima 2002-03-20 00:50:35 +00:00 committed by Alexandre Julliard
parent c90e543d42
commit 4e69776f78
4 changed files with 395 additions and 2 deletions

View File

@ -7,7 +7,10 @@ MODULE = msdmo
LDDLLFLAGS = @LDDLLFLAGS@
SYMBOLFILE = $(MODULE).tmp.o
C_SRCS = msdmo_main.c
C_SRCS = \
dmoreg.c \
dmort.c \
msdmo_main.c
@MAKE_DLL_RULES@

227
dlls/msdmo/dmoreg.c 100644
View File

@ -0,0 +1,227 @@
/*
* Implements dmoreg APIs.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* FIXME - stub.
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winreg.h"
#include "winerror.h"
#include "wine/obj_base.h"
#include "mediaobj.h"
#include "dmoreg.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msdmo);
/*
NOTE: You may build this dll as a native dll and
use with native non-DirectX8 environment(NT 4.0 etc).
*/
static const WCHAR wszDMOPath[] =
{'D','i','r','e','c','t','S','h','o','w','\\',
'M','e','d','i','a','O','b','j','e','c','t','s',0};
static const WCHAR wszDMOCatPath[] =
{'D','i','r','e','c','t','S','h','o','w','\\',
'M','e','d','i','a','O','b','j','e','c','t','s','\\',
'C','a','t','e','g','o','r','i','e','s',0};
static const WCHAR wszInputTypes[] =
{'I','n','p','u','t','T','y','p','e','s',0};
static const WCHAR wszOutputTypes[] =
{'O','u','t','p','u','t','T','y','p','e','s',0};
static const WCHAR QUARTZ_wszREG_SZ[] = {'R','E','G','_','S','Z',0};
/*************************************************************************/
static void QUARTZ_CatPathSepW( WCHAR* pBuf )
{
int len = lstrlenW(pBuf);
pBuf[len] = '\\';
pBuf[len+1] = 0;
}
static void QUARTZ_GUIDtoString( WCHAR* pBuf, const GUID* pguid )
{
/* W"{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}" */
static const WCHAR wszFmt[] =
{'{','%','0','8','X','-','%','0','4','X','-','%','0','4','X',
'-','%','0','2','X','%','0','2','X','-','%','0','2','X','%',
'0','2','X','%','0','2','X','%','0','2','X','%','0','2','X',
'%','0','2','X','}',0};
wsprintfW( pBuf, wszFmt,
pguid->Data1, pguid->Data2, pguid->Data3,
pguid->Data4[0], pguid->Data4[1],
pguid->Data4[2], pguid->Data4[3],
pguid->Data4[4], pguid->Data4[5],
pguid->Data4[6], pguid->Data4[7] );
}
static
LONG QUARTZ_RegOpenKeyW(
HKEY hkRoot, LPCWSTR lpszPath,
REGSAM rsAccess, HKEY* phKey,
BOOL fCreateKey )
{
DWORD dwDisp;
WCHAR wszREG_SZ[ sizeof(QUARTZ_wszREG_SZ)/sizeof(QUARTZ_wszREG_SZ[0]) ];
memcpy(wszREG_SZ,QUARTZ_wszREG_SZ,sizeof(QUARTZ_wszREG_SZ) );
if ( fCreateKey )
return RegCreateKeyExW(
hkRoot, lpszPath, 0, wszREG_SZ,
REG_OPTION_NON_VOLATILE, rsAccess, NULL, phKey, &dwDisp );
else
return RegOpenKeyExW(
hkRoot, lpszPath, 0, rsAccess, phKey );
}
static
LONG QUARTZ_RegSetValueString(
HKEY hKey, LPCWSTR lpszName, LPCWSTR lpValue )
{
return RegSetValueExW(
hKey, lpszName, 0, REG_SZ,
(const BYTE*)lpValue,
sizeof(lpValue[0]) * (lstrlenW(lpValue)+1) );
}
static
LONG QUARTZ_RegSetValueBinary(
HKEY hKey, LPCWSTR lpszName,
const BYTE* pData, int iLenOfData )
{
return RegSetValueExW(
hKey, lpszName, 0, REG_BINARY, pData, iLenOfData );
}
/*************************************************************************/
HRESULT WINAPI DMOEnum( REFGUID rguidCat, DWORD dwFlags, DWORD dwCountOfInTypes, const DMO_PARTIAL_MEDIATYPE* pInTypes, DWORD dwCountOfOutTypes, const DMO_PARTIAL_MEDIATYPE* pOutTypes, IEnumDMO** ppEnum )
{
FIXME( "stub!\n" );
return E_NOTIMPL;
}
HRESULT WINAPI DMOGetName( REFCLSID rclsid, WCHAR* pwszName )
{
FIXME( "stub!\n" );
return E_NOTIMPL;
}
HRESULT WINAPI DMOGetTypes( REFCLSID rclsid, unsigned long ulInputTypesReq, unsigned long* pulInputTypesRet, unsigned long ulOutputTypesReq, unsigned long* pulOutputTypesRet, const DMO_PARTIAL_MEDIATYPE* pOutTypes )
{
FIXME( "stub!\n" );
return E_NOTIMPL;
}
HRESULT WINAPI DMOGuidToStrA( void* pv1, void* pv2 )
{
FIXME( "(%p,%p) stub!\n", pv1, pv2 );
return E_NOTIMPL;
}
HRESULT WINAPI DMOGuidToStrW( void* pv1, void* pv2 )
{
FIXME( "(%p,%p) stub!\n", pv1, pv2 );
return E_NOTIMPL;
}
HRESULT WINAPI DMORegister( LPCWSTR pwszName, REFCLSID rclsid, REFGUID rguidCat, DWORD dwFlags, DWORD dwCountOfInTypes, const DMO_PARTIAL_MEDIATYPE* pInTypes, DWORD dwCountOfOutTypes, const DMO_PARTIAL_MEDIATYPE* pOutTypes )
{
HRESULT hr;
HKEY hKey;
WCHAR wszPath[1024];
FIXME( "() not tested!\n" );
hr = S_OK;
memcpy(wszPath,wszDMOPath,sizeof(wszDMOPath));
QUARTZ_CatPathSepW(wszPath);
QUARTZ_GUIDtoString(&wszPath[lstrlenW(wszPath)],rclsid);
if ( QUARTZ_RegOpenKeyW( HKEY_CLASSES_ROOT,
wszPath, KEY_ALL_ACCESS, &hKey, TRUE ) != ERROR_SUCCESS )
return E_FAIL;
if ( pwszName != NULL && QUARTZ_RegSetValueString(
hKey, NULL, pwszName ) != ERROR_SUCCESS )
hr = E_FAIL;
if ( dwCountOfInTypes > 0 && QUARTZ_RegSetValueBinary(
hKey, wszInputTypes, (const BYTE*)pInTypes,
dwCountOfInTypes * sizeof(DMO_PARTIAL_MEDIATYPE) ) != ERROR_SUCCESS )
hr = E_FAIL;
if ( dwCountOfOutTypes > 0 && QUARTZ_RegSetValueBinary(
hKey, wszOutputTypes, (const BYTE*)pOutTypes,
dwCountOfOutTypes * sizeof(DMO_PARTIAL_MEDIATYPE) ) != ERROR_SUCCESS )
hr = E_FAIL;
RegCloseKey( hKey );
if ( FAILED(hr) )
return hr;
memcpy(wszPath,wszDMOCatPath,sizeof(wszDMOCatPath));
QUARTZ_CatPathSepW(wszPath);
QUARTZ_GUIDtoString(&wszPath[lstrlenW(wszPath)],rguidCat);
QUARTZ_CatPathSepW(wszPath);
QUARTZ_GUIDtoString(&wszPath[lstrlenW(wszPath)],rclsid);
if ( QUARTZ_RegOpenKeyW( HKEY_CLASSES_ROOT,
wszPath, KEY_ALL_ACCESS, &hKey, TRUE ) != ERROR_SUCCESS )
return E_FAIL;
RegCloseKey( hKey );
if ( FAILED(hr) )
return hr;
return S_OK;
}
HRESULT WINAPI DMOStrToGuidA( void* pv1, void* pv2 )
{
FIXME( "(%p,%p) stub!\n", pv1, pv2 );
return E_NOTIMPL;
}
HRESULT WINAPI DMOStrToGuidW( void* pv1, void* pv2 )
{
FIXME( "(%p,%p) stub!\n", pv1, pv2 );
return E_NOTIMPL;
}
HRESULT WINAPI DMOUnregister( REFCLSID rclsid, REFGUID rguidCat )
{
FIXME( "stub!\n" );
return E_NOTIMPL;
}

159
dlls/msdmo/dmort.c 100644
View File

@ -0,0 +1,159 @@
/*
* Implements dmort APIs.
*
* Copyright (C) Hidenori TAKESHIMA <hidenori@a2.ctktv.ne.jp>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "winerror.h"
#include "wine/obj_base.h"
#include "mediaobj.h"
#include "dmort.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msdmo);
HRESULT WINAPI MoCopyMediaType( DMO_MEDIA_TYPE* pmtDst, const DMO_MEDIA_TYPE* pmtSrc )
{
FIXME( "() not tested\n" );
memcpy( &pmtDst->majortype, &pmtSrc->majortype, sizeof(GUID) );
memcpy( &pmtDst->subtype, &pmtSrc->subtype, sizeof(GUID) );
pmtDst->bFixedSizeSamples = pmtSrc->bFixedSizeSamples;
pmtDst->bTemporalCompression = pmtSrc->bTemporalCompression;
pmtDst->lSampleSize = pmtSrc->lSampleSize;
memcpy( &pmtDst->formattype, &pmtSrc->formattype, sizeof(GUID) );
pmtDst->pUnk = NULL;
pmtDst->cbFormat = pmtSrc->cbFormat;
pmtDst->pbFormat = NULL;
if ( pmtSrc->pbFormat != NULL && pmtSrc->cbFormat != 0 )
{
pmtDst->pbFormat = (BYTE*)CoTaskMemAlloc( pmtSrc->cbFormat );
if ( pmtDst->pbFormat == NULL )
{
return E_OUTOFMEMORY;
}
memcpy( pmtDst->pbFormat, pmtSrc->pbFormat, pmtSrc->cbFormat );
}
if ( pmtSrc->pUnk != NULL )
{
pmtDst->pUnk = pmtSrc->pUnk;
IUnknown_AddRef( pmtSrc->pUnk );
}
return S_OK;
}
HRESULT WINAPI MoCreateMediaType( DMO_MEDIA_TYPE** ppmt, DWORD cbFormat )
{
HRESULT hr;
DMO_MEDIA_TYPE* pmt;
FIXME( "() not tested\n" );
if ( ppmt == NULL )
return E_POINTER;
*ppmt = NULL;
pmt = (DMO_MEDIA_TYPE*)CoTaskMemAlloc( sizeof(DMO_MEDIA_TYPE) );
if ( pmt == NULL )
return E_OUTOFMEMORY;
hr = MoInitMediaType( pmt, cbFormat );
if ( FAILED(hr) )
return hr;
*ppmt = pmt;
return S_OK;
}
HRESULT WINAPI MoDeleteMediaType( DMO_MEDIA_TYPE* pmt )
{
FIXME( "() not tested\n" );
MoFreeMediaType( pmt );
CoTaskMemFree( pmt );
return S_OK;
}
HRESULT WINAPI MoDuplicateMediaType( DMO_MEDIA_TYPE** ppmtDest, const DMO_MEDIA_TYPE* pmtSrc )
{
HRESULT hr;
DMO_MEDIA_TYPE* pmtDup;
FIXME( "() not tested\n" );
if ( ppmtDest == NULL )
return E_POINTER;
*ppmtDest = NULL;
pmtDup = (DMO_MEDIA_TYPE*)CoTaskMemAlloc( sizeof(DMO_MEDIA_TYPE) );
if ( pmtDup == NULL )
return E_OUTOFMEMORY;
hr = MoCopyMediaType( pmtDup, pmtSrc );
if ( FAILED(hr) )
return hr;
*ppmtDest = pmtDup;
return S_OK;
}
HRESULT WINAPI MoFreeMediaType( DMO_MEDIA_TYPE* pmt )
{
FIXME( "() not tested\n" );
if ( pmt->pUnk != NULL )
{
IUnknown_Release( pmt->pUnk );
pmt->pUnk = NULL;
}
if ( pmt->pbFormat != NULL )
{
CoTaskMemFree( pmt->pbFormat );
pmt->cbFormat = 0;
pmt->pbFormat = NULL;
}
return S_OK;
}
HRESULT WINAPI MoInitMediaType( DMO_MEDIA_TYPE* pmt, DWORD cbFormat )
{
FIXME( "() not tested\n" );
memset( pmt, 0, sizeof(DMO_MEDIA_TYPE) );
pmt->pUnk = NULL;
if ( cbFormat > 0 )
{
pmt->pbFormat = (BYTE*)CoTaskMemAlloc( cbFormat );
if ( pmt->pbFormat == NULL )
return E_OUTOFMEMORY;
memset( pmt->pbFormat, 0, cbFormat );
}
pmt->cbFormat = cbFormat;
return S_OK;
}

View File

@ -1,9 +1,13 @@
name msdmo
type win32
import ole32.dll
import user32.dll
import advapi32.dll
import kernel32.dll
import ntdll.dll
debug_channels()
debug_channels (msdmo)
@ stub DMOEnum
@ stub DMOGetName