| 1 | /* | 
|---|
| 2 | * Implementation of CLSID_FilterMapper. | 
|---|
| 3 | * | 
|---|
| 4 | * FIXME - stub. | 
|---|
| 5 | * | 
|---|
| 6 | * hidenori@a2.ctktv.ne.jp | 
|---|
| 7 | */ | 
|---|
| 8 |  | 
|---|
| 9 | #include "config.h" | 
|---|
| 10 |  | 
|---|
| 11 | #include "windef.h" | 
|---|
| 12 | #include "winbase.h" | 
|---|
| 13 | #include "wingdi.h" | 
|---|
| 14 | #include "winuser.h" | 
|---|
| 15 | #include "winreg.h" | 
|---|
| 16 | #include "winerror.h" | 
|---|
| 17 | #include "wine/obj_base.h" | 
|---|
| 18 | #include "wine/obj_oleaut.h" | 
|---|
| 19 | #include "strmif.h" | 
|---|
| 20 | #include "control.h" | 
|---|
| 21 | #include "uuids.h" | 
|---|
| 22 |  | 
|---|
| 23 | #include "debugtools.h" | 
|---|
| 24 | DEFAULT_DEBUG_CHANNEL(quartz); | 
|---|
| 25 |  | 
|---|
| 26 | #include "quartz_private.h" | 
|---|
| 27 | #include "fmap.h" | 
|---|
| 28 | #include "regsvr.h" | 
|---|
| 29 |  | 
|---|
| 30 |  | 
|---|
| 31 | /*************************************************************************** | 
|---|
| 32 | * | 
|---|
| 33 | *      new/delete for CLSID_FilterMapper | 
|---|
| 34 | * | 
|---|
| 35 | */ | 
|---|
| 36 |  | 
|---|
| 37 | /* can I use offsetof safely? - FIXME? */ | 
|---|
| 38 | static QUARTZ_IFEntry IFEntries[] = | 
|---|
| 39 | { | 
|---|
| 40 | { &IID_IFilterMapper, offsetof(CFilterMapper,fmap)-offsetof(CFilterMapper,unk) }, | 
|---|
| 41 | }; | 
|---|
| 42 |  | 
|---|
| 43 |  | 
|---|
| 44 | static void QUARTZ_DestroyFilterMapper(IUnknown* punk) | 
|---|
| 45 | { | 
|---|
| 46 | CFilterMapper_THIS(punk,unk); | 
|---|
| 47 |  | 
|---|
| 48 | CFilterMapper_UninitIFilterMapper( This ); | 
|---|
| 49 | } | 
|---|
| 50 |  | 
|---|
| 51 | HRESULT QUARTZ_CreateFilterMapper(IUnknown* punkOuter,void** ppobj) | 
|---|
| 52 | { | 
|---|
| 53 | CFilterMapper*  pfm; | 
|---|
| 54 | HRESULT hr; | 
|---|
| 55 |  | 
|---|
| 56 | TRACE("(%p,%p)\n",punkOuter,ppobj); | 
|---|
| 57 |  | 
|---|
| 58 | pfm = (CFilterMapper*)QUARTZ_AllocObj( sizeof(CFilterMapper) ); | 
|---|
| 59 | if ( pfm == NULL ) | 
|---|
| 60 | return E_OUTOFMEMORY; | 
|---|
| 61 |  | 
|---|
| 62 | QUARTZ_IUnkInit( &pfm->unk, punkOuter ); | 
|---|
| 63 | hr = CFilterMapper_InitIFilterMapper( pfm ); | 
|---|
| 64 | if ( FAILED(hr) ) | 
|---|
| 65 | { | 
|---|
| 66 | QUARTZ_FreeObj( pfm ); | 
|---|
| 67 | return hr; | 
|---|
| 68 | } | 
|---|
| 69 |  | 
|---|
| 70 | pfm->unk.pEntries = IFEntries; | 
|---|
| 71 | pfm->unk.dwEntries = sizeof(IFEntries)/sizeof(IFEntries[0]); | 
|---|
| 72 | pfm->unk.pOnFinalRelease = QUARTZ_DestroyFilterMapper; | 
|---|
| 73 |  | 
|---|
| 74 | *ppobj = (void*)(&pfm->unk); | 
|---|
| 75 |  | 
|---|
| 76 | return S_OK; | 
|---|
| 77 | } | 
|---|
| 78 |  | 
|---|
| 79 | /*************************************************************************** | 
|---|
| 80 | * | 
|---|
| 81 | *      CLSID_FilterMapper::IFilterMapper | 
|---|
| 82 | * | 
|---|
| 83 | */ | 
|---|
| 84 |  | 
|---|
| 85 | static HRESULT WINAPI | 
|---|
| 86 | IFilterMapper_fnQueryInterface(IFilterMapper* iface,REFIID riid,void** ppobj) | 
|---|
| 87 | { | 
|---|
| 88 | CFilterMapper_THIS(iface,fmap); | 
|---|
| 89 |  | 
|---|
| 90 | TRACE("(%p)->()\n",This); | 
|---|
| 91 |  | 
|---|
| 92 | return IUnknown_QueryInterface(This->unk.punkControl,riid,ppobj); | 
|---|
| 93 | } | 
|---|
| 94 |  | 
|---|
| 95 | static ULONG WINAPI | 
|---|
| 96 | IFilterMapper_fnAddRef(IFilterMapper* iface) | 
|---|
| 97 | { | 
|---|
| 98 | CFilterMapper_THIS(iface,fmap); | 
|---|
| 99 |  | 
|---|
| 100 | TRACE("(%p)->()\n",This); | 
|---|
| 101 |  | 
|---|
| 102 | return IUnknown_AddRef(This->unk.punkControl); | 
|---|
| 103 | } | 
|---|
| 104 |  | 
|---|
| 105 | static ULONG WINAPI | 
|---|
| 106 | IFilterMapper_fnRelease(IFilterMapper* iface) | 
|---|
| 107 | { | 
|---|
| 108 | CFilterMapper_THIS(iface,fmap); | 
|---|
| 109 |  | 
|---|
| 110 | TRACE("(%p)->()\n",This); | 
|---|
| 111 |  | 
|---|
| 112 | return IUnknown_Release(This->unk.punkControl); | 
|---|
| 113 | } | 
|---|
| 114 |  | 
|---|
| 115 |  | 
|---|
| 116 | static HRESULT WINAPI | 
|---|
| 117 | IFilterMapper_fnRegisterFilter(IFilterMapper* iface,CLSID clsid,LPCWSTR lpwszName,DWORD dwMerit) | 
|---|
| 118 | { | 
|---|
| 119 | CFilterMapper_THIS(iface,fmap); | 
|---|
| 120 |  | 
|---|
| 121 | FIXME("(%p)->(%s,%s,%08lx)\n",This, | 
|---|
| 122 | debugstr_guid(&clsid),debugstr_w(lpwszName),dwMerit); | 
|---|
| 123 |  | 
|---|
| 124 | /* FIXME */ | 
|---|
| 125 | /* FIXME - handle dwMerit! */ | 
|---|
| 126 | return QUARTZ_RegisterAMovieFilter( | 
|---|
| 127 | &CLSID_LegacyAmFilterCategory, | 
|---|
| 128 | &clsid, | 
|---|
| 129 | NULL, 0, | 
|---|
| 130 | lpwszName, NULL, TRUE ); | 
|---|
| 131 | } | 
|---|
| 132 |  | 
|---|
| 133 | static HRESULT WINAPI | 
|---|
| 134 | IFilterMapper_fnRegisterFilterInstance(IFilterMapper* iface,CLSID clsid,LPCWSTR lpwszName,CLSID* pclsidMedia) | 
|---|
| 135 | { | 
|---|
| 136 | CFilterMapper_THIS(iface,fmap); | 
|---|
| 137 | HRESULT hr; | 
|---|
| 138 |  | 
|---|
| 139 | FIXME("(%p)->()\n",This); | 
|---|
| 140 |  | 
|---|
| 141 | if ( pclsidMedia == NULL ) | 
|---|
| 142 | return E_POINTER; | 
|---|
| 143 | hr = CoCreateGuid(pclsidMedia); | 
|---|
| 144 | if ( FAILED(hr) ) | 
|---|
| 145 | return hr; | 
|---|
| 146 |  | 
|---|
| 147 | /* FIXME */ | 
|---|
| 148 | /* this doesn't work. */ | 
|---|
| 149 | /* return IFilterMapper_RegisterFilter(iface, | 
|---|
| 150 | *pclsidMedia,lpwszName,0x60000000); */ | 
|---|
| 151 |  | 
|---|
| 152 | return E_NOTIMPL; | 
|---|
| 153 | } | 
|---|
| 154 |  | 
|---|
| 155 | static HRESULT WINAPI | 
|---|
| 156 | IFilterMapper_fnRegisterPin(IFilterMapper* iface,CLSID clsidFilter,LPCWSTR lpwszName,BOOL bRendered,BOOL bOutput,BOOL bZero,BOOL bMany,CLSID clsidReserved,LPCWSTR lpwszReserved) | 
|---|
| 157 | { | 
|---|
| 158 | CFilterMapper_THIS(iface,fmap); | 
|---|
| 159 |  | 
|---|
| 160 | FIXME("(%p)->() stub!\n",This); | 
|---|
| 161 |  | 
|---|
| 162 | return E_NOTIMPL; | 
|---|
| 163 | } | 
|---|
| 164 |  | 
|---|
| 165 | static HRESULT WINAPI | 
|---|
| 166 | IFilterMapper_fnRegisterPinType(IFilterMapper* iface,CLSID clsidFilter,LPCWSTR lpwszName,CLSID clsidMajorType,CLSID clsidSubType) | 
|---|
| 167 | { | 
|---|
| 168 | CFilterMapper_THIS(iface,fmap); | 
|---|
| 169 |  | 
|---|
| 170 | FIXME("(%p)->() stub!\n",This); | 
|---|
| 171 |  | 
|---|
| 172 | return E_NOTIMPL; | 
|---|
| 173 | } | 
|---|
| 174 |  | 
|---|
| 175 | static HRESULT WINAPI | 
|---|
| 176 | IFilterMapper_fnUnregisterFilter(IFilterMapper* iface,CLSID clsidFilter) | 
|---|
| 177 | { | 
|---|
| 178 | CFilterMapper_THIS(iface,fmap); | 
|---|
| 179 |  | 
|---|
| 180 | FIXME("(%p)->(%s)\n",This,debugstr_guid(&clsidFilter)); | 
|---|
| 181 |  | 
|---|
| 182 | /* FIXME */ | 
|---|
| 183 | return QUARTZ_RegisterAMovieFilter( | 
|---|
| 184 | &CLSID_LegacyAmFilterCategory, | 
|---|
| 185 | &clsidFilter, | 
|---|
| 186 | NULL, 0, NULL, NULL, FALSE ); | 
|---|
| 187 | } | 
|---|
| 188 |  | 
|---|
| 189 | static HRESULT WINAPI | 
|---|
| 190 | IFilterMapper_fnUnregisterFilterInstance(IFilterMapper* iface,CLSID clsidMedia) | 
|---|
| 191 | { | 
|---|
| 192 | CFilterMapper_THIS(iface,fmap); | 
|---|
| 193 |  | 
|---|
| 194 | FIXME("(%p)->(%s)\n",This,debugstr_guid(&clsidMedia)); | 
|---|
| 195 |  | 
|---|
| 196 | /* FIXME */ | 
|---|
| 197 | /* this doesn't work. */ | 
|---|
| 198 | /* return IFilterMapper_UnregisterFilter(iface,clsidMedia); */ | 
|---|
| 199 |  | 
|---|
| 200 | return E_NOTIMPL; | 
|---|
| 201 | } | 
|---|
| 202 |  | 
|---|
| 203 | static HRESULT WINAPI | 
|---|
| 204 | IFilterMapper_fnUnregisterPin(IFilterMapper* iface,CLSID clsidPin,LPCWSTR lpwszName) | 
|---|
| 205 | { | 
|---|
| 206 | CFilterMapper_THIS(iface,fmap); | 
|---|
| 207 |  | 
|---|
| 208 | FIXME("(%p)->(%s,%s) stub!\n",This, | 
|---|
| 209 | debugstr_guid(&clsidPin),debugstr_w(lpwszName)); | 
|---|
| 210 |  | 
|---|
| 211 | return E_NOTIMPL; | 
|---|
| 212 | } | 
|---|
| 213 |  | 
|---|
| 214 | static HRESULT WINAPI | 
|---|
| 215 | IFilterMapper_fnEnumMatchingFilters(IFilterMapper* iface,IEnumRegFilters** ppobj,DWORD dwMerit,BOOL bInputNeeded,CLSID clsInMajorType,CLSID clsidSubType,BOOL bRender,BOOL bOutputNeeded,CLSID clsOutMajorType,CLSID clsOutSubType) | 
|---|
| 216 | { | 
|---|
| 217 | CFilterMapper_THIS(iface,fmap); | 
|---|
| 218 |  | 
|---|
| 219 | FIXME("(%p)->() stub!\n",This); | 
|---|
| 220 |  | 
|---|
| 221 | return E_NOTIMPL; | 
|---|
| 222 | } | 
|---|
| 223 |  | 
|---|
| 224 |  | 
|---|
| 225 |  | 
|---|
| 226 | static ICOM_VTABLE(IFilterMapper) ifmap = | 
|---|
| 227 | { | 
|---|
| 228 | ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE | 
|---|
| 229 | /* IUnknown fields */ | 
|---|
| 230 | IFilterMapper_fnQueryInterface, | 
|---|
| 231 | IFilterMapper_fnAddRef, | 
|---|
| 232 | IFilterMapper_fnRelease, | 
|---|
| 233 | /* IFilterMapper fields */ | 
|---|
| 234 | IFilterMapper_fnRegisterFilter, | 
|---|
| 235 | IFilterMapper_fnRegisterFilterInstance, | 
|---|
| 236 | IFilterMapper_fnRegisterPin, | 
|---|
| 237 | IFilterMapper_fnRegisterPinType, | 
|---|
| 238 | IFilterMapper_fnUnregisterFilter, | 
|---|
| 239 | IFilterMapper_fnUnregisterFilterInstance, | 
|---|
| 240 | IFilterMapper_fnUnregisterPin, | 
|---|
| 241 | IFilterMapper_fnEnumMatchingFilters, | 
|---|
| 242 | }; | 
|---|
| 243 |  | 
|---|
| 244 |  | 
|---|
| 245 | HRESULT CFilterMapper_InitIFilterMapper( CFilterMapper* pfm ) | 
|---|
| 246 | { | 
|---|
| 247 | TRACE("(%p)\n",pfm); | 
|---|
| 248 | ICOM_VTBL(&pfm->fmap) = &ifmap; | 
|---|
| 249 |  | 
|---|
| 250 | return NOERROR; | 
|---|
| 251 | } | 
|---|
| 252 |  | 
|---|
| 253 | void CFilterMapper_UninitIFilterMapper( CFilterMapper* pfm ) | 
|---|
| 254 | { | 
|---|
| 255 | TRACE("(%p)\n",pfm); | 
|---|
| 256 | } | 
|---|