winegstreamer: Use IWMSyncReader2_GetNextSample in the async reader.
[wine.git] / dlls / winegstreamer / wm_asyncreader.c
blob409ebeae1aff2cac8835b26a305d730e1f579151
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 "gst_private.h"
21 #include "wine/list.h"
23 WINE_DEFAULT_DEBUG_CHANNEL(wmvcore);
25 union async_op_data
27 struct
29 QWORD start;
30 QWORD duration;
31 void *context;
32 } start;
35 struct async_op
37 enum async_op_type
39 ASYNC_OP_START,
40 ASYNC_OP_STOP,
41 ASYNC_OP_CLOSE,
42 } type;
43 union async_op_data u;
44 struct list entry;
47 struct sample
49 INSSBuffer *buffer;
50 QWORD pts, duration;
51 DWORD flags, output;
52 WORD stream;
55 struct async_reader
57 IWMReader IWMReader_iface;
58 IWMReaderAdvanced6 IWMReaderAdvanced6_iface;
59 IWMReaderAccelerator IWMReaderAccelerator_iface;
60 IWMReaderNetworkConfig2 IWMReaderNetworkConfig2_iface;
61 IWMReaderStreamClock IWMReaderStreamClock_iface;
62 IWMReaderTypeNegotiation IWMReaderTypeNegotiation_iface;
63 IReferenceClock IReferenceClock_iface;
64 IUnknown *reader_inner;
65 LONG refcount;
67 IWMSyncReader2 *reader;
69 CRITICAL_SECTION cs;
71 IWMReaderCallbackAdvanced *callback_advanced;
72 IWMReaderAllocatorEx *allocator;
73 IWMReaderCallback *callback;
74 void *context;
76 REFERENCE_TIME clock_start;
77 LARGE_INTEGER clock_frequency;
79 HANDLE callback_thread;
80 CRITICAL_SECTION callback_cs;
81 CONDITION_VARIABLE callback_cv;
83 bool running;
84 struct list async_ops;
86 bool user_clock;
87 QWORD user_time;
90 struct allocator
92 IWMReaderAllocatorEx IWMReaderAllocatorEx_iface;
93 LONG refcount;
95 IWMReaderCallbackAdvanced *callback;
98 static struct allocator *impl_from_IWMReaderAllocatorEx(IWMReaderAllocatorEx *iface)
100 return CONTAINING_RECORD(iface, struct allocator, IWMReaderAllocatorEx_iface);
103 static HRESULT WINAPI allocator_QueryInterface(IWMReaderAllocatorEx *iface, REFIID iid, void **out)
105 struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface);
107 TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out);
109 if (IsEqualIID(iid, &IID_IUnknown)
110 || IsEqualIID(iid, &IID_IWMReaderAllocatorEx))
111 *out = &allocator->IWMReaderAllocatorEx_iface;
112 else
114 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
115 return E_NOINTERFACE;
118 IUnknown_AddRef((IUnknown *)*out);
119 return S_OK;
122 static ULONG WINAPI allocator_AddRef(IWMReaderAllocatorEx *iface)
124 struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface);
125 ULONG refcount = InterlockedIncrement(&allocator->refcount);
126 TRACE("iface %p increasing refcount to %lu.\n", iface, refcount);
127 return refcount;
130 static ULONG WINAPI allocator_Release(IWMReaderAllocatorEx *iface)
132 struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface);
133 ULONG refcount = InterlockedDecrement(&allocator->refcount);
135 TRACE("iface %p decreasing refcount to %lu.\n", iface, refcount);
137 if (!refcount)
139 if (allocator->callback)
140 IWMReaderCallbackAdvanced_Release(allocator->callback);
141 free(allocator);
144 return refcount;
147 static HRESULT WINAPI allocator_AllocateForStreamEx(IWMReaderAllocatorEx *iface,
148 WORD stream_number, DWORD size, INSSBuffer **sample, DWORD flags,
149 QWORD pts, QWORD duration, void *context)
151 struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface);
153 TRACE("iface %p, stream_number %u, size %#lx, sample %p, flags %#lx, pts %I64d, duration %I64d, context %p.\n",
154 iface, stream_number, size, sample, flags, pts, duration, context);
156 if (allocator->callback)
157 return IWMReaderCallbackAdvanced_AllocateForStream(allocator->callback,
158 stream_number, size, sample, context);
160 return E_NOTIMPL;
163 static HRESULT WINAPI allocator_AllocateForOutputEx(IWMReaderAllocatorEx *iface,
164 DWORD output, DWORD size, INSSBuffer **sample, DWORD flags,
165 QWORD pts, QWORD duration, void *context)
167 struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface);
169 TRACE("iface %p, output %lu, size %#lx, sample %p, flags %#lx, pts %I64d, duration %I64d, context %p.\n",
170 iface, output, size, sample, flags, pts, duration, context);
172 if (allocator->callback)
173 return IWMReaderCallbackAdvanced_AllocateForOutput(allocator->callback,
174 output, size, sample, context);
176 return E_NOTIMPL;
179 static const IWMReaderAllocatorExVtbl allocator_vtbl =
181 allocator_QueryInterface,
182 allocator_AddRef,
183 allocator_Release,
184 allocator_AllocateForStreamEx,
185 allocator_AllocateForOutputEx,
188 static HRESULT allocator_create(IWMReaderCallback *callback, IWMReaderAllocatorEx **out)
190 struct allocator *allocator;
191 HRESULT hr;
193 if (!(allocator = calloc(1, sizeof(*allocator))))
194 return E_OUTOFMEMORY;
195 allocator->IWMReaderAllocatorEx_iface.lpVtbl = &allocator_vtbl;
196 allocator->refcount = 1;
198 if (FAILED(hr = IWMReaderCallback_QueryInterface(callback,
199 &IID_IWMReaderCallbackAdvanced, (void **)&allocator->callback)))
201 WARN("Failed to retrieve IWMReaderCallbackAdvanced interface, hr %#lx\n", hr);
202 allocator->callback = NULL;
205 *out = &allocator->IWMReaderAllocatorEx_iface;
206 return S_OK;
209 static REFERENCE_TIME get_current_time(const struct async_reader *reader)
211 LARGE_INTEGER time;
213 QueryPerformanceCounter(&time);
214 return (time.QuadPart * 1000) / reader->clock_frequency.QuadPart * 10000;
217 static DWORD async_reader_get_wait_timeout(struct async_reader *reader, QWORD pts)
219 REFERENCE_TIME current_time = reader->user_time;
220 DWORD timeout = INFINITE;
222 if (!reader->user_clock)
224 current_time = get_current_time(reader) - reader->clock_start;
225 timeout = (pts - current_time) / 10000;
228 return pts > current_time ? timeout : 0;
231 static bool async_reader_wait_pts(struct async_reader *reader, QWORD pts)
233 IWMReaderCallbackAdvanced *callback_advanced = reader->callback_advanced;
234 DWORD timeout;
236 TRACE("reader %p, pts %I64d.\n", reader, pts);
238 if (reader->user_clock && pts > reader->user_time && callback_advanced)
240 QWORD user_time = reader->user_time;
241 LeaveCriticalSection(&reader->callback_cs);
242 IWMReaderCallbackAdvanced_OnTime(callback_advanced, user_time, reader->context);
243 EnterCriticalSection(&reader->callback_cs);
246 while (reader->running && list_empty(&reader->async_ops))
248 if (!(timeout = async_reader_get_wait_timeout(reader, pts)))
249 return true;
250 SleepConditionVariableCS(&reader->callback_cv, &reader->callback_cs, timeout);
253 return false;
256 static void async_reader_deliver_sample(struct async_reader *reader, struct sample *sample)
258 IWMReaderCallbackAdvanced *callback_advanced = reader->callback_advanced;
259 IWMReaderCallback *callback = reader->callback;
260 BOOL read_compressed;
261 HRESULT hr;
263 TRACE("reader %p, output %lu, stream %u, pts %s, duration %s, flags %#lx, buffer %p.\n",
264 reader, sample->output, sample->stream, debugstr_time(sample->pts),
265 debugstr_time(sample->duration), sample->flags, sample->buffer);
267 if (FAILED(hr = IWMSyncReader2_GetReadStreamSamples(reader->reader, sample->stream,
268 &read_compressed)))
269 read_compressed = FALSE;
271 LeaveCriticalSection(&reader->callback_cs);
272 if (read_compressed)
273 hr = IWMReaderCallbackAdvanced_OnStreamSample(callback_advanced, sample->stream,
274 sample->pts, sample->duration, sample->flags, sample->buffer, reader->context);
275 else
276 hr = IWMReaderCallback_OnSample(callback, sample->output, sample->pts, sample->duration,
277 sample->flags, sample->buffer, reader->context);
278 EnterCriticalSection(&reader->callback_cs);
280 TRACE("Callback returned %#lx.\n", hr);
282 INSSBuffer_Release(sample->buffer);
285 static void callback_thread_run(struct async_reader *reader)
287 IWMReaderCallbackAdvanced *callback_advanced = reader->callback_advanced;
288 IWMReaderCallback *callback = reader->callback;
289 static const DWORD zero;
290 HRESULT hr = S_OK;
292 while (reader->running && list_empty(&reader->async_ops))
294 struct sample sample;
296 LeaveCriticalSection(&reader->callback_cs);
297 hr = IWMSyncReader2_GetNextSample(reader->reader, 0, &sample.buffer, &sample.pts,
298 &sample.duration, &sample.flags, &sample.output, &sample.stream);
299 EnterCriticalSection(&reader->callback_cs);
300 if (hr != S_OK)
301 break;
303 if (async_reader_wait_pts(reader, sample.pts))
304 async_reader_deliver_sample(reader, &sample);
305 else
306 INSSBuffer_Release(sample.buffer);
309 if (hr == NS_E_NO_MORE_SAMPLES)
311 BOOL user_clock = reader->user_clock;
312 QWORD user_time = reader->user_time;
314 LeaveCriticalSection(&reader->callback_cs);
316 IWMReaderCallback_OnStatus(callback, WMT_END_OF_STREAMING, S_OK,
317 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
318 IWMReaderCallback_OnStatus(callback, WMT_EOF, S_OK,
319 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
321 if (user_clock && callback_advanced)
323 /* We can only get here if user_time is greater than the PTS
324 * of all samples, in which case we cannot have sent this
325 * notification already. */
326 IWMReaderCallbackAdvanced_OnTime(callback_advanced,
327 user_time, reader->context);
330 EnterCriticalSection(&reader->callback_cs);
332 TRACE("Reached end of stream; exiting.\n");
334 else if (hr != S_OK)
336 ERR("Failed to get sample, hr %#lx.\n", hr);
340 static DWORD WINAPI async_reader_callback_thread(void *arg)
342 struct async_reader *reader = arg;
343 static const DWORD zero;
344 struct list *entry;
345 HRESULT hr = S_OK;
347 IWMReaderCallback_OnStatus(reader->callback, WMT_OPENED, S_OK,
348 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
350 EnterCriticalSection(&reader->callback_cs);
352 while (reader->running)
354 if ((entry = list_head(&reader->async_ops)))
356 struct async_op *op = LIST_ENTRY(entry, struct async_op, entry);
357 list_remove(&op->entry);
359 hr = list_empty(&reader->async_ops) ? S_OK : E_ABORT;
360 switch (op->type)
362 case ASYNC_OP_START:
364 reader->context = op->u.start.context;
365 if (SUCCEEDED(hr))
366 hr = IWMSyncReader2_SetRange(reader->reader, op->u.start.start, op->u.start.duration);
367 if (SUCCEEDED(hr))
368 reader->clock_start = get_current_time(reader);
370 LeaveCriticalSection(&reader->callback_cs);
371 IWMReaderCallback_OnStatus(reader->callback, WMT_STARTED, hr,
372 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
373 EnterCriticalSection(&reader->callback_cs);
375 if (SUCCEEDED(hr))
376 callback_thread_run(reader);
377 break;
380 case ASYNC_OP_STOP:
381 LeaveCriticalSection(&reader->callback_cs);
382 IWMReaderCallback_OnStatus(reader->callback, WMT_STOPPED, hr,
383 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
384 EnterCriticalSection(&reader->callback_cs);
385 break;
387 case ASYNC_OP_CLOSE:
388 LeaveCriticalSection(&reader->callback_cs);
389 IWMReaderCallback_OnStatus(reader->callback, WMT_CLOSED, hr,
390 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
391 EnterCriticalSection(&reader->callback_cs);
393 if (SUCCEEDED(hr))
394 reader->running = false;
395 break;
398 free(op);
401 if (reader->running && list_empty(&reader->async_ops))
402 SleepConditionVariableCS(&reader->callback_cv, &reader->callback_cs, INFINITE);
405 LeaveCriticalSection(&reader->callback_cs);
407 TRACE("Reader is stopping; exiting.\n");
408 return 0;
411 static void async_reader_close(struct async_reader *reader)
413 struct async_op *op, *next;
415 if (reader->callback_thread)
417 WaitForSingleObject(reader->callback_thread, INFINITE);
418 CloseHandle(reader->callback_thread);
419 reader->callback_thread = NULL;
422 LIST_FOR_EACH_ENTRY_SAFE(op, next, &reader->async_ops, struct async_op, entry)
424 list_remove(&op->entry);
425 free(op);
428 if (reader->allocator)
429 IWMReaderAllocatorEx_Release(reader->allocator);
430 reader->allocator = NULL;
432 if (reader->callback_advanced)
433 IWMReaderCallbackAdvanced_Release(reader->callback_advanced);
434 reader->callback_advanced = NULL;
436 if (reader->callback)
437 IWMReaderCallback_Release(reader->callback);
438 reader->callback = NULL;
439 reader->context = NULL;
442 static HRESULT async_reader_open(struct async_reader *reader, IWMReaderCallback *callback, void *context)
444 HRESULT hr = E_OUTOFMEMORY;
446 IWMReaderCallback_AddRef((reader->callback = callback));
447 reader->context = context;
449 if (FAILED(hr = allocator_create(reader->callback, &reader->allocator)))
450 goto error;
452 if (FAILED(hr = IWMReaderCallback_QueryInterface(callback, &IID_IWMReaderCallbackAdvanced,
453 (void **)&reader->callback_advanced)))
455 WARN("Failed to retrieve IWMReaderCallbackAdvanced interface, hr %#lx\n", hr);
456 reader->callback_advanced = NULL;
459 reader->running = true;
460 if (!(reader->callback_thread = CreateThread(NULL, 0, async_reader_callback_thread, reader, 0, NULL)))
461 goto error;
463 return S_OK;
465 error:
466 async_reader_close(reader);
467 return hr;
470 static HRESULT async_reader_queue_op(struct async_reader *reader, enum async_op_type type, union async_op_data *data)
472 struct async_op *op;
474 if (!(op = calloc(1, sizeof(*op))))
475 return E_OUTOFMEMORY;
476 op->type = type;
477 if (data)
478 op->u = *data;
480 EnterCriticalSection(&reader->callback_cs);
481 list_add_tail(&reader->async_ops, &op->entry);
482 LeaveCriticalSection(&reader->callback_cs);
483 WakeConditionVariable(&reader->callback_cv);
485 return S_OK;
488 static struct async_reader *impl_from_IWMReader(IWMReader *iface)
490 return CONTAINING_RECORD(iface, struct async_reader, IWMReader_iface);
493 static HRESULT WINAPI WMReader_QueryInterface(IWMReader *iface, REFIID iid, void **out)
495 struct async_reader *reader = impl_from_IWMReader(iface);
497 TRACE("reader %p, iid %s, out %p.\n", reader, debugstr_guid(iid), out);
499 if (IsEqualIID(iid, &IID_IUnknown)
500 || IsEqualIID(iid, &IID_IWMReader))
501 *out = &reader->IWMReader_iface;
502 else if (IsEqualIID(iid, &IID_IWMReaderAccelerator))
503 *out = &reader->IWMReaderAccelerator_iface;
504 else if (IsEqualIID(iid, &IID_IWMReaderAdvanced)
505 || IsEqualIID(iid, &IID_IWMReaderAdvanced2)
506 || IsEqualIID(iid, &IID_IWMReaderAdvanced3)
507 || IsEqualIID(iid, &IID_IWMReaderAdvanced4)
508 || IsEqualIID(iid, &IID_IWMReaderAdvanced5)
509 || IsEqualIID(iid, &IID_IWMReaderAdvanced6))
510 *out = &reader->IWMReaderAdvanced6_iface;
511 else if (IsEqualIID(iid, &IID_IWMReaderNetworkConfig)
512 || IsEqualIID(iid, &IID_IWMReaderNetworkConfig2))
513 *out = &reader->IWMReaderNetworkConfig2_iface;
514 else if (IsEqualIID(iid, &IID_IWMReaderStreamClock))
515 *out = &reader->IWMReaderStreamClock_iface;
516 else if (IsEqualIID(iid, &IID_IWMReaderTypeNegotiation))
517 *out = &reader->IWMReaderTypeNegotiation_iface;
518 else if (IsEqualIID(iid, &IID_IWMHeaderInfo)
519 || IsEqualIID(iid, &IID_IWMHeaderInfo2)
520 || IsEqualIID(iid, &IID_IWMHeaderInfo3)
521 || IsEqualIID(iid, &IID_IWMLanguageList)
522 || IsEqualIID(iid, &IID_IWMPacketSize)
523 || IsEqualIID(iid, &IID_IWMPacketSize2)
524 || IsEqualIID(iid, &IID_IWMProfile)
525 || IsEqualIID(iid, &IID_IWMProfile2)
526 || IsEqualIID(iid, &IID_IWMProfile3)
527 || IsEqualIID(iid, &IID_IWMReaderPlaylistBurn)
528 || IsEqualIID(iid, &IID_IWMReaderTimecode))
529 return IUnknown_QueryInterface(reader->reader_inner, iid, out);
530 else if (IsEqualIID(iid, &IID_IReferenceClock))
531 *out = &reader->IReferenceClock_iface;
532 else
534 WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid));
535 return E_NOINTERFACE;
538 IUnknown_AddRef((IUnknown *)*out);
539 return S_OK;
542 static ULONG WINAPI WMReader_AddRef(IWMReader *iface)
544 struct async_reader *reader = impl_from_IWMReader(iface);
545 ULONG refcount = InterlockedIncrement(&reader->refcount);
546 TRACE("%p increasing refcount to %lu.\n", reader, refcount);
547 return refcount;
550 static ULONG WINAPI WMReader_Release(IWMReader *iface)
552 struct async_reader *reader = impl_from_IWMReader(iface);
553 ULONG refcount = InterlockedDecrement(&reader->refcount);
555 TRACE("%p decreasing refcount to %lu.\n", reader, refcount);
557 if (!refcount)
559 EnterCriticalSection(&reader->callback_cs);
560 reader->running = false;
561 LeaveCriticalSection(&reader->callback_cs);
562 WakeConditionVariable(&reader->callback_cv);
564 async_reader_close(reader);
566 reader->callback_cs.DebugInfo->Spare[0] = 0;
567 DeleteCriticalSection(&reader->callback_cs);
568 reader->cs.DebugInfo->Spare[0] = 0;
569 DeleteCriticalSection(&reader->cs);
571 IWMSyncReader2_Close(reader->reader);
573 IUnknown_Release(reader->reader_inner);
574 free(reader);
577 return refcount;
580 static HRESULT WINAPI WMReader_Open(IWMReader *iface, const WCHAR *url,
581 IWMReaderCallback *callback, void *context)
583 struct async_reader *reader = impl_from_IWMReader(iface);
584 HRESULT hr;
586 TRACE("reader %p, url %s, callback %p, context %p.\n",
587 reader, debugstr_w(url), callback, context);
589 EnterCriticalSection(&reader->cs);
591 if (SUCCEEDED(hr = IWMSyncReader2_Open(reader->reader, url))
592 && FAILED(hr = async_reader_open(reader, callback, context)))
593 IWMSyncReader2_Close(reader->reader);
595 LeaveCriticalSection(&reader->cs);
596 return hr;
599 static HRESULT WINAPI WMReader_Close(IWMReader *iface)
601 struct async_reader *reader = impl_from_IWMReader(iface);
602 HRESULT hr;
604 TRACE("reader %p.\n", reader);
606 EnterCriticalSection(&reader->cs);
608 if (SUCCEEDED(hr = async_reader_queue_op(reader, ASYNC_OP_CLOSE, NULL)))
610 async_reader_close(reader);
611 hr = IWMSyncReader2_Close(reader->reader);
614 LeaveCriticalSection(&reader->cs);
616 return hr;
619 static HRESULT WINAPI WMReader_GetOutputCount(IWMReader *iface, DWORD *count)
621 struct async_reader *reader = impl_from_IWMReader(iface);
623 TRACE("reader %p, count %p.\n", reader, count);
625 return IWMSyncReader2_GetOutputCount(reader->reader, count);
628 static HRESULT WINAPI WMReader_GetOutputProps(IWMReader *iface, DWORD output, IWMOutputMediaProps **props)
630 struct async_reader *reader = impl_from_IWMReader(iface);
632 TRACE("reader %p, output %lu, props %p.\n", reader, output, props);
634 return IWMSyncReader2_GetOutputProps(reader->reader, output, props);
637 static HRESULT WINAPI WMReader_SetOutputProps(IWMReader *iface, DWORD output, IWMOutputMediaProps *props)
639 struct async_reader *reader = impl_from_IWMReader(iface);
641 TRACE("reader %p, output %lu, props %p.\n", reader, output, props);
643 return IWMSyncReader2_SetOutputProps(reader->reader, output, props);
646 static HRESULT WINAPI WMReader_GetOutputFormatCount(IWMReader *iface, DWORD output, DWORD *count)
648 struct async_reader *reader = impl_from_IWMReader(iface);
650 TRACE("reader %p, output %lu, count %p.\n", reader, output, count);
652 return IWMSyncReader2_GetOutputFormatCount(reader->reader, output, count);
655 static HRESULT WINAPI WMReader_GetOutputFormat(IWMReader *iface, DWORD output,
656 DWORD index, IWMOutputMediaProps **props)
658 struct async_reader *reader = impl_from_IWMReader(iface);
660 TRACE("reader %p, output %lu, index %lu, props %p.\n", reader, output, index, props);
662 return IWMSyncReader2_GetOutputFormat(reader->reader, output, index, props);
665 static HRESULT WINAPI WMReader_Start(IWMReader *iface,
666 QWORD start, QWORD duration, float rate, void *context)
668 union async_op_data data = {.start = {.start = start, .duration = duration, .context = context}};
669 struct async_reader *reader = impl_from_IWMReader(iface);
670 HRESULT hr;
672 TRACE("reader %p, start %s, duration %s, rate %.8e, context %p.\n",
673 reader, debugstr_time(start), debugstr_time(duration), rate, context);
675 if (rate != 1.0f)
676 FIXME("Ignoring rate %.8e.\n", rate);
678 EnterCriticalSection(&reader->cs);
680 if (!reader->callback_thread)
681 hr = NS_E_INVALID_REQUEST;
682 else
683 hr = async_reader_queue_op(reader, ASYNC_OP_START, &data);
685 LeaveCriticalSection(&reader->cs);
687 return hr;
690 static HRESULT WINAPI WMReader_Stop(IWMReader *iface)
692 struct async_reader *reader = impl_from_IWMReader(iface);
693 HRESULT hr;
695 TRACE("reader %p.\n", reader);
697 EnterCriticalSection(&reader->cs);
699 if (!reader->callback_thread)
700 hr = E_UNEXPECTED;
701 else
702 hr = async_reader_queue_op(reader, ASYNC_OP_STOP, NULL);
704 LeaveCriticalSection(&reader->cs);
706 return hr;
709 static HRESULT WINAPI WMReader_Pause(IWMReader *iface)
711 struct async_reader *This = impl_from_IWMReader(iface);
712 FIXME("(%p)\n", This);
713 return E_NOTIMPL;
716 static HRESULT WINAPI WMReader_Resume(IWMReader *iface)
718 struct async_reader *This = impl_from_IWMReader(iface);
719 FIXME("(%p)\n", This);
720 return E_NOTIMPL;
723 static const IWMReaderVtbl WMReaderVtbl = {
724 WMReader_QueryInterface,
725 WMReader_AddRef,
726 WMReader_Release,
727 WMReader_Open,
728 WMReader_Close,
729 WMReader_GetOutputCount,
730 WMReader_GetOutputProps,
731 WMReader_SetOutputProps,
732 WMReader_GetOutputFormatCount,
733 WMReader_GetOutputFormat,
734 WMReader_Start,
735 WMReader_Stop,
736 WMReader_Pause,
737 WMReader_Resume
740 static struct async_reader *impl_from_IWMReaderAdvanced6(IWMReaderAdvanced6 *iface)
742 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderAdvanced6_iface);
745 static HRESULT WINAPI WMReaderAdvanced_QueryInterface(IWMReaderAdvanced6 *iface, REFIID iid, void **out)
747 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
748 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
751 static ULONG WINAPI WMReaderAdvanced_AddRef(IWMReaderAdvanced6 *iface)
753 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
754 return IWMReader_AddRef(&reader->IWMReader_iface);
757 static ULONG WINAPI WMReaderAdvanced_Release(IWMReaderAdvanced6 *iface)
759 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
760 return IWMReader_Release(&reader->IWMReader_iface);
763 static HRESULT WINAPI WMReaderAdvanced_SetUserProvidedClock(IWMReaderAdvanced6 *iface, BOOL user_clock)
765 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
767 TRACE("reader %p, user_clock %d.\n", reader, user_clock);
769 EnterCriticalSection(&reader->callback_cs);
770 reader->user_clock = !!user_clock;
771 LeaveCriticalSection(&reader->callback_cs);
772 WakeConditionVariable(&reader->callback_cv);
773 return S_OK;
776 static HRESULT WINAPI WMReaderAdvanced_GetUserProvidedClock(IWMReaderAdvanced6 *iface, BOOL *user_clock)
778 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
779 FIXME("(%p)->(%p)\n", This, user_clock);
780 return E_NOTIMPL;
783 static HRESULT WINAPI WMReaderAdvanced_DeliverTime(IWMReaderAdvanced6 *iface, QWORD time)
785 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
787 TRACE("reader %p, time %s.\n", reader, debugstr_time(time));
789 EnterCriticalSection(&reader->callback_cs);
791 if (!reader->user_clock)
793 LeaveCriticalSection(&reader->callback_cs);
794 WARN("Not using a user-provided clock; returning E_UNEXPECTED.\n");
795 return E_UNEXPECTED;
798 reader->user_time = time;
800 LeaveCriticalSection(&reader->callback_cs);
801 WakeConditionVariable(&reader->callback_cv);
802 return S_OK;
805 static HRESULT WINAPI WMReaderAdvanced_SetManualStreamSelection(IWMReaderAdvanced6 *iface, BOOL selection)
807 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
808 FIXME("(%p)->(%x)\n", This, selection);
809 return E_NOTIMPL;
812 static HRESULT WINAPI WMReaderAdvanced_GetManualStreamSelection(IWMReaderAdvanced6 *iface, BOOL *selection)
814 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
815 FIXME("(%p)->(%p)\n", This, selection);
816 return E_NOTIMPL;
819 static HRESULT WINAPI WMReaderAdvanced_SetStreamsSelected(IWMReaderAdvanced6 *iface,
820 WORD count, WORD *stream_numbers, WMT_STREAM_SELECTION *selections)
822 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
824 TRACE("reader %p, count %u, stream_numbers %p, selections %p.\n",
825 reader, count, stream_numbers, selections);
827 return IWMSyncReader2_SetStreamsSelected(reader->reader, count, stream_numbers, selections);
830 static HRESULT WINAPI WMReaderAdvanced_GetStreamSelected(IWMReaderAdvanced6 *iface,
831 WORD stream_number, WMT_STREAM_SELECTION *selection)
833 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
835 TRACE("reader %p, stream_number %u, selection %p.\n", reader, stream_number, selection);
837 return IWMSyncReader2_GetStreamSelected(reader->reader, stream_number, selection);
840 static HRESULT WINAPI WMReaderAdvanced_SetReceiveSelectionCallbacks(IWMReaderAdvanced6 *iface, BOOL get_callbacks)
842 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
843 FIXME("(%p)->(%x)\n", This, get_callbacks);
844 return E_NOTIMPL;
847 static HRESULT WINAPI WMReaderAdvanced_GetReceiveSelectionCallbacks(IWMReaderAdvanced6 *iface, BOOL *get_callbacks)
849 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
850 FIXME("(%p)->(%p)\n", This, get_callbacks);
851 return E_NOTIMPL;
854 static HRESULT WINAPI WMReaderAdvanced_SetReceiveStreamSamples(IWMReaderAdvanced6 *iface,
855 WORD stream_number, BOOL compressed)
857 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
859 TRACE("reader %p, stream_number %u, compressed %d.\n", reader, stream_number, compressed);
861 return IWMSyncReader2_SetReadStreamSamples(reader->reader, stream_number, compressed);
864 static HRESULT WINAPI WMReaderAdvanced_GetReceiveStreamSamples(IWMReaderAdvanced6 *iface, WORD stream_num,
865 BOOL *receive_stream_samples)
867 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
868 FIXME("(%p)->(%d %p)\n", This, stream_num, receive_stream_samples);
869 return E_NOTIMPL;
872 static HRESULT WINAPI WMReaderAdvanced_SetAllocateForOutput(IWMReaderAdvanced6 *iface, DWORD output, BOOL allocate)
874 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
876 TRACE("reader %p, output %lu, allocate %d.\n", reader, output, allocate);
878 return IWMSyncReader2_SetAllocateForOutput(reader->reader, output, allocate ? reader->allocator : NULL);
881 static HRESULT WINAPI WMReaderAdvanced_GetAllocateForOutput(IWMReaderAdvanced6 *iface, DWORD output, BOOL *allocate)
883 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
884 IWMReaderAllocatorEx *allocator;
885 HRESULT hr;
887 TRACE("reader %p, output %lu, allocate %p.\n", reader, output, allocate);
889 if (FAILED(hr = IWMSyncReader2_GetAllocateForOutput(reader->reader, output, &allocator)))
890 return hr;
892 if ((*allocate = allocator != NULL))
893 IWMReaderAllocatorEx_Release(allocator);
895 return hr;
898 static HRESULT WINAPI WMReaderAdvanced_SetAllocateForStream(IWMReaderAdvanced6 *iface, WORD stream_number, BOOL allocate)
900 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
902 TRACE("reader %p, stream_number %u, allocate %d.\n", reader, stream_number, allocate);
904 return IWMSyncReader2_SetAllocateForStream(reader->reader, stream_number, allocate ? reader->allocator : NULL);
907 static HRESULT WINAPI WMReaderAdvanced_GetAllocateForStream(IWMReaderAdvanced6 *iface, WORD stream_number, BOOL *allocate)
909 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
910 IWMReaderAllocatorEx *allocator;
911 HRESULT hr;
913 TRACE("reader %p, stream_number %u, allocate %p.\n", reader, stream_number, allocate);
915 if (FAILED(hr = IWMSyncReader2_GetAllocateForStream(reader->reader, stream_number, &allocator)))
916 return hr;
918 if ((*allocate = allocator != NULL))
919 IWMReaderAllocatorEx_Release(allocator);
921 return hr;
924 static HRESULT WINAPI WMReaderAdvanced_GetStatistics(IWMReaderAdvanced6 *iface, WM_READER_STATISTICS *statistics)
926 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
927 FIXME("(%p)->(%p)\n", This, statistics);
928 return E_NOTIMPL;
931 static HRESULT WINAPI WMReaderAdvanced_SetClientInfo(IWMReaderAdvanced6 *iface, WM_READER_CLIENTINFO *client_info)
933 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
934 FIXME("(%p)->(%p)\n", This, client_info);
935 return E_NOTIMPL;
938 static HRESULT WINAPI WMReaderAdvanced_GetMaxOutputSampleSize(IWMReaderAdvanced6 *iface, DWORD output, DWORD *max)
940 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
941 FIXME("(%p)->(%lu %p)\n", This, output, max);
942 return E_NOTIMPL;
945 static HRESULT WINAPI WMReaderAdvanced_GetMaxStreamSampleSize(IWMReaderAdvanced6 *iface,
946 WORD stream_number, DWORD *size)
948 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
950 TRACE("reader %p, stream_number %u, size %p.\n", reader, stream_number, size);
952 return IWMSyncReader2_GetMaxStreamSampleSize(reader->reader, stream_number, size);
955 static HRESULT WINAPI WMReaderAdvanced_NotifyLateDelivery(IWMReaderAdvanced6 *iface, QWORD lateness)
957 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
958 FIXME("(%p)->(%s)\n", This, wine_dbgstr_longlong(lateness));
959 return E_NOTIMPL;
962 static HRESULT WINAPI WMReaderAdvanced2_SetPlayMode(IWMReaderAdvanced6 *iface, WMT_PLAY_MODE mode)
964 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
965 FIXME("(%p)->(%d)\n", This, mode);
966 return E_NOTIMPL;
969 static HRESULT WINAPI WMReaderAdvanced2_GetPlayMode(IWMReaderAdvanced6 *iface, WMT_PLAY_MODE *mode)
971 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
972 FIXME("(%p)->(%p)\n", This, mode);
973 return E_NOTIMPL;
976 static HRESULT WINAPI WMReaderAdvanced2_GetBufferProgress(IWMReaderAdvanced6 *iface, DWORD *percent, QWORD *buffering)
978 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
979 FIXME("(%p)->(%p %p)\n", This, percent, buffering);
980 return E_NOTIMPL;
983 static HRESULT WINAPI WMReaderAdvanced2_GetDownloadProgress(IWMReaderAdvanced6 *iface, DWORD *percent,
984 QWORD *bytes_downloaded, QWORD *download)
986 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
987 FIXME("(%p)->(%p %p %p)\n", This, percent, bytes_downloaded, download);
988 return E_NOTIMPL;
991 static HRESULT WINAPI WMReaderAdvanced2_GetSaveAsProgress(IWMReaderAdvanced6 *iface, DWORD *percent)
993 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
994 FIXME("(%p)->(%p)\n", This, percent);
995 return E_NOTIMPL;
998 static HRESULT WINAPI WMReaderAdvanced2_SaveFileAs(IWMReaderAdvanced6 *iface, const WCHAR *filename)
1000 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1001 FIXME("(%p)->(%s)\n", This, debugstr_w(filename));
1002 return E_NOTIMPL;
1005 static HRESULT WINAPI WMReaderAdvanced2_GetProtocolName(IWMReaderAdvanced6 *iface, WCHAR *protocol, DWORD *protocol_len)
1007 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1008 FIXME("(%p)->(%p %p)\n", This, protocol, protocol_len);
1009 return E_NOTIMPL;
1012 static HRESULT WINAPI WMReaderAdvanced2_StartAtMarker(IWMReaderAdvanced6 *iface, WORD marker_index,
1013 QWORD duration, float rate, void *context)
1015 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1016 FIXME("(%p)->(%d %s %f %p)\n", This, marker_index, wine_dbgstr_longlong(duration), rate, context);
1017 return E_NOTIMPL;
1020 static HRESULT WINAPI WMReaderAdvanced2_GetOutputSetting(IWMReaderAdvanced6 *iface, DWORD output_num,
1021 const WCHAR *name, WMT_ATTR_DATATYPE *type, BYTE *value, WORD *length)
1023 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1024 FIXME("(%p)->(%lu %s %p %p %p)\n", This, output_num, debugstr_w(name), type, value, length);
1025 return E_NOTIMPL;
1028 static HRESULT WINAPI WMReaderAdvanced2_SetOutputSetting(IWMReaderAdvanced6 *iface, DWORD output_num,
1029 const WCHAR *name, WMT_ATTR_DATATYPE type, const BYTE *value, WORD length)
1031 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1032 FIXME("(%p)->(%lu %s %#x %p %u)\n", This, output_num, debugstr_w(name), type, value, length);
1033 return E_NOTIMPL;
1036 static HRESULT WINAPI WMReaderAdvanced2_Preroll(IWMReaderAdvanced6 *iface, QWORD start, QWORD duration, float rate)
1038 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1039 FIXME("(%p)->(%s %s %f)\n", This, wine_dbgstr_longlong(start), wine_dbgstr_longlong(duration), rate);
1040 return E_NOTIMPL;
1043 static HRESULT WINAPI WMReaderAdvanced2_SetLogClientID(IWMReaderAdvanced6 *iface, BOOL log_client_id)
1045 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1046 FIXME("(%p)->(%x)\n", This, log_client_id);
1047 return E_NOTIMPL;
1050 static HRESULT WINAPI WMReaderAdvanced2_GetLogClientID(IWMReaderAdvanced6 *iface, BOOL *log_client_id)
1052 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1053 FIXME("(%p)->(%p)\n", This, log_client_id);
1054 return E_NOTIMPL;
1057 static HRESULT WINAPI WMReaderAdvanced2_StopBuffering(IWMReaderAdvanced6 *iface)
1059 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1060 FIXME("(%p)\n", This);
1061 return E_NOTIMPL;
1064 static HRESULT WINAPI WMReaderAdvanced2_OpenStream(IWMReaderAdvanced6 *iface,
1065 IStream *stream, IWMReaderCallback *callback, void *context)
1067 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
1068 HRESULT hr;
1070 TRACE("reader %p, stream %p, callback %p, context %p.\n", reader, stream, callback, context);
1072 EnterCriticalSection(&reader->cs);
1074 if (SUCCEEDED(hr = IWMSyncReader2_OpenStream(reader->reader, stream))
1075 && FAILED(hr = async_reader_open(reader, callback, context)))
1076 IWMSyncReader2_Close(reader->reader);
1078 LeaveCriticalSection(&reader->cs);
1079 return hr;
1082 static HRESULT WINAPI WMReaderAdvanced3_StopNetStreaming(IWMReaderAdvanced6 *iface)
1084 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1085 FIXME("(%p)\n", This);
1086 return E_NOTIMPL;
1089 static HRESULT WINAPI WMReaderAdvanced3_StartAtPosition(IWMReaderAdvanced6 *iface, WORD stream_num,
1090 void *offset_start, void *duration, WMT_OFFSET_FORMAT format, float rate, void *context)
1092 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1093 FIXME("(%p)->(%d %p %p %d %f %p)\n", This, stream_num, offset_start, duration, format, rate, context);
1094 return E_NOTIMPL;
1097 static HRESULT WINAPI WMReaderAdvanced4_GetLanguageCount(IWMReaderAdvanced6 *iface, DWORD output_num, WORD *language_count)
1099 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1100 FIXME("(%p)->(%lu %p)\n", This, output_num, language_count);
1101 return E_NOTIMPL;
1104 static HRESULT WINAPI WMReaderAdvanced4_GetLanguage(IWMReaderAdvanced6 *iface, DWORD output_num,
1105 WORD language, WCHAR *language_string, WORD *language_string_len)
1107 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
1109 FIXME("reader %p, output %lu, language %#x, language_string %p, language_string_len %p, stub!\n",
1110 reader, output_num, language, language_string, language_string_len);
1112 return E_NOTIMPL;
1115 static HRESULT WINAPI WMReaderAdvanced4_GetMaxSpeedFactor(IWMReaderAdvanced6 *iface, double *factor)
1117 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1118 FIXME("(%p)->(%p)\n", This, factor);
1119 return E_NOTIMPL;
1122 static HRESULT WINAPI WMReaderAdvanced4_IsUsingFastCache(IWMReaderAdvanced6 *iface, BOOL *using_fast_cache)
1124 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1125 FIXME("(%p)->(%p)\n", This, using_fast_cache);
1126 return E_NOTIMPL;
1129 static HRESULT WINAPI WMReaderAdvanced4_AddLogParam(IWMReaderAdvanced6 *iface, const WCHAR *namespace,
1130 const WCHAR *name, const WCHAR *value)
1132 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1133 FIXME("(%p)->(%s %s %s)\n", This, debugstr_w(namespace), debugstr_w(name), debugstr_w(value));
1134 return E_NOTIMPL;
1137 static HRESULT WINAPI WMReaderAdvanced4_SendLogParams(IWMReaderAdvanced6 *iface)
1139 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1140 FIXME("(%p)\n", This);
1141 return E_NOTIMPL;
1144 static HRESULT WINAPI WMReaderAdvanced4_CanSaveFileAs(IWMReaderAdvanced6 *iface, BOOL *can_save)
1146 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1147 FIXME("(%p)->(%p)\n", This, can_save);
1148 return E_NOTIMPL;
1151 static HRESULT WINAPI WMReaderAdvanced4_CancelSaveFileAs(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_GetURL(IWMReaderAdvanced6 *iface, WCHAR *url, DWORD *url_len)
1160 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
1161 FIXME("(%p)->(%p %p)\n", This, url, url_len);
1162 return E_NOTIMPL;
1165 static HRESULT WINAPI WMReaderAdvanced5_SetPlayerHook(IWMReaderAdvanced6 *iface, DWORD output_num, IWMPlayerHook *hook)
1167 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
1169 FIXME("reader %p, output %lu, hook %p, stub!\n", reader, output_num, hook);
1171 return E_NOTIMPL;
1174 static HRESULT WINAPI WMReaderAdvanced6_SetProtectStreamSamples(IWMReaderAdvanced6 *iface, BYTE *cert,
1175 DWORD cert_size, DWORD cert_type, DWORD flags, BYTE *initialization_vector, DWORD *initialization_vector_size)
1177 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
1179 FIXME("reader %p, cert %p, cert_size %lu, cert_type %#lx, flags %#lx, vector %p, vector_size %p, stub!\n",
1180 reader, cert, cert_size, cert_type, flags, initialization_vector, initialization_vector_size);
1182 return E_NOTIMPL;
1185 static const IWMReaderAdvanced6Vtbl WMReaderAdvanced6Vtbl = {
1186 WMReaderAdvanced_QueryInterface,
1187 WMReaderAdvanced_AddRef,
1188 WMReaderAdvanced_Release,
1189 WMReaderAdvanced_SetUserProvidedClock,
1190 WMReaderAdvanced_GetUserProvidedClock,
1191 WMReaderAdvanced_DeliverTime,
1192 WMReaderAdvanced_SetManualStreamSelection,
1193 WMReaderAdvanced_GetManualStreamSelection,
1194 WMReaderAdvanced_SetStreamsSelected,
1195 WMReaderAdvanced_GetStreamSelected,
1196 WMReaderAdvanced_SetReceiveSelectionCallbacks,
1197 WMReaderAdvanced_GetReceiveSelectionCallbacks,
1198 WMReaderAdvanced_SetReceiveStreamSamples,
1199 WMReaderAdvanced_GetReceiveStreamSamples,
1200 WMReaderAdvanced_SetAllocateForOutput,
1201 WMReaderAdvanced_GetAllocateForOutput,
1202 WMReaderAdvanced_SetAllocateForStream,
1203 WMReaderAdvanced_GetAllocateForStream,
1204 WMReaderAdvanced_GetStatistics,
1205 WMReaderAdvanced_SetClientInfo,
1206 WMReaderAdvanced_GetMaxOutputSampleSize,
1207 WMReaderAdvanced_GetMaxStreamSampleSize,
1208 WMReaderAdvanced_NotifyLateDelivery,
1209 WMReaderAdvanced2_SetPlayMode,
1210 WMReaderAdvanced2_GetPlayMode,
1211 WMReaderAdvanced2_GetBufferProgress,
1212 WMReaderAdvanced2_GetDownloadProgress,
1213 WMReaderAdvanced2_GetSaveAsProgress,
1214 WMReaderAdvanced2_SaveFileAs,
1215 WMReaderAdvanced2_GetProtocolName,
1216 WMReaderAdvanced2_StartAtMarker,
1217 WMReaderAdvanced2_GetOutputSetting,
1218 WMReaderAdvanced2_SetOutputSetting,
1219 WMReaderAdvanced2_Preroll,
1220 WMReaderAdvanced2_SetLogClientID,
1221 WMReaderAdvanced2_GetLogClientID,
1222 WMReaderAdvanced2_StopBuffering,
1223 WMReaderAdvanced2_OpenStream,
1224 WMReaderAdvanced3_StopNetStreaming,
1225 WMReaderAdvanced3_StartAtPosition,
1226 WMReaderAdvanced4_GetLanguageCount,
1227 WMReaderAdvanced4_GetLanguage,
1228 WMReaderAdvanced4_GetMaxSpeedFactor,
1229 WMReaderAdvanced4_IsUsingFastCache,
1230 WMReaderAdvanced4_AddLogParam,
1231 WMReaderAdvanced4_SendLogParams,
1232 WMReaderAdvanced4_CanSaveFileAs,
1233 WMReaderAdvanced4_CancelSaveFileAs,
1234 WMReaderAdvanced4_GetURL,
1235 WMReaderAdvanced5_SetPlayerHook,
1236 WMReaderAdvanced6_SetProtectStreamSamples
1239 static struct async_reader *impl_from_IWMReaderAccelerator(IWMReaderAccelerator *iface)
1241 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderAccelerator_iface);
1244 static HRESULT WINAPI reader_accl_QueryInterface(IWMReaderAccelerator *iface, REFIID iid, void **out)
1246 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
1247 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
1250 static ULONG WINAPI reader_accl_AddRef(IWMReaderAccelerator *iface)
1252 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
1253 return IWMReader_AddRef(&reader->IWMReader_iface);
1256 static ULONG WINAPI reader_accl_Release(IWMReaderAccelerator *iface)
1258 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
1259 return IWMReader_Release(&reader->IWMReader_iface);
1262 static HRESULT WINAPI reader_accl_GetCodecInterface(IWMReaderAccelerator *iface, DWORD output, REFIID riid, void **codec)
1264 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
1266 FIXME("reader %p, output %lu, iid %s, codec %p, stub!\n", reader, output, debugstr_guid(riid), codec);
1268 return E_NOTIMPL;
1271 static HRESULT WINAPI reader_accl_Notify(IWMReaderAccelerator *iface, DWORD output, WM_MEDIA_TYPE *subtype)
1273 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
1275 FIXME("reader %p, output %lu, subtype %p, stub!\n", reader, output, subtype);
1277 return E_NOTIMPL;
1280 static const IWMReaderAcceleratorVtbl WMReaderAcceleratorVtbl = {
1281 reader_accl_QueryInterface,
1282 reader_accl_AddRef,
1283 reader_accl_Release,
1284 reader_accl_GetCodecInterface,
1285 reader_accl_Notify
1288 static struct async_reader *impl_from_IWMReaderNetworkConfig2(IWMReaderNetworkConfig2 *iface)
1290 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderNetworkConfig2_iface);
1293 static HRESULT WINAPI networkconfig_QueryInterface(IWMReaderNetworkConfig2 *iface, REFIID iid, void **out)
1295 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1296 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
1299 static ULONG WINAPI networkconfig_AddRef(IWMReaderNetworkConfig2 *iface)
1301 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1302 return IWMReader_AddRef(&reader->IWMReader_iface);
1305 static ULONG WINAPI networkconfig_Release(IWMReaderNetworkConfig2 *iface)
1307 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1308 return IWMReader_Release(&reader->IWMReader_iface);
1311 static HRESULT WINAPI networkconfig_GetBufferingTime(IWMReaderNetworkConfig2 *iface, QWORD *buffering_time)
1313 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1314 FIXME("%p, %p\n", This, buffering_time);
1315 return E_NOTIMPL;
1318 static HRESULT WINAPI networkconfig_SetBufferingTime(IWMReaderNetworkConfig2 *iface, QWORD buffering_time)
1320 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1321 FIXME("%p, %s\n", This, wine_dbgstr_longlong(buffering_time));
1322 return E_NOTIMPL;
1325 static HRESULT WINAPI networkconfig_GetUDPPortRanges(IWMReaderNetworkConfig2 *iface, WM_PORT_NUMBER_RANGE *array,
1326 DWORD *ranges)
1328 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1329 FIXME("%p, %p, %p\n", This, array, ranges);
1330 return E_NOTIMPL;
1333 static HRESULT WINAPI networkconfig_SetUDPPortRanges(IWMReaderNetworkConfig2 *iface,
1334 WM_PORT_NUMBER_RANGE *ranges, DWORD count)
1336 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1338 FIXME("reader %p, ranges %p, count %lu.\n", reader, ranges, count);
1340 return E_NOTIMPL;
1343 static HRESULT WINAPI networkconfig_GetProxySettings(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1344 WMT_PROXY_SETTINGS *proxy)
1346 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1347 FIXME("%p, %s, %p\n", This, debugstr_w(protocol), proxy);
1348 return E_NOTIMPL;
1351 static HRESULT WINAPI networkconfig_SetProxySettings(IWMReaderNetworkConfig2 *iface, LPCWSTR protocol,
1352 WMT_PROXY_SETTINGS proxy)
1354 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1355 FIXME("%p, %s, %d\n", This, debugstr_w(protocol), proxy);
1356 return E_NOTIMPL;
1359 static HRESULT WINAPI networkconfig_GetProxyHostName(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1360 WCHAR *hostname, DWORD *size)
1362 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1363 FIXME("%p, %s, %p, %p\n", This, debugstr_w(protocol), hostname, size);
1364 return E_NOTIMPL;
1367 static HRESULT WINAPI networkconfig_SetProxyHostName(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1368 const WCHAR *hostname)
1370 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1371 FIXME("%p, %s, %s\n", This, debugstr_w(protocol), debugstr_w(hostname));
1372 return E_NOTIMPL;
1375 static HRESULT WINAPI networkconfig_GetProxyPort(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1376 DWORD *port)
1378 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1379 FIXME("%p, %s, %p\n", This, debugstr_w(protocol), port);
1380 return E_NOTIMPL;
1383 static HRESULT WINAPI networkconfig_SetProxyPort(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1384 DWORD port)
1386 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1388 FIXME("reader %p, protocol %s, port %lu, stub!\n", reader, debugstr_w(protocol), port);
1390 return E_NOTIMPL;
1393 static HRESULT WINAPI networkconfig_GetProxyExceptionList(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1394 WCHAR *exceptions, DWORD *count)
1396 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1397 FIXME("%p, %s, %p, %p\n", This, debugstr_w(protocol), exceptions, count);
1398 return E_NOTIMPL;
1401 static HRESULT WINAPI networkconfig_SetProxyExceptionList(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1402 const WCHAR *exceptions)
1404 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1405 FIXME("%p, %s, %s\n", This, debugstr_w(protocol), debugstr_w(exceptions));
1406 return E_NOTIMPL;
1409 static HRESULT WINAPI networkconfig_GetProxyBypassForLocal(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1410 BOOL *bypass)
1412 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1413 FIXME("%p, %s, %p\n", This, debugstr_w(protocol), bypass);
1414 return E_NOTIMPL;
1417 static HRESULT WINAPI networkconfig_SetProxyBypassForLocal(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1418 BOOL bypass)
1420 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1421 FIXME("%p, %s, %d\n", This, debugstr_w(protocol), bypass);
1422 return E_NOTIMPL;
1425 static HRESULT WINAPI networkconfig_GetForceRerunAutoProxyDetection(IWMReaderNetworkConfig2 *iface,
1426 BOOL *detection)
1428 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1429 FIXME("%p, %p\n", This, detection);
1430 return E_NOTIMPL;
1433 static HRESULT WINAPI networkconfig_SetForceRerunAutoProxyDetection(IWMReaderNetworkConfig2 *iface,
1434 BOOL detection)
1436 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1437 FIXME("%p, %d\n", This, detection);
1438 return E_NOTIMPL;
1441 static HRESULT WINAPI networkconfig_GetEnableMulticast(IWMReaderNetworkConfig2 *iface, BOOL *multicast)
1443 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1444 FIXME("%p, %p\n", This, multicast);
1445 return E_NOTIMPL;
1448 static HRESULT WINAPI networkconfig_SetEnableMulticast(IWMReaderNetworkConfig2 *iface, BOOL multicast)
1450 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1451 FIXME("%p, %d\n", This, multicast);
1452 return E_NOTIMPL;
1455 static HRESULT WINAPI networkconfig_GetEnableHTTP(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1457 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1458 FIXME("%p, %p\n", This, enable);
1459 return E_NOTIMPL;
1462 static HRESULT WINAPI networkconfig_SetEnableHTTP(IWMReaderNetworkConfig2 *iface, BOOL enable)
1464 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1465 FIXME("%p, %d\n", This, enable);
1466 return E_NOTIMPL;
1469 static HRESULT WINAPI networkconfig_GetEnableUDP(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_SetEnableUDP(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_GetEnableTCP(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_SetEnableTCP(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_ResetProtocolRollover(IWMReaderNetworkConfig2 *iface)
1499 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1500 FIXME("%p\n", This);
1501 return E_NOTIMPL;
1504 static HRESULT WINAPI networkconfig_GetConnectionBandwidth(IWMReaderNetworkConfig2 *iface, DWORD *bandwidth)
1506 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1507 FIXME("%p, %p\n", This, bandwidth);
1508 return E_NOTIMPL;
1511 static HRESULT WINAPI networkconfig_SetConnectionBandwidth(IWMReaderNetworkConfig2 *iface, DWORD bandwidth)
1513 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1515 FIXME("reader %p, bandwidth %lu, stub!\n", reader, bandwidth);
1517 return E_NOTIMPL;
1520 static HRESULT WINAPI networkconfig_GetNumProtocolsSupported(IWMReaderNetworkConfig2 *iface, DWORD *protocols)
1522 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1523 FIXME("%p, %p\n", This, protocols);
1524 return E_NOTIMPL;
1527 static HRESULT WINAPI networkconfig_GetSupportedProtocolName(IWMReaderNetworkConfig2 *iface, DWORD protocol_num,
1528 WCHAR *protocol, DWORD *size)
1530 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1532 FIXME("reader %p, index %lu, protocol %p, size %p, stub!\n", reader, protocol_num, protocol, size);
1534 return E_NOTIMPL;
1537 static HRESULT WINAPI networkconfig_AddLoggingUrl(IWMReaderNetworkConfig2 *iface, const WCHAR *url)
1539 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1540 FIXME("%p, %s\n", This, debugstr_w(url));
1541 return E_NOTIMPL;
1544 static HRESULT WINAPI networkconfig_GetLoggingUrl(IWMReaderNetworkConfig2 *iface, DWORD index, WCHAR *url,
1545 DWORD *size)
1547 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1549 FIXME("reader %p, index %lu, url %p, size %p, stub!\n", reader, index, url, size);
1551 return E_NOTIMPL;
1554 static HRESULT WINAPI networkconfig_GetLoggingUrlCount(IWMReaderNetworkConfig2 *iface, DWORD *count)
1556 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1557 FIXME("%p, %p\n", This, count);
1558 return E_NOTIMPL;
1561 static HRESULT WINAPI networkconfig_ResetLoggingUrlList(IWMReaderNetworkConfig2 *iface)
1563 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1564 FIXME("%p\n", This);
1565 return E_NOTIMPL;
1568 static HRESULT WINAPI networkconfig_GetEnableContentCaching(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1570 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1571 FIXME("%p, %p\n", This, enable);
1572 return E_NOTIMPL;
1575 static HRESULT WINAPI networkconfig_SetEnableContentCaching(IWMReaderNetworkConfig2 *iface, BOOL enable)
1577 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1578 FIXME("%p, %d\n", This, enable);
1579 return E_NOTIMPL;
1582 static HRESULT WINAPI networkconfig_GetEnableFastCache(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_SetEnableFastCache(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_GetAcceleratedStreamingDuration(IWMReaderNetworkConfig2 *iface,
1597 QWORD *duration)
1599 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1600 FIXME("%p, %p\n", This, duration);
1601 return E_NOTIMPL;
1604 static HRESULT WINAPI networkconfig_SetAcceleratedStreamingDuration(IWMReaderNetworkConfig2 *iface,
1605 QWORD duration)
1607 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1608 FIXME("%p, %s\n", This, wine_dbgstr_longlong(duration));
1609 return E_NOTIMPL;
1612 static HRESULT WINAPI networkconfig_GetAutoReconnectLimit(IWMReaderNetworkConfig2 *iface, DWORD *limit)
1614 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1615 FIXME("%p, %p\n", This, limit);
1616 return E_NOTIMPL;
1619 static HRESULT WINAPI networkconfig_SetAutoReconnectLimit(IWMReaderNetworkConfig2 *iface, DWORD limit)
1621 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1623 FIXME("reader %p, limit %lu, stub!\n", reader, limit);
1625 return E_NOTIMPL;
1628 static HRESULT WINAPI networkconfig_GetEnableResends(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1630 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1631 FIXME("%p, %p\n", This, enable);
1632 return E_NOTIMPL;
1635 static HRESULT WINAPI networkconfig_SetEnableResends(IWMReaderNetworkConfig2 *iface, BOOL enable)
1637 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1638 FIXME("%p, %u\n", This, enable);
1639 return E_NOTIMPL;
1642 static HRESULT WINAPI networkconfig_GetEnableThinning(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_SetEnableThinning(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_GetMaxNetPacketSize(IWMReaderNetworkConfig2 *iface, DWORD *packet_size)
1658 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1659 FIXME("%p, %p\n", This, packet_size);
1660 return E_NOTIMPL;
1663 static const IWMReaderNetworkConfig2Vtbl WMReaderNetworkConfig2Vtbl =
1665 networkconfig_QueryInterface,
1666 networkconfig_AddRef,
1667 networkconfig_Release,
1668 networkconfig_GetBufferingTime,
1669 networkconfig_SetBufferingTime,
1670 networkconfig_GetUDPPortRanges,
1671 networkconfig_SetUDPPortRanges,
1672 networkconfig_GetProxySettings,
1673 networkconfig_SetProxySettings,
1674 networkconfig_GetProxyHostName,
1675 networkconfig_SetProxyHostName,
1676 networkconfig_GetProxyPort,
1677 networkconfig_SetProxyPort,
1678 networkconfig_GetProxyExceptionList,
1679 networkconfig_SetProxyExceptionList,
1680 networkconfig_GetProxyBypassForLocal,
1681 networkconfig_SetProxyBypassForLocal,
1682 networkconfig_GetForceRerunAutoProxyDetection,
1683 networkconfig_SetForceRerunAutoProxyDetection,
1684 networkconfig_GetEnableMulticast,
1685 networkconfig_SetEnableMulticast,
1686 networkconfig_GetEnableHTTP,
1687 networkconfig_SetEnableHTTP,
1688 networkconfig_GetEnableUDP,
1689 networkconfig_SetEnableUDP,
1690 networkconfig_GetEnableTCP,
1691 networkconfig_SetEnableTCP,
1692 networkconfig_ResetProtocolRollover,
1693 networkconfig_GetConnectionBandwidth,
1694 networkconfig_SetConnectionBandwidth,
1695 networkconfig_GetNumProtocolsSupported,
1696 networkconfig_GetSupportedProtocolName,
1697 networkconfig_AddLoggingUrl,
1698 networkconfig_GetLoggingUrl,
1699 networkconfig_GetLoggingUrlCount,
1700 networkconfig_ResetLoggingUrlList,
1701 networkconfig_GetEnableContentCaching,
1702 networkconfig_SetEnableContentCaching,
1703 networkconfig_GetEnableFastCache,
1704 networkconfig_SetEnableFastCache,
1705 networkconfig_GetAcceleratedStreamingDuration,
1706 networkconfig_SetAcceleratedStreamingDuration,
1707 networkconfig_GetAutoReconnectLimit,
1708 networkconfig_SetAutoReconnectLimit,
1709 networkconfig_GetEnableResends,
1710 networkconfig_SetEnableResends,
1711 networkconfig_GetEnableThinning,
1712 networkconfig_SetEnableThinning,
1713 networkconfig_GetMaxNetPacketSize
1716 static struct async_reader *impl_from_IWMReaderStreamClock(IWMReaderStreamClock *iface)
1718 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderStreamClock_iface);
1721 static HRESULT WINAPI readclock_QueryInterface(IWMReaderStreamClock *iface, REFIID iid, void **out)
1723 struct async_reader *reader = impl_from_IWMReaderStreamClock(iface);
1724 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
1727 static ULONG WINAPI readclock_AddRef(IWMReaderStreamClock *iface)
1729 struct async_reader *reader = impl_from_IWMReaderStreamClock(iface);
1730 return IWMReader_AddRef(&reader->IWMReader_iface);
1733 static ULONG WINAPI readclock_Release(IWMReaderStreamClock *iface)
1735 struct async_reader *reader = impl_from_IWMReaderStreamClock(iface);
1736 return IWMReader_Release(&reader->IWMReader_iface);
1739 static HRESULT WINAPI readclock_GetTime(IWMReaderStreamClock *iface, QWORD *now)
1741 struct async_reader *This = impl_from_IWMReaderStreamClock(iface);
1742 FIXME("%p, %p\n", This, now);
1743 return E_NOTIMPL;
1746 static HRESULT WINAPI readclock_SetTimer(IWMReaderStreamClock *iface, QWORD when, void *param, DWORD *id)
1748 struct async_reader *This = impl_from_IWMReaderStreamClock(iface);
1749 FIXME("%p, %s, %p, %p\n", This, wine_dbgstr_longlong(when), param, id);
1750 return E_NOTIMPL;
1753 static HRESULT WINAPI readclock_KillTimer(IWMReaderStreamClock *iface, DWORD id)
1755 struct async_reader *reader = impl_from_IWMReaderStreamClock(iface);
1757 FIXME("reader %p, id %lu, stub!\n", reader, id);
1759 return E_NOTIMPL;
1762 static const IWMReaderStreamClockVtbl WMReaderStreamClockVtbl =
1764 readclock_QueryInterface,
1765 readclock_AddRef,
1766 readclock_Release,
1767 readclock_GetTime,
1768 readclock_SetTimer,
1769 readclock_KillTimer
1772 static struct async_reader *impl_from_IWMReaderTypeNegotiation(IWMReaderTypeNegotiation *iface)
1774 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderTypeNegotiation_iface);
1777 static HRESULT WINAPI negotiation_QueryInterface(IWMReaderTypeNegotiation *iface, REFIID iid, void **out)
1779 struct async_reader *reader = impl_from_IWMReaderTypeNegotiation(iface);
1780 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
1783 static ULONG WINAPI negotiation_AddRef(IWMReaderTypeNegotiation *iface)
1785 struct async_reader *reader = impl_from_IWMReaderTypeNegotiation(iface);
1786 return IWMReader_AddRef(&reader->IWMReader_iface);
1789 static ULONG WINAPI negotiation_Release(IWMReaderTypeNegotiation *iface)
1791 struct async_reader *reader = impl_from_IWMReaderTypeNegotiation(iface);
1792 return IWMReader_Release(&reader->IWMReader_iface);
1795 static HRESULT WINAPI negotiation_TryOutputProps(IWMReaderTypeNegotiation *iface, DWORD output, IWMOutputMediaProps *props)
1797 struct async_reader *reader = impl_from_IWMReaderTypeNegotiation(iface);
1799 FIXME("reader %p, output %lu, props %p, stub!\n", reader, output, props);
1801 return E_NOTIMPL;
1804 static const IWMReaderTypeNegotiationVtbl WMReaderTypeNegotiationVtbl =
1806 negotiation_QueryInterface,
1807 negotiation_AddRef,
1808 negotiation_Release,
1809 negotiation_TryOutputProps
1812 static struct async_reader *impl_from_IReferenceClock(IReferenceClock *iface)
1814 return CONTAINING_RECORD(iface, struct async_reader, IReferenceClock_iface);
1817 static HRESULT WINAPI refclock_QueryInterface(IReferenceClock *iface, REFIID iid, void **out)
1819 struct async_reader *reader = impl_from_IReferenceClock(iface);
1820 return IWMReader_QueryInterface(&reader->IWMReader_iface, iid, out);
1823 static ULONG WINAPI refclock_AddRef(IReferenceClock *iface)
1825 struct async_reader *reader = impl_from_IReferenceClock(iface);
1826 return IWMReader_AddRef(&reader->IWMReader_iface);
1829 static ULONG WINAPI refclock_Release(IReferenceClock *iface)
1831 struct async_reader *reader = impl_from_IReferenceClock(iface);
1832 return IWMReader_Release(&reader->IWMReader_iface);
1835 static HRESULT WINAPI refclock_GetTime(IReferenceClock *iface, REFERENCE_TIME *time)
1837 struct async_reader *This = impl_from_IReferenceClock(iface);
1838 FIXME("%p, %p\n", This, time);
1839 return E_NOTIMPL;
1842 static HRESULT WINAPI refclock_AdviseTime(IReferenceClock *iface, REFERENCE_TIME basetime,
1843 REFERENCE_TIME streamtime, HEVENT event, DWORD_PTR *cookie)
1845 struct async_reader *reader = impl_from_IReferenceClock(iface);
1847 FIXME("reader %p, basetime %s, streamtime %s, event %#Ix, cookie %p, stub!\n",
1848 reader, debugstr_time(basetime), debugstr_time(streamtime), event, cookie);
1850 return E_NOTIMPL;
1853 static HRESULT WINAPI refclock_AdvisePeriodic(IReferenceClock *iface, REFERENCE_TIME starttime,
1854 REFERENCE_TIME period, HSEMAPHORE semaphore, DWORD_PTR *cookie)
1856 struct async_reader *reader = impl_from_IReferenceClock(iface);
1858 FIXME("reader %p, starttime %s, period %s, semaphore %#Ix, cookie %p, stub!\n",
1859 reader, debugstr_time(starttime), debugstr_time(period), semaphore, cookie);
1861 return E_NOTIMPL;
1864 static HRESULT WINAPI refclock_Unadvise(IReferenceClock *iface, DWORD_PTR cookie)
1866 struct async_reader *reader = impl_from_IReferenceClock(iface);
1868 FIXME("reader %p, cookie %Iu, stub!\n", reader, cookie);
1870 return E_NOTIMPL;
1873 static const IReferenceClockVtbl ReferenceClockVtbl =
1875 refclock_QueryInterface,
1876 refclock_AddRef,
1877 refclock_Release,
1878 refclock_GetTime,
1879 refclock_AdviseTime,
1880 refclock_AdvisePeriodic,
1881 refclock_Unadvise
1884 HRESULT WINAPI winegstreamer_create_wm_async_reader(IWMReader **reader)
1886 struct async_reader *object;
1887 HRESULT hr;
1889 TRACE("reader %p.\n", reader);
1891 if (!(object = calloc(1, sizeof(*object))))
1892 return E_OUTOFMEMORY;
1894 object->IReferenceClock_iface.lpVtbl = &ReferenceClockVtbl;
1895 object->IWMReader_iface.lpVtbl = &WMReaderVtbl;
1896 object->IWMReaderAdvanced6_iface.lpVtbl = &WMReaderAdvanced6Vtbl;
1897 object->IWMReaderAccelerator_iface.lpVtbl = &WMReaderAcceleratorVtbl;
1898 object->IWMReaderNetworkConfig2_iface.lpVtbl = &WMReaderNetworkConfig2Vtbl;
1899 object->IWMReaderStreamClock_iface.lpVtbl = &WMReaderStreamClockVtbl;
1900 object->IWMReaderTypeNegotiation_iface.lpVtbl = &WMReaderTypeNegotiationVtbl;
1901 object->refcount = 1;
1903 if (FAILED(hr = winegstreamer_create_wm_sync_reader((IUnknown *)&object->IWMReader_iface,
1904 (void **)&object->reader_inner)))
1905 goto failed;
1907 if (FAILED(hr = IUnknown_QueryInterface(object->reader_inner, &IID_IWMSyncReader2,
1908 (void **)&object->reader)))
1909 goto failed;
1910 IWMReader_Release(&object->IWMReader_iface);
1912 InitializeCriticalSection(&object->cs);
1913 object->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": async_reader.cs");
1914 InitializeCriticalSection(&object->callback_cs);
1915 object->callback_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": async_reader.callback_cs");
1917 QueryPerformanceFrequency(&object->clock_frequency);
1918 list_init(&object->async_ops);
1920 TRACE("Created async reader %p.\n", object);
1921 *reader = (IWMReader *)&object->IWMReader_iface;
1922 return S_OK;
1924 failed:
1925 if (object->reader_inner)
1926 IUnknown_Release(object->reader_inner);
1927 free(object);
1928 return hr;