shlwapi/tests: Link directly to Url*() functions.
[wine.git] / dlls / winegstreamer / wm_asyncreader.c
blob9dfe238028440294100ccec26f86d447b1d7e3e3
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 WINE_DEFAULT_DEBUG_CHANNEL(wmvcore);
23 struct async_reader
25 struct wm_reader reader;
27 IWMReader IWMReader_iface;
28 IWMReaderAdvanced6 IWMReaderAdvanced6_iface;
29 IWMReaderAccelerator IWMReaderAccelerator_iface;
30 IWMReaderNetworkConfig2 IWMReaderNetworkConfig2_iface;
31 IWMReaderStreamClock IWMReaderStreamClock_iface;
32 IWMReaderTypeNegotiation IWMReaderTypeNegotiation_iface;
33 IReferenceClock IReferenceClock_iface;
35 IWMReaderCallback *callback;
36 void *context;
38 LARGE_INTEGER clock_frequency;
39 HANDLE stream_thread;
40 CRITICAL_SECTION stream_cs;
41 CONDITION_VARIABLE stream_cv;
43 bool running;
45 bool user_clock;
46 QWORD user_time;
49 static REFERENCE_TIME get_current_time(const struct async_reader *reader)
51 LARGE_INTEGER time;
53 QueryPerformanceCounter(&time);
54 return (time.QuadPart * 1000) / reader->clock_frequency.QuadPart * 10000;
57 static void open_stream(struct async_reader *reader, IWMReaderCallback *callback, void *context)
59 static const DWORD zero;
60 HRESULT hr;
62 IWMReaderCallback_AddRef(reader->callback = callback);
63 reader->context = context;
64 IWMReaderCallback_OnStatus(callback, WMT_OPENED, S_OK, WMT_TYPE_DWORD, (BYTE *)&zero, context);
66 if (FAILED(hr = IWMReaderCallback_QueryInterface(callback,
67 &IID_IWMReaderCallbackAdvanced, (void **)&reader->reader.callback_advanced)))
68 reader->reader.callback_advanced = NULL;
69 TRACE("Querying for IWMReaderCallbackAdvanced returned %#lx.\n", hr);
72 static DWORD WINAPI stream_thread(void *arg)
74 struct async_reader *reader = arg;
75 WORD i, stream_count = reader->reader.stream_count;
76 IWMReaderCallback *callback = reader->callback;
77 REFERENCE_TIME start_time;
78 static const DWORD zero;
79 QWORD pts, duration;
80 INSSBuffer *sample;
81 DWORD flags;
82 HRESULT hr;
84 start_time = get_current_time(reader);
86 EnterCriticalSection(&reader->stream_cs);
88 while (reader->running)
90 bool all_eos = true;
92 for (i = 0; i < stream_count; ++i)
94 struct wm_stream *stream = &reader->reader.streams[i];
96 if (stream->selection == WMT_OFF)
97 continue;
99 hr = wm_reader_get_stream_sample(stream, &sample, &pts, &duration, &flags);
100 if (hr == S_OK)
102 if (reader->user_clock)
104 QWORD user_time = reader->user_time;
106 if (pts > user_time && reader->reader.callback_advanced)
107 IWMReaderCallbackAdvanced_OnTime(reader->reader.callback_advanced, user_time, reader->context);
108 while (pts > reader->user_time && reader->running)
109 SleepConditionVariableCS(&reader->stream_cv, &reader->stream_cs, INFINITE);
110 if (!reader->running)
112 INSSBuffer_Release(sample);
113 goto out;
116 else
118 for (;;)
120 REFERENCE_TIME current_time = get_current_time(reader);
122 if (pts <= current_time - start_time)
123 break;
125 SleepConditionVariableCS(&reader->stream_cv, &reader->stream_cs,
126 (pts - (current_time - start_time)) / 10000);
128 if (!reader->running)
130 INSSBuffer_Release(sample);
131 goto out;
136 if (stream->read_compressed)
137 hr = IWMReaderCallbackAdvanced_OnStreamSample(reader->reader.callback_advanced,
138 i + 1, pts, duration, flags, sample, reader->context);
139 else
140 hr = IWMReaderCallback_OnSample(callback, i, pts, duration,
141 flags, sample, reader->context);
142 TRACE("Callback returned %#lx.\n", hr);
143 INSSBuffer_Release(sample);
144 all_eos = false;
146 else if (hr != NS_E_NO_MORE_SAMPLES)
148 ERR("Failed to get sample, hr %#lx.\n", hr);
149 LeaveCriticalSection(&reader->stream_cs);
150 return 0;
154 if (all_eos)
156 IWMReaderCallback_OnStatus(callback, WMT_END_OF_STREAMING, S_OK,
157 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
158 IWMReaderCallback_OnStatus(callback, WMT_EOF, S_OK,
159 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
161 if (reader->user_clock && reader->reader.callback_advanced)
163 /* We can only get here if user_time is greater than the PTS
164 * of all samples, in which case we cannot have sent this
165 * notification already. */
166 IWMReaderCallbackAdvanced_OnTime(reader->reader.callback_advanced,
167 reader->user_time, reader->context);
170 TRACE("Reached end of stream; exiting.\n");
171 LeaveCriticalSection(&reader->stream_cs);
172 return 0;
176 out:
177 LeaveCriticalSection(&reader->stream_cs);
179 TRACE("Reader is stopping; exiting.\n");
180 return 0;
183 static void stop_streaming(struct async_reader *reader)
185 if (reader->stream_thread)
187 EnterCriticalSection(&reader->stream_cs);
188 reader->running = false;
189 LeaveCriticalSection(&reader->stream_cs);
190 WakeConditionVariable(&reader->stream_cv);
191 WaitForSingleObject(reader->stream_thread, INFINITE);
192 CloseHandle(reader->stream_thread);
193 reader->stream_thread = NULL;
197 static struct async_reader *impl_from_IWMReader(IWMReader *iface)
199 return CONTAINING_RECORD(iface, struct async_reader, IWMReader_iface);
202 static HRESULT WINAPI WMReader_QueryInterface(IWMReader *iface, REFIID iid, void **out)
204 struct async_reader *reader = impl_from_IWMReader(iface);
206 return IWMProfile3_QueryInterface(&reader->reader.IWMProfile3_iface, iid, out);
209 static ULONG WINAPI WMReader_AddRef(IWMReader *iface)
211 struct async_reader *reader = impl_from_IWMReader(iface);
213 return IWMProfile3_AddRef(&reader->reader.IWMProfile3_iface);
216 static ULONG WINAPI WMReader_Release(IWMReader *iface)
218 struct async_reader *reader = impl_from_IWMReader(iface);
220 return IWMProfile3_Release(&reader->reader.IWMProfile3_iface);
223 static HRESULT WINAPI WMReader_Open(IWMReader *iface, const WCHAR *url,
224 IWMReaderCallback *callback, void *context)
226 struct async_reader *reader = impl_from_IWMReader(iface);
227 HRESULT hr;
229 TRACE("reader %p, url %s, callback %p, context %p.\n",
230 reader, debugstr_w(url), callback, context);
232 EnterCriticalSection(&reader->reader.cs);
234 if (SUCCEEDED(hr = wm_reader_open_file(&reader->reader, url)))
235 open_stream(reader, callback, context);
237 LeaveCriticalSection(&reader->reader.cs);
238 return hr;
241 static HRESULT WINAPI WMReader_Close(IWMReader *iface)
243 struct async_reader *reader = impl_from_IWMReader(iface);
244 static const DWORD zero;
245 HRESULT hr;
247 TRACE("reader %p.\n", reader);
249 EnterCriticalSection(&reader->reader.cs);
251 stop_streaming(reader);
253 hr = wm_reader_close(&reader->reader);
254 if (reader->callback)
256 IWMReaderCallback_OnStatus(reader->callback, WMT_CLOSED, S_OK,
257 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
258 IWMReaderCallback_Release(reader->callback);
260 reader->callback = NULL;
262 LeaveCriticalSection(&reader->reader.cs);
264 return hr;
267 static HRESULT WINAPI WMReader_GetOutputCount(IWMReader *iface, DWORD *count)
269 struct async_reader *reader = impl_from_IWMReader(iface);
271 TRACE("reader %p, count %p.\n", reader, count);
273 EnterCriticalSection(&reader->reader.cs);
274 *count = reader->reader.stream_count;
275 LeaveCriticalSection(&reader->reader.cs);
276 return S_OK;
279 static HRESULT WINAPI WMReader_GetOutputProps(IWMReader *iface, DWORD output, IWMOutputMediaProps **props)
281 struct async_reader *reader = impl_from_IWMReader(iface);
283 TRACE("reader %p, output %lu, props %p.\n", reader, output, props);
285 return wm_reader_get_output_props(&reader->reader, output, props);
288 static HRESULT WINAPI WMReader_SetOutputProps(IWMReader *iface, DWORD output, IWMOutputMediaProps *props)
290 struct async_reader *reader = impl_from_IWMReader(iface);
292 TRACE("reader %p, output %lu, props %p.\n", reader, output, props);
294 return wm_reader_set_output_props(&reader->reader, output, props);
297 static HRESULT WINAPI WMReader_GetOutputFormatCount(IWMReader *iface, DWORD output, DWORD *count)
299 struct async_reader *reader = impl_from_IWMReader(iface);
301 TRACE("reader %p, output %lu, count %p.\n", reader, output, count);
303 return wm_reader_get_output_format_count(&reader->reader, output, count);
306 static HRESULT WINAPI WMReader_GetOutputFormat(IWMReader *iface, DWORD output,
307 DWORD index, IWMOutputMediaProps **props)
309 struct async_reader *reader = impl_from_IWMReader(iface);
311 TRACE("reader %p, output %lu, index %lu, props %p.\n", reader, output, index, props);
313 return wm_reader_get_output_format(&reader->reader, output, index, props);
316 static HRESULT WINAPI WMReader_Start(IWMReader *iface,
317 QWORD start, QWORD duration, float rate, void *context)
319 struct async_reader *reader = impl_from_IWMReader(iface);
320 static const DWORD zero;
322 TRACE("reader %p, start %s, duration %s, rate %.8e, context %p.\n",
323 reader, debugstr_time(start), debugstr_time(duration), rate, context);
325 if (rate != 1.0f)
326 FIXME("Ignoring rate %.8e.\n", rate);
328 EnterCriticalSection(&reader->reader.cs);
330 stop_streaming(reader);
332 IWMReaderCallback_OnStatus(reader->callback, WMT_STARTED, S_OK, WMT_TYPE_DWORD, (BYTE *)&zero, context);
333 reader->context = context;
335 wm_reader_seek(&reader->reader, start, duration);
337 reader->running = true;
338 reader->user_time = 0;
340 if (!(reader->stream_thread = CreateThread(NULL, 0, stream_thread, reader, 0, NULL)))
342 LeaveCriticalSection(&reader->reader.cs);
343 return E_OUTOFMEMORY;
346 LeaveCriticalSection(&reader->reader.cs);
347 WakeConditionVariable(&reader->stream_cv);
349 return S_OK;
352 static HRESULT WINAPI WMReader_Stop(IWMReader *iface)
354 struct async_reader *reader = impl_from_IWMReader(iface);
355 static const DWORD zero;
357 TRACE("reader %p.\n", reader);
359 EnterCriticalSection(&reader->reader.cs);
361 if (!reader->reader.wg_parser)
363 LeaveCriticalSection(&reader->reader.cs);
364 WARN("No stream is open; returning E_UNEXPECTED.\n");
365 return E_UNEXPECTED;
368 stop_streaming(reader);
369 IWMReaderCallback_OnStatus(reader->callback, WMT_STOPPED, S_OK,
370 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
371 LeaveCriticalSection(&reader->reader.cs);
372 return S_OK;
375 static HRESULT WINAPI WMReader_Pause(IWMReader *iface)
377 struct async_reader *This = impl_from_IWMReader(iface);
378 FIXME("(%p)\n", This);
379 return E_NOTIMPL;
382 static HRESULT WINAPI WMReader_Resume(IWMReader *iface)
384 struct async_reader *This = impl_from_IWMReader(iface);
385 FIXME("(%p)\n", This);
386 return E_NOTIMPL;
389 static const IWMReaderVtbl WMReaderVtbl = {
390 WMReader_QueryInterface,
391 WMReader_AddRef,
392 WMReader_Release,
393 WMReader_Open,
394 WMReader_Close,
395 WMReader_GetOutputCount,
396 WMReader_GetOutputProps,
397 WMReader_SetOutputProps,
398 WMReader_GetOutputFormatCount,
399 WMReader_GetOutputFormat,
400 WMReader_Start,
401 WMReader_Stop,
402 WMReader_Pause,
403 WMReader_Resume
406 static struct async_reader *impl_from_IWMReaderAdvanced6(IWMReaderAdvanced6 *iface)
408 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderAdvanced6_iface);
411 static HRESULT WINAPI WMReaderAdvanced_QueryInterface(IWMReaderAdvanced6 *iface, REFIID riid, void **ppv)
413 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
414 return IWMReader_QueryInterface(&This->IWMReader_iface, riid, ppv);
417 static ULONG WINAPI WMReaderAdvanced_AddRef(IWMReaderAdvanced6 *iface)
419 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
420 return IWMReader_AddRef(&This->IWMReader_iface);
423 static ULONG WINAPI WMReaderAdvanced_Release(IWMReaderAdvanced6 *iface)
425 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
426 return IWMReader_Release(&This->IWMReader_iface);
429 static HRESULT WINAPI WMReaderAdvanced_SetUserProvidedClock(IWMReaderAdvanced6 *iface, BOOL user_clock)
431 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
433 TRACE("reader %p, user_clock %d.\n", reader, user_clock);
435 EnterCriticalSection(&reader->stream_cs);
436 reader->user_clock = !!user_clock;
437 LeaveCriticalSection(&reader->stream_cs);
438 return S_OK;
441 static HRESULT WINAPI WMReaderAdvanced_GetUserProvidedClock(IWMReaderAdvanced6 *iface, BOOL *user_clock)
443 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
444 FIXME("(%p)->(%p)\n", This, user_clock);
445 return E_NOTIMPL;
448 static HRESULT WINAPI WMReaderAdvanced_DeliverTime(IWMReaderAdvanced6 *iface, QWORD time)
450 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
452 TRACE("reader %p, time %s.\n", reader, debugstr_time(time));
454 EnterCriticalSection(&reader->stream_cs);
456 if (!reader->user_clock)
458 LeaveCriticalSection(&reader->stream_cs);
459 WARN("Not using a user-provided clock; returning E_UNEXPECTED.\n");
460 return E_UNEXPECTED;
463 reader->user_time = time;
465 LeaveCriticalSection(&reader->stream_cs);
466 WakeConditionVariable(&reader->stream_cv);
467 return S_OK;
470 static HRESULT WINAPI WMReaderAdvanced_SetManualStreamSelection(IWMReaderAdvanced6 *iface, BOOL selection)
472 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
473 FIXME("(%p)->(%x)\n", This, selection);
474 return E_NOTIMPL;
477 static HRESULT WINAPI WMReaderAdvanced_GetManualStreamSelection(IWMReaderAdvanced6 *iface, BOOL *selection)
479 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
480 FIXME("(%p)->(%p)\n", This, selection);
481 return E_NOTIMPL;
484 static HRESULT WINAPI WMReaderAdvanced_SetStreamsSelected(IWMReaderAdvanced6 *iface,
485 WORD count, WORD *stream_numbers, WMT_STREAM_SELECTION *selections)
487 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
489 TRACE("reader %p, count %u, stream_numbers %p, selections %p.\n",
490 reader, count, stream_numbers, selections);
492 return wm_reader_set_streams_selected(&reader->reader, count, stream_numbers, selections);
495 static HRESULT WINAPI WMReaderAdvanced_GetStreamSelected(IWMReaderAdvanced6 *iface,
496 WORD stream_number, WMT_STREAM_SELECTION *selection)
498 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
500 TRACE("reader %p, stream_number %u, selection %p.\n", reader, stream_number, selection);
502 return wm_reader_get_stream_selection(&reader->reader, stream_number, selection);
505 static HRESULT WINAPI WMReaderAdvanced_SetReceiveSelectionCallbacks(IWMReaderAdvanced6 *iface, BOOL get_callbacks)
507 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
508 FIXME("(%p)->(%x)\n", This, get_callbacks);
509 return E_NOTIMPL;
512 static HRESULT WINAPI WMReaderAdvanced_GetReceiveSelectionCallbacks(IWMReaderAdvanced6 *iface, BOOL *get_callbacks)
514 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
515 FIXME("(%p)->(%p)\n", This, get_callbacks);
516 return E_NOTIMPL;
519 static HRESULT WINAPI WMReaderAdvanced_SetReceiveStreamSamples(IWMReaderAdvanced6 *iface,
520 WORD stream_number, BOOL compressed)
522 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
524 TRACE("reader %p, stream_number %u, compressed %d.\n", reader, stream_number, compressed);
526 return wm_reader_set_read_compressed(&reader->reader, stream_number, compressed);
529 static HRESULT WINAPI WMReaderAdvanced_GetReceiveStreamSamples(IWMReaderAdvanced6 *iface, WORD stream_num,
530 BOOL *receive_stream_samples)
532 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
533 FIXME("(%p)->(%d %p)\n", This, stream_num, receive_stream_samples);
534 return E_NOTIMPL;
537 static HRESULT WINAPI WMReaderAdvanced_SetAllocateForOutput(IWMReaderAdvanced6 *iface,
538 DWORD output, BOOL allocate)
540 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
542 TRACE("reader %p, output %lu, allocate %d.\n", reader, output, allocate);
544 return wm_reader_set_allocate_for_output(&reader->reader, output, allocate);
547 static HRESULT WINAPI WMReaderAdvanced_GetAllocateForOutput(IWMReaderAdvanced6 *iface, DWORD output_num, BOOL *allocate)
549 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
551 FIXME("reader %p, output %lu, allocate %p, stub!\n", reader, output_num, allocate);
553 return E_NOTIMPL;
556 static HRESULT WINAPI WMReaderAdvanced_SetAllocateForStream(IWMReaderAdvanced6 *iface,
557 WORD stream_number, BOOL allocate)
559 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
561 TRACE("reader %p, stream_number %u, allocate %d.\n", reader, stream_number, allocate);
563 return wm_reader_set_allocate_for_stream(&reader->reader, stream_number, allocate);
566 static HRESULT WINAPI WMReaderAdvanced_GetAllocateForStream(IWMReaderAdvanced6 *iface, WORD output_num, BOOL *allocate)
568 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
569 FIXME("(%p)->(%d %p)\n", This, output_num, allocate);
570 return E_NOTIMPL;
573 static HRESULT WINAPI WMReaderAdvanced_GetStatistics(IWMReaderAdvanced6 *iface, WM_READER_STATISTICS *statistics)
575 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
576 FIXME("(%p)->(%p)\n", This, statistics);
577 return E_NOTIMPL;
580 static HRESULT WINAPI WMReaderAdvanced_SetClientInfo(IWMReaderAdvanced6 *iface, WM_READER_CLIENTINFO *client_info)
582 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
583 FIXME("(%p)->(%p)\n", This, client_info);
584 return E_NOTIMPL;
587 static HRESULT WINAPI WMReaderAdvanced_GetMaxOutputSampleSize(IWMReaderAdvanced6 *iface, DWORD output, DWORD *max)
589 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
590 FIXME("(%p)->(%lu %p)\n", This, output, max);
591 return E_NOTIMPL;
594 static HRESULT WINAPI WMReaderAdvanced_GetMaxStreamSampleSize(IWMReaderAdvanced6 *iface,
595 WORD stream_number, DWORD *size)
597 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
599 TRACE("reader %p, stream_number %u, size %p.\n", reader, stream_number, size);
601 return wm_reader_get_max_stream_size(&reader->reader, stream_number, size);
604 static HRESULT WINAPI WMReaderAdvanced_NotifyLateDelivery(IWMReaderAdvanced6 *iface, QWORD lateness)
606 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
607 FIXME("(%p)->(%s)\n", This, wine_dbgstr_longlong(lateness));
608 return E_NOTIMPL;
611 static HRESULT WINAPI WMReaderAdvanced2_SetPlayMode(IWMReaderAdvanced6 *iface, WMT_PLAY_MODE mode)
613 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
614 FIXME("(%p)->(%d)\n", This, mode);
615 return E_NOTIMPL;
618 static HRESULT WINAPI WMReaderAdvanced2_GetPlayMode(IWMReaderAdvanced6 *iface, WMT_PLAY_MODE *mode)
620 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
621 FIXME("(%p)->(%p)\n", This, mode);
622 return E_NOTIMPL;
625 static HRESULT WINAPI WMReaderAdvanced2_GetBufferProgress(IWMReaderAdvanced6 *iface, DWORD *percent, QWORD *buffering)
627 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
628 FIXME("(%p)->(%p %p)\n", This, percent, buffering);
629 return E_NOTIMPL;
632 static HRESULT WINAPI WMReaderAdvanced2_GetDownloadProgress(IWMReaderAdvanced6 *iface, DWORD *percent,
633 QWORD *bytes_downloaded, QWORD *download)
635 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
636 FIXME("(%p)->(%p %p %p)\n", This, percent, bytes_downloaded, download);
637 return E_NOTIMPL;
640 static HRESULT WINAPI WMReaderAdvanced2_GetSaveAsProgress(IWMReaderAdvanced6 *iface, DWORD *percent)
642 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
643 FIXME("(%p)->(%p)\n", This, percent);
644 return E_NOTIMPL;
647 static HRESULT WINAPI WMReaderAdvanced2_SaveFileAs(IWMReaderAdvanced6 *iface, const WCHAR *filename)
649 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
650 FIXME("(%p)->(%s)\n", This, debugstr_w(filename));
651 return E_NOTIMPL;
654 static HRESULT WINAPI WMReaderAdvanced2_GetProtocolName(IWMReaderAdvanced6 *iface, WCHAR *protocol, DWORD *protocol_len)
656 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
657 FIXME("(%p)->(%p %p)\n", This, protocol, protocol_len);
658 return E_NOTIMPL;
661 static HRESULT WINAPI WMReaderAdvanced2_StartAtMarker(IWMReaderAdvanced6 *iface, WORD marker_index,
662 QWORD duration, float rate, void *context)
664 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
665 FIXME("(%p)->(%d %s %f %p)\n", This, marker_index, wine_dbgstr_longlong(duration), rate, context);
666 return E_NOTIMPL;
669 static HRESULT WINAPI WMReaderAdvanced2_GetOutputSetting(IWMReaderAdvanced6 *iface, DWORD output_num,
670 const WCHAR *name, WMT_ATTR_DATATYPE *type, BYTE *value, WORD *length)
672 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
673 FIXME("(%p)->(%lu %s %p %p %p)\n", This, output_num, debugstr_w(name), type, value, length);
674 return E_NOTIMPL;
677 static HRESULT WINAPI WMReaderAdvanced2_SetOutputSetting(IWMReaderAdvanced6 *iface, DWORD output_num,
678 const WCHAR *name, WMT_ATTR_DATATYPE type, const BYTE *value, WORD length)
680 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
681 FIXME("(%p)->(%lu %s %#x %p %u)\n", This, output_num, debugstr_w(name), type, value, length);
682 return E_NOTIMPL;
685 static HRESULT WINAPI WMReaderAdvanced2_Preroll(IWMReaderAdvanced6 *iface, QWORD start, QWORD duration, float rate)
687 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
688 FIXME("(%p)->(%s %s %f)\n", This, wine_dbgstr_longlong(start), wine_dbgstr_longlong(duration), rate);
689 return E_NOTIMPL;
692 static HRESULT WINAPI WMReaderAdvanced2_SetLogClientID(IWMReaderAdvanced6 *iface, BOOL log_client_id)
694 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
695 FIXME("(%p)->(%x)\n", This, log_client_id);
696 return E_NOTIMPL;
699 static HRESULT WINAPI WMReaderAdvanced2_GetLogClientID(IWMReaderAdvanced6 *iface, BOOL *log_client_id)
701 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
702 FIXME("(%p)->(%p)\n", This, log_client_id);
703 return E_NOTIMPL;
706 static HRESULT WINAPI WMReaderAdvanced2_StopBuffering(IWMReaderAdvanced6 *iface)
708 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
709 FIXME("(%p)\n", This);
710 return E_NOTIMPL;
713 static HRESULT WINAPI WMReaderAdvanced2_OpenStream(IWMReaderAdvanced6 *iface,
714 IStream *stream, IWMReaderCallback *callback, void *context)
716 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
717 HRESULT hr;
719 TRACE("reader %p, stream %p, callback %p, context %p.\n", reader, stream, callback, context);
721 EnterCriticalSection(&reader->reader.cs);
723 if (SUCCEEDED(hr = wm_reader_open_stream(&reader->reader, stream)))
724 open_stream(reader, callback, context);
726 LeaveCriticalSection(&reader->reader.cs);
727 return hr;
730 static HRESULT WINAPI WMReaderAdvanced3_StopNetStreaming(IWMReaderAdvanced6 *iface)
732 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
733 FIXME("(%p)\n", This);
734 return E_NOTIMPL;
737 static HRESULT WINAPI WMReaderAdvanced3_StartAtPosition(IWMReaderAdvanced6 *iface, WORD stream_num,
738 void *offset_start, void *duration, WMT_OFFSET_FORMAT format, float rate, void *context)
740 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
741 FIXME("(%p)->(%d %p %p %d %f %p)\n", This, stream_num, offset_start, duration, format, rate, context);
742 return E_NOTIMPL;
745 static HRESULT WINAPI WMReaderAdvanced4_GetLanguageCount(IWMReaderAdvanced6 *iface, DWORD output_num, WORD *language_count)
747 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
748 FIXME("(%p)->(%lu %p)\n", This, output_num, language_count);
749 return E_NOTIMPL;
752 static HRESULT WINAPI WMReaderAdvanced4_GetLanguage(IWMReaderAdvanced6 *iface, DWORD output_num,
753 WORD language, WCHAR *language_string, WORD *language_string_len)
755 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
757 FIXME("reader %p, output %lu, language %#x, language_string %p, language_string_len %p, stub!\n",
758 reader, output_num, language, language_string, language_string_len);
760 return E_NOTIMPL;
763 static HRESULT WINAPI WMReaderAdvanced4_GetMaxSpeedFactor(IWMReaderAdvanced6 *iface, double *factor)
765 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
766 FIXME("(%p)->(%p)\n", This, factor);
767 return E_NOTIMPL;
770 static HRESULT WINAPI WMReaderAdvanced4_IsUsingFastCache(IWMReaderAdvanced6 *iface, BOOL *using_fast_cache)
772 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
773 FIXME("(%p)->(%p)\n", This, using_fast_cache);
774 return E_NOTIMPL;
777 static HRESULT WINAPI WMReaderAdvanced4_AddLogParam(IWMReaderAdvanced6 *iface, const WCHAR *namespace,
778 const WCHAR *name, const WCHAR *value)
780 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
781 FIXME("(%p)->(%s %s %s)\n", This, debugstr_w(namespace), debugstr_w(name), debugstr_w(value));
782 return E_NOTIMPL;
785 static HRESULT WINAPI WMReaderAdvanced4_SendLogParams(IWMReaderAdvanced6 *iface)
787 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
788 FIXME("(%p)\n", This);
789 return E_NOTIMPL;
792 static HRESULT WINAPI WMReaderAdvanced4_CanSaveFileAs(IWMReaderAdvanced6 *iface, BOOL *can_save)
794 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
795 FIXME("(%p)->(%p)\n", This, can_save);
796 return E_NOTIMPL;
799 static HRESULT WINAPI WMReaderAdvanced4_CancelSaveFileAs(IWMReaderAdvanced6 *iface)
801 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
802 FIXME("(%p)\n", This);
803 return E_NOTIMPL;
806 static HRESULT WINAPI WMReaderAdvanced4_GetURL(IWMReaderAdvanced6 *iface, WCHAR *url, DWORD *url_len)
808 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
809 FIXME("(%p)->(%p %p)\n", This, url, url_len);
810 return E_NOTIMPL;
813 static HRESULT WINAPI WMReaderAdvanced5_SetPlayerHook(IWMReaderAdvanced6 *iface, DWORD output_num, IWMPlayerHook *hook)
815 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
817 FIXME("reader %p, output %lu, hook %p, stub!\n", reader, output_num, hook);
819 return E_NOTIMPL;
822 static HRESULT WINAPI WMReaderAdvanced6_SetProtectStreamSamples(IWMReaderAdvanced6 *iface, BYTE *cert,
823 DWORD cert_size, DWORD cert_type, DWORD flags, BYTE *initialization_vector, DWORD *initialization_vector_size)
825 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
827 FIXME("reader %p, cert %p, cert_size %lu, cert_type %#lx, flags %#lx, vector %p, vector_size %p, stub!\n",
828 reader, cert, cert_size, cert_type, flags, initialization_vector, initialization_vector_size);
830 return E_NOTIMPL;
833 static const IWMReaderAdvanced6Vtbl WMReaderAdvanced6Vtbl = {
834 WMReaderAdvanced_QueryInterface,
835 WMReaderAdvanced_AddRef,
836 WMReaderAdvanced_Release,
837 WMReaderAdvanced_SetUserProvidedClock,
838 WMReaderAdvanced_GetUserProvidedClock,
839 WMReaderAdvanced_DeliverTime,
840 WMReaderAdvanced_SetManualStreamSelection,
841 WMReaderAdvanced_GetManualStreamSelection,
842 WMReaderAdvanced_SetStreamsSelected,
843 WMReaderAdvanced_GetStreamSelected,
844 WMReaderAdvanced_SetReceiveSelectionCallbacks,
845 WMReaderAdvanced_GetReceiveSelectionCallbacks,
846 WMReaderAdvanced_SetReceiveStreamSamples,
847 WMReaderAdvanced_GetReceiveStreamSamples,
848 WMReaderAdvanced_SetAllocateForOutput,
849 WMReaderAdvanced_GetAllocateForOutput,
850 WMReaderAdvanced_SetAllocateForStream,
851 WMReaderAdvanced_GetAllocateForStream,
852 WMReaderAdvanced_GetStatistics,
853 WMReaderAdvanced_SetClientInfo,
854 WMReaderAdvanced_GetMaxOutputSampleSize,
855 WMReaderAdvanced_GetMaxStreamSampleSize,
856 WMReaderAdvanced_NotifyLateDelivery,
857 WMReaderAdvanced2_SetPlayMode,
858 WMReaderAdvanced2_GetPlayMode,
859 WMReaderAdvanced2_GetBufferProgress,
860 WMReaderAdvanced2_GetDownloadProgress,
861 WMReaderAdvanced2_GetSaveAsProgress,
862 WMReaderAdvanced2_SaveFileAs,
863 WMReaderAdvanced2_GetProtocolName,
864 WMReaderAdvanced2_StartAtMarker,
865 WMReaderAdvanced2_GetOutputSetting,
866 WMReaderAdvanced2_SetOutputSetting,
867 WMReaderAdvanced2_Preroll,
868 WMReaderAdvanced2_SetLogClientID,
869 WMReaderAdvanced2_GetLogClientID,
870 WMReaderAdvanced2_StopBuffering,
871 WMReaderAdvanced2_OpenStream,
872 WMReaderAdvanced3_StopNetStreaming,
873 WMReaderAdvanced3_StartAtPosition,
874 WMReaderAdvanced4_GetLanguageCount,
875 WMReaderAdvanced4_GetLanguage,
876 WMReaderAdvanced4_GetMaxSpeedFactor,
877 WMReaderAdvanced4_IsUsingFastCache,
878 WMReaderAdvanced4_AddLogParam,
879 WMReaderAdvanced4_SendLogParams,
880 WMReaderAdvanced4_CanSaveFileAs,
881 WMReaderAdvanced4_CancelSaveFileAs,
882 WMReaderAdvanced4_GetURL,
883 WMReaderAdvanced5_SetPlayerHook,
884 WMReaderAdvanced6_SetProtectStreamSamples
887 static struct async_reader *impl_from_IWMReaderAccelerator(IWMReaderAccelerator *iface)
889 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderAccelerator_iface);
892 static HRESULT WINAPI reader_accl_QueryInterface(IWMReaderAccelerator *iface, REFIID riid, void **object)
894 struct async_reader *This = impl_from_IWMReaderAccelerator(iface);
895 return IWMReader_QueryInterface(&This->IWMReader_iface, riid, object);
898 static ULONG WINAPI reader_accl_AddRef(IWMReaderAccelerator *iface)
900 struct async_reader *This = impl_from_IWMReaderAccelerator(iface);
901 return IWMReader_AddRef(&This->IWMReader_iface);
904 static ULONG WINAPI reader_accl_Release(IWMReaderAccelerator *iface)
906 struct async_reader *This = impl_from_IWMReaderAccelerator(iface);
907 return IWMReader_Release(&This->IWMReader_iface);
910 static HRESULT WINAPI reader_accl_GetCodecInterface(IWMReaderAccelerator *iface, DWORD output, REFIID riid, void **codec)
912 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
914 FIXME("reader %p, output %lu, iid %s, codec %p, stub!\n", reader, output, debugstr_guid(riid), codec);
916 return E_NOTIMPL;
919 static HRESULT WINAPI reader_accl_Notify(IWMReaderAccelerator *iface, DWORD output, WM_MEDIA_TYPE *subtype)
921 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
923 FIXME("reader %p, output %lu, subtype %p, stub!\n", reader, output, subtype);
925 return E_NOTIMPL;
928 static const IWMReaderAcceleratorVtbl WMReaderAcceleratorVtbl = {
929 reader_accl_QueryInterface,
930 reader_accl_AddRef,
931 reader_accl_Release,
932 reader_accl_GetCodecInterface,
933 reader_accl_Notify
936 static struct async_reader *impl_from_IWMReaderNetworkConfig2(IWMReaderNetworkConfig2 *iface)
938 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderNetworkConfig2_iface);
941 static HRESULT WINAPI networkconfig_QueryInterface(IWMReaderNetworkConfig2 *iface, REFIID riid, void **ppv)
943 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
944 return IWMReader_QueryInterface(&This->IWMReader_iface, riid, ppv);
947 static ULONG WINAPI networkconfig_AddRef(IWMReaderNetworkConfig2 *iface)
949 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
950 return IWMReader_AddRef(&This->IWMReader_iface);
953 static ULONG WINAPI networkconfig_Release(IWMReaderNetworkConfig2 *iface)
955 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
956 return IWMReader_Release(&This->IWMReader_iface);
959 static HRESULT WINAPI networkconfig_GetBufferingTime(IWMReaderNetworkConfig2 *iface, QWORD *buffering_time)
961 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
962 FIXME("%p, %p\n", This, buffering_time);
963 return E_NOTIMPL;
966 static HRESULT WINAPI networkconfig_SetBufferingTime(IWMReaderNetworkConfig2 *iface, QWORD buffering_time)
968 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
969 FIXME("%p, %s\n", This, wine_dbgstr_longlong(buffering_time));
970 return E_NOTIMPL;
973 static HRESULT WINAPI networkconfig_GetUDPPortRanges(IWMReaderNetworkConfig2 *iface, WM_PORT_NUMBER_RANGE *array,
974 DWORD *ranges)
976 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
977 FIXME("%p, %p, %p\n", This, array, ranges);
978 return E_NOTIMPL;
981 static HRESULT WINAPI networkconfig_SetUDPPortRanges(IWMReaderNetworkConfig2 *iface,
982 WM_PORT_NUMBER_RANGE *ranges, DWORD count)
984 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
986 FIXME("reader %p, ranges %p, count %lu.\n", reader, ranges, count);
988 return E_NOTIMPL;
991 static HRESULT WINAPI networkconfig_GetProxySettings(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
992 WMT_PROXY_SETTINGS *proxy)
994 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
995 FIXME("%p, %s, %p\n", This, debugstr_w(protocol), proxy);
996 return E_NOTIMPL;
999 static HRESULT WINAPI networkconfig_SetProxySettings(IWMReaderNetworkConfig2 *iface, LPCWSTR protocol,
1000 WMT_PROXY_SETTINGS proxy)
1002 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1003 FIXME("%p, %s, %d\n", This, debugstr_w(protocol), proxy);
1004 return E_NOTIMPL;
1007 static HRESULT WINAPI networkconfig_GetProxyHostName(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1008 WCHAR *hostname, DWORD *size)
1010 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1011 FIXME("%p, %s, %p, %p\n", This, debugstr_w(protocol), hostname, size);
1012 return E_NOTIMPL;
1015 static HRESULT WINAPI networkconfig_SetProxyHostName(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1016 const WCHAR *hostname)
1018 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1019 FIXME("%p, %s, %s\n", This, debugstr_w(protocol), debugstr_w(hostname));
1020 return E_NOTIMPL;
1023 static HRESULT WINAPI networkconfig_GetProxyPort(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1024 DWORD *port)
1026 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1027 FIXME("%p, %s, %p\n", This, debugstr_w(protocol), port);
1028 return E_NOTIMPL;
1031 static HRESULT WINAPI networkconfig_SetProxyPort(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1032 DWORD port)
1034 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1036 FIXME("reader %p, protocol %s, port %lu, stub!\n", reader, debugstr_w(protocol), port);
1038 return E_NOTIMPL;
1041 static HRESULT WINAPI networkconfig_GetProxyExceptionList(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1042 WCHAR *exceptions, DWORD *count)
1044 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1045 FIXME("%p, %s, %p, %p\n", This, debugstr_w(protocol), exceptions, count);
1046 return E_NOTIMPL;
1049 static HRESULT WINAPI networkconfig_SetProxyExceptionList(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1050 const WCHAR *exceptions)
1052 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1053 FIXME("%p, %s, %s\n", This, debugstr_w(protocol), debugstr_w(exceptions));
1054 return E_NOTIMPL;
1057 static HRESULT WINAPI networkconfig_GetProxyBypassForLocal(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1058 BOOL *bypass)
1060 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1061 FIXME("%p, %s, %p\n", This, debugstr_w(protocol), bypass);
1062 return E_NOTIMPL;
1065 static HRESULT WINAPI networkconfig_SetProxyBypassForLocal(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1066 BOOL bypass)
1068 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1069 FIXME("%p, %s, %d\n", This, debugstr_w(protocol), bypass);
1070 return E_NOTIMPL;
1073 static HRESULT WINAPI networkconfig_GetForceRerunAutoProxyDetection(IWMReaderNetworkConfig2 *iface,
1074 BOOL *detection)
1076 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1077 FIXME("%p, %p\n", This, detection);
1078 return E_NOTIMPL;
1081 static HRESULT WINAPI networkconfig_SetForceRerunAutoProxyDetection(IWMReaderNetworkConfig2 *iface,
1082 BOOL detection)
1084 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1085 FIXME("%p, %d\n", This, detection);
1086 return E_NOTIMPL;
1089 static HRESULT WINAPI networkconfig_GetEnableMulticast(IWMReaderNetworkConfig2 *iface, BOOL *multicast)
1091 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1092 FIXME("%p, %p\n", This, multicast);
1093 return E_NOTIMPL;
1096 static HRESULT WINAPI networkconfig_SetEnableMulticast(IWMReaderNetworkConfig2 *iface, BOOL multicast)
1098 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1099 FIXME("%p, %d\n", This, multicast);
1100 return E_NOTIMPL;
1103 static HRESULT WINAPI networkconfig_GetEnableHTTP(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1105 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1106 FIXME("%p, %p\n", This, enable);
1107 return E_NOTIMPL;
1110 static HRESULT WINAPI networkconfig_SetEnableHTTP(IWMReaderNetworkConfig2 *iface, BOOL enable)
1112 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1113 FIXME("%p, %d\n", This, enable);
1114 return E_NOTIMPL;
1117 static HRESULT WINAPI networkconfig_GetEnableUDP(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1119 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1120 FIXME("%p, %p\n", This, enable);
1121 return E_NOTIMPL;
1124 static HRESULT WINAPI networkconfig_SetEnableUDP(IWMReaderNetworkConfig2 *iface, BOOL enable)
1126 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1127 FIXME("%p, %d\n", This, enable);
1128 return E_NOTIMPL;
1131 static HRESULT WINAPI networkconfig_GetEnableTCP(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1133 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1134 FIXME("%p, %p\n", This, enable);
1135 return E_NOTIMPL;
1138 static HRESULT WINAPI networkconfig_SetEnableTCP(IWMReaderNetworkConfig2 *iface, BOOL enable)
1140 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1141 FIXME("%p, %d\n", This, enable);
1142 return E_NOTIMPL;
1145 static HRESULT WINAPI networkconfig_ResetProtocolRollover(IWMReaderNetworkConfig2 *iface)
1147 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1148 FIXME("%p\n", This);
1149 return E_NOTIMPL;
1152 static HRESULT WINAPI networkconfig_GetConnectionBandwidth(IWMReaderNetworkConfig2 *iface, DWORD *bandwidth)
1154 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1155 FIXME("%p, %p\n", This, bandwidth);
1156 return E_NOTIMPL;
1159 static HRESULT WINAPI networkconfig_SetConnectionBandwidth(IWMReaderNetworkConfig2 *iface, DWORD bandwidth)
1161 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1163 FIXME("reader %p, bandwidth %lu, stub!\n", reader, bandwidth);
1165 return E_NOTIMPL;
1168 static HRESULT WINAPI networkconfig_GetNumProtocolsSupported(IWMReaderNetworkConfig2 *iface, DWORD *protocols)
1170 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1171 FIXME("%p, %p\n", This, protocols);
1172 return E_NOTIMPL;
1175 static HRESULT WINAPI networkconfig_GetSupportedProtocolName(IWMReaderNetworkConfig2 *iface, DWORD protocol_num,
1176 WCHAR *protocol, DWORD *size)
1178 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1180 FIXME("reader %p, index %lu, protocol %p, size %p, stub!\n", reader, protocol_num, protocol, size);
1182 return E_NOTIMPL;
1185 static HRESULT WINAPI networkconfig_AddLoggingUrl(IWMReaderNetworkConfig2 *iface, const WCHAR *url)
1187 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1188 FIXME("%p, %s\n", This, debugstr_w(url));
1189 return E_NOTIMPL;
1192 static HRESULT WINAPI networkconfig_GetLoggingUrl(IWMReaderNetworkConfig2 *iface, DWORD index, WCHAR *url,
1193 DWORD *size)
1195 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1197 FIXME("reader %p, index %lu, url %p, size %p, stub!\n", reader, index, url, size);
1199 return E_NOTIMPL;
1202 static HRESULT WINAPI networkconfig_GetLoggingUrlCount(IWMReaderNetworkConfig2 *iface, DWORD *count)
1204 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1205 FIXME("%p, %p\n", This, count);
1206 return E_NOTIMPL;
1209 static HRESULT WINAPI networkconfig_ResetLoggingUrlList(IWMReaderNetworkConfig2 *iface)
1211 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1212 FIXME("%p\n", This);
1213 return E_NOTIMPL;
1216 static HRESULT WINAPI networkconfig_GetEnableContentCaching(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1218 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1219 FIXME("%p, %p\n", This, enable);
1220 return E_NOTIMPL;
1223 static HRESULT WINAPI networkconfig_SetEnableContentCaching(IWMReaderNetworkConfig2 *iface, BOOL enable)
1225 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1226 FIXME("%p, %d\n", This, enable);
1227 return E_NOTIMPL;
1230 static HRESULT WINAPI networkconfig_GetEnableFastCache(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1232 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1233 FIXME("%p, %p\n", This, enable);
1234 return E_NOTIMPL;
1237 static HRESULT WINAPI networkconfig_SetEnableFastCache(IWMReaderNetworkConfig2 *iface, BOOL enable)
1239 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1240 FIXME("%p, %d\n", This, enable);
1241 return E_NOTIMPL;
1244 static HRESULT WINAPI networkconfig_GetAcceleratedStreamingDuration(IWMReaderNetworkConfig2 *iface,
1245 QWORD *duration)
1247 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1248 FIXME("%p, %p\n", This, duration);
1249 return E_NOTIMPL;
1252 static HRESULT WINAPI networkconfig_SetAcceleratedStreamingDuration(IWMReaderNetworkConfig2 *iface,
1253 QWORD duration)
1255 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1256 FIXME("%p, %s\n", This, wine_dbgstr_longlong(duration));
1257 return E_NOTIMPL;
1260 static HRESULT WINAPI networkconfig_GetAutoReconnectLimit(IWMReaderNetworkConfig2 *iface, DWORD *limit)
1262 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1263 FIXME("%p, %p\n", This, limit);
1264 return E_NOTIMPL;
1267 static HRESULT WINAPI networkconfig_SetAutoReconnectLimit(IWMReaderNetworkConfig2 *iface, DWORD limit)
1269 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1271 FIXME("reader %p, limit %lu, stub!\n", reader, limit);
1273 return E_NOTIMPL;
1276 static HRESULT WINAPI networkconfig_GetEnableResends(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1278 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1279 FIXME("%p, %p\n", This, enable);
1280 return E_NOTIMPL;
1283 static HRESULT WINAPI networkconfig_SetEnableResends(IWMReaderNetworkConfig2 *iface, BOOL enable)
1285 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1286 FIXME("%p, %u\n", This, enable);
1287 return E_NOTIMPL;
1290 static HRESULT WINAPI networkconfig_GetEnableThinning(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1292 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1293 FIXME("%p, %p\n", This, enable);
1294 return E_NOTIMPL;
1297 static HRESULT WINAPI networkconfig_SetEnableThinning(IWMReaderNetworkConfig2 *iface, BOOL enable)
1299 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1300 FIXME("%p, %u\n", This, enable);
1301 return E_NOTIMPL;
1304 static HRESULT WINAPI networkconfig_GetMaxNetPacketSize(IWMReaderNetworkConfig2 *iface, DWORD *packet_size)
1306 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1307 FIXME("%p, %p\n", This, packet_size);
1308 return E_NOTIMPL;
1311 static const IWMReaderNetworkConfig2Vtbl WMReaderNetworkConfig2Vtbl =
1313 networkconfig_QueryInterface,
1314 networkconfig_AddRef,
1315 networkconfig_Release,
1316 networkconfig_GetBufferingTime,
1317 networkconfig_SetBufferingTime,
1318 networkconfig_GetUDPPortRanges,
1319 networkconfig_SetUDPPortRanges,
1320 networkconfig_GetProxySettings,
1321 networkconfig_SetProxySettings,
1322 networkconfig_GetProxyHostName,
1323 networkconfig_SetProxyHostName,
1324 networkconfig_GetProxyPort,
1325 networkconfig_SetProxyPort,
1326 networkconfig_GetProxyExceptionList,
1327 networkconfig_SetProxyExceptionList,
1328 networkconfig_GetProxyBypassForLocal,
1329 networkconfig_SetProxyBypassForLocal,
1330 networkconfig_GetForceRerunAutoProxyDetection,
1331 networkconfig_SetForceRerunAutoProxyDetection,
1332 networkconfig_GetEnableMulticast,
1333 networkconfig_SetEnableMulticast,
1334 networkconfig_GetEnableHTTP,
1335 networkconfig_SetEnableHTTP,
1336 networkconfig_GetEnableUDP,
1337 networkconfig_SetEnableUDP,
1338 networkconfig_GetEnableTCP,
1339 networkconfig_SetEnableTCP,
1340 networkconfig_ResetProtocolRollover,
1341 networkconfig_GetConnectionBandwidth,
1342 networkconfig_SetConnectionBandwidth,
1343 networkconfig_GetNumProtocolsSupported,
1344 networkconfig_GetSupportedProtocolName,
1345 networkconfig_AddLoggingUrl,
1346 networkconfig_GetLoggingUrl,
1347 networkconfig_GetLoggingUrlCount,
1348 networkconfig_ResetLoggingUrlList,
1349 networkconfig_GetEnableContentCaching,
1350 networkconfig_SetEnableContentCaching,
1351 networkconfig_GetEnableFastCache,
1352 networkconfig_SetEnableFastCache,
1353 networkconfig_GetAcceleratedStreamingDuration,
1354 networkconfig_SetAcceleratedStreamingDuration,
1355 networkconfig_GetAutoReconnectLimit,
1356 networkconfig_SetAutoReconnectLimit,
1357 networkconfig_GetEnableResends,
1358 networkconfig_SetEnableResends,
1359 networkconfig_GetEnableThinning,
1360 networkconfig_SetEnableThinning,
1361 networkconfig_GetMaxNetPacketSize
1364 static struct async_reader *impl_from_IWMReaderStreamClock(IWMReaderStreamClock *iface)
1366 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderStreamClock_iface);
1369 static HRESULT WINAPI readclock_QueryInterface(IWMReaderStreamClock *iface, REFIID riid, void **ppv)
1371 struct async_reader *This = impl_from_IWMReaderStreamClock(iface);
1372 return IWMReader_QueryInterface(&This->IWMReader_iface, riid, ppv);
1375 static ULONG WINAPI readclock_AddRef(IWMReaderStreamClock *iface)
1377 struct async_reader *This = impl_from_IWMReaderStreamClock(iface);
1378 return IWMReader_AddRef(&This->IWMReader_iface);
1381 static ULONG WINAPI readclock_Release(IWMReaderStreamClock *iface)
1383 struct async_reader *This = impl_from_IWMReaderStreamClock(iface);
1384 return IWMReader_Release(&This->IWMReader_iface);
1387 static HRESULT WINAPI readclock_GetTime(IWMReaderStreamClock *iface, QWORD *now)
1389 struct async_reader *This = impl_from_IWMReaderStreamClock(iface);
1390 FIXME("%p, %p\n", This, now);
1391 return E_NOTIMPL;
1394 static HRESULT WINAPI readclock_SetTimer(IWMReaderStreamClock *iface, QWORD when, void *param, DWORD *id)
1396 struct async_reader *This = impl_from_IWMReaderStreamClock(iface);
1397 FIXME("%p, %s, %p, %p\n", This, wine_dbgstr_longlong(when), param, id);
1398 return E_NOTIMPL;
1401 static HRESULT WINAPI readclock_KillTimer(IWMReaderStreamClock *iface, DWORD id)
1403 struct async_reader *reader = impl_from_IWMReaderStreamClock(iface);
1405 FIXME("reader %p, id %lu, stub!\n", reader, id);
1407 return E_NOTIMPL;
1410 static const IWMReaderStreamClockVtbl WMReaderStreamClockVtbl =
1412 readclock_QueryInterface,
1413 readclock_AddRef,
1414 readclock_Release,
1415 readclock_GetTime,
1416 readclock_SetTimer,
1417 readclock_KillTimer
1420 static struct async_reader *impl_from_IWMReaderTypeNegotiation(IWMReaderTypeNegotiation *iface)
1422 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderTypeNegotiation_iface);
1425 static HRESULT WINAPI negotiation_QueryInterface(IWMReaderTypeNegotiation *iface, REFIID riid, void **ppv)
1427 struct async_reader *This = impl_from_IWMReaderTypeNegotiation(iface);
1428 return IWMReader_QueryInterface(&This->IWMReader_iface, riid, ppv);
1431 static ULONG WINAPI negotiation_AddRef(IWMReaderTypeNegotiation *iface)
1433 struct async_reader *This = impl_from_IWMReaderTypeNegotiation(iface);
1434 return IWMReader_AddRef(&This->IWMReader_iface);
1437 static ULONG WINAPI negotiation_Release(IWMReaderTypeNegotiation *iface)
1439 struct async_reader *This = impl_from_IWMReaderTypeNegotiation(iface);
1440 return IWMReader_Release(&This->IWMReader_iface);
1443 static HRESULT WINAPI negotiation_TryOutputProps(IWMReaderTypeNegotiation *iface, DWORD output, IWMOutputMediaProps *props)
1445 struct async_reader *reader = impl_from_IWMReaderTypeNegotiation(iface);
1447 FIXME("reader %p, output %lu, props %p, stub!\n", reader, output, props);
1449 return E_NOTIMPL;
1452 static const IWMReaderTypeNegotiationVtbl WMReaderTypeNegotiationVtbl =
1454 negotiation_QueryInterface,
1455 negotiation_AddRef,
1456 negotiation_Release,
1457 negotiation_TryOutputProps
1460 static struct async_reader *impl_from_IReferenceClock(IReferenceClock *iface)
1462 return CONTAINING_RECORD(iface, struct async_reader, IReferenceClock_iface);
1465 static HRESULT WINAPI refclock_QueryInterface(IReferenceClock *iface, REFIID riid, void **ppv)
1467 struct async_reader *This = impl_from_IReferenceClock(iface);
1468 return IWMReader_QueryInterface(&This->IWMReader_iface, riid, ppv);
1471 static ULONG WINAPI refclock_AddRef(IReferenceClock *iface)
1473 struct async_reader *This = impl_from_IReferenceClock(iface);
1474 return IWMReader_AddRef(&This->IWMReader_iface);
1477 static ULONG WINAPI refclock_Release(IReferenceClock *iface)
1479 struct async_reader *This = impl_from_IReferenceClock(iface);
1480 return IWMReader_Release(&This->IWMReader_iface);
1483 static HRESULT WINAPI refclock_GetTime(IReferenceClock *iface, REFERENCE_TIME *time)
1485 struct async_reader *This = impl_from_IReferenceClock(iface);
1486 FIXME("%p, %p\n", This, time);
1487 return E_NOTIMPL;
1490 static HRESULT WINAPI refclock_AdviseTime(IReferenceClock *iface, REFERENCE_TIME basetime,
1491 REFERENCE_TIME streamtime, HEVENT event, DWORD_PTR *cookie)
1493 struct async_reader *reader = impl_from_IReferenceClock(iface);
1495 FIXME("reader %p, basetime %s, streamtime %s, event %#Ix, cookie %p, stub!\n",
1496 reader, debugstr_time(basetime), debugstr_time(streamtime), event, cookie);
1498 return E_NOTIMPL;
1501 static HRESULT WINAPI refclock_AdvisePeriodic(IReferenceClock *iface, REFERENCE_TIME starttime,
1502 REFERENCE_TIME period, HSEMAPHORE semaphore, DWORD_PTR *cookie)
1504 struct async_reader *reader = impl_from_IReferenceClock(iface);
1506 FIXME("reader %p, starttime %s, period %s, semaphore %#Ix, cookie %p, stub!\n",
1507 reader, debugstr_time(starttime), debugstr_time(period), semaphore, cookie);
1509 return E_NOTIMPL;
1512 static HRESULT WINAPI refclock_Unadvise(IReferenceClock *iface, DWORD_PTR cookie)
1514 struct async_reader *reader = impl_from_IReferenceClock(iface);
1516 FIXME("reader %p, cookie %Iu, stub!\n", reader, cookie);
1518 return E_NOTIMPL;
1521 static const IReferenceClockVtbl ReferenceClockVtbl =
1523 refclock_QueryInterface,
1524 refclock_AddRef,
1525 refclock_Release,
1526 refclock_GetTime,
1527 refclock_AdviseTime,
1528 refclock_AdvisePeriodic,
1529 refclock_Unadvise
1532 static struct async_reader *impl_from_wm_reader(struct wm_reader *iface)
1534 return CONTAINING_RECORD(iface, struct async_reader, reader);
1537 static void *async_reader_query_interface(struct wm_reader *iface, REFIID iid)
1539 struct async_reader *reader = impl_from_wm_reader(iface);
1541 TRACE("reader %p, iid %s.\n", reader, debugstr_guid(iid));
1543 if (IsEqualIID(iid, &IID_IReferenceClock))
1544 return &reader->IReferenceClock_iface;
1546 if (IsEqualIID(iid, &IID_IWMReader))
1547 return &reader->IWMReader_iface;
1549 if (IsEqualIID(iid, &IID_IWMReaderAccelerator))
1550 return &reader->IWMReaderAccelerator_iface;
1552 if (IsEqualIID(iid, &IID_IWMReaderAdvanced)
1553 || IsEqualIID(iid, &IID_IWMReaderAdvanced2)
1554 || IsEqualIID(iid, &IID_IWMReaderAdvanced3)
1555 || IsEqualIID(iid, &IID_IWMReaderAdvanced4)
1556 || IsEqualIID(iid, &IID_IWMReaderAdvanced5)
1557 || IsEqualIID(iid, &IID_IWMReaderAdvanced6))
1558 return &reader->IWMReaderAdvanced6_iface;
1560 if (IsEqualIID(iid, &IID_IWMReaderNetworkConfig)
1561 || IsEqualIID(iid, &IID_IWMReaderNetworkConfig2))
1562 return &reader->IWMReaderNetworkConfig2_iface;
1564 if (IsEqualIID(iid, &IID_IWMReaderStreamClock))
1565 return &reader->IWMReaderStreamClock_iface;
1567 if (IsEqualIID(iid, &IID_IWMReaderTypeNegotiation))
1568 return &reader->IWMReaderTypeNegotiation_iface;
1570 return NULL;
1573 static void async_reader_destroy(struct wm_reader *iface)
1575 struct async_reader *reader = impl_from_wm_reader(iface);
1577 TRACE("reader %p.\n", reader);
1579 if (reader->stream_thread)
1581 WaitForSingleObject(reader->stream_thread, INFINITE);
1582 CloseHandle(reader->stream_thread);
1585 reader->stream_cs.DebugInfo->Spare[0] = 0;
1586 DeleteCriticalSection(&reader->stream_cs);
1588 wm_reader_close(&reader->reader);
1590 if (reader->callback)
1591 IWMReaderCallback_Release(reader->callback);
1593 wm_reader_cleanup(&reader->reader);
1594 free(reader);
1597 static const struct wm_reader_ops async_reader_ops =
1599 .query_interface = async_reader_query_interface,
1600 .destroy = async_reader_destroy,
1603 HRESULT WINAPI winegstreamer_create_wm_async_reader(IWMReader **reader)
1605 struct async_reader *object;
1607 TRACE("reader %p.\n", reader);
1609 if (!(object = calloc(1, sizeof(*object))))
1610 return E_OUTOFMEMORY;
1612 wm_reader_init(&object->reader, &async_reader_ops);
1614 object->IReferenceClock_iface.lpVtbl = &ReferenceClockVtbl;
1615 object->IWMReader_iface.lpVtbl = &WMReaderVtbl;
1616 object->IWMReaderAdvanced6_iface.lpVtbl = &WMReaderAdvanced6Vtbl;
1617 object->IWMReaderAccelerator_iface.lpVtbl = &WMReaderAcceleratorVtbl;
1618 object->IWMReaderNetworkConfig2_iface.lpVtbl = &WMReaderNetworkConfig2Vtbl;
1619 object->IWMReaderStreamClock_iface.lpVtbl = &WMReaderStreamClockVtbl;
1620 object->IWMReaderTypeNegotiation_iface.lpVtbl = &WMReaderTypeNegotiationVtbl;
1622 InitializeCriticalSection(&object->stream_cs);
1623 object->stream_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": async_reader.stream_cs");
1625 QueryPerformanceFrequency(&object->clock_frequency);
1627 TRACE("Created async reader %p.\n", object);
1628 *reader = (IWMReader *)&object->IWMReader_iface;
1629 return S_OK;