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
24 #include "wine/debug.h"
25 #include "wine/strmbase.h"
27 WINE_DEFAULT_DEBUG_CHANNEL(qedit
);
31 struct strmbase_renderer renderer
;
35 static struct null_renderer
*impl_from_strmbase_renderer(struct strmbase_renderer
*iface
)
37 return CONTAINING_RECORD(iface
, struct null_renderer
, renderer
);
40 static HRESULT WINAPI
NullRenderer_DoRenderSample(struct strmbase_renderer
*iface
, IMediaSample
*sample
)
42 struct null_renderer
*filter
= impl_from_strmbase_renderer(iface
);
44 if (filter
->renderer
.filter
.state
== State_Paused
)
46 const HANDLE events
[2] = {filter
->run_event
, filter
->renderer
.flush_event
};
48 SetEvent(filter
->renderer
.state_event
);
49 WaitForMultipleObjects(2, events
, FALSE
, INFINITE
);
55 static HRESULT WINAPI
NullRenderer_CheckMediaType(struct strmbase_renderer
*iface
, const AM_MEDIA_TYPE
*mt
)
57 TRACE("Not a stub!\n");
61 static void null_renderer_destroy(struct strmbase_renderer
*iface
)
63 struct null_renderer
*filter
= impl_from_strmbase_renderer(iface
);
65 CloseHandle(filter
->run_event
);
66 strmbase_renderer_cleanup(&filter
->renderer
);
70 static void null_renderer_start_stream(struct strmbase_renderer
*iface
)
72 struct null_renderer
*filter
= impl_from_strmbase_renderer(iface
);
73 SetEvent(filter
->run_event
);
76 static void null_renderer_stop_stream(struct strmbase_renderer
*iface
)
78 struct null_renderer
*filter
= impl_from_strmbase_renderer(iface
);
79 ResetEvent(filter
->run_event
);
82 static const struct strmbase_renderer_ops renderer_ops
=
84 .pfnCheckMediaType
= NullRenderer_CheckMediaType
,
85 .pfnDoRenderSample
= NullRenderer_DoRenderSample
,
86 .renderer_start_stream
= null_renderer_start_stream
,
87 .renderer_stop_stream
= null_renderer_stop_stream
,
88 .renderer_destroy
= null_renderer_destroy
,
91 HRESULT
null_renderer_create(IUnknown
*outer
, IUnknown
**out
)
93 struct null_renderer
*object
;
95 if (!(object
= calloc(1, sizeof(*object
))))
98 strmbase_renderer_init(&object
->renderer
, outer
, &CLSID_NullRenderer
, L
"In", &renderer_ops
);
99 object
->run_event
= CreateEventW(NULL
, TRUE
, FALSE
, NULL
);
101 TRACE("Created null renderer %p.\n", object
);
102 *out
= &object
->renderer
.filter
.IUnknown_inner
;