widl: Renamed --rt option to --winrt for midl compatibility.
[wine.git] / dlls / wmvcore / writer.c
blobf5701482f9390c5f730ed1eb64f9561026acd4ec
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"
24 WINE_DEFAULT_DEBUG_CHANNEL(wmvcore);
26 typedef struct {
27 IWMWriter IWMWriter_iface;
28 IWMWriterAdvanced3 IWMWriterAdvanced3_iface;
29 LONG ref;
30 } WMWriter;
32 static inline WMWriter *impl_from_IWMWriter(IWMWriter *iface)
34 return CONTAINING_RECORD(iface, WMWriter, IWMWriter_iface);
37 static HRESULT WINAPI WMWriter_QueryInterface(IWMWriter *iface, REFIID riid, void **ppv)
39 WMWriter *This = impl_from_IWMWriter(iface);
41 if(IsEqualGUID(&IID_IUnknown, riid)) {
42 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
43 *ppv = &This->IWMWriter_iface;
44 }else if(IsEqualGUID(&IID_IWMWriter, riid)) {
45 TRACE("(%p)->(IID_IWMWriter %p)\n", This, ppv);
46 *ppv = &This->IWMWriter_iface;
47 }else if(IsEqualGUID(&IID_IWMWriterAdvanced, riid)) {
48 TRACE("(%p)->(IID_IWMWriterAdvanced %p)\n", This, ppv);
49 *ppv = &This->IWMWriterAdvanced3_iface;
50 }else if(IsEqualGUID(&IID_IWMWriterAdvanced2, riid)) {
51 TRACE("(%p)->(IID_IWMWriterAdvanced2 %p)\n", This, ppv);
52 *ppv = &This->IWMWriterAdvanced3_iface;
53 }else if(IsEqualGUID(&IID_IWMWriterAdvanced3, riid)) {
54 TRACE("(%p)->(IID_IWMWriterAdvanced3 %p)\n", This, ppv);
55 *ppv = &This->IWMWriterAdvanced3_iface;
56 }else {
57 FIXME("Unsupported iface %s\n", debugstr_guid(riid));
58 *ppv = NULL;
59 return E_NOINTERFACE;
62 IUnknown_AddRef((IUnknown*)*ppv);
63 return S_OK;
66 static ULONG WINAPI WMWriter_AddRef(IWMWriter *iface)
68 WMWriter *This = impl_from_IWMWriter(iface);
69 LONG ref = InterlockedIncrement(&This->ref);
71 TRACE("(%p) ref=%d\n", This, ref);
73 return ref;
76 static ULONG WINAPI WMWriter_Release(IWMWriter *iface)
78 WMWriter *This = impl_from_IWMWriter(iface);
79 LONG ref = InterlockedDecrement(&This->ref);
81 TRACE("(%p) ref=%d\n", This, ref);
83 if(!ref)
84 heap_free(This);
86 return ref;
89 static HRESULT WINAPI WMWriter_SetProfileByID(IWMWriter *iface, REFGUID guidProfile)
91 WMWriter *This = impl_from_IWMWriter(iface);
92 FIXME("(%p)->(%s)\n", This, debugstr_guid(guidProfile));
93 return E_NOTIMPL;
96 static HRESULT WINAPI WMWriter_SetProfile(IWMWriter *iface, IWMProfile *profile)
98 WMWriter *This = impl_from_IWMWriter(iface);
99 FIXME("(%p)->(%p)\n", This, profile);
100 return E_NOTIMPL;
103 static HRESULT WINAPI WMWriter_SetOutputFilename(IWMWriter *iface, const WCHAR *filename)
105 WMWriter *This = impl_from_IWMWriter(iface);
106 FIXME("(%p)->(%s)\n", This, debugstr_w(filename));
107 return E_NOTIMPL;
110 static HRESULT WINAPI WMWriter_GetInputCount(IWMWriter *iface, DWORD *pcInputs)
112 WMWriter *This = impl_from_IWMWriter(iface);
113 FIXME("(%p)->(%p)\n", This, pcInputs);
114 return E_NOTIMPL;
117 static HRESULT WINAPI WMWriter_GetInputProps(IWMWriter *iface, DWORD dwInputNum, IWMInputMediaProps **input)
119 WMWriter *This = impl_from_IWMWriter(iface);
120 FIXME("(%p)->(%d %p)\n", This, dwInputNum, input);
121 return E_NOTIMPL;
124 static HRESULT WINAPI WMWriter_SetInputProps(IWMWriter *iface, DWORD dwInputNum, IWMInputMediaProps *input)
126 WMWriter *This = impl_from_IWMWriter(iface);
127 FIXME("(%p)->(%d %p)\n", This, dwInputNum, input);
128 return E_NOTIMPL;
131 static HRESULT WINAPI WMWriter_GetInputFormatCount(IWMWriter *iface, DWORD dwInputNumber, DWORD *pcFormat)
133 WMWriter *This = impl_from_IWMWriter(iface);
134 FIXME("(%p)->(%d %p)\n", This, dwInputNumber, pcFormat);
135 return E_NOTIMPL;
138 static HRESULT WINAPI WMWriter_GetInputFormat(IWMWriter *iface, DWORD dwInputNumber, DWORD dwFormatNumber,
139 IWMInputMediaProps **props)
141 WMWriter *This = impl_from_IWMWriter(iface);
142 FIXME("(%p)->(%d %d %p)\n", This, dwInputNumber, dwFormatNumber, props);
143 return E_NOTIMPL;
146 static HRESULT WINAPI WMWriter_BeginWriting(IWMWriter *iface)
148 WMWriter *This = impl_from_IWMWriter(iface);
149 FIXME("(%p)\n", This);
150 return E_NOTIMPL;
153 static HRESULT WINAPI WMWriter_EndWriting(IWMWriter *iface)
155 WMWriter *This = impl_from_IWMWriter(iface);
156 FIXME("(%p)\n", This);
157 return E_NOTIMPL;
160 static HRESULT WINAPI WMWriter_AllocateSample(IWMWriter *iface, DWORD size, INSSBuffer **sample)
162 WMWriter *This = impl_from_IWMWriter(iface);
163 FIXME("(%p)->(%d %p)\n", This, size, sample);
164 return E_NOTIMPL;
167 static HRESULT WINAPI WMWriter_WriteSample(IWMWriter *iface, DWORD dwInputNum, QWORD cnsSampleTime,
168 DWORD flags, INSSBuffer *sample)
170 WMWriter *This = impl_from_IWMWriter(iface);
171 FIXME("(%p)->(%d %s %x %p)\n", This, dwInputNum, wine_dbgstr_longlong(cnsSampleTime), flags, sample);
172 return E_NOTIMPL;
175 static HRESULT WINAPI WMWriter_Flush(IWMWriter *iface)
177 WMWriter *This = impl_from_IWMWriter(iface);
178 FIXME("(%p)\n", This);
179 return E_NOTIMPL;
182 static const IWMWriterVtbl WMWriterVtbl = {
183 WMWriter_QueryInterface,
184 WMWriter_AddRef,
185 WMWriter_Release,
186 WMWriter_SetProfileByID,
187 WMWriter_SetProfile,
188 WMWriter_SetOutputFilename,
189 WMWriter_GetInputCount,
190 WMWriter_GetInputProps,
191 WMWriter_SetInputProps,
192 WMWriter_GetInputFormatCount,
193 WMWriter_GetInputFormat,
194 WMWriter_BeginWriting,
195 WMWriter_EndWriting,
196 WMWriter_AllocateSample,
197 WMWriter_WriteSample,
198 WMWriter_Flush
201 static inline WMWriter *impl_from_IWMWriterAdvanced3(IWMWriterAdvanced3 *iface)
203 return CONTAINING_RECORD(iface, WMWriter, IWMWriterAdvanced3_iface);
206 static HRESULT WINAPI WMWriterAdvanced_QueryInterface(IWMWriterAdvanced3 *iface, REFIID riid, void **ppv)
208 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
209 return IWMWriter_QueryInterface(&This->IWMWriter_iface, riid, ppv);
212 static ULONG WINAPI WMWriterAdvanced_AddRef(IWMWriterAdvanced3 *iface)
214 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
215 return IWMWriter_AddRef(&This->IWMWriter_iface);
218 static ULONG WINAPI WMWriterAdvanced_Release(IWMWriterAdvanced3 *iface)
220 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
221 return IWMWriter_Release(&This->IWMWriter_iface);
224 static HRESULT WINAPI WMWriterAdvanced_GetSinkCount(IWMWriterAdvanced3 *iface, DWORD *sinks)
226 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
227 FIXME("(%p)->(%p)\n", This, sinks);
228 return E_NOTIMPL;
231 static HRESULT WINAPI WMWriterAdvanced_GetSink(IWMWriterAdvanced3 *iface, DWORD sink_num, IWMWriterSink **sink)
233 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
234 FIXME("(%p)->(%u %p)\n", This, sink_num, sink);
235 return E_NOTIMPL;
238 static HRESULT WINAPI WMWriterAdvanced_AddSink(IWMWriterAdvanced3 *iface, IWMWriterSink *sink)
240 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
241 FIXME("(%p)->(%p)\n", This, sink);
242 return E_NOTIMPL;
245 static HRESULT WINAPI WMWriterAdvanced_RemoveSink(IWMWriterAdvanced3 *iface, IWMWriterSink *sink)
247 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
248 FIXME("(%p)->(%p)\n", This, sink);
249 return E_NOTIMPL;
252 static HRESULT WINAPI WMWriterAdvanced_WriteStreamSample(IWMWriterAdvanced3 *iface, WORD stream_num,
253 QWORD sample_time, DWORD sample_send_time, QWORD sample_duration, DWORD flags, INSSBuffer *sample)
255 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
256 FIXME("(%p)->(%u %s %u %s %x %p)\n", This, stream_num, wine_dbgstr_longlong(sample_time),
257 sample_send_time, wine_dbgstr_longlong(sample_duration), flags, sample);
258 return E_NOTIMPL;
261 static HRESULT WINAPI WMWriterAdvanced_SetLiveSource(IWMWriterAdvanced3 *iface, BOOL is_live_source)
263 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
264 FIXME("(%p)->(%x)\n", This, is_live_source);
265 return E_NOTIMPL;
268 static HRESULT WINAPI WMWriterAdvanced_IsRealTime(IWMWriterAdvanced3 *iface, BOOL *real_time)
270 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
271 FIXME("(%p)->(%p)\n", This, real_time);
272 return E_NOTIMPL;
275 static HRESULT WINAPI WMWriterAdvanced_GetWriterTime(IWMWriterAdvanced3 *iface, QWORD *current_time)
277 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
278 FIXME("(%p)->(%p)\n", This, current_time);
279 return E_NOTIMPL;
282 static HRESULT WINAPI WMWriterAdvanced_GetStatistics(IWMWriterAdvanced3 *iface, WORD stream_num, WM_WRITER_STATISTICS *stats)
284 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
285 FIXME("(%p)->(%u %p)\n", This, stream_num, stats);
286 return E_NOTIMPL;
289 static HRESULT WINAPI WMWriterAdvanced_SetSyncTolerance(IWMWriterAdvanced3 *iface, DWORD window)
291 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
292 FIXME("(%p)->(%u)\n", This, window);
293 return E_NOTIMPL;
296 static HRESULT WINAPI WMWriterAdvanced_GetSyncTolerance(IWMWriterAdvanced3 *iface, DWORD *window)
298 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
299 FIXME("(%p)->(%p)\n", This, window);
300 return E_NOTIMPL;
303 static HRESULT WINAPI WMWriterAdvanced2_GetInputSetting(IWMWriterAdvanced3 *iface, DWORD input_num,
304 const WCHAR *name, WMT_ATTR_DATATYPE *time, BYTE *value, WORD *length)
306 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
307 FIXME("(%p)->(%u %s %p %p %p)\n", This, input_num, debugstr_w(name), time, value, length);
308 return E_NOTIMPL;
311 static HRESULT WINAPI WMWriterAdvanced2_SetInputSetting(IWMWriterAdvanced3 *iface, DWORD input_num,
312 const WCHAR *name, WMT_ATTR_DATATYPE type, const BYTE *value, WORD length)
314 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
315 FIXME("(%p)->(%u %s %d %p %u)\n", This, input_num, debugstr_w(name), type, value, length);
316 return E_NOTIMPL;
319 static HRESULT WINAPI WMWriterAdvanced3_GetStatisticsEx(IWMWriterAdvanced3 *iface, WORD stream_num,
320 WM_WRITER_STATISTICS_EX *stats)
322 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
323 FIXME("(%p)->(%u %p)\n", This, stream_num, stats);
324 return E_NOTIMPL;
327 static HRESULT WINAPI WMWriterAdvanced3_SetNonBlocking(IWMWriterAdvanced3 *iface)
329 WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
330 FIXME("(%p)\n", This);
331 return E_NOTIMPL;
334 static const IWMWriterAdvanced3Vtbl WMWriterAdvanced3Vtbl = {
335 WMWriterAdvanced_QueryInterface,
336 WMWriterAdvanced_AddRef,
337 WMWriterAdvanced_Release,
338 WMWriterAdvanced_GetSinkCount,
339 WMWriterAdvanced_GetSink,
340 WMWriterAdvanced_AddSink,
341 WMWriterAdvanced_RemoveSink,
342 WMWriterAdvanced_WriteStreamSample,
343 WMWriterAdvanced_SetLiveSource,
344 WMWriterAdvanced_IsRealTime,
345 WMWriterAdvanced_GetWriterTime,
346 WMWriterAdvanced_GetStatistics,
347 WMWriterAdvanced_SetSyncTolerance,
348 WMWriterAdvanced_GetSyncTolerance,
349 WMWriterAdvanced2_GetInputSetting,
350 WMWriterAdvanced2_SetInputSetting,
351 WMWriterAdvanced3_GetStatisticsEx,
352 WMWriterAdvanced3_SetNonBlocking
355 HRESULT WINAPI WMCreateWriter(IUnknown *reserved, IWMWriter **writer)
357 WMWriter *ret;
359 TRACE("(%p %p)\n", reserved, writer);
361 ret = heap_alloc(sizeof(*ret));
362 if(!ret)
363 return E_OUTOFMEMORY;
365 ret->IWMWriter_iface.lpVtbl = &WMWriterVtbl;
366 ret->IWMWriterAdvanced3_iface.lpVtbl = &WMWriterAdvanced3Vtbl;
367 ret->ref = 1;
369 *writer = &ret->IWMWriter_iface;
370 return S_OK;