xref: /reactos/dll/win32/wmvcore/wmvcore_main.c (revision c2c66aff)
1 /*
2  * Copyright 2012 Austin English
3  *
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.
8  *
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.
13  *
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
17  */
18 
19 #include "wmvcore.h"
20 
21 #include "initguid.h"
22 #include "wmsdkidl.h"
23 #include "wine/debug.h"
24 
25 WINE_DEFAULT_DEBUG_CHANNEL(wmvcore);
26 
27 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
28 {
29     TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
30 
31     switch (fdwReason)
32     {
33         case DLL_WINE_PREATTACH:
34             return FALSE;    /* prefer native version */
35         case DLL_PROCESS_ATTACH:
36             DisableThreadLibraryCalls(hinstDLL);
37             break;
38     }
39 
40     return TRUE;
41 }
42 
43 HRESULT WINAPI DllRegisterServer(void)
44 {
45     FIXME("(): stub\n");
46 
47     return S_OK;
48 }
49 
50 HRESULT WINAPI WMCreateEditor(IWMMetadataEditor **editor)
51 {
52     FIXME("(%p): stub\n", editor);
53 
54     *editor = NULL;
55 
56     return E_NOTIMPL;
57 }
58 
59 typedef struct {
60     IWMReader IWMReader_iface;
61     IWMReaderAdvanced6 IWMReaderAdvanced6_iface;
62     LONG ref;
63 } WMReader;
64 
65 static inline WMReader *impl_from_IWMReader(IWMReader *iface)
66 {
67     return CONTAINING_RECORD(iface, WMReader, IWMReader_iface);
68 }
69 
70 static HRESULT WINAPI WMReader_QueryInterface(IWMReader *iface, REFIID riid, void **ppv)
71 {
72     WMReader *This = impl_from_IWMReader(iface);
73 
74     if(IsEqualGUID(riid, &IID_IUnknown)) {
75         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
76         *ppv = &This->IWMReader_iface;
77     }else if(IsEqualGUID(riid, &IID_IWMReader)) {
78         TRACE("(%p)->(IID_IWMReader %p)\n", This, ppv);
79         *ppv = &This->IWMReader_iface;
80     }else if(IsEqualGUID(riid, &IID_IWMReaderAdvanced)) {
81         TRACE("(%p)->(IID_IWMReaderAdvanced %p)\n", This, ppv);
82         *ppv = &This->IWMReaderAdvanced6_iface;
83     }else if(IsEqualGUID(riid, &IID_IWMReaderAdvanced2)) {
84         TRACE("(%p)->(IID_IWMReaderAdvanced2 %p)\n", This, ppv);
85         *ppv = &This->IWMReaderAdvanced6_iface;
86     }else if(IsEqualGUID(riid, &IID_IWMReaderAdvanced3)) {
87         TRACE("(%p)->(IID_IWMReaderAdvanced3 %p)\n", This, ppv);
88         *ppv = &This->IWMReaderAdvanced6_iface;
89     }else if(IsEqualGUID(riid, &IID_IWMReaderAdvanced4)) {
90         TRACE("(%p)->(IID_IWMReaderAdvanced4 %p)\n", This, ppv);
91         *ppv = &This->IWMReaderAdvanced6_iface;
92     }else if(IsEqualGUID(riid, &IID_IWMReaderAdvanced5)) {
93         TRACE("(%p)->(IID_IWMReaderAdvanced5 %p)\n", This, ppv);
94         *ppv = &This->IWMReaderAdvanced6_iface;
95     }else if(IsEqualGUID(riid, &IID_IWMReaderAdvanced6)) {
96         TRACE("(%p)->(IID_IWMReaderAdvanced6 %p)\n", This, ppv);
97         *ppv = &This->IWMReaderAdvanced6_iface;
98     }else {
99         *ppv = NULL;
100         FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
101         return E_NOINTERFACE;
102     }
103 
104     IUnknown_AddRef((IUnknown*)*ppv);
105     return S_OK;
106 }
107 
108 static ULONG WINAPI WMReader_AddRef(IWMReader *iface)
109 {
110     WMReader *This = impl_from_IWMReader(iface);
111     LONG ref = InterlockedIncrement(&This->ref);
112 
113     TRACE("(%p) ref=%d\n", This, ref);
114 
115     return ref;
116 }
117 
118 static ULONG WINAPI WMReader_Release(IWMReader *iface)
119 {
120     WMReader *This = impl_from_IWMReader(iface);
121     LONG ref = InterlockedDecrement(&This->ref);
122 
123     TRACE("(%p) ref=%d\n", This, ref);
124 
125     if(!ref)
126         heap_free(This);
127 
128     return ref;
129 }
130 
131 static HRESULT WINAPI WMReader_Open(IWMReader *iface, const WCHAR *url, IWMReaderCallback *callback, void *context)
132 {
133     WMReader *This = impl_from_IWMReader(iface);
134     FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(url), callback, context);
135     return E_NOTIMPL;
136 }
137 
138 static HRESULT WINAPI WMReader_Close(IWMReader *iface)
139 {
140     WMReader *This = impl_from_IWMReader(iface);
141     FIXME("(%p)\n", This);
142     return E_NOTIMPL;
143 }
144 
145 static HRESULT WINAPI WMReader_GetOutputCount(IWMReader *iface, DWORD *outputs)
146 {
147     WMReader *This = impl_from_IWMReader(iface);
148     FIXME("(%p)->(%p)\n", This, outputs);
149     return E_NOTIMPL;
150 }
151 
152 static HRESULT WINAPI WMReader_GetOutputProps(IWMReader *iface, DWORD output_num, IWMOutputMediaProps **output)
153 {
154     WMReader *This = impl_from_IWMReader(iface);
155     FIXME("(%p)->(%u %p)\n", This, output_num, output);
156     return E_NOTIMPL;
157 }
158 
159 static HRESULT WINAPI WMReader_SetOutputProps(IWMReader *iface, DWORD output_num, IWMOutputMediaProps *output)
160 {
161     WMReader *This = impl_from_IWMReader(iface);
162     FIXME("(%p)->(%u %p)\n", This, output_num, output);
163     return E_NOTIMPL;
164 }
165 
166 static HRESULT WINAPI WMReader_GetOutputFormatCount(IWMReader *iface, DWORD output_num, DWORD *formats)
167 {
168     WMReader *This = impl_from_IWMReader(iface);
169     FIXME("(%p)->(%u %p)\n", This, output_num, formats);
170     return E_NOTIMPL;
171 }
172 
173 static HRESULT WINAPI WMReader_GetOutputFormat(IWMReader *iface, DWORD output_num, DWORD format_num, IWMOutputMediaProps **props)
174 {
175     WMReader *This = impl_from_IWMReader(iface);
176     FIXME("(%p)->(%u %u %p)\n", This, output_num, format_num, props);
177     return E_NOTIMPL;
178 }
179 
180 static HRESULT WINAPI WMReader_Start(IWMReader *iface, QWORD start, QWORD duration, float rate, void *context)
181 {
182     WMReader *This = impl_from_IWMReader(iface);
183     FIXME("(%p)->(%s %s %f %p)\n", This, wine_dbgstr_longlong(start), wine_dbgstr_longlong(duration), rate, context);
184     return E_NOTIMPL;
185 }
186 
187 static HRESULT WINAPI WMReader_Stop(IWMReader *iface)
188 {
189     WMReader *This = impl_from_IWMReader(iface);
190     FIXME("(%p)\n", This);
191     return E_NOTIMPL;
192 }
193 
194 static HRESULT WINAPI WMReader_Pause(IWMReader *iface)
195 {
196     WMReader *This = impl_from_IWMReader(iface);
197     FIXME("(%p)\n", This);
198     return E_NOTIMPL;
199 }
200 
201 static HRESULT WINAPI WMReader_Resume(IWMReader *iface)
202 {
203     WMReader *This = impl_from_IWMReader(iface);
204     FIXME("(%p)\n", This);
205     return E_NOTIMPL;
206 }
207 
208 static const IWMReaderVtbl WMReaderVtbl = {
209     WMReader_QueryInterface,
210     WMReader_AddRef,
211     WMReader_Release,
212     WMReader_Open,
213     WMReader_Close,
214     WMReader_GetOutputCount,
215     WMReader_GetOutputProps,
216     WMReader_SetOutputProps,
217     WMReader_GetOutputFormatCount,
218     WMReader_GetOutputFormat,
219     WMReader_Start,
220     WMReader_Stop,
221     WMReader_Pause,
222     WMReader_Resume
223 };
224 
225 static inline WMReader *impl_from_IWMReaderAdvanced6(IWMReaderAdvanced6 *iface)
226 {
227     return CONTAINING_RECORD(iface, WMReader, IWMReaderAdvanced6_iface);
228 }
229 
230 static HRESULT WINAPI WMReaderAdvanced_QueryInterface(IWMReaderAdvanced6 *iface, REFIID riid, void **ppv)
231 {
232     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
233     return IWMReader_QueryInterface(&This->IWMReader_iface, riid, ppv);
234 }
235 
236 static ULONG WINAPI WMReaderAdvanced_AddRef(IWMReaderAdvanced6 *iface)
237 {
238     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
239     return IWMReader_AddRef(&This->IWMReader_iface);
240 }
241 
242 static ULONG WINAPI WMReaderAdvanced_Release(IWMReaderAdvanced6 *iface)
243 {
244     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
245     return IWMReader_Release(&This->IWMReader_iface);
246 }
247 
248 static HRESULT WINAPI WMReaderAdvanced_SetUserProvidedClock(IWMReaderAdvanced6 *iface, BOOL user_clock)
249 {
250     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
251     FIXME("(%p)->(%x)\n", This, user_clock);
252     return E_NOTIMPL;
253 }
254 
255 static HRESULT WINAPI WMReaderAdvanced_GetUserProvidedClock(IWMReaderAdvanced6 *iface, BOOL *user_clock)
256 {
257     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
258     FIXME("(%p)->(%p)\n", This, user_clock);
259     return E_NOTIMPL;
260 }
261 
262 static HRESULT WINAPI WMReaderAdvanced_DeliverTime(IWMReaderAdvanced6 *iface, QWORD time)
263 {
264     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
265     FIXME("(%p)->(%s)\n", This, wine_dbgstr_longlong(time));
266     return E_NOTIMPL;
267 }
268 
269 static HRESULT WINAPI WMReaderAdvanced_SetManualStreamSelection(IWMReaderAdvanced6 *iface, BOOL selection)
270 {
271     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
272     FIXME("(%p)->(%x)\n", This, selection);
273     return E_NOTIMPL;
274 }
275 
276 static HRESULT WINAPI WMReaderAdvanced_GetManualStreamSelection(IWMReaderAdvanced6 *iface, BOOL *selection)
277 {
278     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
279     FIXME("(%p)->(%p)\n", This, selection);
280     return E_NOTIMPL;
281 }
282 
283 static HRESULT WINAPI WMReaderAdvanced_SetStreamsSelected(IWMReaderAdvanced6 *iface, WORD stream_count,
284         WORD *stream_numbers, WMT_STREAM_SELECTION *selections)
285 {
286     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
287     FIXME("(%p)->(%d %p %p)\n", This, stream_count, stream_numbers, selections);
288     return E_NOTIMPL;
289 }
290 
291 static HRESULT WINAPI WMReaderAdvanced_GetStreamSelected(IWMReaderAdvanced6 *iface, WORD stream_num,
292         WMT_STREAM_SELECTION *selection)
293 {
294     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
295     FIXME("(%p)->(%d %p)\n", This, stream_num, selection);
296     return E_NOTIMPL;
297 }
298 
299 static HRESULT WINAPI WMReaderAdvanced_SetReceiveSelectionCallbacks(IWMReaderAdvanced6 *iface, BOOL get_callbacks)
300 {
301     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
302     FIXME("(%p)->(%x)\n", This, get_callbacks);
303     return E_NOTIMPL;
304 }
305 
306 static HRESULT WINAPI WMReaderAdvanced_GetReceiveSelectionCallbacks(IWMReaderAdvanced6 *iface, BOOL *get_callbacks)
307 {
308     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
309     FIXME("(%p)->(%p)\n", This, get_callbacks);
310     return E_NOTIMPL;
311 }
312 
313 static HRESULT WINAPI WMReaderAdvanced_SetReceiveStreamSamples(IWMReaderAdvanced6 *iface, WORD stream_num,
314         BOOL receive_stream_samples)
315 {
316     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
317     FIXME("(%p)->(%d %x)\n", This, stream_num, receive_stream_samples);
318     return E_NOTIMPL;
319 }
320 
321 static HRESULT WINAPI WMReaderAdvanced_GetReceiveStreamSamples(IWMReaderAdvanced6 *iface, WORD stream_num,
322         BOOL *receive_stream_samples)
323 {
324     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
325     FIXME("(%p)->(%d %p)\n", This, stream_num, receive_stream_samples);
326     return E_NOTIMPL;
327 }
328 
329 static HRESULT WINAPI WMReaderAdvanced_SetAllocateForOutput(IWMReaderAdvanced6 *iface, DWORD output_num, BOOL allocate)
330 {
331     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
332     FIXME("(%p)->(%d %x)\n", This, output_num, allocate);
333     return E_NOTIMPL;
334 }
335 
336 static HRESULT WINAPI WMReaderAdvanced_GetAllocateForOutput(IWMReaderAdvanced6 *iface, DWORD output_num, BOOL *allocate)
337 {
338     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
339     FIXME("(%p)->(%d %p)\n", This, output_num, allocate);
340     return E_NOTIMPL;
341 }
342 
343 static HRESULT WINAPI WMReaderAdvanced_SetAllocateForStream(IWMReaderAdvanced6 *iface, WORD output_num, BOOL allocate)
344 {
345     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
346     FIXME("(%p)->(%d %x)\n", This, output_num, allocate);
347     return E_NOTIMPL;
348 }
349 
350 static HRESULT WINAPI WMReaderAdvanced_GetAllocateForStream(IWMReaderAdvanced6 *iface, WORD output_num, BOOL *allocate)
351 {
352     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
353     FIXME("(%p)->(%d %p)\n", This, output_num, allocate);
354     return E_NOTIMPL;
355 }
356 
357 static HRESULT WINAPI WMReaderAdvanced_GetStatistics(IWMReaderAdvanced6 *iface, WM_READER_STATISTICS *statistics)
358 {
359     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
360     FIXME("(%p)->(%p)\n", This, statistics);
361     return E_NOTIMPL;
362 }
363 
364 static HRESULT WINAPI WMReaderAdvanced_SetClientInfo(IWMReaderAdvanced6 *iface, WM_READER_CLIENTINFO *client_info)
365 {
366     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
367     FIXME("(%p)->(%p)\n", This, client_info);
368     return E_NOTIMPL;
369 }
370 
371 static HRESULT WINAPI WMReaderAdvanced_GetMaxOutputSampleSize(IWMReaderAdvanced6 *iface, DWORD output, DWORD *max)
372 {
373     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
374     FIXME("(%p)->(%d %p)\n", This, output, max);
375     return E_NOTIMPL;
376 }
377 
378 static HRESULT WINAPI WMReaderAdvanced_GetMaxStreamSampleSize(IWMReaderAdvanced6 *iface, WORD stream, DWORD *max)
379 {
380     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
381     FIXME("(%p)->(%d %p)\n", This, stream, max);
382     return E_NOTIMPL;
383 }
384 
385 static HRESULT WINAPI WMReaderAdvanced_NotifyLateDelivery(IWMReaderAdvanced6 *iface, QWORD lateness)
386 {
387     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
388     FIXME("(%p)->(%s)\n", This, wine_dbgstr_longlong(lateness));
389     return E_NOTIMPL;
390 }
391 
392 static HRESULT WINAPI WMReaderAdvanced2_SetPlayMode(IWMReaderAdvanced6 *iface, WMT_PLAY_MODE mode)
393 {
394     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
395     FIXME("(%p)->(%d)\n", This, mode);
396     return E_NOTIMPL;
397 }
398 
399 static HRESULT WINAPI WMReaderAdvanced2_GetPlayMode(IWMReaderAdvanced6 *iface, WMT_PLAY_MODE *mode)
400 {
401     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
402     FIXME("(%p)->(%p)\n", This, mode);
403     return E_NOTIMPL;
404 }
405 
406 static HRESULT WINAPI WMReaderAdvanced2_GetBufferProgress(IWMReaderAdvanced6 *iface, DWORD *percent, QWORD *buffering)
407 {
408     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
409     FIXME("(%p)->(%p %p)\n", This, percent, buffering);
410     return E_NOTIMPL;
411 }
412 
413 static HRESULT WINAPI WMReaderAdvanced2_GetDownloadProgress(IWMReaderAdvanced6 *iface, DWORD *percent,
414         QWORD *bytes_downloaded, QWORD *download)
415 {
416     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
417     FIXME("(%p)->(%p %p %p)\n", This, percent, bytes_downloaded, download);
418     return E_NOTIMPL;
419 }
420 
421 static HRESULT WINAPI WMReaderAdvanced2_GetSaveAsProgress(IWMReaderAdvanced6 *iface, DWORD *percent)
422 {
423     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
424     FIXME("(%p)->(%p)\n", This, percent);
425     return E_NOTIMPL;
426 }
427 
428 static HRESULT WINAPI WMReaderAdvanced2_SaveFileAs(IWMReaderAdvanced6 *iface, const WCHAR *filename)
429 {
430     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
431     FIXME("(%p)->(%s)\n", This, debugstr_w(filename));
432     return E_NOTIMPL;
433 }
434 
435 static HRESULT WINAPI WMReaderAdvanced2_GetProtocolName(IWMReaderAdvanced6 *iface, WCHAR *protocol, DWORD *protocol_len)
436 {
437     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
438     FIXME("(%p)->(%p %p)\n", This, protocol, protocol_len);
439     return E_NOTIMPL;
440 }
441 
442 static HRESULT WINAPI WMReaderAdvanced2_StartAtMarker(IWMReaderAdvanced6 *iface, WORD marker_index,
443         QWORD duration, float rate, void *context)
444 {
445     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
446     FIXME("(%p)->(%d %s %f %p)\n", This, marker_index, wine_dbgstr_longlong(duration), rate, context);
447     return E_NOTIMPL;
448 }
449 
450 static HRESULT WINAPI WMReaderAdvanced2_GetOutputSetting(IWMReaderAdvanced6 *iface, DWORD output_num,
451         const WCHAR *name, WMT_ATTR_DATATYPE *type, BYTE *value, WORD *length)
452 {
453     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
454     FIXME("(%p)->(%d %s %p %p %p)\n", This, output_num, debugstr_w(name), type, value, length);
455     return E_NOTIMPL;
456 }
457 
458 static HRESULT WINAPI WMReaderAdvanced2_SetOutputSetting(IWMReaderAdvanced6 *iface, DWORD output_num,
459         const WCHAR *name, WMT_ATTR_DATATYPE type, const BYTE *value, WORD length)
460 {
461     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
462     FIXME("(%p)->(%d %s %d %p %d)\n", This, output_num, debugstr_w(name), type, value, length);
463     return E_NOTIMPL;
464 }
465 
466 static HRESULT WINAPI WMReaderAdvanced2_Preroll(IWMReaderAdvanced6 *iface, QWORD start, QWORD duration, float rate)
467 {
468     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
469     FIXME("(%p)->(%s %s %f)\n", This, wine_dbgstr_longlong(start), wine_dbgstr_longlong(duration), rate);
470     return E_NOTIMPL;
471 }
472 
473 static HRESULT WINAPI WMReaderAdvanced2_SetLogClientID(IWMReaderAdvanced6 *iface, BOOL log_client_id)
474 {
475     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
476     FIXME("(%p)->(%x)\n", This, log_client_id);
477     return E_NOTIMPL;
478 }
479 
480 static HRESULT WINAPI WMReaderAdvanced2_GetLogClientID(IWMReaderAdvanced6 *iface, BOOL *log_client_id)
481 {
482     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
483     FIXME("(%p)->(%p)\n", This, log_client_id);
484     return E_NOTIMPL;
485 }
486 
487 static HRESULT WINAPI WMReaderAdvanced2_StopBuffering(IWMReaderAdvanced6 *iface)
488 {
489     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
490     FIXME("(%p)\n", This);
491     return E_NOTIMPL;
492 }
493 
494 static HRESULT WINAPI WMReaderAdvanced2_OpenStream(IWMReaderAdvanced6 *iface, IStream *stream,
495         IWMReaderCallback *callback, void *context)
496 {
497     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
498     FIXME("(%p)->(%p %p %p)\n", This, stream, callback, context);
499     return E_NOTIMPL;
500 }
501 
502 static HRESULT WINAPI WMReaderAdvanced3_StopNetStreaming(IWMReaderAdvanced6 *iface)
503 {
504     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
505     FIXME("(%p)\n", This);
506     return E_NOTIMPL;
507 }
508 
509 static HRESULT WINAPI WMReaderAdvanced3_StartAtPosition(IWMReaderAdvanced6 *iface, WORD stream_num,
510         void *offset_start, void *duration, WMT_OFFSET_FORMAT format, float rate, void *context)
511 {
512     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
513     FIXME("(%p)->(%d %p %p %d %f %p)\n", This, stream_num, offset_start, duration, format, rate, context);
514     return E_NOTIMPL;
515 }
516 
517 static HRESULT WINAPI WMReaderAdvanced4_GetLanguageCount(IWMReaderAdvanced6 *iface, DWORD output_num, WORD *language_count)
518 {
519     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
520     FIXME("(%p)->(%d %p)\n", This, output_num, language_count);
521     return E_NOTIMPL;
522 }
523 
524 static HRESULT WINAPI WMReaderAdvanced4_GetLanguage(IWMReaderAdvanced6 *iface, DWORD output_num,
525        WORD language, WCHAR *language_string, WORD *language_string_len)
526 {
527     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
528     FIXME("(%p)->(%d %x %p %p)\n", This, output_num, language, language_string, language_string_len);
529     return E_NOTIMPL;
530 }
531 
532 static HRESULT WINAPI WMReaderAdvanced4_GetMaxSpeedFactor(IWMReaderAdvanced6 *iface, double *factor)
533 {
534     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
535     FIXME("(%p)->(%p)\n", This, factor);
536     return E_NOTIMPL;
537 }
538 
539 static HRESULT WINAPI WMReaderAdvanced4_IsUsingFastCache(IWMReaderAdvanced6 *iface, BOOL *using_fast_cache)
540 {
541     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
542     FIXME("(%p)->(%p)\n", This, using_fast_cache);
543     return E_NOTIMPL;
544 }
545 
546 static HRESULT WINAPI WMReaderAdvanced4_AddLogParam(IWMReaderAdvanced6 *iface, const WCHAR *namespace,
547         const WCHAR *name, const WCHAR *value)
548 {
549     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
550     FIXME("(%p)->(%s %s %s)\n", This, debugstr_w(namespace), debugstr_w(name), debugstr_w(value));
551     return E_NOTIMPL;
552 }
553 
554 static HRESULT WINAPI WMReaderAdvanced4_SendLogParams(IWMReaderAdvanced6 *iface)
555 {
556     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
557     FIXME("(%p)\n", This);
558     return E_NOTIMPL;
559 }
560 
561 static HRESULT WINAPI WMReaderAdvanced4_CanSaveFileAs(IWMReaderAdvanced6 *iface, BOOL *can_save)
562 {
563     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
564     FIXME("(%p)->(%p)\n", This, can_save);
565     return E_NOTIMPL;
566 }
567 
568 static HRESULT WINAPI WMReaderAdvanced4_CancelSaveFileAs(IWMReaderAdvanced6 *iface)
569 {
570     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
571     FIXME("(%p)\n", This);
572     return E_NOTIMPL;
573 }
574 
575 static HRESULT WINAPI WMReaderAdvanced4_GetURL(IWMReaderAdvanced6 *iface, WCHAR *url, DWORD *url_len)
576 {
577     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
578     FIXME("(%p)->(%p %p)\n", This, url, url_len);
579     return E_NOTIMPL;
580 }
581 
582 static HRESULT WINAPI WMReaderAdvanced5_SetPlayerHook(IWMReaderAdvanced6 *iface, DWORD output_num, IWMPlayerHook *hook)
583 {
584     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
585     FIXME("(%p)->(%d %p)\n", This, output_num, hook);
586     return E_NOTIMPL;
587 }
588 
589 static HRESULT WINAPI WMReaderAdvanced6_SetProtextStreamSamples(IWMReaderAdvanced6 *iface, BYTE *cert,
590         DWORD cert_size, DWORD cert_type, DWORD flags, BYTE *initialization_vector, DWORD *initialization_vector_size)
591 {
592     WMReader *This = impl_from_IWMReaderAdvanced6(iface);
593     FIXME("(%p)->(%p %d %d %x %p %p)\n", This, cert, cert_size, cert_type, flags, initialization_vector,
594           initialization_vector_size);
595     return E_NOTIMPL;
596 }
597 
598 static const IWMReaderAdvanced6Vtbl WMReaderAdvanced6Vtbl = {
599     WMReaderAdvanced_QueryInterface,
600     WMReaderAdvanced_AddRef,
601     WMReaderAdvanced_Release,
602     WMReaderAdvanced_SetUserProvidedClock,
603     WMReaderAdvanced_GetUserProvidedClock,
604     WMReaderAdvanced_DeliverTime,
605     WMReaderAdvanced_SetManualStreamSelection,
606     WMReaderAdvanced_GetManualStreamSelection,
607     WMReaderAdvanced_SetStreamsSelected,
608     WMReaderAdvanced_GetStreamSelected,
609     WMReaderAdvanced_SetReceiveSelectionCallbacks,
610     WMReaderAdvanced_GetReceiveSelectionCallbacks,
611     WMReaderAdvanced_SetReceiveStreamSamples,
612     WMReaderAdvanced_GetReceiveStreamSamples,
613     WMReaderAdvanced_SetAllocateForOutput,
614     WMReaderAdvanced_GetAllocateForOutput,
615     WMReaderAdvanced_SetAllocateForStream,
616     WMReaderAdvanced_GetAllocateForStream,
617     WMReaderAdvanced_GetStatistics,
618     WMReaderAdvanced_SetClientInfo,
619     WMReaderAdvanced_GetMaxOutputSampleSize,
620     WMReaderAdvanced_GetMaxStreamSampleSize,
621     WMReaderAdvanced_NotifyLateDelivery,
622     WMReaderAdvanced2_SetPlayMode,
623     WMReaderAdvanced2_GetPlayMode,
624     WMReaderAdvanced2_GetBufferProgress,
625     WMReaderAdvanced2_GetDownloadProgress,
626     WMReaderAdvanced2_GetSaveAsProgress,
627     WMReaderAdvanced2_SaveFileAs,
628     WMReaderAdvanced2_GetProtocolName,
629     WMReaderAdvanced2_StartAtMarker,
630     WMReaderAdvanced2_GetOutputSetting,
631     WMReaderAdvanced2_SetOutputSetting,
632     WMReaderAdvanced2_Preroll,
633     WMReaderAdvanced2_SetLogClientID,
634     WMReaderAdvanced2_GetLogClientID,
635     WMReaderAdvanced2_StopBuffering,
636     WMReaderAdvanced2_OpenStream,
637     WMReaderAdvanced3_StopNetStreaming,
638     WMReaderAdvanced3_StartAtPosition,
639     WMReaderAdvanced4_GetLanguageCount,
640     WMReaderAdvanced4_GetLanguage,
641     WMReaderAdvanced4_GetMaxSpeedFactor,
642     WMReaderAdvanced4_IsUsingFastCache,
643     WMReaderAdvanced4_AddLogParam,
644     WMReaderAdvanced4_SendLogParams,
645     WMReaderAdvanced4_CanSaveFileAs,
646     WMReaderAdvanced4_CancelSaveFileAs,
647     WMReaderAdvanced4_GetURL,
648     WMReaderAdvanced5_SetPlayerHook,
649     WMReaderAdvanced6_SetProtextStreamSamples
650 };
651 
652 HRESULT WINAPI WMCreateReader(IUnknown *reserved, DWORD rights, IWMReader **ret_reader)
653 {
654     WMReader *reader;
655 
656     TRACE("(%p, %x, %p)\n", reserved, rights, ret_reader);
657 
658     reader = heap_alloc(sizeof(*reader));
659     if(!reader)
660         return E_OUTOFMEMORY;
661 
662     reader->IWMReader_iface.lpVtbl = &WMReaderVtbl;
663     reader->IWMReaderAdvanced6_iface.lpVtbl = &WMReaderAdvanced6Vtbl;
664     reader->ref = 1;
665 
666     *ret_reader = &reader->IWMReader_iface;
667     return S_OK;
668 }
669 
670 HRESULT WINAPI WMCreateReaderPriv(IWMReader **ret_reader)
671 {
672     return WMCreateReader(NULL, 0, ret_reader);
673 }
674 
675 HRESULT WINAPI WMCreateSyncReader(IUnknown *pcert, DWORD rights, IWMSyncReader **syncreader)
676 {
677     FIXME("(%p, %x, %p): stub\n", pcert, rights, syncreader);
678 
679     *syncreader = NULL;
680 
681     return E_NOTIMPL;
682 }
683 
684 typedef struct {
685     IWMProfileManager IWMProfileManager_iface;
686     LONG ref;
687 } WMProfileManager;
688 
689 static inline WMProfileManager *impl_from_IWMProfileManager(IWMProfileManager *iface)
690 {
691     return CONTAINING_RECORD(iface, WMProfileManager, IWMProfileManager_iface);
692 }
693 
694 static HRESULT WINAPI WMProfileManager_QueryInterface(IWMProfileManager *iface, REFIID riid, void **ppv)
695 {
696     WMProfileManager *This = impl_from_IWMProfileManager(iface);
697 
698     if(IsEqualGUID(&IID_IUnknown, riid)) {
699         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
700         *ppv = &This->IWMProfileManager_iface;
701     }else if(IsEqualGUID(&IID_IWMProfileManager, riid)) {
702         TRACE("(%p)->(IID_IWMProfileManager %p)\n", This, ppv);
703         *ppv = &This->IWMProfileManager_iface;
704     }else {
705         *ppv = NULL;
706         return E_NOINTERFACE;
707     }
708 
709     IUnknown_AddRef((IUnknown*)*ppv);
710     return S_OK;
711 }
712 
713 static ULONG WINAPI WMProfileManager_AddRef(IWMProfileManager *iface)
714 {
715     WMProfileManager *This = impl_from_IWMProfileManager(iface);
716     LONG ref = InterlockedIncrement(&This->ref);
717 
718     TRACE("(%p) ref=%d\n", This, ref);
719 
720     return ref;
721 }
722 
723 static ULONG WINAPI WMProfileManager_Release(IWMProfileManager *iface)
724 {
725     WMProfileManager *This = impl_from_IWMProfileManager(iface);
726     LONG ref = InterlockedDecrement(&This->ref);
727 
728     TRACE("(%p) ref=%d\n", This, ref);
729 
730     if(!ref)
731         heap_free(This);
732 
733     return ref;
734 }
735 
736 static HRESULT WINAPI WMProfileManager_CreateEmptyProfile(IWMProfileManager *iface, WMT_VERSION version, IWMProfile **ret)
737 {
738     WMProfileManager *This = impl_from_IWMProfileManager(iface);
739     FIXME("(%p)->(%x %p)\n", This, version, ret);
740     return E_NOTIMPL;
741 }
742 
743 static HRESULT WINAPI WMProfileManager_LoadProfileByID(IWMProfileManager *iface, REFGUID guid, IWMProfile **ret)
744 {
745     WMProfileManager *This = impl_from_IWMProfileManager(iface);
746     FIXME("(%p)->(%s %p)\n", This, debugstr_guid(guid), ret);
747     return E_NOTIMPL;
748 }
749 
750 static HRESULT WINAPI WMProfileManager_LoadProfileByData(IWMProfileManager *iface, const WCHAR *profile, IWMProfile **ret)
751 {
752     WMProfileManager *This = impl_from_IWMProfileManager(iface);
753     FIXME("(%p)->(%s %p)\n", This, debugstr_w(profile), ret);
754     return E_NOTIMPL;
755 }
756 
757 static HRESULT WINAPI WMProfileManager_SaveProfile(IWMProfileManager *iface, IWMProfile *profile, WCHAR *profile_str, DWORD *len)
758 {
759     WMProfileManager *This = impl_from_IWMProfileManager(iface);
760     FIXME("(%p)->(%p %p %p)\n", This, profile, profile_str, len);
761     return E_NOTIMPL;
762 }
763 
764 static HRESULT WINAPI WMProfileManager_GetSystemProfileCount(IWMProfileManager *iface, DWORD *ret)
765 {
766     WMProfileManager *This = impl_from_IWMProfileManager(iface);
767     FIXME("(%p)->(%p)\n", This, ret);
768     return E_NOTIMPL;
769 }
770 
771 static HRESULT WINAPI WMProfileManager_LoadSystemProfile(IWMProfileManager *iface, DWORD index, IWMProfile **ret)
772 {
773     WMProfileManager *This = impl_from_IWMProfileManager(iface);
774     FIXME("(%p)->(%d %p)\n", This, index, ret);
775     return E_NOTIMPL;
776 }
777 
778 static const IWMProfileManagerVtbl WMProfileManagerVtbl = {
779     WMProfileManager_QueryInterface,
780     WMProfileManager_AddRef,
781     WMProfileManager_Release,
782     WMProfileManager_CreateEmptyProfile,
783     WMProfileManager_LoadProfileByID,
784     WMProfileManager_LoadProfileByData,
785     WMProfileManager_SaveProfile,
786     WMProfileManager_GetSystemProfileCount,
787     WMProfileManager_LoadSystemProfile
788 };
789 
790 HRESULT WINAPI WMCreateProfileManager(IWMProfileManager **ret)
791 {
792     WMProfileManager *profile_mgr;
793 
794     TRACE("(%p)\n", ret);
795 
796     profile_mgr = heap_alloc(sizeof(*profile_mgr));
797     if(!profile_mgr)
798         return E_OUTOFMEMORY;
799 
800     profile_mgr->IWMProfileManager_iface.lpVtbl = &WMProfileManagerVtbl;
801     profile_mgr->ref = 1;
802 
803     *ret = &profile_mgr->IWMProfileManager_iface;
804     return S_OK;
805 }
806