win32u: Implement NtGdiIcmBrushInfo and use it instead of __wine_get_brush_bitmap_info.
[wine.git] / dlls / wmvcore / async_reader.c
blob47de592c95c7a39291e3c2ca64ab092ef804b364
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 "wmvcore_private.h"
31 #include "wmsdk.h"
33 #include "wine/debug.h"
34 #include "wine/list.h"
36 WINE_DEFAULT_DEBUG_CHANNEL(wmvcore);
38 union async_op_data
40 struct
42 QWORD start;
43 QWORD duration;
44 void *context;
45 } start;
48 struct async_op
50 enum async_op_type
52 ASYNC_OP_START,
53 ASYNC_OP_STOP,
54 ASYNC_OP_CLOSE,
55 } type;
56 union async_op_data u;
57 struct list entry;
60 struct sample
62 INSSBuffer *buffer;
63 QWORD pts, duration;
64 DWORD flags, output;
65 WORD stream;
68 struct async_reader
70 IWMReader IWMReader_iface;
71 IWMReaderAdvanced6 IWMReaderAdvanced6_iface;
72 IWMReaderAccelerator IWMReaderAccelerator_iface;
73 IWMReaderNetworkConfig2 IWMReaderNetworkConfig2_iface;
74 IWMReaderStreamClock IWMReaderStreamClock_iface;
75 IWMReaderTypeNegotiation IWMReaderTypeNegotiation_iface;
76 IReferenceClock IReferenceClock_iface;
77 IUnknown *reader_inner;
78 LONG refcount;
80 IWMSyncReader2 *reader;
82 CRITICAL_SECTION cs;
84 IWMReaderCallbackAdvanced *callback_advanced;
85 IWMReaderAllocatorEx *allocator;
86 IWMReaderCallback *callback;
87 void *context;
89 REFERENCE_TIME clock_start;
90 LARGE_INTEGER clock_frequency;
92 HANDLE callback_thread;
93 CRITICAL_SECTION callback_cs;
94 CONDITION_VARIABLE callback_cv;
96 bool running;
97 struct list async_ops;
99 bool user_clock;
100 QWORD user_time;
103 struct allocator
105 IWMReaderAllocatorEx IWMReaderAllocatorEx_iface;
106 LONG refcount;
108 IWMReaderCallbackAdvanced *callback;
111 static struct allocator *impl_from_IWMReaderAllocatorEx(IWMReaderAllocatorEx *iface)
113 return CONTAINING_RECORD(iface, struct allocator, IWMReaderAllocatorEx_iface);
116 static HRESULT WINAPI allocator_QueryInterface(IWMReaderAllocatorEx *iface, REFIID iid, void **out)
118 struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface);
120 TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
122 if (IsEqualIID(iid, &IID_IUnknown)
123 || IsEqualIID(iid, &IID_IWMReaderAllocatorEx))
124 *out = &allocator->IWMReaderAllocatorEx_iface;
125 else
127 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
128 return E_NOINTERFACE;
131 IUnknown_AddRef((IUnknown *)*out);
132 return S_OK;
135 static ULONG WINAPI allocator_AddRef(IWMReaderAllocatorEx *iface)
137 struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface);
138 ULONG refcount = InterlockedIncrement(&allocator->refcount);
139 TRACE("iface %p increasing refcount to %lu.\n", iface, refcount);
140 return refcount;
143 static ULONG WINAPI allocator_Release(IWMReaderAllocatorEx *iface)
145 struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface);
146 ULONG refcount = InterlockedDecrement(&allocator->refcount);
148 TRACE("iface %p decreasing refcount to %lu.\n", iface, refcount);
150 if (!refcount)
152 if (allocator->callback)
153 IWMReaderCallbackAdvanced_Release(allocator->callback);
154 free(allocator);
157 return refcount;
160 static HRESULT WINAPI allocator_AllocateForStreamEx(IWMReaderAllocatorEx *iface,
161 WORD stream_number, DWORD size, INSSBuffer **sample, DWORD flags,
162 QWORD pts, QWORD duration, void *context)
164 struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface);
166 TRACE("iface %p, stream_number %u, size %#lx, sample %p, flags %#lx, pts %I64d, duration %I64d, context %p.\n",
167 iface, stream_number, size, sample, flags, pts, duration, context);
169 if (allocator->callback)
170 return IWMReaderCallbackAdvanced_AllocateForStream(allocator->callback,
171 stream_number, size, sample, context);
173 return E_NOTIMPL;
176 static HRESULT WINAPI allocator_AllocateForOutputEx(IWMReaderAllocatorEx *iface,
177 DWORD output, DWORD size, INSSBuffer **sample, DWORD flags,
178 QWORD pts, QWORD duration, void *context)
180 struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface);
182 TRACE("iface %p, output %lu, size %#lx, sample %p, flags %#lx, pts %I64d, duration %I64d, context %p.\n",
183 iface, output, size, sample, flags, pts, duration, context);
185 if (allocator->callback)
186 return IWMReaderCallbackAdvanced_AllocateForOutput(allocator->callback,
187 output, size, sample, context);
189 return E_NOTIMPL;
192 static const IWMReaderAllocatorExVtbl allocator_vtbl =
194 allocator_QueryInterface,
195 allocator_AddRef,
196 allocator_Release,
197 allocator_AllocateForStreamEx,
198 allocator_AllocateForOutputEx,
201 static HRESULT allocator_create(IWMReaderCallback *callback, IWMReaderAllocatorEx **out)
203 struct allocator *allocator;
204 HRESULT hr;
206 if (!(allocator = calloc(1, sizeof(*allocator))))
207 return E_OUTOFMEMORY;
208 allocator->IWMReaderAllocatorEx_iface.lpVtbl = &allocator_vtbl;
209 allocator->refcount = 1;
211 if (FAILED(hr = IWMReaderCallback_QueryInterface(callback,
212 &IID_IWMReaderCallbackAdvanced, (void **)&allocator->callback)))
214 WARN("Failed to retrieve IWMReaderCallbackAdvanced interface, hr %#lx\n", hr);
215 allocator->callback = NULL;
218 *out = &allocator->IWMReaderAllocatorEx_iface;
219 return S_OK;
222 static REFERENCE_TIME get_current_time(const struct async_reader *reader)
224 LARGE_INTEGER time;
226 QueryPerformanceCounter(&time);
227 return (time.QuadPart * 1000) / reader->clock_frequency.QuadPart * 10000;
230 static DWORD async_reader_get_wait_timeout(struct async_reader *reader, QWORD pts)
232 REFERENCE_TIME current_time = reader->user_time;
233 DWORD timeout = INFINITE;
235 if (!reader->user_clock)
237 current_time = get_current_time(reader) - reader->clock_start;
238 timeout = (pts - current_time) / 10000;
241 return pts > current_time ? timeout : 0;
244 static bool async_reader_wait_pts(struct async_reader *reader, QWORD pts)
246 IWMReaderCallbackAdvanced *callback_advanced = reader->callback_advanced;
247 DWORD timeout;
249 TRACE("reader %p, pts %I64d.\n", reader, pts);
251 if (reader->user_clock && pts > reader->user_time && callback_advanced)
253 QWORD user_time = reader->user_time;
254 LeaveCriticalSection(&reader->callback_cs);
255 IWMReaderCallbackAdvanced_OnTime(callback_advanced, user_time, reader->context);
256 EnterCriticalSection(&reader->callback_cs);
259 while (reader->running && list_empty(&reader->async_ops))
261 if (!(timeout = async_reader_get_wait_timeout(reader, pts)))
262 return true;
263 SleepConditionVariableCS(&reader->callback_cv, &reader->callback_cs, timeout);
266 return false;
269 static void async_reader_deliver_sample(struct async_reader *reader, struct sample *sample)
271 IWMReaderCallbackAdvanced *callback_advanced = reader->callback_advanced;
272 IWMReaderCallback *callback = reader->callback;
273 BOOL read_compressed;
274 HRESULT hr;
276 TRACE("reader %p, output %lu, stream %u, pts %s, duration %s, flags %#lx, buffer %p.\n",
277 reader, sample->output, sample->stream, debugstr_time(sample->pts),
278 debugstr_time(sample->duration), sample->flags, sample->buffer);
280 if (FAILED(hr = IWMSyncReader2_GetReadStreamSamples(reader->reader, sample->stream,
281 &read_compressed)))
282 read_compressed = FALSE;
284 LeaveCriticalSection(&reader->callback_cs);
285 if (read_compressed)
286 hr = IWMReaderCallbackAdvanced_OnStreamSample(callback_advanced, sample->stream,
287 sample->pts, sample->duration, sample->flags, sample->buffer, reader->context);
288 else
289 hr = IWMReaderCallback_OnSample(callback, sample->output, sample->pts, sample->duration,
290 sample->flags, sample->buffer, reader->context);
291 EnterCriticalSection(&reader->callback_cs);
293 TRACE("Callback returned %#lx.\n", hr);
295 INSSBuffer_Release(sample->buffer);
298 static void callback_thread_run(struct async_reader *reader)
300 IWMReaderCallbackAdvanced *callback_advanced = reader->callback_advanced;
301 IWMReaderCallback *callback = reader->callback;
302 static const DWORD zero;
303 HRESULT hr = S_OK;
305 while (reader->running && list_empty(&reader->async_ops))
307 struct sample sample;
309 LeaveCriticalSection(&reader->callback_cs);
310 hr = IWMSyncReader2_GetNextSample(reader->reader, 0, &sample.buffer, &sample.pts,
311 &sample.duration, &sample.flags, &sample.output, &sample.stream);
312 EnterCriticalSection(&reader->callback_cs);
313 if (hr != S_OK)
314 break;
316 if (async_reader_wait_pts(reader, sample.pts))
317 async_reader_deliver_sample(reader, &sample);
318 else
319 INSSBuffer_Release(sample.buffer);
322 if (hr == NS_E_NO_MORE_SAMPLES)
324 BOOL user_clock = reader->user_clock;
325 QWORD user_time = reader->user_time;
327 LeaveCriticalSection(&reader->callback_cs);
329 IWMReaderCallback_OnStatus(callback, WMT_END_OF_STREAMING, S_OK,
330 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
331 IWMReaderCallback_OnStatus(callback, WMT_EOF, S_OK,
332 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
334 if (user_clock && callback_advanced)
336 /* We can only get here if user_time is greater than the PTS
337 * of all samples, in which case we cannot have sent this
338 * notification already. */
339 IWMReaderCallbackAdvanced_OnTime(callback_advanced,
340 user_time, reader->context);
343 EnterCriticalSection(&reader->callback_cs);
345 TRACE("Reached end of stream; exiting.\n");
347 else if (hr != S_OK)
349 ERR("Failed to get sample, hr %#lx.\n", hr);
353 static DWORD WINAPI async_reader_callback_thread(void *arg)
355 struct async_reader *reader = arg;
356 static const DWORD zero;
357 struct list *entry;
358 HRESULT hr = S_OK;
360 IWMReaderCallback_OnStatus(reader->callback, WMT_OPENED, S_OK,
361 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
363 EnterCriticalSection(&reader->callback_cs);
365 while (reader->running)
367 if ((entry = list_head(&reader->async_ops)))
369 struct async_op *op = LIST_ENTRY(entry, struct async_op, entry);
370 list_remove(&op->entry);
372 hr = list_empty(&reader->async_ops) ? S_OK : E_ABORT;
373 switch (op->type)
375 case ASYNC_OP_START:
377 reader->context = op->u.start.context;
378 if (SUCCEEDED(hr))
379 hr = IWMSyncReader2_SetRange(reader->reader, op->u.start.start, op->u.start.duration);
380 if (SUCCEEDED(hr))
381 reader->clock_start = get_current_time(reader);
383 LeaveCriticalSection(&reader->callback_cs);
384 IWMReaderCallback_OnStatus(reader->callback, WMT_STARTED, hr,
385 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
386 EnterCriticalSection(&reader->callback_cs);
388 if (SUCCEEDED(hr))
389 callback_thread_run(reader);
390 break;
393 case ASYNC_OP_STOP:
394 LeaveCriticalSection(&reader->callback_cs);
395 IWMReaderCallback_OnStatus(reader->callback, WMT_STOPPED, hr,
396 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
397 EnterCriticalSection(&reader->callback_cs);
398 break;
400 case ASYNC_OP_CLOSE:
401 LeaveCriticalSection(&reader->callback_cs);
402 IWMReaderCallback_OnStatus(reader->callback, WMT_CLOSED, hr,
403 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
404 EnterCriticalSection(&reader->callback_cs);
406 if (SUCCEEDED(hr))
407 reader->running = false;
408 break;
411 free(op);
414 if (reader->running && list_empty(&reader->async_ops))
415 SleepConditionVariableCS(&reader->callback_cv, &reader->callback_cs, INFINITE);
418 LeaveCriticalSection(&reader->callback_cs);
420 TRACE("Reader is stopping; exiting.\n");
421 return 0;
424 static void async_reader_close(struct async_reader *reader)
426 struct async_op *op, *next;
428 if (reader->callback_thread)
430 WaitForSingleObject(reader->callback_thread, INFINITE);
431 CloseHandle(reader->callback_thread);
432 reader->callback_thread = NULL;
435 LIST_FOR_EACH_ENTRY_SAFE(op, next, &reader->async_ops, struct async_op, entry)
437 list_remove(&op->entry);
438 free(op);
441 if (reader->allocator)
442 IWMReaderAllocatorEx_Release(reader->allocator);
443 reader->allocator = NULL;
445 if (reader->callback_advanced)
446 IWMReaderCallbackAdvanced_Release(reader->callback_advanced);
447 reader->callback_advanced = NULL;
449 if (reader->callback)
450 IWMReaderCallback_Release(reader->callback);
451 reader->callback = NULL;
452 reader->context = NULL;
455 static HRESULT async_reader_open(struct async_reader *reader, IWMReaderCallback *callback, void *context)
457 HRESULT hr = E_OUTOFMEMORY;
459 IWMReaderCallback_AddRef((reader->callback = callback));
460 reader->context = context;
462 if (FAILED(hr = allocator_create(reader->callback, &reader->allocator)))
463 goto error;
465 if (FAILED(hr = IWMReaderCallback_QueryInterface(callback, &IID_IWMReaderCallbackAdvanced,
466 (void **)&reader->callback_advanced)))
468 WARN("Failed to retrieve IWMReaderCallbackAdvanced interface, hr %#lx\n", hr);
469 reader->callback_advanced = NULL;
472 reader->running = true;
473 if (!(reader->callback_thread = CreateThread(NULL, 0, async_reader_callback_thread, reader, 0, NULL)))
474 goto error;
476 return S_OK;
478 error:
479 async_reader_close(reader);
480 return hr;
483 static HRESULT async_reader_queue_op(struct async_reader *reader, enum async_op_type type, union async_op_data *data)
485 struct async_op *op;
487 if (!(op = calloc(1, sizeof(*op))))
488 return E_OUTOFMEMORY;
489 op->type = type;
490 if (data)
491 op->u = *data;
493 EnterCriticalSection(&reader->callback_cs);
494 list_add_tail(&reader->async_ops, &op->entry);
495 LeaveCriticalSection(&reader->callback_cs);
496 WakeConditionVariable(&reader->callback_cv);
498 return S_OK;
501 static struct async_reader *impl_from_IWMReader(IWMReader *iface)
503 return CONTAINING_RECORD(iface, struct async_reader, IWMReader_iface);
506 static HRESULT WINAPI WMReader_QueryInterface(IWMReader *iface, REFIID iid, void **out)
508 struct async_reader *reader = impl_from_IWMReader(iface);
510 TRACE("reader %p, iid %s, out %p.\n", reader, debugstr_guid(iid), out);
512 if (IsEqualIID(iid, &IID_IUnknown)
513 || IsEqualIID(iid, &IID_IWMReader))
514 *out = &reader->IWMReader_iface;
515 else if (IsEqualIID(iid, &IID_IWMReaderAccelerator))
516 *out = &reader->IWMReaderAccelerator_iface;
517 else if (IsEqualIID(iid, &IID_IWMReaderAdvanced)
518 || IsEqualIID(iid, &IID_IWMReaderAdvanced2)
519 || IsEqualIID(iid, &IID_IWMReaderAdvanced3)
520 || IsEqualIID(iid, &IID_IWMReaderAdvanced4)
521 || IsEqualIID(iid, &IID_IWMReaderAdvanced5)
522 || IsEqualIID(iid, &IID_IWMReaderAdvanced6))
523 *out = &reader->IWMReaderAdvanced6_iface;
524 else if (IsEqualIID(iid, &IID_IWMReaderNetworkConfig)
525 || IsEqualIID(iid, &IID_IWMReaderNetworkConfig2))
526 *out = &reader->IWMReaderNetworkConfig2_iface;
527 else if (IsEqualIID(iid, &IID_IWMReaderStreamClock))
528 *out = &reader->IWMReaderStreamClock_iface;
529 else if (IsEqualIID(iid, &IID_IWMReaderTypeNegotiation))
530 *out = &reader->IWMReaderTypeNegotiation_iface;
531 else if (IsEqualIID(iid, &IID_IWMHeaderInfo)
532 || IsEqualIID(iid, &IID_IWMHeaderInfo2)
533 || IsEqualIID(iid, &IID_IWMHeaderInfo3)
534 || IsEqualIID(iid, &IID_IWMLanguageList)
535 || IsEqualIID(iid, &IID_IWMPacketSize)
536 || IsEqualIID(iid, &IID_IWMPacketSize2)
537 || IsEqualIID(iid, &IID_IWMProfile)
538 || IsEqualIID(iid, &IID_IWMProfile2)
539 || IsEqualIID(iid, &IID_IWMProfile3)
540 || IsEqualIID(iid, &IID_IWMReaderPlaylistBurn)
541 || IsEqualIID(iid, &IID_IWMReaderTimecode))
542 return IUnknown_QueryInterface(reader->reader_inner, iid, out);
543 else if (IsEqualIID(iid, &IID_IReferenceClock))
544 *out = &reader->IReferenceClock_iface;
545 else
547 FIXME("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
548 *out = NULL;
549 return E_NOINTERFACE;
552 IUnknown_AddRef((IUnknown *)*out);
553 return S_OK;
556 static ULONG WINAPI WMReader_AddRef(IWMReader *iface)
558 struct async_reader *reader = impl_from_IWMReader(iface);
559 ULONG refcount = InterlockedIncrement(&reader->refcount);
560 TRACE("%p increasing refcount to %lu.\n", reader, refcount);
561 return refcount;
564 static ULONG WINAPI WMReader_Release(IWMReader *iface)
566 struct async_reader *reader = impl_from_IWMReader(iface);
567 ULONG refcount = InterlockedDecrement(&reader->refcount);
569 TRACE("%p decreasing refcount to %lu.\n", reader, refcount);
571 if (!refcount)
573 EnterCriticalSection(&reader->callback_cs);
574 reader->running = false;
575 LeaveCriticalSection(&reader->callback_cs);
576 WakeConditionVariable(&reader->callback_cv);
578 async_reader_close(reader);
580 reader->callback_cs.DebugInfo->Spare[0] = 0;
581 DeleteCriticalSection(&reader->callback_cs);
582 reader->cs.DebugInfo->Spare[0] = 0;
583 DeleteCriticalSection(&reader->cs);
585 IWMSyncReader2_Close(reader->reader);
587 IUnknown_Release(reader->reader_inner);
588 free(reader);
591 return refcount;
594 static HRESULT WINAPI WMReader_Open(IWMReader *iface, const WCHAR *url,
595 IWMReaderCallback *callback, void *context)
597 struct async_reader *reader = impl_from_IWMReader(iface);
598 HRESULT hr;
600 TRACE("reader %p, url %s, callback %p, context %p.\n",
601 reader, debugstr_w(url), callback, context);
603 EnterCriticalSection(&reader->cs);
605 if (SUCCEEDED(hr = IWMSyncReader2_Open(reader->reader, url))
606 && FAILED(hr = async_reader_open(reader, callback, context)))
607 IWMSyncReader2_Close(reader->reader);
609 LeaveCriticalSection(&reader->cs);
610 return hr;
613 static HRESULT WINAPI WMReader_Close(IWMReader *iface)
615 struct async_reader *reader = impl_from_IWMReader(iface);
616 HRESULT hr;
618 TRACE("reader %p.\n", reader);
620 EnterCriticalSection(&reader->cs);
622 if (SUCCEEDED(hr = async_reader_queue_op(reader, ASYNC_OP_CLOSE, NULL)))
624 async_reader_close(reader);
625 hr = IWMSyncReader2_Close(reader->reader);
628 LeaveCriticalSection(&reader->cs);
630 return hr;
633 static HRESULT WINAPI WMReader_GetOutputCount(IWMReader *iface, DWORD *count)
635 struct async_reader *reader = impl_from_IWMReader(iface);
637 TRACE("reader %p, count %p.\n", reader, count);
639 return IWMSyncReader2_GetOutputCount(reader->reader, count);
642 static HRESULT WINAPI WMReader_GetOutputProps(IWMReader *iface, DWORD output, IWMOutputMediaProps **props)
644 struct async_reader *reader = impl_from_IWMReader(iface);
646 TRACE("reader %p, output %lu, props %p.\n", reader, output, props);
648 return IWMSyncReader2_GetOutputProps(reader->reader, output, props);
651 static HRESULT WINAPI WMReader_SetOutputProps(IWMReader *iface, DWORD output, IWMOutputMediaProps *props)
653 struct async_reader *reader = impl_from_IWMReader(iface);
655 TRACE("reader %p, output %lu, props %p.\n", reader, output, props);
657 return IWMSyncReader2_SetOutputProps(reader->reader, output, props);
660 static HRESULT WINAPI WMReader_GetOutputFormatCount(IWMReader *iface, DWORD output, DWORD *count)
662 struct async_reader *reader = impl_from_IWMReader(iface);
664 TRACE("reader %p, output %lu, count %p.\n", reader, output, count);
666 return IWMSyncReader2_GetOutputFormatCount(reader->reader, output, count);
669 static HRESULT WINAPI WMReader_GetOutputFormat(IWMReader *iface, DWORD output,
670 DWORD index, IWMOutputMediaProps **props)
672 struct async_reader *reader = impl_from_IWMReader(iface);
674 TRACE("reader %p, output %lu, index %lu, props %p.\n", reader, output, index, props);
676 return IWMSyncReader2_GetOutputFormat(reader->reader, output, index, props);
679 static HRESULT WINAPI WMReader_Start(IWMReader *iface,
680 QWORD start, QWORD duration, float rate, void *context)
682 union async_op_data data = {.start = {.start = start, .duration = duration, .context = context}};
683 struct async_reader *reader = impl_from_IWMReader(iface);
684 HRESULT hr;
686 TRACE("reader %p, start %s, duration %s, rate %.8e, context %p.\n",
687 reader, debugstr_time(start), debugstr_time(duration), rate, context);
689 if (rate != 1.0f)
690 FIXME("Ignoring rate %.8e.\n", rate);
692 EnterCriticalSection(&reader->cs);
694 if (!reader->callback_thread)
695 hr = NS_E_INVALID_REQUEST;
696 else
697 hr = async_reader_queue_op(reader, ASYNC_OP_START, &data);
699 LeaveCriticalSection(&reader->cs);
701 return hr;
704 static HRESULT WINAPI WMReader_Stop(IWMReader *iface)
706 struct async_reader *reader = impl_from_IWMReader(iface);
707 HRESULT hr;
709 TRACE("reader %p.\n", reader);
711 EnterCriticalSection(&reader->cs);
713 if (!reader->callback_thread)
714 hr = E_UNEXPECTED;
715 else
716 hr = async_reader_queue_op(reader, ASYNC_OP_STOP, NULL);
718 LeaveCriticalSection(&reader->cs);
720 return hr;
723 static HRESULT WINAPI WMReader_Pause(IWMReader *iface)
725 struct async_reader *This = impl_from_IWMReader(iface);
726 FIXME("(%p)\n", This);
727 return E_NOTIMPL;
730 static HRESULT WINAPI WMReader_Resume(IWMReader *iface)
732 struct async_reader *This = impl_from_IWMReader(iface);
733 FIXME("(%p)\n", This);
734 return E_NOTIMPL;
737 static const IWMReaderVtbl WMReaderVtbl = {
738 WMReader_QueryInterface,
739 WMReader_AddRef,
740 WMReader_Release,
741 WMReader_Open,
742 WMReader_Close,
743 WMReader_GetOutputCount,
744 WMReader_GetOutputProps,
745 WMReader_SetOutputProps,
746 WMReader_GetOutputFormatCount,
747 WMReader_GetOutputFormat,
748 WMReader_Start,
749 WMReader_Stop,
750 WMReader_Pause,
751 WMReader_Resume
754 static struct async_reader *impl_from_IWMReaderAdvanced6(IWMReaderAdvanced6 *iface)
756 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderAdvanced6_iface);
759 static HRESULT WINAPI WMReaderAdvanced_QueryInterface(IWMReaderAdvanced6 *iface, REFIID iid, void **out)
761 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
762 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
765 static ULONG WINAPI WMReaderAdvanced_AddRef(IWMReaderAdvanced6 *iface)
767 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
768 return IWMReader_AddRef(&reader->IWMReader_iface);
771 static ULONG WINAPI WMReaderAdvanced_Release(IWMReaderAdvanced6 *iface)
773 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
774 return IWMReader_Release(&reader->IWMReader_iface);
777 static HRESULT WINAPI WMReaderAdvanced_SetUserProvidedClock(IWMReaderAdvanced6 *iface, BOOL user_clock)
779 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
781 TRACE("reader %p, user_clock %d.\n", reader, user_clock);
783 EnterCriticalSection(&reader->callback_cs);
784 reader->user_clock = !!user_clock;
785 LeaveCriticalSection(&reader->callback_cs);
786 WakeConditionVariable(&reader->callback_cv);
787 return S_OK;
790 static HRESULT WINAPI WMReaderAdvanced_GetUserProvidedClock(IWMReaderAdvanced6 *iface, BOOL *user_clock)
792 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
793 FIXME("(%p)->(%p)\n", This, user_clock);
794 return E_NOTIMPL;
797 static HRESULT WINAPI WMReaderAdvanced_DeliverTime(IWMReaderAdvanced6 *iface, QWORD time)
799 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
801 TRACE("reader %p, time %s.\n", reader, debugstr_time(time));
803 EnterCriticalSection(&reader->callback_cs);
805 if (!reader->user_clock)
807 LeaveCriticalSection(&reader->callback_cs);
808 WARN("Not using a user-provided clock; returning E_UNEXPECTED.\n");
809 return E_UNEXPECTED;
812 reader->user_time = time;
814 LeaveCriticalSection(&reader->callback_cs);
815 WakeConditionVariable(&reader->callback_cv);
816 return S_OK;
819 static HRESULT WINAPI WMReaderAdvanced_SetManualStreamSelection(IWMReaderAdvanced6 *iface, BOOL selection)
821 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
822 FIXME("(%p)->(%x)\n", This, selection);
823 return E_NOTIMPL;
826 static HRESULT WINAPI WMReaderAdvanced_GetManualStreamSelection(IWMReaderAdvanced6 *iface, BOOL *selection)
828 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
829 FIXME("(%p)->(%p)\n", This, selection);
830 return E_NOTIMPL;
833 static HRESULT WINAPI WMReaderAdvanced_SetStreamsSelected(IWMReaderAdvanced6 *iface,
834 WORD count, WORD *stream_numbers, WMT_STREAM_SELECTION *selections)
836 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
838 TRACE("reader %p, count %u, stream_numbers %p, selections %p.\n",
839 reader, count, stream_numbers, selections);
841 return IWMSyncReader2_SetStreamsSelected(reader->reader, count, stream_numbers, selections);
844 static HRESULT WINAPI WMReaderAdvanced_GetStreamSelected(IWMReaderAdvanced6 *iface,
845 WORD stream_number, WMT_STREAM_SELECTION *selection)
847 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
849 TRACE("reader %p, stream_number %u, selection %p.\n", reader, stream_number, selection);
851 return IWMSyncReader2_GetStreamSelected(reader->reader, stream_number, selection);
854 static HRESULT WINAPI WMReaderAdvanced_SetReceiveSelectionCallbacks(IWMReaderAdvanced6 *iface, BOOL get_callbacks)
856 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
857 FIXME("(%p)->(%x)\n", This, get_callbacks);
858 return E_NOTIMPL;
861 static HRESULT WINAPI WMReaderAdvanced_GetReceiveSelectionCallbacks(IWMReaderAdvanced6 *iface, BOOL *get_callbacks)
863 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
864 FIXME("(%p)->(%p)\n", This, get_callbacks);
865 return E_NOTIMPL;
868 static HRESULT WINAPI WMReaderAdvanced_SetReceiveStreamSamples(IWMReaderAdvanced6 *iface,
869 WORD stream_number, BOOL compressed)
871 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
873 TRACE("reader %p, stream_number %u, compressed %d.\n", reader, stream_number, compressed);
875 return IWMSyncReader2_SetReadStreamSamples(reader->reader, stream_number, compressed);
878 static HRESULT WINAPI WMReaderAdvanced_GetReceiveStreamSamples(IWMReaderAdvanced6 *iface, WORD stream_num,
879 BOOL *receive_stream_samples)
881 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
882 FIXME("(%p)->(%d %p)\n", This, stream_num, receive_stream_samples);
883 return E_NOTIMPL;
886 static HRESULT WINAPI WMReaderAdvanced_SetAllocateForOutput(IWMReaderAdvanced6 *iface, DWORD output, BOOL allocate)
888 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
890 TRACE("reader %p, output %lu, allocate %d.\n", reader, output, allocate);
892 return IWMSyncReader2_SetAllocateForOutput(reader->reader, output, allocate ? reader->allocator : NULL);
895 static HRESULT WINAPI WMReaderAdvanced_GetAllocateForOutput(IWMReaderAdvanced6 *iface, DWORD output, BOOL *allocate)
897 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
898 IWMReaderAllocatorEx *allocator;
899 HRESULT hr;
901 TRACE("reader %p, output %lu, allocate %p.\n", reader, output, allocate);
903 if (FAILED(hr = IWMSyncReader2_GetAllocateForOutput(reader->reader, output, &allocator)))
904 return hr;
906 if ((*allocate = allocator != NULL))
907 IWMReaderAllocatorEx_Release(allocator);
909 return hr;
912 static HRESULT WINAPI WMReaderAdvanced_SetAllocateForStream(IWMReaderAdvanced6 *iface, WORD stream_number, BOOL allocate)
914 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
916 TRACE("reader %p, stream_number %u, allocate %d.\n", reader, stream_number, allocate);
918 return IWMSyncReader2_SetAllocateForStream(reader->reader, stream_number, allocate ? reader->allocator : NULL);
921 static HRESULT WINAPI WMReaderAdvanced_GetAllocateForStream(IWMReaderAdvanced6 *iface, WORD stream_number, BOOL *allocate)
923 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
924 IWMReaderAllocatorEx *allocator;
925 HRESULT hr;
927 TRACE("reader %p, stream_number %u, allocate %p.\n", reader, stream_number, allocate);
929 if (FAILED(hr = IWMSyncReader2_GetAllocateForStream(reader->reader, stream_number, &allocator)))
930 return hr;
932 if ((*allocate = allocator != NULL))
933 IWMReaderAllocatorEx_Release(allocator);
935 return hr;
938 static HRESULT WINAPI WMReaderAdvanced_GetStatistics(IWMReaderAdvanced6 *iface, WM_READER_STATISTICS *statistics)
940 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
941 FIXME("(%p)->(%p)\n", This, statistics);
942 return E_NOTIMPL;
945 static HRESULT WINAPI WMReaderAdvanced_SetClientInfo(IWMReaderAdvanced6 *iface, WM_READER_CLIENTINFO *client_info)
947 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
948 FIXME("(%p)->(%p)\n", This, client_info);
949 return E_NOTIMPL;
952 static HRESULT WINAPI WMReaderAdvanced_GetMaxOutputSampleSize(IWMReaderAdvanced6 *iface, DWORD output, DWORD *max)
954 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
955 FIXME("(%p)->(%lu %p)\n", This, output, max);
956 return E_NOTIMPL;
959 static HRESULT WINAPI WMReaderAdvanced_GetMaxStreamSampleSize(IWMReaderAdvanced6 *iface,
960 WORD stream_number, DWORD *size)
962 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
964 TRACE("reader %p, stream_number %u, size %p.\n", reader, stream_number, size);
966 return IWMSyncReader2_GetMaxStreamSampleSize(reader->reader, stream_number, size);
969 static HRESULT WINAPI WMReaderAdvanced_NotifyLateDelivery(IWMReaderAdvanced6 *iface, QWORD lateness)
971 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
972 FIXME("(%p)->(%s)\n", This, wine_dbgstr_longlong(lateness));
973 return E_NOTIMPL;
976 static HRESULT WINAPI WMReaderAdvanced2_SetPlayMode(IWMReaderAdvanced6 *iface, WMT_PLAY_MODE mode)
978 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
979 FIXME("(%p)->(%d)\n", This, mode);
980 return E_NOTIMPL;
983 static HRESULT WINAPI WMReaderAdvanced2_GetPlayMode(IWMReaderAdvanced6 *iface, WMT_PLAY_MODE *mode)
985 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
986 FIXME("(%p)->(%p)\n", This, mode);
987 return E_NOTIMPL;
990 static HRESULT WINAPI WMReaderAdvanced2_GetBufferProgress(IWMReaderAdvanced6 *iface, DWORD *percent, QWORD *buffering)
992 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
993 FIXME("(%p)->(%p %p)\n", This, percent, buffering);
994 return E_NOTIMPL;
997 static HRESULT WINAPI WMReaderAdvanced2_GetDownloadProgress(IWMReaderAdvanced6 *iface, DWORD *percent,
998 QWORD *bytes_downloaded, QWORD *download)
1000 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1001 FIXME("(%p)->(%p %p %p)\n", This, percent, bytes_downloaded, download);
1002 return E_NOTIMPL;
1005 static HRESULT WINAPI WMReaderAdvanced2_GetSaveAsProgress(IWMReaderAdvanced6 *iface, DWORD *percent)
1007 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1008 FIXME("(%p)->(%p)\n", This, percent);
1009 return E_NOTIMPL;
1012 static HRESULT WINAPI WMReaderAdvanced2_SaveFileAs(IWMReaderAdvanced6 *iface, const WCHAR *filename)
1014 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1015 FIXME("(%p)->(%s)\n", This, debugstr_w(filename));
1016 return E_NOTIMPL;
1019 static HRESULT WINAPI WMReaderAdvanced2_GetProtocolName(IWMReaderAdvanced6 *iface, WCHAR *protocol, DWORD *protocol_len)
1021 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1022 FIXME("(%p)->(%p %p)\n", This, protocol, protocol_len);
1023 return E_NOTIMPL;
1026 static HRESULT WINAPI WMReaderAdvanced2_StartAtMarker(IWMReaderAdvanced6 *iface, WORD marker_index,
1027 QWORD duration, float rate, void *context)
1029 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1030 FIXME("(%p)->(%d %s %f %p)\n", This, marker_index, wine_dbgstr_longlong(duration), rate, context);
1031 return E_NOTIMPL;
1034 static HRESULT WINAPI WMReaderAdvanced2_GetOutputSetting(IWMReaderAdvanced6 *iface, DWORD output_num,
1035 const WCHAR *name, WMT_ATTR_DATATYPE *type, BYTE *value, WORD *length)
1037 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1038 FIXME("(%p)->(%lu %s %p %p %p)\n", This, output_num, debugstr_w(name), type, value, length);
1039 return E_NOTIMPL;
1042 static HRESULT WINAPI WMReaderAdvanced2_SetOutputSetting(IWMReaderAdvanced6 *iface, DWORD output_num,
1043 const WCHAR *name, WMT_ATTR_DATATYPE type, const BYTE *value, WORD length)
1045 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1046 FIXME("(%p)->(%lu %s %#x %p %u)\n", This, output_num, debugstr_w(name), type, value, length);
1047 return E_NOTIMPL;
1050 static HRESULT WINAPI WMReaderAdvanced2_Preroll(IWMReaderAdvanced6 *iface, QWORD start, QWORD duration, float rate)
1052 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1053 FIXME("(%p)->(%s %s %f)\n", This, wine_dbgstr_longlong(start), wine_dbgstr_longlong(duration), rate);
1054 return E_NOTIMPL;
1057 static HRESULT WINAPI WMReaderAdvanced2_SetLogClientID(IWMReaderAdvanced6 *iface, BOOL log_client_id)
1059 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1060 FIXME("(%p)->(%x)\n", This, log_client_id);
1061 return E_NOTIMPL;
1064 static HRESULT WINAPI WMReaderAdvanced2_GetLogClientID(IWMReaderAdvanced6 *iface, BOOL *log_client_id)
1066 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1067 FIXME("(%p)->(%p)\n", This, log_client_id);
1068 return E_NOTIMPL;
1071 static HRESULT WINAPI WMReaderAdvanced2_StopBuffering(IWMReaderAdvanced6 *iface)
1073 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1074 FIXME("(%p)\n", This);
1075 return E_NOTIMPL;
1078 static HRESULT WINAPI WMReaderAdvanced2_OpenStream(IWMReaderAdvanced6 *iface,
1079 IStream *stream, IWMReaderCallback *callback, void *context)
1081 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
1082 HRESULT hr;
1084 TRACE("reader %p, stream %p, callback %p, context %p.\n", reader, stream, callback, context);
1086 EnterCriticalSection(&reader->cs);
1088 if (SUCCEEDED(hr = IWMSyncReader2_OpenStream(reader->reader, stream))
1089 && FAILED(hr = async_reader_open(reader, callback, context)))
1090 IWMSyncReader2_Close(reader->reader);
1092 LeaveCriticalSection(&reader->cs);
1093 return hr;
1096 static HRESULT WINAPI WMReaderAdvanced3_StopNetStreaming(IWMReaderAdvanced6 *iface)
1098 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1099 FIXME("(%p)\n", This);
1100 return E_NOTIMPL;
1103 static HRESULT WINAPI WMReaderAdvanced3_StartAtPosition(IWMReaderAdvanced6 *iface, WORD stream_num,
1104 void *offset_start, void *duration, WMT_OFFSET_FORMAT format, float rate, void *context)
1106 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1107 FIXME("(%p)->(%d %p %p %d %f %p)\n", This, stream_num, offset_start, duration, format, rate, context);
1108 return E_NOTIMPL;
1111 static HRESULT WINAPI WMReaderAdvanced4_GetLanguageCount(IWMReaderAdvanced6 *iface, DWORD output_num, WORD *language_count)
1113 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1114 FIXME("(%p)->(%lu %p)\n", This, output_num, language_count);
1115 return E_NOTIMPL;
1118 static HRESULT WINAPI WMReaderAdvanced4_GetLanguage(IWMReaderAdvanced6 *iface, DWORD output_num,
1119 WORD language, WCHAR *language_string, WORD *language_string_len)
1121 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
1123 FIXME("reader %p, output %lu, language %#x, language_string %p, language_string_len %p, stub!\n",
1124 reader, output_num, language, language_string, language_string_len);
1126 return E_NOTIMPL;
1129 static HRESULT WINAPI WMReaderAdvanced4_GetMaxSpeedFactor(IWMReaderAdvanced6 *iface, double *factor)
1131 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1132 FIXME("(%p)->(%p)\n", This, factor);
1133 return E_NOTIMPL;
1136 static HRESULT WINAPI WMReaderAdvanced4_IsUsingFastCache(IWMReaderAdvanced6 *iface, BOOL *using_fast_cache)
1138 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1139 FIXME("(%p)->(%p)\n", This, using_fast_cache);
1140 return E_NOTIMPL;
1143 static HRESULT WINAPI WMReaderAdvanced4_AddLogParam(IWMReaderAdvanced6 *iface, const WCHAR *namespace,
1144 const WCHAR *name, const WCHAR *value)
1146 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1147 FIXME("(%p)->(%s %s %s)\n", This, debugstr_w(namespace), debugstr_w(name), debugstr_w(value));
1148 return E_NOTIMPL;
1151 static HRESULT WINAPI WMReaderAdvanced4_SendLogParams(IWMReaderAdvanced6 *iface)
1153 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1154 FIXME("(%p)\n", This);
1155 return E_NOTIMPL;
1158 static HRESULT WINAPI WMReaderAdvanced4_CanSaveFileAs(IWMReaderAdvanced6 *iface, BOOL *can_save)
1160 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1161 FIXME("(%p)->(%p)\n", This, can_save);
1162 return E_NOTIMPL;
1165 static HRESULT WINAPI WMReaderAdvanced4_CancelSaveFileAs(IWMReaderAdvanced6 *iface)
1167 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1168 FIXME("(%p)\n", This);
1169 return E_NOTIMPL;
1172 static HRESULT WINAPI WMReaderAdvanced4_GetURL(IWMReaderAdvanced6 *iface, WCHAR *url, DWORD *url_len)
1174 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1175 FIXME("(%p)->(%p %p)\n", This, url, url_len);
1176 return E_NOTIMPL;
1179 static HRESULT WINAPI WMReaderAdvanced5_SetPlayerHook(IWMReaderAdvanced6 *iface, DWORD output_num, IWMPlayerHook *hook)
1181 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
1183 FIXME("reader %p, output %lu, hook %p, stub!\n", reader, output_num, hook);
1185 return E_NOTIMPL;
1188 static HRESULT WINAPI WMReaderAdvanced6_SetProtectStreamSamples(IWMReaderAdvanced6 *iface, BYTE *cert,
1189 DWORD cert_size, DWORD cert_type, DWORD flags, BYTE *initialization_vector, DWORD *initialization_vector_size)
1191 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
1193 FIXME("reader %p, cert %p, cert_size %lu, cert_type %#lx, flags %#lx, vector %p, vector_size %p, stub!\n",
1194 reader, cert, cert_size, cert_type, flags, initialization_vector, initialization_vector_size);
1196 return E_NOTIMPL;
1199 static const IWMReaderAdvanced6Vtbl WMReaderAdvanced6Vtbl = {
1200 WMReaderAdvanced_QueryInterface,
1201 WMReaderAdvanced_AddRef,
1202 WMReaderAdvanced_Release,
1203 WMReaderAdvanced_SetUserProvidedClock,
1204 WMReaderAdvanced_GetUserProvidedClock,
1205 WMReaderAdvanced_DeliverTime,
1206 WMReaderAdvanced_SetManualStreamSelection,
1207 WMReaderAdvanced_GetManualStreamSelection,
1208 WMReaderAdvanced_SetStreamsSelected,
1209 WMReaderAdvanced_GetStreamSelected,
1210 WMReaderAdvanced_SetReceiveSelectionCallbacks,
1211 WMReaderAdvanced_GetReceiveSelectionCallbacks,
1212 WMReaderAdvanced_SetReceiveStreamSamples,
1213 WMReaderAdvanced_GetReceiveStreamSamples,
1214 WMReaderAdvanced_SetAllocateForOutput,
1215 WMReaderAdvanced_GetAllocateForOutput,
1216 WMReaderAdvanced_SetAllocateForStream,
1217 WMReaderAdvanced_GetAllocateForStream,
1218 WMReaderAdvanced_GetStatistics,
1219 WMReaderAdvanced_SetClientInfo,
1220 WMReaderAdvanced_GetMaxOutputSampleSize,
1221 WMReaderAdvanced_GetMaxStreamSampleSize,
1222 WMReaderAdvanced_NotifyLateDelivery,
1223 WMReaderAdvanced2_SetPlayMode,
1224 WMReaderAdvanced2_GetPlayMode,
1225 WMReaderAdvanced2_GetBufferProgress,
1226 WMReaderAdvanced2_GetDownloadProgress,
1227 WMReaderAdvanced2_GetSaveAsProgress,
1228 WMReaderAdvanced2_SaveFileAs,
1229 WMReaderAdvanced2_GetProtocolName,
1230 WMReaderAdvanced2_StartAtMarker,
1231 WMReaderAdvanced2_GetOutputSetting,
1232 WMReaderAdvanced2_SetOutputSetting,
1233 WMReaderAdvanced2_Preroll,
1234 WMReaderAdvanced2_SetLogClientID,
1235 WMReaderAdvanced2_GetLogClientID,
1236 WMReaderAdvanced2_StopBuffering,
1237 WMReaderAdvanced2_OpenStream,
1238 WMReaderAdvanced3_StopNetStreaming,
1239 WMReaderAdvanced3_StartAtPosition,
1240 WMReaderAdvanced4_GetLanguageCount,
1241 WMReaderAdvanced4_GetLanguage,
1242 WMReaderAdvanced4_GetMaxSpeedFactor,
1243 WMReaderAdvanced4_IsUsingFastCache,
1244 WMReaderAdvanced4_AddLogParam,
1245 WMReaderAdvanced4_SendLogParams,
1246 WMReaderAdvanced4_CanSaveFileAs,
1247 WMReaderAdvanced4_CancelSaveFileAs,
1248 WMReaderAdvanced4_GetURL,
1249 WMReaderAdvanced5_SetPlayerHook,
1250 WMReaderAdvanced6_SetProtectStreamSamples
1253 static struct async_reader *impl_from_IWMReaderAccelerator(IWMReaderAccelerator *iface)
1255 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderAccelerator_iface);
1258 static HRESULT WINAPI reader_accl_QueryInterface(IWMReaderAccelerator *iface, REFIID iid, void **out)
1260 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
1261 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
1264 static ULONG WINAPI reader_accl_AddRef(IWMReaderAccelerator *iface)
1266 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
1267 return IWMReader_AddRef(&reader->IWMReader_iface);
1270 static ULONG WINAPI reader_accl_Release(IWMReaderAccelerator *iface)
1272 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
1273 return IWMReader_Release(&reader->IWMReader_iface);
1276 static HRESULT WINAPI reader_accl_GetCodecInterface(IWMReaderAccelerator *iface, DWORD output, REFIID riid, void **codec)
1278 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
1280 FIXME("reader %p, output %lu, iid %s, codec %p, stub!\n", reader, output, debugstr_guid(riid), codec);
1282 return E_NOTIMPL;
1285 static HRESULT WINAPI reader_accl_Notify(IWMReaderAccelerator *iface, DWORD output, WM_MEDIA_TYPE *subtype)
1287 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
1289 FIXME("reader %p, output %lu, subtype %p, stub!\n", reader, output, subtype);
1291 return E_NOTIMPL;
1294 static const IWMReaderAcceleratorVtbl WMReaderAcceleratorVtbl = {
1295 reader_accl_QueryInterface,
1296 reader_accl_AddRef,
1297 reader_accl_Release,
1298 reader_accl_GetCodecInterface,
1299 reader_accl_Notify
1302 static struct async_reader *impl_from_IWMReaderNetworkConfig2(IWMReaderNetworkConfig2 *iface)
1304 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderNetworkConfig2_iface);
1307 static HRESULT WINAPI networkconfig_QueryInterface(IWMReaderNetworkConfig2 *iface, REFIID iid, void **out)
1309 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1310 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
1313 static ULONG WINAPI networkconfig_AddRef(IWMReaderNetworkConfig2 *iface)
1315 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1316 return IWMReader_AddRef(&reader->IWMReader_iface);
1319 static ULONG WINAPI networkconfig_Release(IWMReaderNetworkConfig2 *iface)
1321 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1322 return IWMReader_Release(&reader->IWMReader_iface);
1325 static HRESULT WINAPI networkconfig_GetBufferingTime(IWMReaderNetworkConfig2 *iface, QWORD *buffering_time)
1327 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1328 FIXME("%p, %p\n", This, buffering_time);
1329 return E_NOTIMPL;
1332 static HRESULT WINAPI networkconfig_SetBufferingTime(IWMReaderNetworkConfig2 *iface, QWORD buffering_time)
1334 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1335 FIXME("%p, %s\n", This, wine_dbgstr_longlong(buffering_time));
1336 return E_NOTIMPL;
1339 static HRESULT WINAPI networkconfig_GetUDPPortRanges(IWMReaderNetworkConfig2 *iface, WM_PORT_NUMBER_RANGE *array,
1340 DWORD *ranges)
1342 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1343 FIXME("%p, %p, %p\n", This, array, ranges);
1344 return E_NOTIMPL;
1347 static HRESULT WINAPI networkconfig_SetUDPPortRanges(IWMReaderNetworkConfig2 *iface,
1348 WM_PORT_NUMBER_RANGE *ranges, DWORD count)
1350 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1352 FIXME("reader %p, ranges %p, count %lu.\n", reader, ranges, count);
1354 return E_NOTIMPL;
1357 static HRESULT WINAPI networkconfig_GetProxySettings(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1358 WMT_PROXY_SETTINGS *proxy)
1360 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1361 FIXME("%p, %s, %p\n", This, debugstr_w(protocol), proxy);
1362 return E_NOTIMPL;
1365 static HRESULT WINAPI networkconfig_SetProxySettings(IWMReaderNetworkConfig2 *iface, LPCWSTR protocol,
1366 WMT_PROXY_SETTINGS proxy)
1368 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1369 FIXME("%p, %s, %d\n", This, debugstr_w(protocol), proxy);
1370 return E_NOTIMPL;
1373 static HRESULT WINAPI networkconfig_GetProxyHostName(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1374 WCHAR *hostname, DWORD *size)
1376 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1377 FIXME("%p, %s, %p, %p\n", This, debugstr_w(protocol), hostname, size);
1378 return E_NOTIMPL;
1381 static HRESULT WINAPI networkconfig_SetProxyHostName(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1382 const WCHAR *hostname)
1384 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1385 FIXME("%p, %s, %s\n", This, debugstr_w(protocol), debugstr_w(hostname));
1386 return E_NOTIMPL;
1389 static HRESULT WINAPI networkconfig_GetProxyPort(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1390 DWORD *port)
1392 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1393 FIXME("%p, %s, %p\n", This, debugstr_w(protocol), port);
1394 return E_NOTIMPL;
1397 static HRESULT WINAPI networkconfig_SetProxyPort(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1398 DWORD port)
1400 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1402 FIXME("reader %p, protocol %s, port %lu, stub!\n", reader, debugstr_w(protocol), port);
1404 return E_NOTIMPL;
1407 static HRESULT WINAPI networkconfig_GetProxyExceptionList(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1408 WCHAR *exceptions, DWORD *count)
1410 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1411 FIXME("%p, %s, %p, %p\n", This, debugstr_w(protocol), exceptions, count);
1412 return E_NOTIMPL;
1415 static HRESULT WINAPI networkconfig_SetProxyExceptionList(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1416 const WCHAR *exceptions)
1418 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1419 FIXME("%p, %s, %s\n", This, debugstr_w(protocol), debugstr_w(exceptions));
1420 return E_NOTIMPL;
1423 static HRESULT WINAPI networkconfig_GetProxyBypassForLocal(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1424 BOOL *bypass)
1426 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1427 FIXME("%p, %s, %p\n", This, debugstr_w(protocol), bypass);
1428 return E_NOTIMPL;
1431 static HRESULT WINAPI networkconfig_SetProxyBypassForLocal(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1432 BOOL bypass)
1434 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1435 FIXME("%p, %s, %d\n", This, debugstr_w(protocol), bypass);
1436 return E_NOTIMPL;
1439 static HRESULT WINAPI networkconfig_GetForceRerunAutoProxyDetection(IWMReaderNetworkConfig2 *iface,
1440 BOOL *detection)
1442 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1443 FIXME("%p, %p\n", This, detection);
1444 return E_NOTIMPL;
1447 static HRESULT WINAPI networkconfig_SetForceRerunAutoProxyDetection(IWMReaderNetworkConfig2 *iface,
1448 BOOL detection)
1450 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1451 FIXME("%p, %d\n", This, detection);
1452 return E_NOTIMPL;
1455 static HRESULT WINAPI networkconfig_GetEnableMulticast(IWMReaderNetworkConfig2 *iface, BOOL *multicast)
1457 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1458 FIXME("%p, %p\n", This, multicast);
1459 return E_NOTIMPL;
1462 static HRESULT WINAPI networkconfig_SetEnableMulticast(IWMReaderNetworkConfig2 *iface, BOOL multicast)
1464 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1465 FIXME("%p, %d\n", This, multicast);
1466 return E_NOTIMPL;
1469 static HRESULT WINAPI networkconfig_GetEnableHTTP(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1471 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1472 FIXME("%p, %p\n", This, enable);
1473 return E_NOTIMPL;
1476 static HRESULT WINAPI networkconfig_SetEnableHTTP(IWMReaderNetworkConfig2 *iface, BOOL enable)
1478 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1479 FIXME("%p, %d\n", This, enable);
1480 return E_NOTIMPL;
1483 static HRESULT WINAPI networkconfig_GetEnableUDP(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1485 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1486 FIXME("%p, %p\n", This, enable);
1487 return E_NOTIMPL;
1490 static HRESULT WINAPI networkconfig_SetEnableUDP(IWMReaderNetworkConfig2 *iface, BOOL enable)
1492 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1493 FIXME("%p, %d\n", This, enable);
1494 return E_NOTIMPL;
1497 static HRESULT WINAPI networkconfig_GetEnableTCP(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1499 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1500 FIXME("%p, %p\n", This, enable);
1501 return E_NOTIMPL;
1504 static HRESULT WINAPI networkconfig_SetEnableTCP(IWMReaderNetworkConfig2 *iface, BOOL enable)
1506 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1507 FIXME("%p, %d\n", This, enable);
1508 return E_NOTIMPL;
1511 static HRESULT WINAPI networkconfig_ResetProtocolRollover(IWMReaderNetworkConfig2 *iface)
1513 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1514 FIXME("%p\n", This);
1515 return E_NOTIMPL;
1518 static HRESULT WINAPI networkconfig_GetConnectionBandwidth(IWMReaderNetworkConfig2 *iface, DWORD *bandwidth)
1520 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1521 FIXME("%p, %p\n", This, bandwidth);
1522 return E_NOTIMPL;
1525 static HRESULT WINAPI networkconfig_SetConnectionBandwidth(IWMReaderNetworkConfig2 *iface, DWORD bandwidth)
1527 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1529 FIXME("reader %p, bandwidth %lu, stub!\n", reader, bandwidth);
1531 return E_NOTIMPL;
1534 static HRESULT WINAPI networkconfig_GetNumProtocolsSupported(IWMReaderNetworkConfig2 *iface, DWORD *protocols)
1536 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1537 FIXME("%p, %p\n", This, protocols);
1538 return E_NOTIMPL;
1541 static HRESULT WINAPI networkconfig_GetSupportedProtocolName(IWMReaderNetworkConfig2 *iface, DWORD protocol_num,
1542 WCHAR *protocol, DWORD *size)
1544 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1546 FIXME("reader %p, index %lu, protocol %p, size %p, stub!\n", reader, protocol_num, protocol, size);
1548 return E_NOTIMPL;
1551 static HRESULT WINAPI networkconfig_AddLoggingUrl(IWMReaderNetworkConfig2 *iface, const WCHAR *url)
1553 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1554 FIXME("%p, %s\n", This, debugstr_w(url));
1555 return E_NOTIMPL;
1558 static HRESULT WINAPI networkconfig_GetLoggingUrl(IWMReaderNetworkConfig2 *iface, DWORD index, WCHAR *url,
1559 DWORD *size)
1561 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1563 FIXME("reader %p, index %lu, url %p, size %p, stub!\n", reader, index, url, size);
1565 return E_NOTIMPL;
1568 static HRESULT WINAPI networkconfig_GetLoggingUrlCount(IWMReaderNetworkConfig2 *iface, DWORD *count)
1570 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1571 FIXME("%p, %p\n", This, count);
1572 return E_NOTIMPL;
1575 static HRESULT WINAPI networkconfig_ResetLoggingUrlList(IWMReaderNetworkConfig2 *iface)
1577 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1578 FIXME("%p\n", This);
1579 return E_NOTIMPL;
1582 static HRESULT WINAPI networkconfig_GetEnableContentCaching(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1584 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1585 FIXME("%p, %p\n", This, enable);
1586 return E_NOTIMPL;
1589 static HRESULT WINAPI networkconfig_SetEnableContentCaching(IWMReaderNetworkConfig2 *iface, BOOL enable)
1591 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1592 FIXME("%p, %d\n", This, enable);
1593 return E_NOTIMPL;
1596 static HRESULT WINAPI networkconfig_GetEnableFastCache(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1598 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1599 FIXME("%p, %p\n", This, enable);
1600 return E_NOTIMPL;
1603 static HRESULT WINAPI networkconfig_SetEnableFastCache(IWMReaderNetworkConfig2 *iface, BOOL enable)
1605 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1606 FIXME("%p, %d\n", This, enable);
1607 return E_NOTIMPL;
1610 static HRESULT WINAPI networkconfig_GetAcceleratedStreamingDuration(IWMReaderNetworkConfig2 *iface,
1611 QWORD *duration)
1613 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1614 FIXME("%p, %p\n", This, duration);
1615 return E_NOTIMPL;
1618 static HRESULT WINAPI networkconfig_SetAcceleratedStreamingDuration(IWMReaderNetworkConfig2 *iface,
1619 QWORD duration)
1621 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1622 FIXME("%p, %s\n", This, wine_dbgstr_longlong(duration));
1623 return E_NOTIMPL;
1626 static HRESULT WINAPI networkconfig_GetAutoReconnectLimit(IWMReaderNetworkConfig2 *iface, DWORD *limit)
1628 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1629 FIXME("%p, %p\n", This, limit);
1630 return E_NOTIMPL;
1633 static HRESULT WINAPI networkconfig_SetAutoReconnectLimit(IWMReaderNetworkConfig2 *iface, DWORD limit)
1635 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1637 FIXME("reader %p, limit %lu, stub!\n", reader, limit);
1639 return E_NOTIMPL;
1642 static HRESULT WINAPI networkconfig_GetEnableResends(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1644 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1645 FIXME("%p, %p\n", This, enable);
1646 return E_NOTIMPL;
1649 static HRESULT WINAPI networkconfig_SetEnableResends(IWMReaderNetworkConfig2 *iface, BOOL enable)
1651 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1652 FIXME("%p, %u\n", This, enable);
1653 return E_NOTIMPL;
1656 static HRESULT WINAPI networkconfig_GetEnableThinning(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1658 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1659 FIXME("%p, %p\n", This, enable);
1660 return E_NOTIMPL;
1663 static HRESULT WINAPI networkconfig_SetEnableThinning(IWMReaderNetworkConfig2 *iface, BOOL enable)
1665 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1666 FIXME("%p, %u\n", This, enable);
1667 return E_NOTIMPL;
1670 static HRESULT WINAPI networkconfig_GetMaxNetPacketSize(IWMReaderNetworkConfig2 *iface, DWORD *packet_size)
1672 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1673 FIXME("%p, %p\n", This, packet_size);
1674 return E_NOTIMPL;
1677 static const IWMReaderNetworkConfig2Vtbl WMReaderNetworkConfig2Vtbl =
1679 networkconfig_QueryInterface,
1680 networkconfig_AddRef,
1681 networkconfig_Release,
1682 networkconfig_GetBufferingTime,
1683 networkconfig_SetBufferingTime,
1684 networkconfig_GetUDPPortRanges,
1685 networkconfig_SetUDPPortRanges,
1686 networkconfig_GetProxySettings,
1687 networkconfig_SetProxySettings,
1688 networkconfig_GetProxyHostName,
1689 networkconfig_SetProxyHostName,
1690 networkconfig_GetProxyPort,
1691 networkconfig_SetProxyPort,
1692 networkconfig_GetProxyExceptionList,
1693 networkconfig_SetProxyExceptionList,
1694 networkconfig_GetProxyBypassForLocal,
1695 networkconfig_SetProxyBypassForLocal,
1696 networkconfig_GetForceRerunAutoProxyDetection,
1697 networkconfig_SetForceRerunAutoProxyDetection,
1698 networkconfig_GetEnableMulticast,
1699 networkconfig_SetEnableMulticast,
1700 networkconfig_GetEnableHTTP,
1701 networkconfig_SetEnableHTTP,
1702 networkconfig_GetEnableUDP,
1703 networkconfig_SetEnableUDP,
1704 networkconfig_GetEnableTCP,
1705 networkconfig_SetEnableTCP,
1706 networkconfig_ResetProtocolRollover,
1707 networkconfig_GetConnectionBandwidth,
1708 networkconfig_SetConnectionBandwidth,
1709 networkconfig_GetNumProtocolsSupported,
1710 networkconfig_GetSupportedProtocolName,
1711 networkconfig_AddLoggingUrl,
1712 networkconfig_GetLoggingUrl,
1713 networkconfig_GetLoggingUrlCount,
1714 networkconfig_ResetLoggingUrlList,
1715 networkconfig_GetEnableContentCaching,
1716 networkconfig_SetEnableContentCaching,
1717 networkconfig_GetEnableFastCache,
1718 networkconfig_SetEnableFastCache,
1719 networkconfig_GetAcceleratedStreamingDuration,
1720 networkconfig_SetAcceleratedStreamingDuration,
1721 networkconfig_GetAutoReconnectLimit,
1722 networkconfig_SetAutoReconnectLimit,
1723 networkconfig_GetEnableResends,
1724 networkconfig_SetEnableResends,
1725 networkconfig_GetEnableThinning,
1726 networkconfig_SetEnableThinning,
1727 networkconfig_GetMaxNetPacketSize
1730 static struct async_reader *impl_from_IWMReaderStreamClock(IWMReaderStreamClock *iface)
1732 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderStreamClock_iface);
1735 static HRESULT WINAPI readclock_QueryInterface(IWMReaderStreamClock *iface, REFIID iid, void **out)
1737 struct async_reader *reader = impl_from_IWMReaderStreamClock(iface);
1738 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
1741 static ULONG WINAPI readclock_AddRef(IWMReaderStreamClock *iface)
1743 struct async_reader *reader = impl_from_IWMReaderStreamClock(iface);
1744 return IWMReader_AddRef(&reader->IWMReader_iface);
1747 static ULONG WINAPI readclock_Release(IWMReaderStreamClock *iface)
1749 struct async_reader *reader = impl_from_IWMReaderStreamClock(iface);
1750 return IWMReader_Release(&reader->IWMReader_iface);
1753 static HRESULT WINAPI readclock_GetTime(IWMReaderStreamClock *iface, QWORD *now)
1755 struct async_reader *This = impl_from_IWMReaderStreamClock(iface);
1756 FIXME("%p, %p\n", This, now);
1757 return E_NOTIMPL;
1760 static HRESULT WINAPI readclock_SetTimer(IWMReaderStreamClock *iface, QWORD when, void *param, DWORD *id)
1762 struct async_reader *This = impl_from_IWMReaderStreamClock(iface);
1763 FIXME("%p, %s, %p, %p\n", This, wine_dbgstr_longlong(when), param, id);
1764 return E_NOTIMPL;
1767 static HRESULT WINAPI readclock_KillTimer(IWMReaderStreamClock *iface, DWORD id)
1769 struct async_reader *reader = impl_from_IWMReaderStreamClock(iface);
1771 FIXME("reader %p, id %lu, stub!\n", reader, id);
1773 return E_NOTIMPL;
1776 static const IWMReaderStreamClockVtbl WMReaderStreamClockVtbl =
1778 readclock_QueryInterface,
1779 readclock_AddRef,
1780 readclock_Release,
1781 readclock_GetTime,
1782 readclock_SetTimer,
1783 readclock_KillTimer
1786 static struct async_reader *impl_from_IWMReaderTypeNegotiation(IWMReaderTypeNegotiation *iface)
1788 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderTypeNegotiation_iface);
1791 static HRESULT WINAPI negotiation_QueryInterface(IWMReaderTypeNegotiation *iface, REFIID iid, void **out)
1793 struct async_reader *reader = impl_from_IWMReaderTypeNegotiation(iface);
1794 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
1797 static ULONG WINAPI negotiation_AddRef(IWMReaderTypeNegotiation *iface)
1799 struct async_reader *reader = impl_from_IWMReaderTypeNegotiation(iface);
1800 return IWMReader_AddRef(&reader->IWMReader_iface);
1803 static ULONG WINAPI negotiation_Release(IWMReaderTypeNegotiation *iface)
1805 struct async_reader *reader = impl_from_IWMReaderTypeNegotiation(iface);
1806 return IWMReader_Release(&reader->IWMReader_iface);
1809 static HRESULT WINAPI negotiation_TryOutputProps(IWMReaderTypeNegotiation *iface, DWORD output, IWMOutputMediaProps *props)
1811 struct async_reader *reader = impl_from_IWMReaderTypeNegotiation(iface);
1813 FIXME("reader %p, output %lu, props %p, stub!\n", reader, output, props);
1815 return E_NOTIMPL;
1818 static const IWMReaderTypeNegotiationVtbl WMReaderTypeNegotiationVtbl =
1820 negotiation_QueryInterface,
1821 negotiation_AddRef,
1822 negotiation_Release,
1823 negotiation_TryOutputProps
1826 static struct async_reader *impl_from_IReferenceClock(IReferenceClock *iface)
1828 return CONTAINING_RECORD(iface, struct async_reader, IReferenceClock_iface);
1831 static HRESULT WINAPI refclock_QueryInterface(IReferenceClock *iface, REFIID iid, void **out)
1833 struct async_reader *reader = impl_from_IReferenceClock(iface);
1834 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
1837 static ULONG WINAPI refclock_AddRef(IReferenceClock *iface)
1839 struct async_reader *reader = impl_from_IReferenceClock(iface);
1840 return IWMReader_AddRef(&reader->IWMReader_iface);
1843 static ULONG WINAPI refclock_Release(IReferenceClock *iface)
1845 struct async_reader *reader = impl_from_IReferenceClock(iface);
1846 return IWMReader_Release(&reader->IWMReader_iface);
1849 static HRESULT WINAPI refclock_GetTime(IReferenceClock *iface, REFERENCE_TIME *time)
1851 struct async_reader *This = impl_from_IReferenceClock(iface);
1852 FIXME("%p, %p\n", This, time);
1853 return E_NOTIMPL;
1856 static HRESULT WINAPI refclock_AdviseTime(IReferenceClock *iface, REFERENCE_TIME basetime,
1857 REFERENCE_TIME streamtime, HEVENT event, DWORD_PTR *cookie)
1859 struct async_reader *reader = impl_from_IReferenceClock(iface);
1861 FIXME("reader %p, basetime %s, streamtime %s, event %#Ix, cookie %p, stub!\n",
1862 reader, debugstr_time(basetime), debugstr_time(streamtime), event, cookie);
1864 return E_NOTIMPL;
1867 static HRESULT WINAPI refclock_AdvisePeriodic(IReferenceClock *iface, REFERENCE_TIME starttime,
1868 REFERENCE_TIME period, HSEMAPHORE semaphore, DWORD_PTR *cookie)
1870 struct async_reader *reader = impl_from_IReferenceClock(iface);
1872 FIXME("reader %p, starttime %s, period %s, semaphore %#Ix, cookie %p, stub!\n",
1873 reader, debugstr_time(starttime), debugstr_time(period), semaphore, cookie);
1875 return E_NOTIMPL;
1878 static HRESULT WINAPI refclock_Unadvise(IReferenceClock *iface, DWORD_PTR cookie)
1880 struct async_reader *reader = impl_from_IReferenceClock(iface);
1882 FIXME("reader %p, cookie %Iu, stub!\n", reader, cookie);
1884 return E_NOTIMPL;
1887 static const IReferenceClockVtbl ReferenceClockVtbl =
1889 refclock_QueryInterface,
1890 refclock_AddRef,
1891 refclock_Release,
1892 refclock_GetTime,
1893 refclock_AdviseTime,
1894 refclock_AdvisePeriodic,
1895 refclock_Unadvise
1898 static HRESULT WINAPI async_reader_create(IWMReader **reader)
1900 struct async_reader *object;
1901 HRESULT hr;
1903 TRACE("reader %p.\n", reader);
1905 if (!(object = calloc(1, sizeof(*object))))
1906 return E_OUTOFMEMORY;
1908 object->IReferenceClock_iface.lpVtbl = &ReferenceClockVtbl;
1909 object->IWMReader_iface.lpVtbl = &WMReaderVtbl;
1910 object->IWMReaderAdvanced6_iface.lpVtbl = &WMReaderAdvanced6Vtbl;
1911 object->IWMReaderAccelerator_iface.lpVtbl = &WMReaderAcceleratorVtbl;
1912 object->IWMReaderNetworkConfig2_iface.lpVtbl = &WMReaderNetworkConfig2Vtbl;
1913 object->IWMReaderStreamClock_iface.lpVtbl = &WMReaderStreamClockVtbl;
1914 object->IWMReaderTypeNegotiation_iface.lpVtbl = &WMReaderTypeNegotiationVtbl;
1915 object->refcount = 1;
1917 if (FAILED(hr = winegstreamer_create_wm_sync_reader((IUnknown *)&object->IWMReader_iface,
1918 (void **)&object->reader_inner)))
1919 goto failed;
1921 if (FAILED(hr = IUnknown_QueryInterface(object->reader_inner, &IID_IWMSyncReader2,
1922 (void **)&object->reader)))
1923 goto failed;
1924 IWMReader_Release(&object->IWMReader_iface);
1926 InitializeCriticalSection(&object->cs);
1927 object->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": async_reader.cs");
1928 InitializeCriticalSection(&object->callback_cs);
1929 object->callback_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": async_reader.callback_cs");
1931 QueryPerformanceFrequency(&object->clock_frequency);
1932 list_init(&object->async_ops);
1934 TRACE("Created async reader %p.\n", object);
1935 *reader = (IWMReader *)&object->IWMReader_iface;
1936 return S_OK;
1938 failed:
1939 if (object->reader_inner)
1940 IUnknown_Release(object->reader_inner);
1941 free(object);
1942 return hr;
1945 HRESULT WINAPI WMCreateReader(IUnknown *reserved, DWORD rights, IWMReader **reader)
1947 TRACE("reserved %p, rights %#lx, reader %p.\n", reserved, rights, reader);
1949 return async_reader_create(reader);
1952 HRESULT WINAPI WMCreateReaderPriv(IWMReader **reader)
1954 TRACE("reader %p.\n", reader);
1956 return async_reader_create(reader);