1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
/*
* Copyright 2015 Jacek Caban for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "wmvcore.h"
#include "wmsdkidl.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(wmvcore);
typedef struct {
IWMWriter IWMWriter_iface;
IWMWriterAdvanced3 IWMWriterAdvanced3_iface;
LONG ref;
} WMWriter;
static inline WMWriter *impl_from_IWMWriter(IWMWriter *iface)
{
return CONTAINING_RECORD(iface, WMWriter, IWMWriter_iface);
}
static HRESULT WINAPI WMWriter_QueryInterface(IWMWriter *iface, REFIID riid, void **ppv)
{
WMWriter *This = impl_from_IWMWriter(iface);
if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
*ppv = &This->IWMWriter_iface;
}else if(IsEqualGUID(&IID_IWMWriter, riid)) {
TRACE("(%p)->(IID_IWMWriter %p)\n", This, ppv);
*ppv = &This->IWMWriter_iface;
}else if(IsEqualGUID(&IID_IWMWriterAdvanced, riid)) {
TRACE("(%p)->(IID_IWMWriterAdvanced %p)\n", This, ppv);
*ppv = &This->IWMWriterAdvanced3_iface;
}else if(IsEqualGUID(&IID_IWMWriterAdvanced2, riid)) {
TRACE("(%p)->(IID_IWMWriterAdvanced2 %p)\n", This, ppv);
*ppv = &This->IWMWriterAdvanced3_iface;
}else if(IsEqualGUID(&IID_IWMWriterAdvanced3, riid)) {
TRACE("(%p)->(IID_IWMWriterAdvanced3 %p)\n", This, ppv);
*ppv = &This->IWMWriterAdvanced3_iface;
}else {
FIXME("Unsupported iface %s\n", debugstr_guid(riid));
*ppv = NULL;
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
static ULONG WINAPI WMWriter_AddRef(IWMWriter *iface)
{
WMWriter *This = impl_from_IWMWriter(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
return ref;
}
static ULONG WINAPI WMWriter_Release(IWMWriter *iface)
{
WMWriter *This = impl_from_IWMWriter(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
if(!ref)
heap_free(This);
return ref;
}
static HRESULT WINAPI WMWriter_SetProfileByID(IWMWriter *iface, REFGUID guidProfile)
{
WMWriter *This = impl_from_IWMWriter(iface);
FIXME("(%p)->(%s)\n", This, debugstr_guid(guidProfile));
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriter_SetProfile(IWMWriter *iface, IWMProfile *profile)
{
WMWriter *This = impl_from_IWMWriter(iface);
FIXME("(%p)->(%p)\n", This, profile);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriter_SetOutputFilename(IWMWriter *iface, const WCHAR *filename)
{
WMWriter *This = impl_from_IWMWriter(iface);
FIXME("(%p)->(%s)\n", This, debugstr_w(filename));
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriter_GetInputCount(IWMWriter *iface, DWORD *pcInputs)
{
WMWriter *This = impl_from_IWMWriter(iface);
FIXME("(%p)->(%p)\n", This, pcInputs);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriter_GetInputProps(IWMWriter *iface, DWORD dwInputNum, IWMInputMediaProps **input)
{
WMWriter *This = impl_from_IWMWriter(iface);
FIXME("(%p)->(%d %p)\n", This, dwInputNum, input);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriter_SetInputProps(IWMWriter *iface, DWORD dwInputNum, IWMInputMediaProps *input)
{
WMWriter *This = impl_from_IWMWriter(iface);
FIXME("(%p)->(%d %p)\n", This, dwInputNum, input);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriter_GetInputFormatCount(IWMWriter *iface, DWORD dwInputNumber, DWORD *pcFormat)
{
WMWriter *This = impl_from_IWMWriter(iface);
FIXME("(%p)->(%d %p)\n", This, dwInputNumber, pcFormat);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriter_GetInputFormat(IWMWriter *iface, DWORD dwInputNumber, DWORD dwFormatNumber,
IWMInputMediaProps **props)
{
WMWriter *This = impl_from_IWMWriter(iface);
FIXME("(%p)->(%d %d %p)\n", This, dwInputNumber, dwFormatNumber, props);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriter_BeginWriting(IWMWriter *iface)
{
WMWriter *This = impl_from_IWMWriter(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriter_EndWriting(IWMWriter *iface)
{
WMWriter *This = impl_from_IWMWriter(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriter_AllocateSample(IWMWriter *iface, DWORD size, INSSBuffer **sample)
{
WMWriter *This = impl_from_IWMWriter(iface);
FIXME("(%p)->(%d %p)\n", This, size, sample);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriter_WriteSample(IWMWriter *iface, DWORD dwInputNum, QWORD cnsSampleTime,
DWORD flags, INSSBuffer *sample)
{
WMWriter *This = impl_from_IWMWriter(iface);
FIXME("(%p)->(%d %s %x %p)\n", This, dwInputNum, wine_dbgstr_longlong(cnsSampleTime), flags, sample);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriter_Flush(IWMWriter *iface)
{
WMWriter *This = impl_from_IWMWriter(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
static const IWMWriterVtbl WMWriterVtbl = {
WMWriter_QueryInterface,
WMWriter_AddRef,
WMWriter_Release,
WMWriter_SetProfileByID,
WMWriter_SetProfile,
WMWriter_SetOutputFilename,
WMWriter_GetInputCount,
WMWriter_GetInputProps,
WMWriter_SetInputProps,
WMWriter_GetInputFormatCount,
WMWriter_GetInputFormat,
WMWriter_BeginWriting,
WMWriter_EndWriting,
WMWriter_AllocateSample,
WMWriter_WriteSample,
WMWriter_Flush
};
static inline WMWriter *impl_from_IWMWriterAdvanced3(IWMWriterAdvanced3 *iface)
{
return CONTAINING_RECORD(iface, WMWriter, IWMWriterAdvanced3_iface);
}
static HRESULT WINAPI WMWriterAdvanced_QueryInterface(IWMWriterAdvanced3 *iface, REFIID riid, void **ppv)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
return IWMWriter_QueryInterface(&This->IWMWriter_iface, riid, ppv);
}
static ULONG WINAPI WMWriterAdvanced_AddRef(IWMWriterAdvanced3 *iface)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
return IWMWriter_AddRef(&This->IWMWriter_iface);
}
static ULONG WINAPI WMWriterAdvanced_Release(IWMWriterAdvanced3 *iface)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
return IWMWriter_Release(&This->IWMWriter_iface);
}
static HRESULT WINAPI WMWriterAdvanced_GetSinkCount(IWMWriterAdvanced3 *iface, DWORD *sinks)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
FIXME("(%p)->(%p)\n", This, sinks);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriterAdvanced_GetSink(IWMWriterAdvanced3 *iface, DWORD sink_num, IWMWriterSink **sink)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
FIXME("(%p)->(%u %p)\n", This, sink_num, sink);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriterAdvanced_AddSink(IWMWriterAdvanced3 *iface, IWMWriterSink *sink)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
FIXME("(%p)->(%p)\n", This, sink);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriterAdvanced_RemoveSink(IWMWriterAdvanced3 *iface, IWMWriterSink *sink)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
FIXME("(%p)->(%p)\n", This, sink);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriterAdvanced_WriteStreamSample(IWMWriterAdvanced3 *iface, WORD stream_num,
QWORD sample_time, DWORD sample_send_time, QWORD sample_duration, DWORD flags, INSSBuffer *sample)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
FIXME("(%p)->(%u %s %u %s %x %p)\n", This, stream_num, wine_dbgstr_longlong(sample_time),
sample_send_time, wine_dbgstr_longlong(sample_duration), flags, sample);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriterAdvanced_SetLiveSource(IWMWriterAdvanced3 *iface, BOOL is_live_source)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
FIXME("(%p)->(%x)\n", This, is_live_source);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriterAdvanced_IsRealTime(IWMWriterAdvanced3 *iface, BOOL *real_time)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
FIXME("(%p)->(%p)\n", This, real_time);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriterAdvanced_GetWriterTime(IWMWriterAdvanced3 *iface, QWORD *current_time)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
FIXME("(%p)->(%p)\n", This, current_time);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriterAdvanced_GetStatistics(IWMWriterAdvanced3 *iface, WORD stream_num, WM_WRITER_STATISTICS *stats)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
FIXME("(%p)->(%u %p)\n", This, stream_num, stats);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriterAdvanced_SetSyncTolerance(IWMWriterAdvanced3 *iface, DWORD window)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
FIXME("(%p)->(%u)\n", This, window);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriterAdvanced_GetSyncTolerance(IWMWriterAdvanced3 *iface, DWORD *window)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
FIXME("(%p)->(%p)\n", This, window);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriterAdvanced2_GetInputSetting(IWMWriterAdvanced3 *iface, DWORD input_num,
const WCHAR *name, WMT_ATTR_DATATYPE *time, BYTE *value, WORD *length)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
FIXME("(%p)->(%u %s %p %p %p)\n", This, input_num, debugstr_w(name), time, value, length);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriterAdvanced2_SetInputSetting(IWMWriterAdvanced3 *iface, DWORD input_num,
const WCHAR *name, WMT_ATTR_DATATYPE type, const BYTE *value, WORD length)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
FIXME("(%p)->(%u %s %d %p %u)\n", This, input_num, debugstr_w(name), type, value, length);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriterAdvanced3_GetStatisticsEx(IWMWriterAdvanced3 *iface, WORD stream_num,
WM_WRITER_STATISTICS_EX *stats)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
FIXME("(%p)->(%u %p)\n", This, stream_num, stats);
return E_NOTIMPL;
}
static HRESULT WINAPI WMWriterAdvanced3_SetNonBlocking(IWMWriterAdvanced3 *iface)
{
WMWriter *This = impl_from_IWMWriterAdvanced3(iface);
FIXME("(%p)\n", This);
return E_NOTIMPL;
}
static const IWMWriterAdvanced3Vtbl WMWriterAdvanced3Vtbl = {
WMWriterAdvanced_QueryInterface,
WMWriterAdvanced_AddRef,
WMWriterAdvanced_Release,
WMWriterAdvanced_GetSinkCount,
WMWriterAdvanced_GetSink,
WMWriterAdvanced_AddSink,
WMWriterAdvanced_RemoveSink,
WMWriterAdvanced_WriteStreamSample,
WMWriterAdvanced_SetLiveSource,
WMWriterAdvanced_IsRealTime,
WMWriterAdvanced_GetWriterTime,
WMWriterAdvanced_GetStatistics,
WMWriterAdvanced_SetSyncTolerance,
WMWriterAdvanced_GetSyncTolerance,
WMWriterAdvanced2_GetInputSetting,
WMWriterAdvanced2_SetInputSetting,
WMWriterAdvanced3_GetStatisticsEx,
WMWriterAdvanced3_SetNonBlocking
};
HRESULT WINAPI WMCreateWriter(IUnknown *reserved, IWMWriter **writer)
{
WMWriter *ret;
TRACE("(%p %p)\n", reserved, writer);
ret = heap_alloc(sizeof(*ret));
if(!ret)
return E_OUTOFMEMORY;
ret->IWMWriter_iface.lpVtbl = &WMWriterVtbl;
ret->IWMWriterAdvanced3_iface.lpVtbl = &WMWriterAdvanced3Vtbl;
ret->ref = 1;
*writer = &ret->IWMWriter_iface;
return S_OK;
}
HRESULT WINAPI WMCreateWriterPriv(IWMWriter **writer)
{
return WMCreateWriter(NULL, writer);
}