winegstreamer: Disconnect source pins before calling wg_parser_disconnect().
[wine.git] / dlls / evr / evr.c
blob5e6ca03ea3dd9b948385f1a40c4810bbd483b018
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 "wine/debug.h"
23 #include <stdio.h>
25 #include "evr_private.h"
26 #include "d3d9.h"
28 #include "initguid.h"
29 #include "dxva2api.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(evr);
33 struct evr
35 struct strmbase_renderer renderer;
36 IEVRFilterConfig IEVRFilterConfig_iface;
39 static struct evr *impl_from_strmbase_renderer(struct strmbase_renderer *iface)
41 return CONTAINING_RECORD(iface, struct evr, renderer);
44 static HRESULT evr_query_interface(struct strmbase_renderer *iface, REFIID iid, void **out)
46 struct evr *filter = impl_from_strmbase_renderer(iface);
48 if (IsEqualGUID(iid, &IID_IEVRFilterConfig))
49 *out = &filter->IEVRFilterConfig_iface;
50 else
51 return E_NOINTERFACE;
53 IUnknown_AddRef((IUnknown *)*out);
54 return S_OK;
57 static void evr_destroy(struct strmbase_renderer *iface)
59 struct evr *filter = impl_from_strmbase_renderer(iface);
61 strmbase_renderer_cleanup(&filter->renderer);
62 free(filter);
65 static HRESULT evr_render(struct strmbase_renderer *iface, IMediaSample *sample)
67 FIXME("Not implemented.\n");
68 return E_NOTIMPL;
71 static HRESULT evr_query_accept(struct strmbase_renderer *iface, const AM_MEDIA_TYPE *mt)
73 FIXME("Not implemented.\n");
74 return E_NOTIMPL;
77 static const struct strmbase_renderer_ops renderer_ops =
79 .renderer_query_accept = evr_query_accept,
80 .renderer_render = evr_render,
81 .renderer_query_interface = evr_query_interface,
82 .renderer_destroy = evr_destroy,
85 static struct evr *impl_from_IEVRFilterConfig(IEVRFilterConfig *iface)
87 return CONTAINING_RECORD(iface, struct evr, IEVRFilterConfig_iface);
90 static HRESULT WINAPI filter_config_QueryInterface(IEVRFilterConfig *iface, REFIID iid, void **out)
92 struct evr *filter = impl_from_IEVRFilterConfig(iface);
93 return IUnknown_QueryInterface(filter->renderer.filter.outer_unk, iid, out);
96 static ULONG WINAPI filter_config_AddRef(IEVRFilterConfig *iface)
98 struct evr *filter = impl_from_IEVRFilterConfig(iface);
99 return IUnknown_AddRef(filter->renderer.filter.outer_unk);
102 static ULONG WINAPI filter_config_Release(IEVRFilterConfig *iface)
104 struct evr *filter = impl_from_IEVRFilterConfig(iface);
105 return IUnknown_Release(filter->renderer.filter.outer_unk);
108 static HRESULT WINAPI filter_config_SetNumberOfStreams(IEVRFilterConfig *iface, DWORD count)
110 struct evr *filter = impl_from_IEVRFilterConfig(iface);
112 FIXME("filter %p, count %lu, stub!\n", filter, count);
114 return E_NOTIMPL;
117 static HRESULT WINAPI filter_config_GetNumberOfStreams(IEVRFilterConfig *iface, DWORD *count)
119 struct evr *filter = impl_from_IEVRFilterConfig(iface);
121 FIXME("filter %p, count %p, stub!\n", filter, count);
123 return E_NOTIMPL;
126 static const IEVRFilterConfigVtbl filter_config_vtbl =
128 filter_config_QueryInterface,
129 filter_config_AddRef,
130 filter_config_Release,
131 filter_config_SetNumberOfStreams,
132 filter_config_GetNumberOfStreams,
135 HRESULT evr_filter_create(IUnknown *outer, void **out)
137 struct evr *object;
139 if (!(object = calloc(1, sizeof(*object))))
140 return E_OUTOFMEMORY;
142 strmbase_renderer_init(&object->renderer, outer,
143 &CLSID_EnhancedVideoRenderer, L"EVR Input0", &renderer_ops);
144 object->IEVRFilterConfig_iface.lpVtbl = &filter_config_vtbl;
146 TRACE("Created EVR %p.\n", object);
147 *out = &object->renderer.filter.IUnknown_inner;
148 return S_OK;