wined3d: Correctly destroy the adapter on format initialization failure in no3d mode.
[wine/zf.git] / dlls / qedit / nullrenderer.c
blobc64d5e2987c2bd893ed363e5e8d264aab7adfcb6
1 /*
2 * Null renderer filter
4 * Copyright 2004 Christian Costa
5 * Copyright 2008 Maarten Lankhorst
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define COBJMACROS
23 #include "dshow.h"
24 #include "wine/debug.h"
25 #include "wine/strmbase.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(qedit);
29 struct null_renderer
31 struct strmbase_renderer renderer;
34 static struct null_renderer *impl_from_strmbase_renderer(struct strmbase_renderer *iface)
36 return CONTAINING_RECORD(iface, struct null_renderer, renderer);
39 static HRESULT WINAPI NullRenderer_DoRenderSample(struct strmbase_renderer *iface, IMediaSample *sample)
41 struct null_renderer *filter = impl_from_strmbase_renderer(iface);
43 if (filter->renderer.filter.state == State_Paused)
44 SetEvent(filter->renderer.state_event);
46 return S_OK;
49 static HRESULT WINAPI NullRenderer_CheckMediaType(struct strmbase_renderer *iface, const AM_MEDIA_TYPE *mt)
51 TRACE("Not a stub!\n");
52 return S_OK;
55 static void null_renderer_destroy(struct strmbase_renderer *iface)
57 struct null_renderer *filter = impl_from_strmbase_renderer(iface);
59 strmbase_renderer_cleanup(&filter->renderer);
60 free(filter);
63 static const struct strmbase_renderer_ops renderer_ops =
65 .pfnCheckMediaType = NullRenderer_CheckMediaType,
66 .pfnDoRenderSample = NullRenderer_DoRenderSample,
67 .renderer_destroy = null_renderer_destroy,
70 HRESULT null_renderer_create(IUnknown *outer, IUnknown **out)
72 struct null_renderer *object;
74 if (!(object = calloc(1, sizeof(*object))))
75 return E_OUTOFMEMORY;
77 strmbase_renderer_init(&object->renderer, outer, &CLSID_NullRenderer, L"In", &renderer_ops);
79 TRACE("Created null renderer %p.\n", object);
80 *out = &object->renderer.filter.IUnknown_inner;
81 return S_OK;