wow64: Add thunks for the I/O completion syscalls.
[wine.git] / dlls / wmvcore / writer.c
blob717984db1afb9a50621e4158f5af9e185468edef
1 /*
2 * Copyright 2015 Jacek Caban for CodeWeavers
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 #include "wmvcore.h"
20 #include "wmsdkidl.h"
22 #include "wine/debug.h"
23 #include "wine/heap.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(wmvcore);
27 typedef struct {
28 IWMWriter IWMWriter_iface;
29 IWMWriterAdvanced3 IWMWriterAdvanced3_iface;
30 LONG ref;
31 } WMWriter;
33 static inline WMWriter *impl_from_IWMWriter(IWMWriter *iface)
35 return CONTAINING_RECORD(iface, WMWriter, IWMWriter_iface);
38 static HRESULT WINAPI WMWriter_QueryInterface(IWMWriter *iface, REFIID riid, void **ppv)
40 WMWriter *This = impl_from_IWMWriter(iface);
42 if(IsEqualGUID(&IID_IUnknown, riid)) {
43 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
44 *ppv = &This->IWMWriter_iface;
45 }else if(IsEqualGUID(&IID_IWMWriter, riid)) {
46 TRACE("(%p)->(IID_IWMWriter %p)\n", This, ppv);
47 *ppv = &This->IWMWriter_iface;
48 }else if(IsEqualGUID(&IID_IWMWriterAdvanced, riid)) {
49 TRACE("(%p)->(IID_IWMWriterAdvanced %p)\n", This, ppv);
50 *ppv = &This->IWMWriterAdvanced3_iface;
51 }else if(IsEqualGUID(&IID_IWMWriterAdvanced2, riid)) {
52 TRACE("(%p)->(IID_IWMWriterAdvanced2 %p)\n", This, ppv);
53 *ppv = &This->IWMWriterAdvanced3_iface;
54 }else if(IsEqualGUID(&IID_IWMWriterAdvanced3, riid)) {
55 TRACE("(%p)->(IID_IWMWriterAdvanced3 %p)\n", This, ppv);
56 *ppv = &This->IWMWriterAdvanced3_iface;
57 }else {
58 FIXME("Unsupported iface %s\n", debugstr_guid(riid));
59 *ppv = NULL;
60 return E_NOINTERFACE;
63 IUnknown_AddRef((IUnknown*)*ppv);
64 return S_OK;
67 static ULONG WINAPI WMWriter_AddRef(IWMWriter *iface)
69 WMWriter *This = impl_from_IWMWriter(iface);
70 LONG ref = InterlockedIncrement(&This->ref);
72 TRACE("(%p) ref=%d\n", This, ref);
74 return ref;
77 static ULONG WINAPI WMWriter_Release(IWMWriter *iface)
79 WMWriter *This = impl_from_IWMWriter(iface);
80 LONG ref = InterlockedDecrement(&This->ref);
82 TRACE("(%p) ref=%d\n", This, ref);
84 if(!ref)
85 heap_free(This);
87 return ref;
90 static HRESULT WINAPI WMWriter_SetProfileByID(IWMWriter *iface, REFGUID guidProfile)
92 WMWriter *This = impl_from_IWMWriter(iface);
93 FIXME("(%p)->(%s)\n", This, debugstr_guid(guidProfile));
94 return E_NOTIMPL;
97 static HRESULT WINAPI WMWriter_SetProfile(IWMWriter *iface, IWMProfile *profile)
99 WMWriter *This = impl_from_IWMWriter(iface);
100 FIXME("(%p)->(%p)\n", This, profile);
101 return E_NOTIMPL;
104 static HRESULT WINAPI WMWriter_SetOutputFilename(IWMWriter *iface, const WCHAR *filename)
106 WMWriter *This = impl_from_IWMWriter(iface);
107 FIXME("(%p)->(%s)\n", This, debugstr_w(filename));
108 return E_NOTIMPL;
111 static HRESULT WINAPI WMWriter_GetInputCount(IWMWriter *iface, DWORD *pcInputs)
113 WMWriter *This = impl_from_IWMWriter(iface);
114 FIXME("(%p)->(%p)\n", This, pcInputs);
115 return E_NOTIMPL;
118 static HRESULT WINAPI WMWriter_GetInputProps(IWMWriter *iface, DWORD dwInputNum, IWMInputMediaProps **input)
120 WMWriter *This = impl_from_IWMWriter(iface);
121 FIXME("(%p)->(%d %p)\n", This, dwInputNum, input);
122 return E_NOTIMPL;
125 static HRESULT WINAPI WMWriter_SetInputProps(IWMWriter *iface, DWORD dwInputNum, IWMInputMediaProps *input)
127 WMWriter *This = impl_from_IWMWriter(iface);
128 FIXME("(%p)->(%d %p)\n", This, dwInputNum, input);
129 return E_NOTIMPL;
132 static HRESULT WINAPI WMWriter_GetInputFormatCount(IWMWriter *iface, DWORD dwInputNumber, DWORD *pcFormat)
134 WMWriter *This = impl_from_IWMWriter(iface);
135 FIXME("(%p)->(%d %p)\n", This, dwInputNumber, pcFormat);
136 return E_NOTIMPL;
139 static HRESULT WINAPI WMWriter_GetInputFormat(IWMWriter *iface, DWORD dwInputNumber, DWORD dwFormatNumber,
140 IWMInputMediaProps **props)
142 WMWriter *This = impl_from_IWMWriter(iface);
143 FIXME("(%p)->(%d %d %p)\n", This, dwInputNumber, dwFormatNumber, props);
144 return E_NOTIMPL;
147 static HRESULT WINAPI WMWriter_BeginWriting(IWMWriter *iface)
149 WMWriter *This = impl_from_IWMWriter(iface);
150 FIXME("(%p)\n", This);
151 return E_NOTIMPL;
154 static HRESULT WINAPI WMWriter_EndWriting(IWMWriter *iface)
156 WMWriter *This = impl_from_IWMWriter(iface);
157 FIXME("(%p)\n", This);
158 return E_NOTIMPL;
161 static HRESULT WINAPI WMWriter_AllocateSample(IWMWriter *iface, DWORD size, INSSBuffer **sample)
163 WMWriter *This = impl_from_IWMWriter(iface);
164 FIXME("(%p)->(%d %p)\n", This, size, sample);
165 return E_NOTIMPL;
168 static HRESULT WINAPI WMWriter_WriteSample(IWMWriter *iface, DWORD dwInputNum, QWORD cnsSampleTime,
169 DWORD flags, INSSBuffer *sample)
171 WMWriter *This = impl_from_IWMWriter(iface);
172 FIXME("(%p)->(%d %s %x %p)\n", This, dwInputNum, wine_dbgstr_longlong(cnsSampleTime), flags, sample);
173 return E_NOTIMPL;
176 static HRESULT WINAPI WMWriter_Flush(IWMWriter *iface)
178 WMWriter *This = impl_from_IWMWriter(iface);
179 FIXME("(%p)\n", This);
180 return E_NOTIMPL;
183 static const IWMWriterVtbl WMWriterVtbl = {
184 WMWriter_QueryInterface,
185 WMWriter_AddRef,
186 WMWriter_Release,
187 WMWriter_SetProfileByID,
188 WMWriter_SetProfile,
189 WMWriter_SetOutputFilename,
190 WMWriter_GetInputCount,
191 WMWriter_GetInputProps,
192 WMWriter_SetInputProps,
193 WMWriter_GetInputFormatCount,
194 WMWriter_GetInputFormat,
195 WMWriter_BeginWriting,
196 WMWriter_EndWriting,
197 WMWriter_AllocateSample,
198 WMWriter_WriteSample,
199 WMWriter_Flush
202 static inline WMWriter *impl_from_IWMWriterAdvanced3(IWMWriterAdvanced3 *iface)
204 return CONTAINING_RECORD(iface, WMWriter, IWMWriterAdvanced3_iface);
207 static HRESULT WINAPI WMWriterAdvanced_QueryInterface(IWMWriterAdvanced3 *iface, REFIID riid, void **ppv)
209 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
210 return IWMWriter_QueryInterface(&This->IWMWriter_iface, riid, ppv);
213 static ULONG WINAPI WMWriterAdvanced_AddRef(IWMWriterAdvanced3 *iface)
215 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
216 return IWMWriter_AddRef(&This->IWMWriter_iface);
219 static ULONG WINAPI WMWriterAdvanced_Release(IWMWriterAdvanced3 *iface)
221 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
222 return IWMWriter_Release(&This->IWMWriter_iface);
225 static HRESULT WINAPI WMWriterAdvanced_GetSinkCount(IWMWriterAdvanced3 *iface, DWORD *sinks)
227 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
228 FIXME("(%p)->(%p)\n", This, sinks);
229 return E_NOTIMPL;
232 static HRESULT WINAPI WMWriterAdvanced_GetSink(IWMWriterAdvanced3 *iface, DWORD sink_num, IWMWriterSink **sink)
234 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
235 FIXME("(%p)->(%u %p)\n", This, sink_num, sink);
236 return E_NOTIMPL;
239 static HRESULT WINAPI WMWriterAdvanced_AddSink(IWMWriterAdvanced3 *iface, IWMWriterSink *sink)
241 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
242 FIXME("(%p)->(%p)\n", This, sink);
243 return E_NOTIMPL;
246 static HRESULT WINAPI WMWriterAdvanced_RemoveSink(IWMWriterAdvanced3 *iface, IWMWriterSink *sink)
248 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
249 FIXME("(%p)->(%p)\n", This, sink);
250 return E_NOTIMPL;
253 static HRESULT WINAPI WMWriterAdvanced_WriteStreamSample(IWMWriterAdvanced3 *iface, WORD stream_num,
254 QWORD sample_time, DWORD sample_send_time, QWORD sample_duration, DWORD flags, INSSBuffer *sample)
256 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
257 FIXME("(%p)->(%u %s %u %s %x %p)\n", This, stream_num, wine_dbgstr_longlong(sample_time),
258 sample_send_time, wine_dbgstr_longlong(sample_duration), flags, sample);
259 return E_NOTIMPL;
262 static HRESULT WINAPI WMWriterAdvanced_SetLiveSource(IWMWriterAdvanced3 *iface, BOOL is_live_source)
264 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
265 FIXME("(%p)->(%x)\n", This, is_live_source);
266 return E_NOTIMPL;
269 static HRESULT WINAPI WMWriterAdvanced_IsRealTime(IWMWriterAdvanced3 *iface, BOOL *real_time)
271 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
272 FIXME("(%p)->(%p)\n", This, real_time);
273 return E_NOTIMPL;
276 static HRESULT WINAPI WMWriterAdvanced_GetWriterTime(IWMWriterAdvanced3 *iface, QWORD *current_time)
278 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
279 FIXME("(%p)->(%p)\n", This, current_time);
280 return E_NOTIMPL;
283 static HRESULT WINAPI WMWriterAdvanced_GetStatistics(IWMWriterAdvanced3 *iface, WORD stream_num, WM_WRITER_STATISTICS *stats)
285 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
286 FIXME("(%p)->(%u %p)\n", This, stream_num, stats);
287 return E_NOTIMPL;
290 static HRESULT WINAPI WMWriterAdvanced_SetSyncTolerance(IWMWriterAdvanced3 *iface, DWORD window)
292 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
293 FIXME("(%p)->(%u)\n", This, window);
294 return E_NOTIMPL;
297 static HRESULT WINAPI WMWriterAdvanced_GetSyncTolerance(IWMWriterAdvanced3 *iface, DWORD *window)
299 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
300 FIXME("(%p)->(%p)\n", This, window);
301 return E_NOTIMPL;
304 static HRESULT WINAPI WMWriterAdvanced2_GetInputSetting(IWMWriterAdvanced3 *iface, DWORD input_num,
305 const WCHAR *name, WMT_ATTR_DATATYPE *time, BYTE *value, WORD *length)
307 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
308 FIXME("(%p)->(%u %s %p %p %p)\n", This, input_num, debugstr_w(name), time, value, length);
309 return E_NOTIMPL;
312 static HRESULT WINAPI WMWriterAdvanced2_SetInputSetting(IWMWriterAdvanced3 *iface, DWORD input_num,
313 const WCHAR *name, WMT_ATTR_DATATYPE type, const BYTE *value, WORD length)
315 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
316 FIXME("(%p)->(%u %s %d %p %u)\n", This, input_num, debugstr_w(name), type, value, length);
317 return E_NOTIMPL;
320 static HRESULT WINAPI WMWriterAdvanced3_GetStatisticsEx(IWMWriterAdvanced3 *iface, WORD stream_num,
321 WM_WRITER_STATISTICS_EX *stats)
323 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
324 FIXME("(%p)->(%u %p)\n", This, stream_num, stats);
325 return E_NOTIMPL;
328 static HRESULT WINAPI WMWriterAdvanced3_SetNonBlocking(IWMWriterAdvanced3 *iface)
330 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
331 FIXME("(%p)\n", This);
332 return E_NOTIMPL;
335 static const IWMWriterAdvanced3Vtbl WMWriterAdvanced3Vtbl = {
336 WMWriterAdvanced_QueryInterface,
337 WMWriterAdvanced_AddRef,
338 WMWriterAdvanced_Release,
339 WMWriterAdvanced_GetSinkCount,
340 WMWriterAdvanced_GetSink,
341 WMWriterAdvanced_AddSink,
342 WMWriterAdvanced_RemoveSink,
343 WMWriterAdvanced_WriteStreamSample,
344 WMWriterAdvanced_SetLiveSource,
345 WMWriterAdvanced_IsRealTime,
346 WMWriterAdvanced_GetWriterTime,
347 WMWriterAdvanced_GetStatistics,
348 WMWriterAdvanced_SetSyncTolerance,
349 WMWriterAdvanced_GetSyncTolerance,
350 WMWriterAdvanced2_GetInputSetting,
351 WMWriterAdvanced2_SetInputSetting,
352 WMWriterAdvanced3_GetStatisticsEx,
353 WMWriterAdvanced3_SetNonBlocking
356 HRESULT WINAPI WMCreateWriter(IUnknown *reserved, IWMWriter **writer)
358 WMWriter *ret;
360 TRACE("(%p %p)\n", reserved, writer);
362 ret = heap_alloc(sizeof(*ret));
363 if(!ret)
364 return E_OUTOFMEMORY;
366 ret->IWMWriter_iface.lpVtbl = &WMWriterVtbl;
367 ret->IWMWriterAdvanced3_iface.lpVtbl = &WMWriterAdvanced3Vtbl;
368 ret->ref = 1;
370 *writer = &ret->IWMWriter_iface;
371 return S_OK;
374 HRESULT WINAPI WMCreateWriterPriv(IWMWriter **writer)
376 return WMCreateWriter(NULL, writer);