oleaut32/tests: Test more return values.
[wine.git] / dlls / evr / evr.c
blobc2d2933211ef9f7d9b3054f83a89cd23a8a32d78
1 /*
2 * Copyright 2017 Fabian Maurer
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define COBJMACROS
21 #include "config.h"
22 #include "wine/debug.h"
24 #include <stdio.h>
26 #include "evr_private.h"
27 #include "d3d9.h"
28 #include "wine/strmbase.h"
30 #include "initguid.h"
31 #include "dxva2api.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(evr);
35 typedef struct
37 BaseFilter filter;
39 IUnknown IUnknown_inner;
40 } evr_filter;
42 static inline evr_filter *impl_from_inner_IUnknown(IUnknown *iface)
44 return CONTAINING_RECORD(iface, evr_filter, IUnknown_inner);
47 static HRESULT WINAPI inner_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
49 evr_filter *This = impl_from_inner_IUnknown(iface);
50 TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppv);
52 *ppv = NULL;
54 if (IsEqualIID(riid, &IID_IUnknown))
55 *ppv = &This->IUnknown_inner;
57 else if (IsEqualIID(riid, &IID_IAMCertifiedOutputProtection))
58 FIXME("No interface for IID_IAMCertifiedOutputProtection\n");
59 else if (IsEqualIID(riid, &IID_IAMFilterMiscFlags))
60 FIXME("No interface for IID_IAMFilterMiscFlags\n");
61 else if (IsEqualIID(riid, &IID_IBaseFilter))
62 *ppv =&This->filter.IBaseFilter_iface;
63 else if (IsEqualIID(riid, &IID_IMediaFilter))
64 *ppv =&This->filter.IBaseFilter_iface;
65 else if (IsEqualIID(riid, &IID_IPersist))
66 *ppv =&This->filter.IBaseFilter_iface;
67 else if (IsEqualIID(riid, &IID_IKsPropertySet))
68 FIXME("No interface for IID_IKsPropertySet\n");
69 else if (IsEqualIID(riid, &IID_IMediaEventSink))
70 FIXME("No interface for IID_IMediaEventSink\n");
71 else if (IsEqualIID(riid, &IID_IMediaSeeking))
72 FIXME("No interface for IID_IMediaSeeking\n");
73 else if (IsEqualIID(riid, &IID_IQualityControl))
74 FIXME("No interface for IID_IQualityControl\n");
75 else if (IsEqualIID(riid, &IID_IQualProp))
76 FIXME("No interface for IID_IQualProp\n");
78 else if (IsEqualIID(riid, &IID_IEVRFilterConfig))
79 FIXME("No interface for IID_IEVRFilterConfig\n");
80 else if (IsEqualIID(riid, &IID_IMFGetService))
81 FIXME("No interface for IID_IMFGetService\n");
82 else if (IsEqualIID(riid, &IID_IMFVideoPositionMapper))
83 FIXME("No interface for IID_IMFVideoPositionMapper\n");
84 else if (IsEqualIID(riid, &IID_IMFVideoRenderer))
85 FIXME("No interface for IID_IMFVideoRenderer\n");
87 else if (IsEqualIID(riid, &IID_IMemInputPin))
88 FIXME("No interface for IID_IMemInputPin\n");
89 else if (IsEqualIID(riid, &IID_IPin))
90 FIXME("No interface for IID_IPin\n");
91 else if (IsEqualIID(riid, &IID_IQualityControl))
92 FIXME("No interface for IID_IQualityControl\n");
94 else if (IsEqualIID(riid, &IID_IDirectXVideoMemoryConfiguration))
95 FIXME("No interface for IID_IDirectXVideoMemoryConfiguration\n");
97 if (*ppv)
99 IUnknown_AddRef((IUnknown *)(*ppv));
100 return S_OK;
103 FIXME("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppv);
104 return E_NOINTERFACE;
107 static ULONG WINAPI inner_AddRef(IUnknown *iface)
109 evr_filter *This = impl_from_inner_IUnknown(iface);
110 ULONG ref = BaseFilterImpl_AddRef(&This->filter.IBaseFilter_iface);
112 TRACE("(%p, %p)->(): new ref %d\n", iface, This, ref);
114 return ref;
117 static ULONG WINAPI inner_Release(IUnknown *iface)
119 evr_filter *This = impl_from_inner_IUnknown(iface);
120 ULONG ref = BaseFilterImpl_Release(&This->filter.IBaseFilter_iface);
122 TRACE("(%p, %p)->(): new ref %d\n", iface, This, ref);
124 if (!ref)
125 CoTaskMemFree(This);
127 return ref;
130 static const IUnknownVtbl evr_inner_vtbl =
132 inner_QueryInterface,
133 inner_AddRef,
134 inner_Release
137 static inline evr_filter *impl_from_IBaseFilter(IBaseFilter *iface)
139 return CONTAINING_RECORD(iface, evr_filter, filter);
142 static HRESULT WINAPI filter_QueryInterface(IBaseFilter *iface, REFIID riid, void **ppv)
144 evr_filter *This = impl_from_IBaseFilter(iface);
145 return IUnknown_QueryInterface(&This->IUnknown_inner, riid, ppv);
148 static ULONG WINAPI filter_AddRef(IBaseFilter *iface)
150 evr_filter *This = impl_from_IBaseFilter(iface);
151 LONG ret;
153 ret = IUnknown_AddRef(&This->IUnknown_inner);
155 TRACE("(%p)->AddRef from %d\n", iface, ret - 1);
157 return ret;
160 static ULONG WINAPI filter_Release(IBaseFilter *iface)
162 evr_filter *This = impl_from_IBaseFilter(iface);
163 LONG ret;
165 ret = IUnknown_Release(&This->IUnknown_inner);
167 TRACE("(%p)->Release from %d\n", iface, ret + 1);
169 return ret;
172 static const IBaseFilterVtbl basefilter_vtbl =
174 filter_QueryInterface,
175 filter_AddRef,
176 filter_Release,
177 BaseFilterImpl_GetClassID,
178 BaseRendererImpl_Stop,
179 BaseRendererImpl_Pause,
180 BaseRendererImpl_Run,
181 BaseRendererImpl_GetState,
182 BaseRendererImpl_SetSyncSource,
183 BaseFilterImpl_GetSyncSource,
184 BaseFilterImpl_EnumPins,
185 BaseRendererImpl_FindPin,
186 BaseFilterImpl_QueryFilterInfo,
187 BaseFilterImpl_JoinFilterGraph,
188 BaseFilterImpl_QueryVendorInfo
191 static IPin* WINAPI filter_GetPin(BaseFilter *iface, int position)
193 FIXME("(%p, %d): stub!\n", iface, position);
194 return NULL;
197 static LONG WINAPI filter_GetPinCount(BaseFilter *iface)
199 FIXME("(%p): stub!\n", iface);
200 return 0;
203 static const BaseFilterFuncTable basefilter_functable =
205 filter_GetPin,
206 filter_GetPinCount,
209 HRESULT evr_filter_create(IUnknown *outer_unk, void **ppv)
211 evr_filter *object;
213 TRACE("(%p, %p)\n", outer_unk, ppv);
215 *ppv = NULL;
217 if(outer_unk != NULL)
219 FIXME("Aggregation yet unsupported!\n");
220 return E_NOINTERFACE;
223 object = CoTaskMemAlloc(sizeof(evr_filter));
224 if (!object)
225 return E_OUTOFMEMORY;
227 BaseFilter_Init(&object->filter, &basefilter_vtbl, &CLSID_EnhancedVideoRenderer,
228 (DWORD_PTR)(__FILE__ ": EVR.csFilter"), &basefilter_functable);
230 object->IUnknown_inner.lpVtbl = &evr_inner_vtbl;
232 *ppv = &object->IUnknown_inner;
234 return S_OK;