mfplat/sample: Refactor sample_CopyToBuffer().
[wine.git] / dlls / wmvcore / async_reader.c
blob3a8556a5f0a3a1b9671145df3cc887015f33bb8c
1 /*
2 * Copyright 2012 Austin English
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 <stdarg.h>
20 #include <stddef.h>
21 #include <stdbool.h>
23 #define COBJMACROS
24 #include "windef.h"
25 #include "winbase.h"
27 #define EXTERN_GUID DEFINE_GUID
28 #include "initguid.h"
29 #include "strmif.h"
30 #include "wmvcore_private.h"
32 #include "wmsdk.h"
34 #include "wine/debug.h"
35 #include "wine/list.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(wmvcore);
39 union async_op_data
41 struct
43 QWORD start;
44 QWORD duration;
45 void *context;
46 } start;
49 struct async_op
51 enum async_op_type
53 ASYNC_OP_START,
54 ASYNC_OP_STOP,
55 ASYNC_OP_CLOSE,
56 } type;
57 union async_op_data u;
58 struct list entry;
61 struct sample
63 INSSBuffer *buffer;
64 QWORD pts, duration;
65 DWORD flags, output;
66 WORD stream;
69 struct async_reader
71 IWMReader IWMReader_iface;
72 IWMReaderAdvanced6 IWMReaderAdvanced6_iface;
73 IWMReaderAccelerator IWMReaderAccelerator_iface;
74 IWMReaderNetworkConfig2 IWMReaderNetworkConfig2_iface;
75 IWMReaderStreamClock IWMReaderStreamClock_iface;
76 IWMReaderTypeNegotiation IWMReaderTypeNegotiation_iface;
77 IReferenceClock IReferenceClock_iface;
78 IUnknown *reader_inner;
79 LONG refcount;
81 IWMSyncReader2 *reader;
83 CRITICAL_SECTION cs;
85 IWMReaderCallbackAdvanced *callback_advanced;
86 IWMReaderAllocatorEx *allocator;
87 IWMReaderCallback *callback;
88 void *context;
90 REFERENCE_TIME clock_start;
91 LARGE_INTEGER clock_frequency;
93 HANDLE callback_thread;
94 CRITICAL_SECTION callback_cs;
95 CONDITION_VARIABLE callback_cv;
97 bool running;
98 struct list async_ops;
100 bool user_clock;
101 QWORD user_time;
104 struct allocator
106 IWMReaderAllocatorEx IWMReaderAllocatorEx_iface;
107 LONG refcount;
109 IWMReaderCallbackAdvanced *callback;
112 static struct allocator *impl_from_IWMReaderAllocatorEx(IWMReaderAllocatorEx *iface)
114 return CONTAINING_RECORD(iface, struct allocator, IWMReaderAllocatorEx_iface);
117 static HRESULT WINAPI allocator_QueryInterface(IWMReaderAllocatorEx *iface, REFIID iid, void **out)
119 struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface);
121 TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
123 if (IsEqualIID(iid, &IID_IUnknown)
124 || IsEqualIID(iid, &IID_IWMReaderAllocatorEx))
125 *out = &allocator->IWMReaderAllocatorEx_iface;
126 else
128 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
129 return E_NOINTERFACE;
132 IUnknown_AddRef((IUnknown *)*out);
133 return S_OK;
136 static ULONG WINAPI allocator_AddRef(IWMReaderAllocatorEx *iface)
138 struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface);
139 ULONG refcount = InterlockedIncrement(&allocator->refcount);
140 TRACE("iface %p increasing refcount to %lu.\n", iface, refcount);
141 return refcount;
144 static ULONG WINAPI allocator_Release(IWMReaderAllocatorEx *iface)
146 struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface);
147 ULONG refcount = InterlockedDecrement(&allocator->refcount);
149 TRACE("iface %p decreasing refcount to %lu.\n", iface, refcount);
151 if (!refcount)
153 if (allocator->callback)
154 IWMReaderCallbackAdvanced_Release(allocator->callback);
155 free(allocator);
158 return refcount;
161 static HRESULT WINAPI allocator_AllocateForStreamEx(IWMReaderAllocatorEx *iface,
162 WORD stream_number, DWORD size, INSSBuffer **sample, DWORD flags,
163 QWORD pts, QWORD duration, void *context)
165 struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface);
167 TRACE("iface %p, stream_number %u, size %#lx, sample %p, flags %#lx, pts %I64d, duration %I64d, context %p.\n",
168 iface, stream_number, size, sample, flags, pts, duration, context);
170 if (allocator->callback)
171 return IWMReaderCallbackAdvanced_AllocateForStream(allocator->callback,
172 stream_number, size, sample, context);
174 return E_NOTIMPL;
177 static HRESULT WINAPI allocator_AllocateForOutputEx(IWMReaderAllocatorEx *iface,
178 DWORD output, DWORD size, INSSBuffer **sample, DWORD flags,
179 QWORD pts, QWORD duration, void *context)
181 struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface);
183 TRACE("iface %p, output %lu, size %#lx, sample %p, flags %#lx, pts %I64d, duration %I64d, context %p.\n",
184 iface, output, size, sample, flags, pts, duration, context);
186 if (allocator->callback)
187 return IWMReaderCallbackAdvanced_AllocateForOutput(allocator->callback,
188 output, size, sample, context);
190 return E_NOTIMPL;
193 static const IWMReaderAllocatorExVtbl allocator_vtbl =
195 allocator_QueryInterface,
196 allocator_AddRef,
197 allocator_Release,
198 allocator_AllocateForStreamEx,
199 allocator_AllocateForOutputEx,
202 static HRESULT allocator_create(IWMReaderCallback *callback, IWMReaderAllocatorEx **out)
204 struct allocator *allocator;
205 HRESULT hr;
207 if (!(allocator = calloc(1, sizeof(*allocator))))
208 return E_OUTOFMEMORY;
209 allocator->IWMReaderAllocatorEx_iface.lpVtbl = &allocator_vtbl;
210 allocator->refcount = 1;
212 if (FAILED(hr = IWMReaderCallback_QueryInterface(callback,
213 &IID_IWMReaderCallbackAdvanced, (void **)&allocator->callback)))
215 WARN("Failed to retrieve IWMReaderCallbackAdvanced interface, hr %#lx\n", hr);
216 allocator->callback = NULL;
219 *out = &allocator->IWMReaderAllocatorEx_iface;
220 return S_OK;
223 static REFERENCE_TIME get_current_time(const struct async_reader *reader)
225 LARGE_INTEGER time;
227 QueryPerformanceCounter(&time);
228 return (time.QuadPart * 1000) / reader->clock_frequency.QuadPart * 10000;
231 static DWORD async_reader_get_wait_timeout(struct async_reader *reader, QWORD pts)
233 REFERENCE_TIME current_time = reader->user_time;
234 DWORD timeout = INFINITE;
236 if (!reader->user_clock)
238 current_time = get_current_time(reader) - reader->clock_start;
239 timeout = (pts - current_time) / 10000;
242 return pts > current_time ? timeout : 0;
245 static bool async_reader_wait_pts(struct async_reader *reader, QWORD pts)
247 IWMReaderCallbackAdvanced *callback_advanced = reader->callback_advanced;
248 DWORD timeout;
250 TRACE("reader %p, pts %I64d.\n", reader, pts);
252 if (reader->user_clock && pts > reader->user_time && callback_advanced)
254 QWORD user_time = reader->user_time;
255 LeaveCriticalSection(&reader->callback_cs);
256 IWMReaderCallbackAdvanced_OnTime(callback_advanced, user_time, reader->context);
257 EnterCriticalSection(&reader->callback_cs);
260 while (reader->running && list_empty(&reader->async_ops))
262 if (!(timeout = async_reader_get_wait_timeout(reader, pts)))
263 return true;
264 SleepConditionVariableCS(&reader->callback_cv, &reader->callback_cs, timeout);
267 return false;
270 static void async_reader_deliver_sample(struct async_reader *reader, struct sample *sample)
272 IWMReaderCallbackAdvanced *callback_advanced = reader->callback_advanced;
273 IWMReaderCallback *callback = reader->callback;
274 BOOL read_compressed;
275 HRESULT hr;
277 TRACE("reader %p, output %lu, stream %u, pts %s, duration %s, flags %#lx, buffer %p.\n",
278 reader, sample->output, sample->stream, debugstr_time(sample->pts),
279 debugstr_time(sample->duration), sample->flags, sample->buffer);
281 if (FAILED(hr = IWMSyncReader2_GetReadStreamSamples(reader->reader, sample->stream,
282 &read_compressed)))
283 read_compressed = FALSE;
285 LeaveCriticalSection(&reader->callback_cs);
286 if (read_compressed)
287 hr = IWMReaderCallbackAdvanced_OnStreamSample(callback_advanced, sample->stream,
288 sample->pts, sample->duration, sample->flags, sample->buffer, reader->context);
289 else
290 hr = IWMReaderCallback_OnSample(callback, sample->output, sample->pts, sample->duration,
291 sample->flags, sample->buffer, reader->context);
292 EnterCriticalSection(&reader->callback_cs);
294 TRACE("Callback returned %#lx.\n", hr);
296 INSSBuffer_Release(sample->buffer);
299 static void callback_thread_run(struct async_reader *reader)
301 IWMReaderCallbackAdvanced *callback_advanced = reader->callback_advanced;
302 IWMReaderCallback *callback = reader->callback;
303 static const DWORD zero;
304 HRESULT hr = S_OK;
306 while (reader->running && list_empty(&reader->async_ops))
308 struct sample sample;
310 LeaveCriticalSection(&reader->callback_cs);
311 hr = IWMSyncReader2_GetNextSample(reader->reader, 0, &sample.buffer, &sample.pts,
312 &sample.duration, &sample.flags, &sample.output, &sample.stream);
313 EnterCriticalSection(&reader->callback_cs);
314 if (hr != S_OK)
315 break;
317 if (async_reader_wait_pts(reader, sample.pts))
318 async_reader_deliver_sample(reader, &sample);
319 else
320 INSSBuffer_Release(sample.buffer);
323 if (hr == NS_E_NO_MORE_SAMPLES)
325 BOOL user_clock = reader->user_clock;
326 QWORD user_time = reader->user_time;
328 LeaveCriticalSection(&reader->callback_cs);
330 IWMReaderCallback_OnStatus(callback, WMT_END_OF_STREAMING, S_OK,
331 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
332 IWMReaderCallback_OnStatus(callback, WMT_EOF, S_OK,
333 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
335 if (user_clock && callback_advanced)
337 /* We can only get here if user_time is greater than the PTS
338 * of all samples, in which case we cannot have sent this
339 * notification already. */
340 IWMReaderCallbackAdvanced_OnTime(callback_advanced,
341 user_time, reader->context);
344 EnterCriticalSection(&reader->callback_cs);
346 TRACE("Reached end of stream; exiting.\n");
348 else if (hr != S_OK)
350 ERR("Failed to get sample, hr %#lx.\n", hr);
354 static DWORD WINAPI async_reader_callback_thread(void *arg)
356 struct async_reader *reader = arg;
357 static const DWORD zero;
358 struct list *entry;
359 HRESULT hr = S_OK;
361 IWMReaderCallback_OnStatus(reader->callback, WMT_OPENED, S_OK,
362 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
364 EnterCriticalSection(&reader->callback_cs);
366 while (reader->running)
368 if ((entry = list_head(&reader->async_ops)))
370 struct async_op *op = LIST_ENTRY(entry, struct async_op, entry);
371 list_remove(&op->entry);
373 hr = list_empty(&reader->async_ops) ? S_OK : E_ABORT;
374 switch (op->type)
376 case ASYNC_OP_START:
378 reader->context = op->u.start.context;
379 if (SUCCEEDED(hr))
380 hr = IWMSyncReader2_SetRange(reader->reader, op->u.start.start, op->u.start.duration);
381 if (SUCCEEDED(hr))
382 reader->clock_start = get_current_time(reader);
384 LeaveCriticalSection(&reader->callback_cs);
385 IWMReaderCallback_OnStatus(reader->callback, WMT_STARTED, hr,
386 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
387 EnterCriticalSection(&reader->callback_cs);
389 if (SUCCEEDED(hr))
390 callback_thread_run(reader);
391 break;
394 case ASYNC_OP_STOP:
395 LeaveCriticalSection(&reader->callback_cs);
396 IWMReaderCallback_OnStatus(reader->callback, WMT_STOPPED, hr,
397 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
398 EnterCriticalSection(&reader->callback_cs);
399 break;
401 case ASYNC_OP_CLOSE:
402 LeaveCriticalSection(&reader->callback_cs);
403 IWMReaderCallback_OnStatus(reader->callback, WMT_CLOSED, hr,
404 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
405 EnterCriticalSection(&reader->callback_cs);
407 if (SUCCEEDED(hr))
408 reader->running = false;
409 break;
412 free(op);
415 if (reader->running && list_empty(&reader->async_ops))
416 SleepConditionVariableCS(&reader->callback_cv, &reader->callback_cs, INFINITE);
419 LeaveCriticalSection(&reader->callback_cs);
421 TRACE("Reader is stopping; exiting.\n");
422 return 0;
425 static void async_reader_close(struct async_reader *reader)
427 struct async_op *op, *next;
429 if (reader->callback_thread)
431 WaitForSingleObject(reader->callback_thread, INFINITE);
432 CloseHandle(reader->callback_thread);
433 reader->callback_thread = NULL;
436 LIST_FOR_EACH_ENTRY_SAFE(op, next, &reader->async_ops, struct async_op, entry)
438 list_remove(&op->entry);
439 free(op);
442 if (reader->allocator)
443 IWMReaderAllocatorEx_Release(reader->allocator);
444 reader->allocator = NULL;
446 if (reader->callback_advanced)
447 IWMReaderCallbackAdvanced_Release(reader->callback_advanced);
448 reader->callback_advanced = NULL;
450 if (reader->callback)
451 IWMReaderCallback_Release(reader->callback);
452 reader->callback = NULL;
453 reader->context = NULL;
456 static HRESULT async_reader_open(struct async_reader *reader, IWMReaderCallback *callback, void *context)
458 HRESULT hr = E_OUTOFMEMORY;
460 IWMReaderCallback_AddRef((reader->callback = callback));
461 reader->context = context;
463 if (FAILED(hr = allocator_create(reader->callback, &reader->allocator)))
464 goto error;
466 if (FAILED(hr = IWMReaderCallback_QueryInterface(callback, &IID_IWMReaderCallbackAdvanced,
467 (void **)&reader->callback_advanced)))
469 WARN("Failed to retrieve IWMReaderCallbackAdvanced interface, hr %#lx\n", hr);
470 reader->callback_advanced = NULL;
473 reader->running = true;
474 if (!(reader->callback_thread = CreateThread(NULL, 0, async_reader_callback_thread, reader, 0, NULL)))
475 goto error;
477 return S_OK;
479 error:
480 async_reader_close(reader);
481 return hr;
484 static HRESULT async_reader_queue_op(struct async_reader *reader, enum async_op_type type, union async_op_data *data)
486 struct async_op *op;
488 if (!(op = calloc(1, sizeof(*op))))
489 return E_OUTOFMEMORY;
490 op->type = type;
491 if (data)
492 op->u = *data;
494 EnterCriticalSection(&reader->callback_cs);
495 list_add_tail(&reader->async_ops, &op->entry);
496 LeaveCriticalSection(&reader->callback_cs);
497 WakeConditionVariable(&reader->callback_cv);
499 return S_OK;
502 static struct async_reader *impl_from_IWMReader(IWMReader *iface)
504 return CONTAINING_RECORD(iface, struct async_reader, IWMReader_iface);
507 static HRESULT WINAPI WMReader_QueryInterface(IWMReader *iface, REFIID iid, void **out)
509 struct async_reader *reader = impl_from_IWMReader(iface);
511 TRACE("reader %p, iid %s, out %p.\n", reader, debugstr_guid(iid), out);
513 if (IsEqualIID(iid, &IID_IUnknown)
514 || IsEqualIID(iid, &IID_IWMReader))
515 *out = &reader->IWMReader_iface;
516 else if (IsEqualIID(iid, &IID_IWMReaderAccelerator))
517 *out = &reader->IWMReaderAccelerator_iface;
518 else if (IsEqualIID(iid, &IID_IWMReaderAdvanced)
519 || IsEqualIID(iid, &IID_IWMReaderAdvanced2)
520 || IsEqualIID(iid, &IID_IWMReaderAdvanced3)
521 || IsEqualIID(iid, &IID_IWMReaderAdvanced4)
522 || IsEqualIID(iid, &IID_IWMReaderAdvanced5)
523 || IsEqualIID(iid, &IID_IWMReaderAdvanced6))
524 *out = &reader->IWMReaderAdvanced6_iface;
525 else if (IsEqualIID(iid, &IID_IWMReaderNetworkConfig)
526 || IsEqualIID(iid, &IID_IWMReaderNetworkConfig2))
527 *out = &reader->IWMReaderNetworkConfig2_iface;
528 else if (IsEqualIID(iid, &IID_IWMReaderStreamClock))
529 *out = &reader->IWMReaderStreamClock_iface;
530 else if (IsEqualIID(iid, &IID_IWMReaderTypeNegotiation))
531 *out = &reader->IWMReaderTypeNegotiation_iface;
532 else if (IsEqualIID(iid, &IID_IWMHeaderInfo)
533 || IsEqualIID(iid, &IID_IWMHeaderInfo2)
534 || IsEqualIID(iid, &IID_IWMHeaderInfo3)
535 || IsEqualIID(iid, &IID_IWMLanguageList)
536 || IsEqualIID(iid, &IID_IWMPacketSize)
537 || IsEqualIID(iid, &IID_IWMPacketSize2)
538 || IsEqualIID(iid, &IID_IWMProfile)
539 || IsEqualIID(iid, &IID_IWMProfile2)
540 || IsEqualIID(iid, &IID_IWMProfile3)
541 || IsEqualIID(iid, &IID_IWMReaderPlaylistBurn)
542 || IsEqualIID(iid, &IID_IWMReaderTimecode))
543 return IUnknown_QueryInterface(reader->reader_inner, iid, out);
544 else if (IsEqualIID(iid, &IID_IReferenceClock))
545 *out = &reader->IReferenceClock_iface;
546 else
548 FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
549 *out = NULL;
550 return E_NOINTERFACE;
553 IUnknown_AddRef((IUnknown *)*out);
554 return S_OK;
557 static ULONG WINAPI WMReader_AddRef(IWMReader *iface)
559 struct async_reader *reader = impl_from_IWMReader(iface);
560 ULONG refcount = InterlockedIncrement(&reader->refcount);
561 TRACE("%p increasing refcount to %lu.\n", reader, refcount);
562 return refcount;
565 static ULONG WINAPI WMReader_Release(IWMReader *iface)
567 struct async_reader *reader = impl_from_IWMReader(iface);
568 ULONG refcount = InterlockedDecrement(&reader->refcount);
570 TRACE("%p decreasing refcount to %lu.\n", reader, refcount);
572 if (!refcount)
574 EnterCriticalSection(&reader->callback_cs);
575 reader->running = false;
576 LeaveCriticalSection(&reader->callback_cs);
577 WakeConditionVariable(&reader->callback_cv);
579 async_reader_close(reader);
581 reader->callback_cs.DebugInfo->Spare[0] = 0;
582 DeleteCriticalSection(&reader->callback_cs);
583 reader->cs.DebugInfo->Spare[0] = 0;
584 DeleteCriticalSection(&reader->cs);
586 IWMSyncReader2_Close(reader->reader);
588 IUnknown_Release(reader->reader_inner);
589 free(reader);
592 return refcount;
595 static HRESULT WINAPI WMReader_Open(IWMReader *iface, const WCHAR *url,
596 IWMReaderCallback *callback, void *context)
598 struct async_reader *reader = impl_from_IWMReader(iface);
599 HRESULT hr;
601 TRACE("reader %p, url %s, callback %p, context %p.\n",
602 reader, debugstr_w(url), callback, context);
604 EnterCriticalSection(&reader->cs);
606 if (SUCCEEDED(hr = IWMSyncReader2_Open(reader->reader, url))
607 && FAILED(hr = async_reader_open(reader, callback, context)))
608 IWMSyncReader2_Close(reader->reader);
610 LeaveCriticalSection(&reader->cs);
611 return hr;
614 static HRESULT WINAPI WMReader_Close(IWMReader *iface)
616 struct async_reader *reader = impl_from_IWMReader(iface);
617 HRESULT hr;
619 TRACE("reader %p.\n", reader);
621 EnterCriticalSection(&reader->cs);
623 if (SUCCEEDED(hr = async_reader_queue_op(reader, ASYNC_OP_CLOSE, NULL)))
625 async_reader_close(reader);
626 hr = IWMSyncReader2_Close(reader->reader);
629 LeaveCriticalSection(&reader->cs);
631 return hr;
634 static HRESULT WINAPI WMReader_GetOutputCount(IWMReader *iface, DWORD *count)
636 struct async_reader *reader = impl_from_IWMReader(iface);
638 TRACE("reader %p, count %p.\n", reader, count);
640 return IWMSyncReader2_GetOutputCount(reader->reader, count);
643 static HRESULT WINAPI WMReader_GetOutputProps(IWMReader *iface, DWORD output, IWMOutputMediaProps **props)
645 struct async_reader *reader = impl_from_IWMReader(iface);
647 TRACE("reader %p, output %lu, props %p.\n", reader, output, props);
649 return IWMSyncReader2_GetOutputProps(reader->reader, output, props);
652 static HRESULT WINAPI WMReader_SetOutputProps(IWMReader *iface, DWORD output, IWMOutputMediaProps *props)
654 struct async_reader *reader = impl_from_IWMReader(iface);
656 TRACE("reader %p, output %lu, props %p.\n", reader, output, props);
658 return IWMSyncReader2_SetOutputProps(reader->reader, output, props);
661 static HRESULT WINAPI WMReader_GetOutputFormatCount(IWMReader *iface, DWORD output, DWORD *count)
663 struct async_reader *reader = impl_from_IWMReader(iface);
665 TRACE("reader %p, output %lu, count %p.\n", reader, output, count);
667 return IWMSyncReader2_GetOutputFormatCount(reader->reader, output, count);
670 static HRESULT WINAPI WMReader_GetOutputFormat(IWMReader *iface, DWORD output,
671 DWORD index, IWMOutputMediaProps **props)
673 struct async_reader *reader = impl_from_IWMReader(iface);
675 TRACE("reader %p, output %lu, index %lu, props %p.\n", reader, output, index, props);
677 return IWMSyncReader2_GetOutputFormat(reader->reader, output, index, props);
680 static HRESULT WINAPI WMReader_Start(IWMReader *iface,
681 QWORD start, QWORD duration, float rate, void *context)
683 union async_op_data data = {.start = {.start = start, .duration = duration, .context = context}};
684 struct async_reader *reader = impl_from_IWMReader(iface);
685 HRESULT hr;
687 TRACE("reader %p, start %s, duration %s, rate %.8e, context %p.\n",
688 reader, debugstr_time(start), debugstr_time(duration), rate, context);
690 if (rate != 1.0f)
691 FIXME("Ignoring rate %.8e.\n", rate);
693 EnterCriticalSection(&reader->cs);
695 if (!reader->callback_thread)
696 hr = NS_E_INVALID_REQUEST;
697 else
698 hr = async_reader_queue_op(reader, ASYNC_OP_START, &data);
700 LeaveCriticalSection(&reader->cs);
702 return hr;
705 static HRESULT WINAPI WMReader_Stop(IWMReader *iface)
707 struct async_reader *reader = impl_from_IWMReader(iface);
708 HRESULT hr;
710 TRACE("reader %p.\n", reader);
712 EnterCriticalSection(&reader->cs);
714 if (!reader->callback_thread)
715 hr = E_UNEXPECTED;
716 else
717 hr = async_reader_queue_op(reader, ASYNC_OP_STOP, NULL);
719 LeaveCriticalSection(&reader->cs);
721 return hr;
724 static HRESULT WINAPI WMReader_Pause(IWMReader *iface)
726 struct async_reader *This = impl_from_IWMReader(iface);
727 FIXME("(%p)\n", This);
728 return E_NOTIMPL;
731 static HRESULT WINAPI WMReader_Resume(IWMReader *iface)
733 struct async_reader *This = impl_from_IWMReader(iface);
734 FIXME("(%p)\n", This);
735 return E_NOTIMPL;
738 static const IWMReaderVtbl WMReaderVtbl = {
739 WMReader_QueryInterface,
740 WMReader_AddRef,
741 WMReader_Release,
742 WMReader_Open,
743 WMReader_Close,
744 WMReader_GetOutputCount,
745 WMReader_GetOutputProps,
746 WMReader_SetOutputProps,
747 WMReader_GetOutputFormatCount,
748 WMReader_GetOutputFormat,
749 WMReader_Start,
750 WMReader_Stop,
751 WMReader_Pause,
752 WMReader_Resume
755 static struct async_reader *impl_from_IWMReaderAdvanced6(IWMReaderAdvanced6 *iface)
757 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderAdvanced6_iface);
760 static HRESULT WINAPI WMReaderAdvanced_QueryInterface(IWMReaderAdvanced6 *iface, REFIID iid, void **out)
762 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
763 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
766 static ULONG WINAPI WMReaderAdvanced_AddRef(IWMReaderAdvanced6 *iface)
768 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
769 return IWMReader_AddRef(&reader->IWMReader_iface);
772 static ULONG WINAPI WMReaderAdvanced_Release(IWMReaderAdvanced6 *iface)
774 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
775 return IWMReader_Release(&reader->IWMReader_iface);
778 static HRESULT WINAPI WMReaderAdvanced_SetUserProvidedClock(IWMReaderAdvanced6 *iface, BOOL user_clock)
780 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
782 TRACE("reader %p, user_clock %d.\n", reader, user_clock);
784 EnterCriticalSection(&reader->callback_cs);
785 reader->user_clock = !!user_clock;
786 LeaveCriticalSection(&reader->callback_cs);
787 WakeConditionVariable(&reader->callback_cv);
788 return S_OK;
791 static HRESULT WINAPI WMReaderAdvanced_GetUserProvidedClock(IWMReaderAdvanced6 *iface, BOOL *user_clock)
793 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
794 FIXME("(%p)->(%p)\n", This, user_clock);
795 return E_NOTIMPL;
798 static HRESULT WINAPI WMReaderAdvanced_DeliverTime(IWMReaderAdvanced6 *iface, QWORD time)
800 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
802 TRACE("reader %p, time %s.\n", reader, debugstr_time(time));
804 EnterCriticalSection(&reader->callback_cs);
806 if (!reader->user_clock)
808 LeaveCriticalSection(&reader->callback_cs);
809 WARN("Not using a user-provided clock; returning E_UNEXPECTED.\n");
810 return E_UNEXPECTED;
813 reader->user_time = time;
815 LeaveCriticalSection(&reader->callback_cs);
816 WakeConditionVariable(&reader->callback_cv);
817 return S_OK;
820 static HRESULT WINAPI WMReaderAdvanced_SetManualStreamSelection(IWMReaderAdvanced6 *iface, BOOL selection)
822 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
823 FIXME("(%p)->(%x)\n", This, selection);
824 return E_NOTIMPL;
827 static HRESULT WINAPI WMReaderAdvanced_GetManualStreamSelection(IWMReaderAdvanced6 *iface, BOOL *selection)
829 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
830 FIXME("(%p)->(%p)\n", This, selection);
831 return E_NOTIMPL;
834 static HRESULT WINAPI WMReaderAdvanced_SetStreamsSelected(IWMReaderAdvanced6 *iface,
835 WORD count, WORD *stream_numbers, WMT_STREAM_SELECTION *selections)
837 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
839 TRACE("reader %p, count %u, stream_numbers %p, selections %p.\n",
840 reader, count, stream_numbers, selections);
842 return IWMSyncReader2_SetStreamsSelected(reader->reader, count, stream_numbers, selections);
845 static HRESULT WINAPI WMReaderAdvanced_GetStreamSelected(IWMReaderAdvanced6 *iface,
846 WORD stream_number, WMT_STREAM_SELECTION *selection)
848 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
850 TRACE("reader %p, stream_number %u, selection %p.\n", reader, stream_number, selection);
852 return IWMSyncReader2_GetStreamSelected(reader->reader, stream_number, selection);
855 static HRESULT WINAPI WMReaderAdvanced_SetReceiveSelectionCallbacks(IWMReaderAdvanced6 *iface, BOOL get_callbacks)
857 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
858 FIXME("(%p)->(%x)\n", This, get_callbacks);
859 return E_NOTIMPL;
862 static HRESULT WINAPI WMReaderAdvanced_GetReceiveSelectionCallbacks(IWMReaderAdvanced6 *iface, BOOL *get_callbacks)
864 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
865 FIXME("(%p)->(%p)\n", This, get_callbacks);
866 return E_NOTIMPL;
869 static HRESULT WINAPI WMReaderAdvanced_SetReceiveStreamSamples(IWMReaderAdvanced6 *iface,
870 WORD stream_number, BOOL compressed)
872 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
874 TRACE("reader %p, stream_number %u, compressed %d.\n", reader, stream_number, compressed);
876 return IWMSyncReader2_SetReadStreamSamples(reader->reader, stream_number, compressed);
879 static HRESULT WINAPI WMReaderAdvanced_GetReceiveStreamSamples(IWMReaderAdvanced6 *iface, WORD stream_num,
880 BOOL *receive_stream_samples)
882 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
883 FIXME("(%p)->(%d %p)\n", This, stream_num, receive_stream_samples);
884 return E_NOTIMPL;
887 static HRESULT WINAPI WMReaderAdvanced_SetAllocateForOutput(IWMReaderAdvanced6 *iface, DWORD output, BOOL allocate)
889 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
891 TRACE("reader %p, output %lu, allocate %d.\n", reader, output, allocate);
893 return IWMSyncReader2_SetAllocateForOutput(reader->reader, output, allocate ? reader->allocator : NULL);
896 static HRESULT WINAPI WMReaderAdvanced_GetAllocateForOutput(IWMReaderAdvanced6 *iface, DWORD output, BOOL *allocate)
898 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
899 IWMReaderAllocatorEx *allocator;
900 HRESULT hr;
902 TRACE("reader %p, output %lu, allocate %p.\n", reader, output, allocate);
904 if (FAILED(hr = IWMSyncReader2_GetAllocateForOutput(reader->reader, output, &allocator)))
905 return hr;
907 if ((*allocate = allocator != NULL))
908 IWMReaderAllocatorEx_Release(allocator);
910 return hr;
913 static HRESULT WINAPI WMReaderAdvanced_SetAllocateForStream(IWMReaderAdvanced6 *iface, WORD stream_number, BOOL allocate)
915 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
917 TRACE("reader %p, stream_number %u, allocate %d.\n", reader, stream_number, allocate);
919 return IWMSyncReader2_SetAllocateForStream(reader->reader, stream_number, allocate ? reader->allocator : NULL);
922 static HRESULT WINAPI WMReaderAdvanced_GetAllocateForStream(IWMReaderAdvanced6 *iface, WORD stream_number, BOOL *allocate)
924 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
925 IWMReaderAllocatorEx *allocator;
926 HRESULT hr;
928 TRACE("reader %p, stream_number %u, allocate %p.\n", reader, stream_number, allocate);
930 if (FAILED(hr = IWMSyncReader2_GetAllocateForStream(reader->reader, stream_number, &allocator)))
931 return hr;
933 if ((*allocate = allocator != NULL))
934 IWMReaderAllocatorEx_Release(allocator);
936 return hr;
939 static HRESULT WINAPI WMReaderAdvanced_GetStatistics(IWMReaderAdvanced6 *iface, WM_READER_STATISTICS *statistics)
941 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
942 FIXME("(%p)->(%p)\n", This, statistics);
943 return E_NOTIMPL;
946 static HRESULT WINAPI WMReaderAdvanced_SetClientInfo(IWMReaderAdvanced6 *iface, WM_READER_CLIENTINFO *client_info)
948 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
949 FIXME("(%p)->(%p)\n", This, client_info);
950 return E_NOTIMPL;
953 static HRESULT WINAPI WMReaderAdvanced_GetMaxOutputSampleSize(IWMReaderAdvanced6 *iface, DWORD output, DWORD *max)
955 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
956 FIXME("(%p)->(%lu %p)\n", This, output, max);
957 return E_NOTIMPL;
960 static HRESULT WINAPI WMReaderAdvanced_GetMaxStreamSampleSize(IWMReaderAdvanced6 *iface,
961 WORD stream_number, DWORD *size)
963 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
965 TRACE("reader %p, stream_number %u, size %p.\n", reader, stream_number, size);
967 return IWMSyncReader2_GetMaxStreamSampleSize(reader->reader, stream_number, size);
970 static HRESULT WINAPI WMReaderAdvanced_NotifyLateDelivery(IWMReaderAdvanced6 *iface, QWORD lateness)
972 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
973 FIXME("(%p)->(%s)\n", This, wine_dbgstr_longlong(lateness));
974 return E_NOTIMPL;
977 static HRESULT WINAPI WMReaderAdvanced2_SetPlayMode(IWMReaderAdvanced6 *iface, WMT_PLAY_MODE mode)
979 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
980 FIXME("(%p)->(%d)\n", This, mode);
981 return E_NOTIMPL;
984 static HRESULT WINAPI WMReaderAdvanced2_GetPlayMode(IWMReaderAdvanced6 *iface, WMT_PLAY_MODE *mode)
986 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
987 FIXME("(%p)->(%p)\n", This, mode);
988 return E_NOTIMPL;
991 static HRESULT WINAPI WMReaderAdvanced2_GetBufferProgress(IWMReaderAdvanced6 *iface, DWORD *percent, QWORD *buffering)
993 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
994 FIXME("(%p)->(%p %p)\n", This, percent, buffering);
995 return E_NOTIMPL;
998 static HRESULT WINAPI WMReaderAdvanced2_GetDownloadProgress(IWMReaderAdvanced6 *iface, DWORD *percent,
999 QWORD *bytes_downloaded, QWORD *download)
1001 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1002 FIXME("(%p)->(%p %p %p)\n", This, percent, bytes_downloaded, download);
1003 return E_NOTIMPL;
1006 static HRESULT WINAPI WMReaderAdvanced2_GetSaveAsProgress(IWMReaderAdvanced6 *iface, DWORD *percent)
1008 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1009 FIXME("(%p)->(%p)\n", This, percent);
1010 return E_NOTIMPL;
1013 static HRESULT WINAPI WMReaderAdvanced2_SaveFileAs(IWMReaderAdvanced6 *iface, const WCHAR *filename)
1015 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1016 FIXME("(%p)->(%s)\n", This, debugstr_w(filename));
1017 return E_NOTIMPL;
1020 static HRESULT WINAPI WMReaderAdvanced2_GetProtocolName(IWMReaderAdvanced6 *iface, WCHAR *protocol, DWORD *protocol_len)
1022 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1023 FIXME("(%p)->(%p %p)\n", This, protocol, protocol_len);
1024 return E_NOTIMPL;
1027 static HRESULT WINAPI WMReaderAdvanced2_StartAtMarker(IWMReaderAdvanced6 *iface, WORD marker_index,
1028 QWORD duration, float rate, void *context)
1030 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1031 FIXME("(%p)->(%d %s %f %p)\n", This, marker_index, wine_dbgstr_longlong(duration), rate, context);
1032 return E_NOTIMPL;
1035 static HRESULT WINAPI WMReaderAdvanced2_GetOutputSetting(IWMReaderAdvanced6 *iface, DWORD output_num,
1036 const WCHAR *name, WMT_ATTR_DATATYPE *type, BYTE *value, WORD *length)
1038 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1039 FIXME("(%p)->(%lu %s %p %p %p)\n", This, output_num, debugstr_w(name), type, value, length);
1040 return E_NOTIMPL;
1043 static HRESULT WINAPI WMReaderAdvanced2_SetOutputSetting(IWMReaderAdvanced6 *iface, DWORD output_num,
1044 const WCHAR *name, WMT_ATTR_DATATYPE type, const BYTE *value, WORD length)
1046 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1047 FIXME("(%p)->(%lu %s %#x %p %u)\n", This, output_num, debugstr_w(name), type, value, length);
1048 return E_NOTIMPL;
1051 static HRESULT WINAPI WMReaderAdvanced2_Preroll(IWMReaderAdvanced6 *iface, QWORD start, QWORD duration, float rate)
1053 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1054 FIXME("(%p)->(%s %s %f)\n", This, wine_dbgstr_longlong(start), wine_dbgstr_longlong(duration), rate);
1055 return E_NOTIMPL;
1058 static HRESULT WINAPI WMReaderAdvanced2_SetLogClientID(IWMReaderAdvanced6 *iface, BOOL log_client_id)
1060 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1061 FIXME("(%p)->(%x)\n", This, log_client_id);
1062 return E_NOTIMPL;
1065 static HRESULT WINAPI WMReaderAdvanced2_GetLogClientID(IWMReaderAdvanced6 *iface, BOOL *log_client_id)
1067 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1068 FIXME("(%p)->(%p)\n", This, log_client_id);
1069 return E_NOTIMPL;
1072 static HRESULT WINAPI WMReaderAdvanced2_StopBuffering(IWMReaderAdvanced6 *iface)
1074 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1075 FIXME("(%p)\n", This);
1076 return E_NOTIMPL;
1079 static HRESULT WINAPI WMReaderAdvanced2_OpenStream(IWMReaderAdvanced6 *iface,
1080 IStream *stream, IWMReaderCallback *callback, void *context)
1082 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
1083 HRESULT hr;
1085 TRACE("reader %p, stream %p, callback %p, context %p.\n", reader, stream, callback, context);
1087 EnterCriticalSection(&reader->cs);
1089 if (SUCCEEDED(hr = IWMSyncReader2_OpenStream(reader->reader, stream))
1090 && FAILED(hr = async_reader_open(reader, callback, context)))
1091 IWMSyncReader2_Close(reader->reader);
1093 LeaveCriticalSection(&reader->cs);
1094 return hr;
1097 static HRESULT WINAPI WMReaderAdvanced3_StopNetStreaming(IWMReaderAdvanced6 *iface)
1099 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1100 FIXME("(%p)\n", This);
1101 return E_NOTIMPL;
1104 static HRESULT WINAPI WMReaderAdvanced3_StartAtPosition(IWMReaderAdvanced6 *iface, WORD stream_num,
1105 void *offset_start, void *duration, WMT_OFFSET_FORMAT format, float rate, void *context)
1107 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1108 FIXME("(%p)->(%d %p %p %d %f %p)\n", This, stream_num, offset_start, duration, format, rate, context);
1109 return E_NOTIMPL;
1112 static HRESULT WINAPI WMReaderAdvanced4_GetLanguageCount(IWMReaderAdvanced6 *iface, DWORD output_num, WORD *language_count)
1114 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1115 FIXME("(%p)->(%lu %p)\n", This, output_num, language_count);
1116 return E_NOTIMPL;
1119 static HRESULT WINAPI WMReaderAdvanced4_GetLanguage(IWMReaderAdvanced6 *iface, DWORD output_num,
1120 WORD language, WCHAR *language_string, WORD *language_string_len)
1122 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
1124 FIXME("reader %p, output %lu, language %#x, language_string %p, language_string_len %p, stub!\n",
1125 reader, output_num, language, language_string, language_string_len);
1127 return E_NOTIMPL;
1130 static HRESULT WINAPI WMReaderAdvanced4_GetMaxSpeedFactor(IWMReaderAdvanced6 *iface, double *factor)
1132 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1133 FIXME("(%p)->(%p)\n", This, factor);
1134 return E_NOTIMPL;
1137 static HRESULT WINAPI WMReaderAdvanced4_IsUsingFastCache(IWMReaderAdvanced6 *iface, BOOL *using_fast_cache)
1139 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1140 FIXME("(%p)->(%p)\n", This, using_fast_cache);
1141 return E_NOTIMPL;
1144 static HRESULT WINAPI WMReaderAdvanced4_AddLogParam(IWMReaderAdvanced6 *iface, const WCHAR *namespace,
1145 const WCHAR *name, const WCHAR *value)
1147 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1148 FIXME("(%p)->(%s %s %s)\n", This, debugstr_w(namespace), debugstr_w(name), debugstr_w(value));
1149 return E_NOTIMPL;
1152 static HRESULT WINAPI WMReaderAdvanced4_SendLogParams(IWMReaderAdvanced6 *iface)
1154 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1155 FIXME("(%p)\n", This);
1156 return E_NOTIMPL;
1159 static HRESULT WINAPI WMReaderAdvanced4_CanSaveFileAs(IWMReaderAdvanced6 *iface, BOOL *can_save)
1161 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1162 FIXME("(%p)->(%p)\n", This, can_save);
1163 return E_NOTIMPL;
1166 static HRESULT WINAPI WMReaderAdvanced4_CancelSaveFileAs(IWMReaderAdvanced6 *iface)
1168 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1169 FIXME("(%p)\n", This);
1170 return E_NOTIMPL;
1173 static HRESULT WINAPI WMReaderAdvanced4_GetURL(IWMReaderAdvanced6 *iface, WCHAR *url, DWORD *url_len)
1175 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1176 FIXME("(%p)->(%p %p)\n", This, url, url_len);
1177 return E_NOTIMPL;
1180 static HRESULT WINAPI WMReaderAdvanced5_SetPlayerHook(IWMReaderAdvanced6 *iface, DWORD output_num, IWMPlayerHook *hook)
1182 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
1184 FIXME("reader %p, output %lu, hook %p, stub!\n", reader, output_num, hook);
1186 return E_NOTIMPL;
1189 static HRESULT WINAPI WMReaderAdvanced6_SetProtectStreamSamples(IWMReaderAdvanced6 *iface, BYTE *cert,
1190 DWORD cert_size, DWORD cert_type, DWORD flags, BYTE *initialization_vector, DWORD *initialization_vector_size)
1192 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
1194 FIXME("reader %p, cert %p, cert_size %lu, cert_type %#lx, flags %#lx, vector %p, vector_size %p, stub!\n",
1195 reader, cert, cert_size, cert_type, flags, initialization_vector, initialization_vector_size);
1197 return E_NOTIMPL;
1200 static const IWMReaderAdvanced6Vtbl WMReaderAdvanced6Vtbl = {
1201 WMReaderAdvanced_QueryInterface,
1202 WMReaderAdvanced_AddRef,
1203 WMReaderAdvanced_Release,
1204 WMReaderAdvanced_SetUserProvidedClock,
1205 WMReaderAdvanced_GetUserProvidedClock,
1206 WMReaderAdvanced_DeliverTime,
1207 WMReaderAdvanced_SetManualStreamSelection,
1208 WMReaderAdvanced_GetManualStreamSelection,
1209 WMReaderAdvanced_SetStreamsSelected,
1210 WMReaderAdvanced_GetStreamSelected,
1211 WMReaderAdvanced_SetReceiveSelectionCallbacks,
1212 WMReaderAdvanced_GetReceiveSelectionCallbacks,
1213 WMReaderAdvanced_SetReceiveStreamSamples,
1214 WMReaderAdvanced_GetReceiveStreamSamples,
1215 WMReaderAdvanced_SetAllocateForOutput,
1216 WMReaderAdvanced_GetAllocateForOutput,
1217 WMReaderAdvanced_SetAllocateForStream,
1218 WMReaderAdvanced_GetAllocateForStream,
1219 WMReaderAdvanced_GetStatistics,
1220 WMReaderAdvanced_SetClientInfo,
1221 WMReaderAdvanced_GetMaxOutputSampleSize,
1222 WMReaderAdvanced_GetMaxStreamSampleSize,
1223 WMReaderAdvanced_NotifyLateDelivery,
1224 WMReaderAdvanced2_SetPlayMode,
1225 WMReaderAdvanced2_GetPlayMode,
1226 WMReaderAdvanced2_GetBufferProgress,
1227 WMReaderAdvanced2_GetDownloadProgress,
1228 WMReaderAdvanced2_GetSaveAsProgress,
1229 WMReaderAdvanced2_SaveFileAs,
1230 WMReaderAdvanced2_GetProtocolName,
1231 WMReaderAdvanced2_StartAtMarker,
1232 WMReaderAdvanced2_GetOutputSetting,
1233 WMReaderAdvanced2_SetOutputSetting,
1234 WMReaderAdvanced2_Preroll,
1235 WMReaderAdvanced2_SetLogClientID,
1236 WMReaderAdvanced2_GetLogClientID,
1237 WMReaderAdvanced2_StopBuffering,
1238 WMReaderAdvanced2_OpenStream,
1239 WMReaderAdvanced3_StopNetStreaming,
1240 WMReaderAdvanced3_StartAtPosition,
1241 WMReaderAdvanced4_GetLanguageCount,
1242 WMReaderAdvanced4_GetLanguage,
1243 WMReaderAdvanced4_GetMaxSpeedFactor,
1244 WMReaderAdvanced4_IsUsingFastCache,
1245 WMReaderAdvanced4_AddLogParam,
1246 WMReaderAdvanced4_SendLogParams,
1247 WMReaderAdvanced4_CanSaveFileAs,
1248 WMReaderAdvanced4_CancelSaveFileAs,
1249 WMReaderAdvanced4_GetURL,
1250 WMReaderAdvanced5_SetPlayerHook,
1251 WMReaderAdvanced6_SetProtectStreamSamples
1254 static struct async_reader *impl_from_IWMReaderAccelerator(IWMReaderAccelerator *iface)
1256 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderAccelerator_iface);
1259 static HRESULT WINAPI reader_accl_QueryInterface(IWMReaderAccelerator *iface, REFIID iid, void **out)
1261 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
1262 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
1265 static ULONG WINAPI reader_accl_AddRef(IWMReaderAccelerator *iface)
1267 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
1268 return IWMReader_AddRef(&reader->IWMReader_iface);
1271 static ULONG WINAPI reader_accl_Release(IWMReaderAccelerator *iface)
1273 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
1274 return IWMReader_Release(&reader->IWMReader_iface);
1277 static HRESULT WINAPI reader_accl_GetCodecInterface(IWMReaderAccelerator *iface, DWORD output, REFIID riid, void **codec)
1279 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
1281 FIXME("reader %p, output %lu, iid %s, codec %p, stub!\n", reader, output, debugstr_guid(riid), codec);
1283 return E_NOTIMPL;
1286 static HRESULT WINAPI reader_accl_Notify(IWMReaderAccelerator *iface, DWORD output, WM_MEDIA_TYPE *subtype)
1288 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
1290 FIXME("reader %p, output %lu, subtype %p, stub!\n", reader, output, subtype);
1292 return E_NOTIMPL;
1295 static const IWMReaderAcceleratorVtbl WMReaderAcceleratorVtbl = {
1296 reader_accl_QueryInterface,
1297 reader_accl_AddRef,
1298 reader_accl_Release,
1299 reader_accl_GetCodecInterface,
1300 reader_accl_Notify
1303 static struct async_reader *impl_from_IWMReaderNetworkConfig2(IWMReaderNetworkConfig2 *iface)
1305 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderNetworkConfig2_iface);
1308 static HRESULT WINAPI networkconfig_QueryInterface(IWMReaderNetworkConfig2 *iface, REFIID iid, void **out)
1310 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1311 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
1314 static ULONG WINAPI networkconfig_AddRef(IWMReaderNetworkConfig2 *iface)
1316 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1317 return IWMReader_AddRef(&reader->IWMReader_iface);
1320 static ULONG WINAPI networkconfig_Release(IWMReaderNetworkConfig2 *iface)
1322 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1323 return IWMReader_Release(&reader->IWMReader_iface);
1326 static HRESULT WINAPI networkconfig_GetBufferingTime(IWMReaderNetworkConfig2 *iface, QWORD *buffering_time)
1328 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1329 FIXME("%p, %p\n", This, buffering_time);
1330 return E_NOTIMPL;
1333 static HRESULT WINAPI networkconfig_SetBufferingTime(IWMReaderNetworkConfig2 *iface, QWORD buffering_time)
1335 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1336 FIXME("%p, %s\n", This, wine_dbgstr_longlong(buffering_time));
1337 return E_NOTIMPL;
1340 static HRESULT WINAPI networkconfig_GetUDPPortRanges(IWMReaderNetworkConfig2 *iface, WM_PORT_NUMBER_RANGE *array,
1341 DWORD *ranges)
1343 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1344 FIXME("%p, %p, %p\n", This, array, ranges);
1345 return E_NOTIMPL;
1348 static HRESULT WINAPI networkconfig_SetUDPPortRanges(IWMReaderNetworkConfig2 *iface,
1349 WM_PORT_NUMBER_RANGE *ranges, DWORD count)
1351 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1353 FIXME("reader %p, ranges %p, count %lu.\n", reader, ranges, count);
1355 return E_NOTIMPL;
1358 static HRESULT WINAPI networkconfig_GetProxySettings(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1359 WMT_PROXY_SETTINGS *proxy)
1361 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1362 FIXME("%p, %s, %p\n", This, debugstr_w(protocol), proxy);
1363 return E_NOTIMPL;
1366 static HRESULT WINAPI networkconfig_SetProxySettings(IWMReaderNetworkConfig2 *iface, LPCWSTR protocol,
1367 WMT_PROXY_SETTINGS proxy)
1369 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1370 FIXME("%p, %s, %d\n", This, debugstr_w(protocol), proxy);
1371 return E_NOTIMPL;
1374 static HRESULT WINAPI networkconfig_GetProxyHostName(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1375 WCHAR *hostname, DWORD *size)
1377 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1378 FIXME("%p, %s, %p, %p\n", This, debugstr_w(protocol), hostname, size);
1379 return E_NOTIMPL;
1382 static HRESULT WINAPI networkconfig_SetProxyHostName(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1383 const WCHAR *hostname)
1385 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1386 FIXME("%p, %s, %s\n", This, debugstr_w(protocol), debugstr_w(hostname));
1387 return E_NOTIMPL;
1390 static HRESULT WINAPI networkconfig_GetProxyPort(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1391 DWORD *port)
1393 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1394 FIXME("%p, %s, %p\n", This, debugstr_w(protocol), port);
1395 return E_NOTIMPL;
1398 static HRESULT WINAPI networkconfig_SetProxyPort(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1399 DWORD port)
1401 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1403 FIXME("reader %p, protocol %s, port %lu, stub!\n", reader, debugstr_w(protocol), port);
1405 return E_NOTIMPL;
1408 static HRESULT WINAPI networkconfig_GetProxyExceptionList(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1409 WCHAR *exceptions, DWORD *count)
1411 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1412 FIXME("%p, %s, %p, %p\n", This, debugstr_w(protocol), exceptions, count);
1413 return E_NOTIMPL;
1416 static HRESULT WINAPI networkconfig_SetProxyExceptionList(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1417 const WCHAR *exceptions)
1419 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1420 FIXME("%p, %s, %s\n", This, debugstr_w(protocol), debugstr_w(exceptions));
1421 return E_NOTIMPL;
1424 static HRESULT WINAPI networkconfig_GetProxyBypassForLocal(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1425 BOOL *bypass)
1427 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1428 FIXME("%p, %s, %p\n", This, debugstr_w(protocol), bypass);
1429 return E_NOTIMPL;
1432 static HRESULT WINAPI networkconfig_SetProxyBypassForLocal(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1433 BOOL bypass)
1435 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1436 FIXME("%p, %s, %d\n", This, debugstr_w(protocol), bypass);
1437 return E_NOTIMPL;
1440 static HRESULT WINAPI networkconfig_GetForceRerunAutoProxyDetection(IWMReaderNetworkConfig2 *iface,
1441 BOOL *detection)
1443 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1444 FIXME("%p, %p\n", This, detection);
1445 return E_NOTIMPL;
1448 static HRESULT WINAPI networkconfig_SetForceRerunAutoProxyDetection(IWMReaderNetworkConfig2 *iface,
1449 BOOL detection)
1451 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1452 FIXME("%p, %d\n", This, detection);
1453 return E_NOTIMPL;
1456 static HRESULT WINAPI networkconfig_GetEnableMulticast(IWMReaderNetworkConfig2 *iface, BOOL *multicast)
1458 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1459 FIXME("%p, %p\n", This, multicast);
1460 return E_NOTIMPL;
1463 static HRESULT WINAPI networkconfig_SetEnableMulticast(IWMReaderNetworkConfig2 *iface, BOOL multicast)
1465 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1466 FIXME("%p, %d\n", This, multicast);
1467 return E_NOTIMPL;
1470 static HRESULT WINAPI networkconfig_GetEnableHTTP(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1472 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1473 FIXME("%p, %p\n", This, enable);
1474 return E_NOTIMPL;
1477 static HRESULT WINAPI networkconfig_SetEnableHTTP(IWMReaderNetworkConfig2 *iface, BOOL enable)
1479 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1480 FIXME("%p, %d\n", This, enable);
1481 return E_NOTIMPL;
1484 static HRESULT WINAPI networkconfig_GetEnableUDP(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1486 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1487 FIXME("%p, %p\n", This, enable);
1488 return E_NOTIMPL;
1491 static HRESULT WINAPI networkconfig_SetEnableUDP(IWMReaderNetworkConfig2 *iface, BOOL enable)
1493 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1494 FIXME("%p, %d\n", This, enable);
1495 return E_NOTIMPL;
1498 static HRESULT WINAPI networkconfig_GetEnableTCP(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1500 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1501 FIXME("%p, %p\n", This, enable);
1502 return E_NOTIMPL;
1505 static HRESULT WINAPI networkconfig_SetEnableTCP(IWMReaderNetworkConfig2 *iface, BOOL enable)
1507 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1508 FIXME("%p, %d\n", This, enable);
1509 return E_NOTIMPL;
1512 static HRESULT WINAPI networkconfig_ResetProtocolRollover(IWMReaderNetworkConfig2 *iface)
1514 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1515 FIXME("%p\n", This);
1516 return E_NOTIMPL;
1519 static HRESULT WINAPI networkconfig_GetConnectionBandwidth(IWMReaderNetworkConfig2 *iface, DWORD *bandwidth)
1521 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1522 FIXME("%p, %p\n", This, bandwidth);
1523 return E_NOTIMPL;
1526 static HRESULT WINAPI networkconfig_SetConnectionBandwidth(IWMReaderNetworkConfig2 *iface, DWORD bandwidth)
1528 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1530 FIXME("reader %p, bandwidth %lu, stub!\n", reader, bandwidth);
1532 return E_NOTIMPL;
1535 static HRESULT WINAPI networkconfig_GetNumProtocolsSupported(IWMReaderNetworkConfig2 *iface, DWORD *protocols)
1537 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1538 FIXME("%p, %p\n", This, protocols);
1539 return E_NOTIMPL;
1542 static HRESULT WINAPI networkconfig_GetSupportedProtocolName(IWMReaderNetworkConfig2 *iface, DWORD protocol_num,
1543 WCHAR *protocol, DWORD *size)
1545 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1547 FIXME("reader %p, index %lu, protocol %p, size %p, stub!\n", reader, protocol_num, protocol, size);
1549 return E_NOTIMPL;
1552 static HRESULT WINAPI networkconfig_AddLoggingUrl(IWMReaderNetworkConfig2 *iface, const WCHAR *url)
1554 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1555 FIXME("%p, %s\n", This, debugstr_w(url));
1556 return E_NOTIMPL;
1559 static HRESULT WINAPI networkconfig_GetLoggingUrl(IWMReaderNetworkConfig2 *iface, DWORD index, WCHAR *url,
1560 DWORD *size)
1562 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1564 FIXME("reader %p, index %lu, url %p, size %p, stub!\n", reader, index, url, size);
1566 return E_NOTIMPL;
1569 static HRESULT WINAPI networkconfig_GetLoggingUrlCount(IWMReaderNetworkConfig2 *iface, DWORD *count)
1571 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1572 FIXME("%p, %p\n", This, count);
1573 return E_NOTIMPL;
1576 static HRESULT WINAPI networkconfig_ResetLoggingUrlList(IWMReaderNetworkConfig2 *iface)
1578 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1579 FIXME("%p\n", This);
1580 return E_NOTIMPL;
1583 static HRESULT WINAPI networkconfig_GetEnableContentCaching(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1585 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1586 FIXME("%p, %p\n", This, enable);
1587 return E_NOTIMPL;
1590 static HRESULT WINAPI networkconfig_SetEnableContentCaching(IWMReaderNetworkConfig2 *iface, BOOL enable)
1592 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1593 FIXME("%p, %d\n", This, enable);
1594 return E_NOTIMPL;
1597 static HRESULT WINAPI networkconfig_GetEnableFastCache(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1599 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1600 FIXME("%p, %p\n", This, enable);
1601 return E_NOTIMPL;
1604 static HRESULT WINAPI networkconfig_SetEnableFastCache(IWMReaderNetworkConfig2 *iface, BOOL enable)
1606 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1607 FIXME("%p, %d\n", This, enable);
1608 return E_NOTIMPL;
1611 static HRESULT WINAPI networkconfig_GetAcceleratedStreamingDuration(IWMReaderNetworkConfig2 *iface,
1612 QWORD *duration)
1614 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1615 FIXME("%p, %p\n", This, duration);
1616 return E_NOTIMPL;
1619 static HRESULT WINAPI networkconfig_SetAcceleratedStreamingDuration(IWMReaderNetworkConfig2 *iface,
1620 QWORD duration)
1622 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1623 FIXME("%p, %s\n", This, wine_dbgstr_longlong(duration));
1624 return E_NOTIMPL;
1627 static HRESULT WINAPI networkconfig_GetAutoReconnectLimit(IWMReaderNetworkConfig2 *iface, DWORD *limit)
1629 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1630 FIXME("%p, %p\n", This, limit);
1631 return E_NOTIMPL;
1634 static HRESULT WINAPI networkconfig_SetAutoReconnectLimit(IWMReaderNetworkConfig2 *iface, DWORD limit)
1636 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1638 FIXME("reader %p, limit %lu, stub!\n", reader, limit);
1640 return E_NOTIMPL;
1643 static HRESULT WINAPI networkconfig_GetEnableResends(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1645 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1646 FIXME("%p, %p\n", This, enable);
1647 return E_NOTIMPL;
1650 static HRESULT WINAPI networkconfig_SetEnableResends(IWMReaderNetworkConfig2 *iface, BOOL enable)
1652 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1653 FIXME("%p, %u\n", This, enable);
1654 return E_NOTIMPL;
1657 static HRESULT WINAPI networkconfig_GetEnableThinning(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1659 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1660 FIXME("%p, %p\n", This, enable);
1661 return E_NOTIMPL;
1664 static HRESULT WINAPI networkconfig_SetEnableThinning(IWMReaderNetworkConfig2 *iface, BOOL enable)
1666 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1667 FIXME("%p, %u\n", This, enable);
1668 return E_NOTIMPL;
1671 static HRESULT WINAPI networkconfig_GetMaxNetPacketSize(IWMReaderNetworkConfig2 *iface, DWORD *packet_size)
1673 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1674 FIXME("%p, %p\n", This, packet_size);
1675 return E_NOTIMPL;
1678 static const IWMReaderNetworkConfig2Vtbl WMReaderNetworkConfig2Vtbl =
1680 networkconfig_QueryInterface,
1681 networkconfig_AddRef,
1682 networkconfig_Release,
1683 networkconfig_GetBufferingTime,
1684 networkconfig_SetBufferingTime,
1685 networkconfig_GetUDPPortRanges,
1686 networkconfig_SetUDPPortRanges,
1687 networkconfig_GetProxySettings,
1688 networkconfig_SetProxySettings,
1689 networkconfig_GetProxyHostName,
1690 networkconfig_SetProxyHostName,
1691 networkconfig_GetProxyPort,
1692 networkconfig_SetProxyPort,
1693 networkconfig_GetProxyExceptionList,
1694 networkconfig_SetProxyExceptionList,
1695 networkconfig_GetProxyBypassForLocal,
1696 networkconfig_SetProxyBypassForLocal,
1697 networkconfig_GetForceRerunAutoProxyDetection,
1698 networkconfig_SetForceRerunAutoProxyDetection,
1699 networkconfig_GetEnableMulticast,
1700 networkconfig_SetEnableMulticast,
1701 networkconfig_GetEnableHTTP,
1702 networkconfig_SetEnableHTTP,
1703 networkconfig_GetEnableUDP,
1704 networkconfig_SetEnableUDP,
1705 networkconfig_GetEnableTCP,
1706 networkconfig_SetEnableTCP,
1707 networkconfig_ResetProtocolRollover,
1708 networkconfig_GetConnectionBandwidth,
1709 networkconfig_SetConnectionBandwidth,
1710 networkconfig_GetNumProtocolsSupported,
1711 networkconfig_GetSupportedProtocolName,
1712 networkconfig_AddLoggingUrl,
1713 networkconfig_GetLoggingUrl,
1714 networkconfig_GetLoggingUrlCount,
1715 networkconfig_ResetLoggingUrlList,
1716 networkconfig_GetEnableContentCaching,
1717 networkconfig_SetEnableContentCaching,
1718 networkconfig_GetEnableFastCache,
1719 networkconfig_SetEnableFastCache,
1720 networkconfig_GetAcceleratedStreamingDuration,
1721 networkconfig_SetAcceleratedStreamingDuration,
1722 networkconfig_GetAutoReconnectLimit,
1723 networkconfig_SetAutoReconnectLimit,
1724 networkconfig_GetEnableResends,
1725 networkconfig_SetEnableResends,
1726 networkconfig_GetEnableThinning,
1727 networkconfig_SetEnableThinning,
1728 networkconfig_GetMaxNetPacketSize
1731 static struct async_reader *impl_from_IWMReaderStreamClock(IWMReaderStreamClock *iface)
1733 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderStreamClock_iface);
1736 static HRESULT WINAPI readclock_QueryInterface(IWMReaderStreamClock *iface, REFIID iid, void **out)
1738 struct async_reader *reader = impl_from_IWMReaderStreamClock(iface);
1739 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
1742 static ULONG WINAPI readclock_AddRef(IWMReaderStreamClock *iface)
1744 struct async_reader *reader = impl_from_IWMReaderStreamClock(iface);
1745 return IWMReader_AddRef(&reader->IWMReader_iface);
1748 static ULONG WINAPI readclock_Release(IWMReaderStreamClock *iface)
1750 struct async_reader *reader = impl_from_IWMReaderStreamClock(iface);
1751 return IWMReader_Release(&reader->IWMReader_iface);
1754 static HRESULT WINAPI readclock_GetTime(IWMReaderStreamClock *iface, QWORD *now)
1756 struct async_reader *This = impl_from_IWMReaderStreamClock(iface);
1757 FIXME("%p, %p\n", This, now);
1758 return E_NOTIMPL;
1761 static HRESULT WINAPI readclock_SetTimer(IWMReaderStreamClock *iface, QWORD when, void *param, DWORD *id)
1763 struct async_reader *This = impl_from_IWMReaderStreamClock(iface);
1764 FIXME("%p, %s, %p, %p\n", This, wine_dbgstr_longlong(when), param, id);
1765 return E_NOTIMPL;
1768 static HRESULT WINAPI readclock_KillTimer(IWMReaderStreamClock *iface, DWORD id)
1770 struct async_reader *reader = impl_from_IWMReaderStreamClock(iface);
1772 FIXME("reader %p, id %lu, stub!\n", reader, id);
1774 return E_NOTIMPL;
1777 static const IWMReaderStreamClockVtbl WMReaderStreamClockVtbl =
1779 readclock_QueryInterface,
1780 readclock_AddRef,
1781 readclock_Release,
1782 readclock_GetTime,
1783 readclock_SetTimer,
1784 readclock_KillTimer
1787 static struct async_reader *impl_from_IWMReaderTypeNegotiation(IWMReaderTypeNegotiation *iface)
1789 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderTypeNegotiation_iface);
1792 static HRESULT WINAPI negotiation_QueryInterface(IWMReaderTypeNegotiation *iface, REFIID iid, void **out)
1794 struct async_reader *reader = impl_from_IWMReaderTypeNegotiation(iface);
1795 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
1798 static ULONG WINAPI negotiation_AddRef(IWMReaderTypeNegotiation *iface)
1800 struct async_reader *reader = impl_from_IWMReaderTypeNegotiation(iface);
1801 return IWMReader_AddRef(&reader->IWMReader_iface);
1804 static ULONG WINAPI negotiation_Release(IWMReaderTypeNegotiation *iface)
1806 struct async_reader *reader = impl_from_IWMReaderTypeNegotiation(iface);
1807 return IWMReader_Release(&reader->IWMReader_iface);
1810 static HRESULT WINAPI negotiation_TryOutputProps(IWMReaderTypeNegotiation *iface, DWORD output, IWMOutputMediaProps *props)
1812 struct async_reader *reader = impl_from_IWMReaderTypeNegotiation(iface);
1814 FIXME("reader %p, output %lu, props %p, stub!\n", reader, output, props);
1816 return E_NOTIMPL;
1819 static const IWMReaderTypeNegotiationVtbl WMReaderTypeNegotiationVtbl =
1821 negotiation_QueryInterface,
1822 negotiation_AddRef,
1823 negotiation_Release,
1824 negotiation_TryOutputProps
1827 static struct async_reader *impl_from_IReferenceClock(IReferenceClock *iface)
1829 return CONTAINING_RECORD(iface, struct async_reader, IReferenceClock_iface);
1832 static HRESULT WINAPI refclock_QueryInterface(IReferenceClock *iface, REFIID iid, void **out)
1834 struct async_reader *reader = impl_from_IReferenceClock(iface);
1835 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
1838 static ULONG WINAPI refclock_AddRef(IReferenceClock *iface)
1840 struct async_reader *reader = impl_from_IReferenceClock(iface);
1841 return IWMReader_AddRef(&reader->IWMReader_iface);
1844 static ULONG WINAPI refclock_Release(IReferenceClock *iface)
1846 struct async_reader *reader = impl_from_IReferenceClock(iface);
1847 return IWMReader_Release(&reader->IWMReader_iface);
1850 static HRESULT WINAPI refclock_GetTime(IReferenceClock *iface, REFERENCE_TIME *time)
1852 struct async_reader *This = impl_from_IReferenceClock(iface);
1853 FIXME("%p, %p\n", This, time);
1854 return E_NOTIMPL;
1857 static HRESULT WINAPI refclock_AdviseTime(IReferenceClock *iface, REFERENCE_TIME basetime,
1858 REFERENCE_TIME streamtime, HEVENT event, DWORD_PTR *cookie)
1860 struct async_reader *reader = impl_from_IReferenceClock(iface);
1862 FIXME("reader %p, basetime %s, streamtime %s, event %#Ix, cookie %p, stub!\n",
1863 reader, debugstr_time(basetime), debugstr_time(streamtime), event, cookie);
1865 return E_NOTIMPL;
1868 static HRESULT WINAPI refclock_AdvisePeriodic(IReferenceClock *iface, REFERENCE_TIME starttime,
1869 REFERENCE_TIME period, HSEMAPHORE semaphore, DWORD_PTR *cookie)
1871 struct async_reader *reader = impl_from_IReferenceClock(iface);
1873 FIXME("reader %p, starttime %s, period %s, semaphore %#Ix, cookie %p, stub!\n",
1874 reader, debugstr_time(starttime), debugstr_time(period), semaphore, cookie);
1876 return E_NOTIMPL;
1879 static HRESULT WINAPI refclock_Unadvise(IReferenceClock *iface, DWORD_PTR cookie)
1881 struct async_reader *reader = impl_from_IReferenceClock(iface);
1883 FIXME("reader %p, cookie %Iu, stub!\n", reader, cookie);
1885 return E_NOTIMPL;
1888 static const IReferenceClockVtbl ReferenceClockVtbl =
1890 refclock_QueryInterface,
1891 refclock_AddRef,
1892 refclock_Release,
1893 refclock_GetTime,
1894 refclock_AdviseTime,
1895 refclock_AdvisePeriodic,
1896 refclock_Unadvise
1899 static HRESULT WINAPI async_reader_create(IWMReader **reader)
1901 struct async_reader *object;
1902 HRESULT hr;
1904 TRACE("reader %p.\n", reader);
1906 if (!(object = calloc(1, sizeof(*object))))
1907 return E_OUTOFMEMORY;
1909 object->IReferenceClock_iface.lpVtbl = &ReferenceClockVtbl;
1910 object->IWMReader_iface.lpVtbl = &WMReaderVtbl;
1911 object->IWMReaderAdvanced6_iface.lpVtbl = &WMReaderAdvanced6Vtbl;
1912 object->IWMReaderAccelerator_iface.lpVtbl = &WMReaderAcceleratorVtbl;
1913 object->IWMReaderNetworkConfig2_iface.lpVtbl = &WMReaderNetworkConfig2Vtbl;
1914 object->IWMReaderStreamClock_iface.lpVtbl = &WMReaderStreamClockVtbl;
1915 object->IWMReaderTypeNegotiation_iface.lpVtbl = &WMReaderTypeNegotiationVtbl;
1916 object->refcount = 1;
1918 if (FAILED(hr = winegstreamer_create_wm_sync_reader((IUnknown *)&object->IWMReader_iface,
1919 (void **)&object->reader_inner)))
1920 goto failed;
1922 if (FAILED(hr = IUnknown_QueryInterface(object->reader_inner, &IID_IWMSyncReader2,
1923 (void **)&object->reader)))
1924 goto failed;
1925 IWMReader_Release(&object->IWMReader_iface);
1927 InitializeCriticalSection(&object->cs);
1928 object->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": async_reader.cs");
1929 InitializeCriticalSection(&object->callback_cs);
1930 object->callback_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": async_reader.callback_cs");
1932 QueryPerformanceFrequency(&object->clock_frequency);
1933 list_init(&object->async_ops);
1935 TRACE("Created async reader %p.\n", object);
1936 *reader = &object->IWMReader_iface;
1937 return S_OK;
1939 failed:
1940 if (object->reader_inner)
1941 IUnknown_Release(object->reader_inner);
1942 free(object);
1943 return hr;
1946 HRESULT WINAPI WMCreateReader(IUnknown *reserved, DWORD rights, IWMReader **reader)
1948 TRACE("reserved %p, rights %#lx, reader %p.\n", reserved, rights, reader);
1950 return async_reader_create(reader);
1953 HRESULT WINAPI WMCreateReaderPriv(IWMReader **reader)
1955 TRACE("reader %p.\n", reader);
1957 return async_reader_create(reader);