2 * Implementation of CLSID_FilterMapper and CLSID_FilterMapper2.
6 * hidenori@a2.ctktv.ne.jp
20 #include "debugtools.h"
21 DEFAULT_DEBUG_CHANNEL(quartz);
23 #include "quartz_private.h"
28 /***************************************************************************
30 * new/delete for CLSID_FilterMapper
34 /* can I use offsetof safely? - FIXME? */
35 static QUARTZ_IFEntry FMapIFEntries[] =
37 { &IID_IFilterMapper, offsetof(CFilterMapper,fmap)-offsetof(CFilterMapper,unk) },
41 static void QUARTZ_DestroyFilterMapper(IUnknown* punk)
43 CFilterMapper_THIS(punk,unk);
45 CFilterMapper_UninitIFilterMapper( This );
48 HRESULT QUARTZ_CreateFilterMapper(IUnknown* punkOuter,void** ppobj)
53 TRACE("(%p,%p)\n",punkOuter,ppobj);
55 pfm = (CFilterMapper*)QUARTZ_AllocObj( sizeof(CFilterMapper) );
59 QUARTZ_IUnkInit( &pfm->unk, punkOuter );
60 hr = CFilterMapper_InitIFilterMapper( pfm );
63 QUARTZ_FreeObj( pfm );
67 pfm->unk.pEntries = FMapIFEntries;
68 pfm->unk.dwEntries = sizeof(FMapIFEntries)/sizeof(FMapIFEntries[0]);
69 pfm->unk.pOnFinalRelease = QUARTZ_DestroyFilterMapper;
71 *ppobj = (void*)(&pfm->unk);
76 /***************************************************************************
78 * CLSID_FilterMapper::IFilterMapper
83 IFilterMapper_fnQueryInterface(IFilterMapper* iface,REFIID riid,void** ppobj)
85 CFilterMapper_THIS(iface,fmap);
87 TRACE("(%p)->()\n",This);
89 return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
93 IFilterMapper_fnAddRef(IFilterMapper* iface)
95 CFilterMapper_THIS(iface,fmap);
97 TRACE("(%p)->()\n",This);
99 return IUnknown_AddRef(This->unk.punkControl);
103 IFilterMapper_fnRelease(IFilterMapper* iface)
105 CFilterMapper_THIS(iface,fmap);
107 TRACE("(%p)->()\n",This);
109 return IUnknown_Release(This->unk.punkControl);
113 static HRESULT WINAPI
114 IFilterMapper_fnRegisterFilter(IFilterMapper* iface,CLSID clsid,LPCWSTR lpwszName,DWORD dwMerit)
116 CFilterMapper_THIS(iface,fmap);
118 FIXME("(%p)->(%s,%s,%08lx)\n",This,
119 debugstr_guid(&clsid),debugstr_w(lpwszName),dwMerit);
122 /* FIXME - handle dwMerit! */
123 return QUARTZ_RegisterAMovieFilter(
124 &CLSID_LegacyAmFilterCategory,
127 lpwszName, NULL, TRUE );
130 static HRESULT WINAPI
131 IFilterMapper_fnRegisterFilterInstance(IFilterMapper* iface,CLSID clsid,LPCWSTR lpwszName,CLSID* pclsidMedia)
133 CFilterMapper_THIS(iface,fmap);
136 FIXME("(%p)->()\n",This);
138 if ( pclsidMedia == NULL )
140 hr = CoCreateGuid(pclsidMedia);
145 /* this doesn't work. */
146 /* return IFilterMapper_RegisterFilter(iface,
147 *pclsidMedia,lpwszName,0x60000000); */
152 static HRESULT WINAPI
153 IFilterMapper_fnRegisterPin(IFilterMapper* iface,CLSID clsidFilter,LPCWSTR lpwszName,BOOL bRendered,BOOL bOutput,BOOL bZero,BOOL bMany,CLSID clsidReserved,LPCWSTR lpwszReserved)
155 CFilterMapper_THIS(iface,fmap);
157 FIXME("(%p)->() stub!\n",This);
162 static HRESULT WINAPI
163 IFilterMapper_fnRegisterPinType(IFilterMapper* iface,CLSID clsidFilter,LPCWSTR lpwszName,CLSID clsidMajorType,CLSID clsidSubType)
165 CFilterMapper_THIS(iface,fmap);
167 FIXME("(%p)->() stub!\n",This);
172 static HRESULT WINAPI
173 IFilterMapper_fnUnregisterFilter(IFilterMapper* iface,CLSID clsidFilter)
175 CFilterMapper_THIS(iface,fmap);
177 FIXME("(%p)->(%s)\n",This,debugstr_guid(&clsidFilter));
180 return QUARTZ_RegisterAMovieFilter(
181 &CLSID_LegacyAmFilterCategory,
183 NULL, 0, NULL, NULL, FALSE );
186 static HRESULT WINAPI
187 IFilterMapper_fnUnregisterFilterInstance(IFilterMapper* iface,CLSID clsidMedia)
189 CFilterMapper_THIS(iface,fmap);
191 FIXME("(%p)->(%s)\n",This,debugstr_guid(&clsidMedia));
194 /* this doesn't work. */
195 /* return IFilterMapper_UnregisterFilter(iface,clsidMedia); */
200 static HRESULT WINAPI
201 IFilterMapper_fnUnregisterPin(IFilterMapper* iface,CLSID clsidPin,LPCWSTR lpwszName)
203 CFilterMapper_THIS(iface,fmap);
205 FIXME("(%p)->(%s,%s) stub!\n",This,
206 debugstr_guid(&clsidPin),debugstr_w(lpwszName));
211 static HRESULT WINAPI
212 IFilterMapper_fnEnumMatchingFilters(IFilterMapper* iface,IEnumRegFilters** ppobj,DWORD dwMerit,BOOL bInputNeeded,CLSID clsInMajorType,CLSID clsidSubType,BOOL bRender,BOOL bOutputNeeded,CLSID clsOutMajorType,CLSID clsOutSubType)
214 CFilterMapper_THIS(iface,fmap);
216 FIXME("(%p)->() stub!\n",This);
223 static ICOM_VTABLE(IFilterMapper) ifmap =
225 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
226 /* IUnknown fields */
227 IFilterMapper_fnQueryInterface,
228 IFilterMapper_fnAddRef,
229 IFilterMapper_fnRelease,
230 /* IFilterMapper fields */
231 IFilterMapper_fnRegisterFilter,
232 IFilterMapper_fnRegisterFilterInstance,
233 IFilterMapper_fnRegisterPin,
234 IFilterMapper_fnRegisterPinType,
235 IFilterMapper_fnUnregisterFilter,
236 IFilterMapper_fnUnregisterFilterInstance,
237 IFilterMapper_fnUnregisterPin,
238 IFilterMapper_fnEnumMatchingFilters,
242 HRESULT CFilterMapper_InitIFilterMapper( CFilterMapper* pfm )
245 ICOM_VTBL(&pfm->fmap) = &ifmap;
250 void CFilterMapper_UninitIFilterMapper( CFilterMapper* pfm )
256 /***************************************************************************
258 * new/delete for CLSID_FilterMapper2
262 /* can I use offsetof safely? - FIXME? */
263 static QUARTZ_IFEntry FMap2IFEntries[] =
265 { &IID_IFilterMapper2, offsetof(CFilterMapper2,fmap3)-offsetof(CFilterMapper2,unk) },
266 { &IID_IFilterMapper3, offsetof(CFilterMapper2,fmap3)-offsetof(CFilterMapper2,unk) },
270 static void QUARTZ_DestroyFilterMapper2(IUnknown* punk)
272 CFilterMapper2_THIS(punk,unk);
274 CFilterMapper2_UninitIFilterMapper3( This );
277 HRESULT QUARTZ_CreateFilterMapper2(IUnknown* punkOuter,void** ppobj)
282 TRACE("(%p,%p)\n",punkOuter,ppobj);
284 pfm = (CFilterMapper2*)QUARTZ_AllocObj( sizeof(CFilterMapper2) );
286 return E_OUTOFMEMORY;
288 QUARTZ_IUnkInit( &pfm->unk, punkOuter );
289 hr = CFilterMapper2_InitIFilterMapper3( pfm );
292 QUARTZ_FreeObj( pfm );
296 pfm->unk.pEntries = FMap2IFEntries;
297 pfm->unk.dwEntries = sizeof(FMap2IFEntries)/sizeof(FMap2IFEntries[0]);
298 pfm->unk.pOnFinalRelease = QUARTZ_DestroyFilterMapper2;
300 *ppobj = (void*)(&pfm->unk);
305 /***************************************************************************
307 * CLSID_FilterMapper2::IFilterMapper3
312 static HRESULT WINAPI
313 IFilterMapper3_fnQueryInterface(IFilterMapper3* iface,REFIID riid,void** ppobj)
315 CFilterMapper2_THIS(iface,fmap3);
317 TRACE("(%p)->()\n",This);
319 return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj);
323 IFilterMapper3_fnAddRef(IFilterMapper3* iface)
325 CFilterMapper2_THIS(iface,fmap3);
327 TRACE("(%p)->()\n",This);
329 return IUnknown_AddRef(This->unk.punkControl);
333 IFilterMapper3_fnRelease(IFilterMapper3* iface)
335 CFilterMapper2_THIS(iface,fmap3);
337 TRACE("(%p)->()\n",This);
339 return IUnknown_Release(This->unk.punkControl);
342 static HRESULT WINAPI
343 IFilterMapper3_fnCreateCategory(IFilterMapper3* iface,REFCLSID rclsidCategory,DWORD dwMerit,LPCWSTR lpwszDesc)
345 CFilterMapper2_THIS(iface,fmap3);
347 FIXME("(%p)->(%s,%lu,%s) stub!\n",This,
348 debugstr_guid(rclsidCategory),
349 (unsigned long)dwMerit,debugstr_w(lpwszDesc));
355 static HRESULT WINAPI
356 IFilterMapper3_fnUnregisterFilter(IFilterMapper3* iface,const CLSID* pclsidCategory,const OLECHAR* lpwszInst,REFCLSID rclsidFilter)
358 CFilterMapper2_THIS(iface,fmap3);
360 FIXME("(%p)->(%s,%s,%s) stub!\n",This,
361 debugstr_guid(pclsidCategory),
362 debugstr_w(lpwszInst),
363 debugstr_guid(rclsidFilter));
365 if ( pclsidCategory == NULL )
366 pclsidCategory = &CLSID_LegacyAmFilterCategory;
369 return QUARTZ_RegisterAMovieFilter(
373 NULL, lpwszInst, FALSE );
377 static HRESULT WINAPI
378 IFilterMapper3_fnRegisterFilter(IFilterMapper3* iface,REFCLSID rclsidFilter,LPCWSTR lpName,IMoniker** ppMoniker,const CLSID* pclsidCategory,const OLECHAR* lpwszInst,const REGFILTER2* pRF2)
380 CFilterMapper2_THIS(iface,fmap3);
382 FIXME( "(%p)->(%s,%s,%p,%s,%s,%p) stub!\n",This,
383 debugstr_guid(rclsidFilter),debugstr_w(lpName),
384 ppMoniker,debugstr_guid(pclsidCategory),
385 debugstr_w(lpwszInst),pRF2 );
387 if ( lpName == NULL || pRF2 == NULL )
390 if ( ppMoniker != NULL )
392 FIXME( "ppMoniker != NULL - not implemented!\n" );
396 if ( pclsidCategory == NULL )
397 pclsidCategory = &CLSID_LegacyAmFilterCategory;
399 /* FIXME!! - all members in REGFILTER2 are ignored ! */
401 return QUARTZ_RegisterAMovieFilter(
405 lpName, lpwszInst, TRUE );
409 static HRESULT WINAPI
410 IFilterMapper3_fnEnumMatchingFilters(IFilterMapper3* iface,IEnumMoniker** ppMoniker,DWORD dwFlags,BOOL bExactMatch,DWORD dwMerit,BOOL bInputNeeded,DWORD cInputTypes,const GUID* pguidInputTypes,const REGPINMEDIUM* pPinMediumIn,const CLSID* pPinCategoryIn,BOOL bRender,BOOL bOutputNeeded,DWORD cOutputTypes,const GUID* pguidOutputTypes,const REGPINMEDIUM* pPinMediumOut,const CLSID* pPinCategoryOut)
412 CFilterMapper2_THIS(iface,fmap3);
414 FIXME("(%p)->() stub!\n",This);
419 static HRESULT WINAPI
420 IFilterMapper3_fnGetICreateDevEnum(IFilterMapper3* iface,ICreateDevEnum** ppDevEnum)
422 CFilterMapper2_THIS(iface,fmap3);
425 FIXME("(%p)->() stub!\n",This);
433 static ICOM_VTABLE(IFilterMapper3) ifmap3 =
435 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
436 /* IUnknown fields */
437 IFilterMapper3_fnQueryInterface,
438 IFilterMapper3_fnAddRef,
439 IFilterMapper3_fnRelease,
440 /* IFilterMapper2 fields */
441 IFilterMapper3_fnCreateCategory,
442 IFilterMapper3_fnUnregisterFilter,
443 IFilterMapper3_fnRegisterFilter,
444 IFilterMapper3_fnEnumMatchingFilters,
445 /* IFilterMapper3 fields */
446 IFilterMapper3_fnGetICreateDevEnum,
450 HRESULT CFilterMapper2_InitIFilterMapper3( CFilterMapper2* pfm )
453 ICOM_VTBL(&pfm->fmap3) = &ifmap3;
458 void CFilterMapper2_UninitIFilterMapper3( CFilterMapper2* pfm )