ReactOS 0.4.17-dev-966-gf06eace
main.c
Go to the documentation of this file.
1/* DirectShow Editing Services (qedit.dll)
2 *
3 * Copyright 2008 Google (Lei Zhang)
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20#define WINE_NO_NAMELESS_EXTENSION
21
22#include "qedit_private.h"
23#include "rpcproxy.h"
24#include "wine/debug.h"
25
27
29{
31 {
33 }
34 else if (reason == DLL_PROCESS_DETACH && !reserved)
35 {
37 }
38 return TRUE;
39}
40
41/******************************************************************************
42 * DirectShow ClassFactory
43 */
44typedef struct {
45 IClassFactory IClassFactory_iface;
46 LONG ref;
49
51{
52 return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
53}
54
56{
57 const CLSID *clsid;
59};
60
62{
63 {&CLSID_AMTimeline, timeline_create},
64 {&CLSID_MediaDet, media_detector_create},
65 {&CLSID_NullRenderer, null_renderer_create},
66 {&CLSID_SampleGrabber, sample_grabber_create},
67};
68
70{
73 {
74 IClassFactory_AddRef(iface);
75 *ppobj = iface;
76 return S_OK;
77 }
78
79 *ppobj = NULL;
80 WARN("(%p)->(%s,%p), not found\n", iface, debugstr_guid(riid), ppobj);
81 return E_NOINTERFACE;
82}
83
85{
87 return InterlockedIncrement(&This->ref);
88}
89
91{
94
95 if (ref == 0)
97
98 return ref;
99}
100
102 void **ppobj)
103{
107
108 TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
109
110 *ppobj = NULL;
111 if (pOuter && !IsEqualGUID(&IID_IUnknown, riid))
112 return E_NOINTERFACE;
113
114 hres = This->create_instance(pOuter, &punk);
115 if (SUCCEEDED(hres)) {
116 hres = IUnknown_QueryInterface(punk, riid, ppobj);
117 IUnknown_Release(punk);
118 }
119 return hres;
120}
121
123{
125 FIXME("(%p)->(%d),stub!\n",This,dolock);
126 return S_OK;
127}
128
129static const IClassFactoryVtbl DSCF_Vtbl =
130{
136};
137
138
139/*******************************************************************************
140 * DllGetClassObject [QEDIT.@]
141 * Retrieves class object from a DLL object
142 *
143 * PARAMS
144 * rclsid [I] CLSID for the class object
145 * riid [I] Reference to identifier of interface for class object
146 * ppv [O] Address of variable to receive interface pointer for riid
147 *
148 * RETURNS
149 * Success: S_OK
150 * Failure: CLASS_E_CLASSNOTAVAILABLE, E_OUTOFMEMORY, E_INVALIDARG,
151 * E_UNEXPECTED, E_NOINTERFACE
152 */
153
155{
156 unsigned int i;
158
159 TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
160
162 && ! IsEqualGUID( &IID_IUnknown, riid) )
163 return E_NOINTERFACE;
164
165 for (i = 0; i < ARRAY_SIZE(object_creation); i++)
166 {
167 if (IsEqualGUID(object_creation[i].clsid, rclsid))
168 break;
169 }
170
172 {
173 FIXME("%s: no class found.\n", debugstr_guid(rclsid));
175 }
176
177 factory = CoTaskMemAlloc(sizeof(*factory));
178 if (factory == NULL) return E_OUTOFMEMORY;
179
181 factory->ref = 1;
182
183 factory->create_instance = object_creation[i].create_instance;
184
186 return S_OK;
187}
188
190
192{
193 {
194 .cInstances = 1,
195 .nMediaTypes = 1,
196 .lpMediaType = &reg_null_mt,
197 },
198 {
199 .dwFlags = REG_PINFLAG_B_OUTPUT,
200 .cInstances = 1,
201 .nMediaTypes = 1,
202 .lpMediaType = &reg_null_mt,
203 },
204};
205
207{
208 .dwVersion = 2,
209 .dwMerit = MERIT_DO_NOT_USE,
210 .u.s2.cPins2 = 2,
211 .u.s2.rgPins2 = reg_sample_grabber_pins,
212};
213
215{
216 {
218 .cInstances = 1,
219 .nMediaTypes = 1,
220 .lpMediaType = &reg_null_mt,
221 },
222};
223
225{
226 .dwVersion = 2,
227 .dwMerit = MERIT_DO_NOT_USE,
228 .u.s2.cPins2 = 1,
229 .u.s2.rgPins2 = reg_null_renderer_pins,
230};
231
232/***********************************************************************
233 * DllRegisterServer (QEDIT.@)
234 */
236{
237 IFilterMapper2 *mapper;
238 HRESULT hr;
239
241 return hr;
242
243 if (FAILED(hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
244 &IID_IFilterMapper2, (void **)&mapper)))
245 return hr;
246
247 IFilterMapper2_RegisterFilter(mapper, &CLSID_SampleGrabber, L"SampleGrabber",
249 IFilterMapper2_RegisterFilter(mapper, &CLSID_NullRenderer, L"Null Renderer",
251
252 IFilterMapper2_Release(mapper);
253 return S_OK;
254}
255
256/***********************************************************************
257 * DllUnregisterServer (QEDIT.@)
258 */
260{
261 IFilterMapper2 *mapper;
262 HRESULT hr;
263
265 return hr;
266
267 if (FAILED(hr = CoCreateInstance(&CLSID_FilterMapper2, NULL, CLSCTX_INPROC_SERVER,
268 &IID_IFilterMapper2, (void **)&mapper)))
269 return hr;
270
271 IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_SampleGrabber);
272 IFilterMapper2_UnregisterFilter(mapper, NULL, NULL, &CLSID_NullRenderer);
273
274 IFilterMapper2_Release(mapper);
275 return S_OK;
276}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
REGPINTYPES
Definition: axextend.idl:194
@ REG_PINFLAG_B_OUTPUT
Definition: axextend.idl:221
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ARRAY_SIZE(A)
Definition: main.h:20
HRESULT __wine_unregister_resources(HMODULE module)
Definition: register.c:124
HRESULT __wine_register_resources(HMODULE module)
Definition: register.c:112
BOOL NTAPI DllMain(_In_ HINSTANCE hDll, _In_ ULONG dwReason, _In_opt_ PVOID pReserved)
Definition: main.c:33
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
const GUID IID_IUnknown
const GUID IID_IClassFactory
HRESULT create_instance(const CLSID *clsid, const IID *iid, void **ppv)
Definition: clsfactory.c:212
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT hr
Definition: delayimp.cpp:582
static LPVOID LPUNKNOWN
Definition: dinput.c:53
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
static const struct object_creation_info object_creation[]
Definition: main.c:60
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: main.c:153
static const IClassFactoryVtbl DSCF_Vtbl
Definition: main.c:127
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: main.c:49
static HINSTANCE instance
Definition: main.c:35
HRESULT WINAPI DllRegisterServer(void)
Definition: main.c:235
static ULONG WINAPI DSCF_AddRef(IClassFactory *iface)
Definition: main.c:84
static const REGFILTERPINS2 reg_sample_grabber_pins[2]
Definition: main.c:191
static const REGFILTERPINS2 reg_null_renderer_pins[1]
Definition: main.c:214
static ULONG WINAPI DSCF_Release(IClassFactory *iface)
Definition: main.c:90
HRESULT WINAPI DllUnregisterServer(void)
Definition: main.c:259
static HRESULT WINAPI DSCF_LockServer(IClassFactory *iface, BOOL dolock)
Definition: main.c:122
static const REGPINTYPES reg_null_mt
Definition: main.c:189
static HRESULT WINAPI DSCF_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj)
Definition: main.c:69
static const REGFILTER2 reg_sample_grabber
Definition: main.c:206
static const REGFILTER2 reg_null_renderer
Definition: main.c:224
static HRESULT WINAPI DSCF_CreateInstance(IClassFactory *iface, IUnknown *pOuter, REFIID riid, void **ppobj)
Definition: main.c:101
HRESULT media_detector_create(IUnknown *pUnkOuter, IUnknown **ppv)
Definition: mediadet.c:724
HRESULT null_renderer_create(IUnknown *outer, IUnknown **out)
Definition: nullrenderer.c:64
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1971
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define L(x)
Definition: resources.c:13
r reserved
Definition: btrfs.c:3006
#define MERIT_DO_NOT_USE
Definition: precomp.h:18
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
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
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
#define GUID_NULL
Definition: ks.h:106
HRESULT hres
Definition: protocol.c:432
static IUnknown * outer
Definition: compobj.c:82
const CLSID * clsid
Definition: msctf.cpp:50
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
_In_opt_ IUnknown * punk
Definition: shlwapi.h:158
HRESULT timeline_create(IUnknown *outer, IUnknown **out)
Definition: timeline.c:424
HRESULT sample_grabber_create(IUnknown *outer, IUnknown **out)
#define TRACE(s)
Definition: solgame.cpp:4
void strmbase_release_typelibs(void)
Definition: dispatch.c:72
DWORD dwVersion
Definition: axextend.idl:238
Definition: main.c:439
IClassFactory IClassFactory_iface
Definition: main.c:440
HRESULT(* create_instance)(IUnknown *outer, IUnknown **out)
Definition: main.c:58
const CLSID * clsid
Definition: main.c:56
Definition: send.c:48
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:3479
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:3772