strmbase: Implement BaseDispatch.

This commit is contained in:
Aric Stewart 2012-04-20 07:26:18 -05:00 committed by Alexandre Julliard
parent 7eacf27e20
commit a37d4b79ab
3 changed files with 93 additions and 0 deletions

View File

@ -1,6 +1,7 @@
MODULE = libstrmbase.a
C_SRCS = \
dispatch.c \
dllfunc.c \
enumpins.c \
filter.c \

82
dlls/strmbase/dispatch.c Normal file
View File

@ -0,0 +1,82 @@
/*
* Generic Implementation of IDispatch for strmbase classes
*
* Copyright 2012 Aric Stewart, CodeWeavers
*
* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "dshow.h"
#include "wine/debug.h"
#include "wine/unicode.h"
#include "wine/strmbase.h"
#include "uuids.h"
#include "vfwmsgs.h"
#include <assert.h>
WINE_DEFAULT_DEBUG_CHANNEL(strmbase);
HRESULT WINAPI BaseDispatch_Init(BaseDispatch *This, REFIID riid)
{
HRESULT hr = E_FAIL;
ITypeLib *pTypeLib;
This->pTypeInfo = NULL;
hr = LoadRegTypeLib(&LIBID_QuartzTypeLib, 1, 0, LOCALE_SYSTEM_DEFAULT, &pTypeLib);
if (SUCCEEDED(hr))
{
hr = ITypeLib_GetTypeInfoOfGuid(pTypeLib, riid, &This->pTypeInfo);
if (pTypeLib)
ITypeLib_Release(pTypeLib);
}
return hr;
}
HRESULT WINAPI BaseDispatch_Destroy(BaseDispatch *This)
{
if (This->pTypeInfo)
ITypeInfo_Release(This->pTypeInfo);
return S_OK;
}
HRESULT WINAPI BaseDispatchImpl_GetIDsOfNames(BaseDispatch *This, REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid)
{
if (This->pTypeInfo)
return ITypeInfo_GetIDsOfNames(This->pTypeInfo, rgszNames, cNames, rgdispid);
return E_NOTIMPL;
}
HRESULT WINAPI BaseDispatchImpl_GetTypeInfo(BaseDispatch *This, REFIID riid, UINT itinfo, LCID lcid, ITypeInfo **pptinfo)
{
if (This->pTypeInfo)
{
ITypeInfo_AddRef(This->pTypeInfo);
*pptinfo = This->pTypeInfo;
return S_OK;
}
return E_NOTIMPL;
}
HRESULT WINAPI BaseDispatchImpl_GetTypeInfoCount(BaseDispatch *This, UINT *pctinfo)
{
if (This->pTypeInfo)
*pctinfo = 1;
else
*pctinfo = 0;
return S_OK;
}

View File

@ -403,6 +403,16 @@ RECT WINAPI BaseWindowImpl_GetDefaultRect(BaseWindow *This);
LRESULT WINAPI BaseWindowImpl_OnReceiveMessage(BaseWindow *This, HWND hwnd, INT uMsg, WPARAM wParam, LPARAM lParam);
BOOL WINAPI BaseWindowImpl_OnSize(BaseWindow *This, LONG Height, LONG Width);
typedef struct{
ITypeInfo *pTypeInfo;
} BaseDispatch;
HRESULT WINAPI BaseDispatch_Init(BaseDispatch *This, REFIID riid);
HRESULT WINAPI BaseDispatch_Destroy(BaseDispatch *This);
HRESULT WINAPI BaseDispatchImpl_GetIDsOfNames(BaseDispatch *This, REFIID riid, OLECHAR **rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid);
HRESULT WINAPI BaseDispatchImpl_GetTypeInfo(BaseDispatch *This, REFIID riid, UINT itinfo, LCID lcid, ITypeInfo **pptinfo);
HRESULT WINAPI BaseDispatchImpl_GetTypeInfoCount(BaseDispatch *This, UINT *pctinfo);
#ifdef __IVideoWindow_FWD_DEFINED__
typedef struct tagBaseControlWindow
{