ReactOS 0.4.17-dev-966-gf06eace
dispatch.c
Go to the documentation of this file.
1/*
2 * ITypeInfo cache for IDispatch
3 *
4 * Copyright 2019 Zebediah Figura
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include "strmbase_private.h"
22
24
27
29{
30 &IID_IBasicAudio,
31 &IID_IBasicVideo,
32 &IID_IMediaControl,
33 &IID_IMediaEvent,
34 &IID_IMediaPosition,
35 &IID_IVideoWindow,
36};
37
39{
40 HRESULT hr;
41
42 if (!control_typelib)
43 {
45
46 hr = LoadRegTypeLib(&LIBID_QuartzTypeLib, 1, 0, LOCALE_SYSTEM_DEFAULT, &typelib);
47 if (FAILED(hr))
48 {
49 ERR("Failed to load typelib, hr %#lx.\n", hr);
50 return hr;
51 }
53 ITypeLib_Release(typelib);
54 }
56 {
58
59 hr = ITypeLib_GetTypeInfoOfGuid(control_typelib, control_tid_id[tid], &typeinfo);
60 if (FAILED(hr))
61 {
62 ERR("Failed to get type info for %s, hr %#lx.\n", debugstr_guid(control_tid_id[tid]), hr);
63 return hr;
64 }
66 ITypeInfo_Release(typeinfo);
67 }
68 ITypeInfo_AddRef(*ret = control_typeinfo[tid]);
69 return S_OK;
70}
71
73{
74 unsigned int i;
75
76 for (i = 0; i < ARRAY_SIZE(control_typeinfo); ++i)
77 {
79 ITypeInfo_Release(control_typeinfo[i]);
80 }
82 ITypeLib_Release(control_typelib);
83}
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ARRAY_SIZE(A)
Definition: main.h:20
#define ERR(fmt,...)
Definition: precomp.h:57
HRESULT hr
Definition: delayimp.cpp:582
#define NULL
Definition: types.h:112
HRESULT WINAPI LoadRegTypeLib(REFGUID rguid, WORD wVerMajor, WORD wVerMinor, LCID lcid, ITypeLib **ppTLib)
Definition: typelib.c:507
return ret
Definition: mutex.c:147
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
@ last_tid
static TfClientId tid
#define InterlockedCompareExchangePointer
Definition: interlocked.h:144
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
#define LOCALE_SYSTEM_DEFAULT
#define REFIID
Definition: guiddef.h:118
static ITypeLib * control_typelib
Definition: dispatch.c:25
static REFIID control_tid_id[]
Definition: dispatch.c:28
void strmbase_release_typelibs(void)
Definition: dispatch.c:72
static ITypeInfo * control_typeinfo[last_tid]
Definition: dispatch.c:26
HRESULT strmbase_get_typeinfo(enum strmbase_type_id tid, ITypeInfo **ret)
Definition: dispatch.c:38
strmbase_type_id
Definition: strmbase.h:224