dinput: Enumerate user format object forwards.
[wine.git] / dlls / winegstreamer / wm_asyncreader.c
blobef6e445a51b0c9dc3ef2c3e1566a810f41c14e42
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 IWMReaderCallback *callback = reader->callback;
76 REFERENCE_TIME start_time;
77 struct wm_stream *stream;
78 static const DWORD zero;
79 QWORD pts, duration;
80 WORD stream_number;
81 INSSBuffer *sample;
82 HRESULT hr = S_OK;
83 DWORD flags;
85 start_time = get_current_time(reader);
87 EnterCriticalSection(&reader->stream_cs);
89 while (reader->running)
91 hr = wm_reader_get_stream_sample(&reader->reader, 0, &sample, &pts, &duration, &flags, &stream_number);
92 if (hr != S_OK)
93 break;
95 stream = wm_reader_get_stream_by_stream_number(&reader->reader, stream_number);
97 if (reader->user_clock)
99 QWORD user_time = reader->user_time;
101 if (pts > user_time && reader->reader.callback_advanced)
103 LeaveCriticalSection(&reader->stream_cs);
104 IWMReaderCallbackAdvanced_OnTime(reader->reader.callback_advanced, user_time, reader->context);
105 EnterCriticalSection(&reader->stream_cs);
108 while (pts > reader->user_time && reader->running)
109 SleepConditionVariableCS(&reader->stream_cv, &reader->stream_cs, INFINITE);
111 else
113 while (reader->running)
115 REFERENCE_TIME current_time = get_current_time(reader);
117 if (pts <= current_time - start_time)
118 break;
120 SleepConditionVariableCS(&reader->stream_cv, &reader->stream_cs,
121 (pts - (current_time - start_time)) / 10000);
125 if (reader->running)
127 LeaveCriticalSection(&reader->stream_cs);
128 if (stream->read_compressed)
129 hr = IWMReaderCallbackAdvanced_OnStreamSample(reader->reader.callback_advanced,
130 stream_number, pts, duration, flags, sample, reader->context);
131 else
132 hr = IWMReaderCallback_OnSample(callback, stream_number - 1, pts, duration,
133 flags, sample, reader->context);
134 EnterCriticalSection(&reader->stream_cs);
136 TRACE("Callback returned %#lx.\n", hr);
139 INSSBuffer_Release(sample);
142 LeaveCriticalSection(&reader->stream_cs);
144 if (hr == NS_E_NO_MORE_SAMPLES)
146 IWMReaderCallback_OnStatus(callback, WMT_END_OF_STREAMING, S_OK,
147 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
148 IWMReaderCallback_OnStatus(callback, WMT_EOF, S_OK,
149 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
151 if (reader->user_clock && reader->reader.callback_advanced)
153 /* We can only get here if user_time is greater than the PTS
154 * of all samples, in which case we cannot have sent this
155 * notification already. */
156 IWMReaderCallbackAdvanced_OnTime(reader->reader.callback_advanced,
157 reader->user_time, reader->context);
160 TRACE("Reached end of stream; exiting.\n");
162 else if (hr != S_OK)
164 ERR("Failed to get sample, hr %#lx.\n", hr);
167 TRACE("Reader is stopping; exiting.\n");
168 return 0;
171 static void stop_streaming(struct async_reader *reader)
173 if (reader->stream_thread)
175 EnterCriticalSection(&reader->stream_cs);
176 reader->running = false;
177 LeaveCriticalSection(&reader->stream_cs);
178 WakeConditionVariable(&reader->stream_cv);
179 WaitForSingleObject(reader->stream_thread, INFINITE);
180 CloseHandle(reader->stream_thread);
181 reader->stream_thread = NULL;
185 static struct async_reader *impl_from_IWMReader(IWMReader *iface)
187 return CONTAINING_RECORD(iface, struct async_reader, IWMReader_iface);
190 static HRESULT WINAPI WMReader_QueryInterface(IWMReader *iface, REFIID iid, void **out)
192 struct async_reader *reader = impl_from_IWMReader(iface);
194 return IWMProfile3_QueryInterface(&reader->reader.IWMProfile3_iface, iid, out);
197 static ULONG WINAPI WMReader_AddRef(IWMReader *iface)
199 struct async_reader *reader = impl_from_IWMReader(iface);
201 return IWMProfile3_AddRef(&reader->reader.IWMProfile3_iface);
204 static ULONG WINAPI WMReader_Release(IWMReader *iface)
206 struct async_reader *reader = impl_from_IWMReader(iface);
208 return IWMProfile3_Release(&reader->reader.IWMProfile3_iface);
211 static HRESULT WINAPI WMReader_Open(IWMReader *iface, const WCHAR *url,
212 IWMReaderCallback *callback, void *context)
214 struct async_reader *reader = impl_from_IWMReader(iface);
215 HRESULT hr;
217 TRACE("reader %p, url %s, callback %p, context %p.\n",
218 reader, debugstr_w(url), callback, context);
220 EnterCriticalSection(&reader->reader.cs);
222 if (reader->reader.wg_parser)
224 LeaveCriticalSection(&reader->reader.cs);
225 WARN("Stream is already open; returning E_UNEXPECTED.\n");
226 return E_UNEXPECTED;
229 if (SUCCEEDED(hr = wm_reader_open_file(&reader->reader, url)))
230 open_stream(reader, callback, context);
232 LeaveCriticalSection(&reader->reader.cs);
233 return hr;
236 static HRESULT WINAPI WMReader_Close(IWMReader *iface)
238 struct async_reader *reader = impl_from_IWMReader(iface);
239 static const DWORD zero;
240 HRESULT hr;
242 TRACE("reader %p.\n", reader);
244 EnterCriticalSection(&reader->reader.cs);
246 stop_streaming(reader);
248 hr = wm_reader_close(&reader->reader);
249 if (reader->callback)
251 IWMReaderCallback_OnStatus(reader->callback, WMT_CLOSED, S_OK,
252 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
253 IWMReaderCallback_Release(reader->callback);
255 reader->callback = NULL;
257 LeaveCriticalSection(&reader->reader.cs);
259 return hr;
262 static HRESULT WINAPI WMReader_GetOutputCount(IWMReader *iface, DWORD *count)
264 struct async_reader *reader = impl_from_IWMReader(iface);
266 TRACE("reader %p, count %p.\n", reader, count);
268 EnterCriticalSection(&reader->reader.cs);
269 *count = reader->reader.stream_count;
270 LeaveCriticalSection(&reader->reader.cs);
271 return S_OK;
274 static HRESULT WINAPI WMReader_GetOutputProps(IWMReader *iface, DWORD output, IWMOutputMediaProps **props)
276 struct async_reader *reader = impl_from_IWMReader(iface);
278 TRACE("reader %p, output %lu, props %p.\n", reader, output, props);
280 return wm_reader_get_output_props(&reader->reader, output, props);
283 static HRESULT WINAPI WMReader_SetOutputProps(IWMReader *iface, DWORD output, IWMOutputMediaProps *props)
285 struct async_reader *reader = impl_from_IWMReader(iface);
287 TRACE("reader %p, output %lu, props %p.\n", reader, output, props);
289 return wm_reader_set_output_props(&reader->reader, output, props);
292 static HRESULT WINAPI WMReader_GetOutputFormatCount(IWMReader *iface, DWORD output, DWORD *count)
294 struct async_reader *reader = impl_from_IWMReader(iface);
296 TRACE("reader %p, output %lu, count %p.\n", reader, output, count);
298 return wm_reader_get_output_format_count(&reader->reader, output, count);
301 static HRESULT WINAPI WMReader_GetOutputFormat(IWMReader *iface, DWORD output,
302 DWORD index, IWMOutputMediaProps **props)
304 struct async_reader *reader = impl_from_IWMReader(iface);
306 TRACE("reader %p, output %lu, index %lu, props %p.\n", reader, output, index, props);
308 return wm_reader_get_output_format(&reader->reader, output, index, props);
311 static HRESULT WINAPI WMReader_Start(IWMReader *iface,
312 QWORD start, QWORD duration, float rate, void *context)
314 struct async_reader *reader = impl_from_IWMReader(iface);
315 static const DWORD zero;
317 TRACE("reader %p, start %s, duration %s, rate %.8e, context %p.\n",
318 reader, debugstr_time(start), debugstr_time(duration), rate, context);
320 if (rate != 1.0f)
321 FIXME("Ignoring rate %.8e.\n", rate);
323 EnterCriticalSection(&reader->reader.cs);
325 if (!reader->reader.wg_parser)
327 LeaveCriticalSection(&reader->reader.cs);
328 WARN("No stream is open; returning NS_E_INVALID_REQUEST.\n");
329 return NS_E_INVALID_REQUEST;
332 stop_streaming(reader);
334 IWMReaderCallback_OnStatus(reader->callback, WMT_STARTED, S_OK, WMT_TYPE_DWORD, (BYTE *)&zero, context);
335 reader->context = context;
337 wm_reader_seek(&reader->reader, start, duration);
339 reader->running = true;
340 reader->user_time = 0;
342 if (!(reader->stream_thread = CreateThread(NULL, 0, stream_thread, reader, 0, NULL)))
344 LeaveCriticalSection(&reader->reader.cs);
345 return E_OUTOFMEMORY;
348 LeaveCriticalSection(&reader->reader.cs);
349 WakeConditionVariable(&reader->stream_cv);
351 return S_OK;
354 static HRESULT WINAPI WMReader_Stop(IWMReader *iface)
356 struct async_reader *reader = impl_from_IWMReader(iface);
357 static const DWORD zero;
359 TRACE("reader %p.\n", reader);
361 EnterCriticalSection(&reader->reader.cs);
363 if (!reader->reader.wg_parser)
365 LeaveCriticalSection(&reader->reader.cs);
366 WARN("No stream is open; returning E_UNEXPECTED.\n");
367 return E_UNEXPECTED;
370 stop_streaming(reader);
371 IWMReaderCallback_OnStatus(reader->callback, WMT_STOPPED, S_OK,
372 WMT_TYPE_DWORD, (BYTE *)&zero, reader->context);
373 LeaveCriticalSection(&reader->reader.cs);
374 return S_OK;
377 static HRESULT WINAPI WMReader_Pause(IWMReader *iface)
379 struct async_reader *This = impl_from_IWMReader(iface);
380 FIXME("(%p)\n", This);
381 return E_NOTIMPL;
384 static HRESULT WINAPI WMReader_Resume(IWMReader *iface)
386 struct async_reader *This = impl_from_IWMReader(iface);
387 FIXME("(%p)\n", This);
388 return E_NOTIMPL;
391 static const IWMReaderVtbl WMReaderVtbl = {
392 WMReader_QueryInterface,
393 WMReader_AddRef,
394 WMReader_Release,
395 WMReader_Open,
396 WMReader_Close,
397 WMReader_GetOutputCount,
398 WMReader_GetOutputProps,
399 WMReader_SetOutputProps,
400 WMReader_GetOutputFormatCount,
401 WMReader_GetOutputFormat,
402 WMReader_Start,
403 WMReader_Stop,
404 WMReader_Pause,
405 WMReader_Resume
408 static struct async_reader *impl_from_IWMReaderAdvanced6(IWMReaderAdvanced6 *iface)
410 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderAdvanced6_iface);
413 static HRESULT WINAPI WMReaderAdvanced_QueryInterface(IWMReaderAdvanced6 *iface, REFIID riid, void **ppv)
415 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
416 return IWMReader_QueryInterface(&This->IWMReader_iface, riid, ppv);
419 static ULONG WINAPI WMReaderAdvanced_AddRef(IWMReaderAdvanced6 *iface)
421 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
422 return IWMReader_AddRef(&This->IWMReader_iface);
425 static ULONG WINAPI WMReaderAdvanced_Release(IWMReaderAdvanced6 *iface)
427 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
428 return IWMReader_Release(&This->IWMReader_iface);
431 static HRESULT WINAPI WMReaderAdvanced_SetUserProvidedClock(IWMReaderAdvanced6 *iface, BOOL user_clock)
433 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
435 TRACE("reader %p, user_clock %d.\n", reader, user_clock);
437 EnterCriticalSection(&reader->stream_cs);
438 reader->user_clock = !!user_clock;
439 LeaveCriticalSection(&reader->stream_cs);
440 return S_OK;
443 static HRESULT WINAPI WMReaderAdvanced_GetUserProvidedClock(IWMReaderAdvanced6 *iface, BOOL *user_clock)
445 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
446 FIXME("(%p)->(%p)\n", This, user_clock);
447 return E_NOTIMPL;
450 static HRESULT WINAPI WMReaderAdvanced_DeliverTime(IWMReaderAdvanced6 *iface, QWORD time)
452 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
454 TRACE("reader %p, time %s.\n", reader, debugstr_time(time));
456 EnterCriticalSection(&reader->stream_cs);
458 if (!reader->user_clock)
460 LeaveCriticalSection(&reader->stream_cs);
461 WARN("Not using a user-provided clock; returning E_UNEXPECTED.\n");
462 return E_UNEXPECTED;
465 reader->user_time = time;
467 LeaveCriticalSection(&reader->stream_cs);
468 WakeConditionVariable(&reader->stream_cv);
469 return S_OK;
472 static HRESULT WINAPI WMReaderAdvanced_SetManualStreamSelection(IWMReaderAdvanced6 *iface, BOOL selection)
474 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
475 FIXME("(%p)->(%x)\n", This, selection);
476 return E_NOTIMPL;
479 static HRESULT WINAPI WMReaderAdvanced_GetManualStreamSelection(IWMReaderAdvanced6 *iface, BOOL *selection)
481 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
482 FIXME("(%p)->(%p)\n", This, selection);
483 return E_NOTIMPL;
486 static HRESULT WINAPI WMReaderAdvanced_SetStreamsSelected(IWMReaderAdvanced6 *iface,
487 WORD count, WORD *stream_numbers, WMT_STREAM_SELECTION *selections)
489 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
491 TRACE("reader %p, count %u, stream_numbers %p, selections %p.\n",
492 reader, count, stream_numbers, selections);
494 return wm_reader_set_streams_selected(&reader->reader, count, stream_numbers, selections);
497 static HRESULT WINAPI WMReaderAdvanced_GetStreamSelected(IWMReaderAdvanced6 *iface,
498 WORD stream_number, WMT_STREAM_SELECTION *selection)
500 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
502 TRACE("reader %p, stream_number %u, selection %p.\n", reader, stream_number, selection);
504 return wm_reader_get_stream_selection(&reader->reader, stream_number, selection);
507 static HRESULT WINAPI WMReaderAdvanced_SetReceiveSelectionCallbacks(IWMReaderAdvanced6 *iface, BOOL get_callbacks)
509 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
510 FIXME("(%p)->(%x)\n", This, get_callbacks);
511 return E_NOTIMPL;
514 static HRESULT WINAPI WMReaderAdvanced_GetReceiveSelectionCallbacks(IWMReaderAdvanced6 *iface, BOOL *get_callbacks)
516 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
517 FIXME("(%p)->(%p)\n", This, get_callbacks);
518 return E_NOTIMPL;
521 static HRESULT WINAPI WMReaderAdvanced_SetReceiveStreamSamples(IWMReaderAdvanced6 *iface,
522 WORD stream_number, BOOL compressed)
524 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
526 TRACE("reader %p, stream_number %u, compressed %d.\n", reader, stream_number, compressed);
528 return wm_reader_set_read_compressed(&reader->reader, stream_number, compressed);
531 static HRESULT WINAPI WMReaderAdvanced_GetReceiveStreamSamples(IWMReaderAdvanced6 *iface, WORD stream_num,
532 BOOL *receive_stream_samples)
534 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
535 FIXME("(%p)->(%d %p)\n", This, stream_num, receive_stream_samples);
536 return E_NOTIMPL;
539 static HRESULT WINAPI WMReaderAdvanced_SetAllocateForOutput(IWMReaderAdvanced6 *iface,
540 DWORD output, BOOL allocate)
542 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
544 TRACE("reader %p, output %lu, allocate %d.\n", reader, output, allocate);
546 return wm_reader_set_allocate_for_output(&reader->reader, output, allocate);
549 static HRESULT WINAPI WMReaderAdvanced_GetAllocateForOutput(IWMReaderAdvanced6 *iface, DWORD output_num, BOOL *allocate)
551 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
553 FIXME("reader %p, output %lu, allocate %p, stub!\n", reader, output_num, allocate);
555 return E_NOTIMPL;
558 static HRESULT WINAPI WMReaderAdvanced_SetAllocateForStream(IWMReaderAdvanced6 *iface,
559 WORD stream_number, BOOL allocate)
561 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
563 TRACE("reader %p, stream_number %u, allocate %d.\n", reader, stream_number, allocate);
565 return wm_reader_set_allocate_for_stream(&reader->reader, stream_number, allocate);
568 static HRESULT WINAPI WMReaderAdvanced_GetAllocateForStream(IWMReaderAdvanced6 *iface, WORD output_num, BOOL *allocate)
570 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
571 FIXME("(%p)->(%d %p)\n", This, output_num, allocate);
572 return E_NOTIMPL;
575 static HRESULT WINAPI WMReaderAdvanced_GetStatistics(IWMReaderAdvanced6 *iface, WM_READER_STATISTICS *statistics)
577 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
578 FIXME("(%p)->(%p)\n", This, statistics);
579 return E_NOTIMPL;
582 static HRESULT WINAPI WMReaderAdvanced_SetClientInfo(IWMReaderAdvanced6 *iface, WM_READER_CLIENTINFO *client_info)
584 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
585 FIXME("(%p)->(%p)\n", This, client_info);
586 return E_NOTIMPL;
589 static HRESULT WINAPI WMReaderAdvanced_GetMaxOutputSampleSize(IWMReaderAdvanced6 *iface, DWORD output, DWORD *max)
591 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
592 FIXME("(%p)->(%lu %p)\n", This, output, max);
593 return E_NOTIMPL;
596 static HRESULT WINAPI WMReaderAdvanced_GetMaxStreamSampleSize(IWMReaderAdvanced6 *iface,
597 WORD stream_number, DWORD *size)
599 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
601 TRACE("reader %p, stream_number %u, size %p.\n", reader, stream_number, size);
603 return wm_reader_get_max_stream_size(&reader->reader, stream_number, size);
606 static HRESULT WINAPI WMReaderAdvanced_NotifyLateDelivery(IWMReaderAdvanced6 *iface, QWORD lateness)
608 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
609 FIXME("(%p)->(%s)\n", This, wine_dbgstr_longlong(lateness));
610 return E_NOTIMPL;
613 static HRESULT WINAPI WMReaderAdvanced2_SetPlayMode(IWMReaderAdvanced6 *iface, WMT_PLAY_MODE mode)
615 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
616 FIXME("(%p)->(%d)\n", This, mode);
617 return E_NOTIMPL;
620 static HRESULT WINAPI WMReaderAdvanced2_GetPlayMode(IWMReaderAdvanced6 *iface, WMT_PLAY_MODE *mode)
622 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
623 FIXME("(%p)->(%p)\n", This, mode);
624 return E_NOTIMPL;
627 static HRESULT WINAPI WMReaderAdvanced2_GetBufferProgress(IWMReaderAdvanced6 *iface, DWORD *percent, QWORD *buffering)
629 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
630 FIXME("(%p)->(%p %p)\n", This, percent, buffering);
631 return E_NOTIMPL;
634 static HRESULT WINAPI WMReaderAdvanced2_GetDownloadProgress(IWMReaderAdvanced6 *iface, DWORD *percent,
635 QWORD *bytes_downloaded, QWORD *download)
637 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
638 FIXME("(%p)->(%p %p %p)\n", This, percent, bytes_downloaded, download);
639 return E_NOTIMPL;
642 static HRESULT WINAPI WMReaderAdvanced2_GetSaveAsProgress(IWMReaderAdvanced6 *iface, DWORD *percent)
644 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
645 FIXME("(%p)->(%p)\n", This, percent);
646 return E_NOTIMPL;
649 static HRESULT WINAPI WMReaderAdvanced2_SaveFileAs(IWMReaderAdvanced6 *iface, const WCHAR *filename)
651 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
652 FIXME("(%p)->(%s)\n", This, debugstr_w(filename));
653 return E_NOTIMPL;
656 static HRESULT WINAPI WMReaderAdvanced2_GetProtocolName(IWMReaderAdvanced6 *iface, WCHAR *protocol, DWORD *protocol_len)
658 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
659 FIXME("(%p)->(%p %p)\n", This, protocol, protocol_len);
660 return E_NOTIMPL;
663 static HRESULT WINAPI WMReaderAdvanced2_StartAtMarker(IWMReaderAdvanced6 *iface, WORD marker_index,
664 QWORD duration, float rate, void *context)
666 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
667 FIXME("(%p)->(%d %s %f %p)\n", This, marker_index, wine_dbgstr_longlong(duration), rate, context);
668 return E_NOTIMPL;
671 static HRESULT WINAPI WMReaderAdvanced2_GetOutputSetting(IWMReaderAdvanced6 *iface, DWORD output_num,
672 const WCHAR *name, WMT_ATTR_DATATYPE *type, BYTE *value, WORD *length)
674 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
675 FIXME("(%p)->(%lu %s %p %p %p)\n", This, output_num, debugstr_w(name), type, value, length);
676 return E_NOTIMPL;
679 static HRESULT WINAPI WMReaderAdvanced2_SetOutputSetting(IWMReaderAdvanced6 *iface, DWORD output_num,
680 const WCHAR *name, WMT_ATTR_DATATYPE type, const BYTE *value, WORD length)
682 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
683 FIXME("(%p)->(%lu %s %#x %p %u)\n", This, output_num, debugstr_w(name), type, value, length);
684 return E_NOTIMPL;
687 static HRESULT WINAPI WMReaderAdvanced2_Preroll(IWMReaderAdvanced6 *iface, QWORD start, QWORD duration, float rate)
689 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
690 FIXME("(%p)->(%s %s %f)\n", This, wine_dbgstr_longlong(start), wine_dbgstr_longlong(duration), rate);
691 return E_NOTIMPL;
694 static HRESULT WINAPI WMReaderAdvanced2_SetLogClientID(IWMReaderAdvanced6 *iface, BOOL log_client_id)
696 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
697 FIXME("(%p)->(%x)\n", This, log_client_id);
698 return E_NOTIMPL;
701 static HRESULT WINAPI WMReaderAdvanced2_GetLogClientID(IWMReaderAdvanced6 *iface, BOOL *log_client_id)
703 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
704 FIXME("(%p)->(%p)\n", This, log_client_id);
705 return E_NOTIMPL;
708 static HRESULT WINAPI WMReaderAdvanced2_StopBuffering(IWMReaderAdvanced6 *iface)
710 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
711 FIXME("(%p)\n", This);
712 return E_NOTIMPL;
715 static HRESULT WINAPI WMReaderAdvanced2_OpenStream(IWMReaderAdvanced6 *iface,
716 IStream *stream, IWMReaderCallback *callback, void *context)
718 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
719 HRESULT hr;
721 TRACE("reader %p, stream %p, callback %p, context %p.\n", reader, stream, callback, context);
723 EnterCriticalSection(&reader->reader.cs);
725 if (reader->reader.wg_parser)
727 LeaveCriticalSection(&reader->reader.cs);
728 WARN("Stream is already open; returning E_UNEXPECTED.\n");
729 return E_UNEXPECTED;
732 if (SUCCEEDED(hr = wm_reader_open_stream(&reader->reader, stream)))
733 open_stream(reader, callback, context);
735 LeaveCriticalSection(&reader->reader.cs);
736 return hr;
739 static HRESULT WINAPI WMReaderAdvanced3_StopNetStreaming(IWMReaderAdvanced6 *iface)
741 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
742 FIXME("(%p)\n", This);
743 return E_NOTIMPL;
746 static HRESULT WINAPI WMReaderAdvanced3_StartAtPosition(IWMReaderAdvanced6 *iface, WORD stream_num,
747 void *offset_start, void *duration, WMT_OFFSET_FORMAT format, float rate, void *context)
749 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
750 FIXME("(%p)->(%d %p %p %d %f %p)\n", This, stream_num, offset_start, duration, format, rate, context);
751 return E_NOTIMPL;
754 static HRESULT WINAPI WMReaderAdvanced4_GetLanguageCount(IWMReaderAdvanced6 *iface, DWORD output_num, WORD *language_count)
756 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
757 FIXME("(%p)->(%lu %p)\n", This, output_num, language_count);
758 return E_NOTIMPL;
761 static HRESULT WINAPI WMReaderAdvanced4_GetLanguage(IWMReaderAdvanced6 *iface, DWORD output_num,
762 WORD language, WCHAR *language_string, WORD *language_string_len)
764 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
766 FIXME("reader %p, output %lu, language %#x, language_string %p, language_string_len %p, stub!\n",
767 reader, output_num, language, language_string, language_string_len);
769 return E_NOTIMPL;
772 static HRESULT WINAPI WMReaderAdvanced4_GetMaxSpeedFactor(IWMReaderAdvanced6 *iface, double *factor)
774 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
775 FIXME("(%p)->(%p)\n", This, factor);
776 return E_NOTIMPL;
779 static HRESULT WINAPI WMReaderAdvanced4_IsUsingFastCache(IWMReaderAdvanced6 *iface, BOOL *using_fast_cache)
781 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
782 FIXME("(%p)->(%p)\n", This, using_fast_cache);
783 return E_NOTIMPL;
786 static HRESULT WINAPI WMReaderAdvanced4_AddLogParam(IWMReaderAdvanced6 *iface, const WCHAR *namespace,
787 const WCHAR *name, const WCHAR *value)
789 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
790 FIXME("(%p)->(%s %s %s)\n", This, debugstr_w(namespace), debugstr_w(name), debugstr_w(value));
791 return E_NOTIMPL;
794 static HRESULT WINAPI WMReaderAdvanced4_SendLogParams(IWMReaderAdvanced6 *iface)
796 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
797 FIXME("(%p)\n", This);
798 return E_NOTIMPL;
801 static HRESULT WINAPI WMReaderAdvanced4_CanSaveFileAs(IWMReaderAdvanced6 *iface, BOOL *can_save)
803 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
804 FIXME("(%p)->(%p)\n", This, can_save);
805 return E_NOTIMPL;
808 static HRESULT WINAPI WMReaderAdvanced4_CancelSaveFileAs(IWMReaderAdvanced6 *iface)
810 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
811 FIXME("(%p)\n", This);
812 return E_NOTIMPL;
815 static HRESULT WINAPI WMReaderAdvanced4_GetURL(IWMReaderAdvanced6 *iface, WCHAR *url, DWORD *url_len)
817 struct async_reader *This = impl_from_IWMReaderAdvanced6(iface);
818 FIXME("(%p)->(%p %p)\n", This, url, url_len);
819 return E_NOTIMPL;
822 static HRESULT WINAPI WMReaderAdvanced5_SetPlayerHook(IWMReaderAdvanced6 *iface, DWORD output_num, IWMPlayerHook *hook)
824 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
826 FIXME("reader %p, output %lu, hook %p, stub!\n", reader, output_num, hook);
828 return E_NOTIMPL;
831 static HRESULT WINAPI WMReaderAdvanced6_SetProtectStreamSamples(IWMReaderAdvanced6 *iface, BYTE *cert,
832 DWORD cert_size, DWORD cert_type, DWORD flags, BYTE *initialization_vector, DWORD *initialization_vector_size)
834 struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
836 FIXME("reader %p, cert %p, cert_size %lu, cert_type %#lx, flags %#lx, vector %p, vector_size %p, stub!\n",
837 reader, cert, cert_size, cert_type, flags, initialization_vector, initialization_vector_size);
839 return E_NOTIMPL;
842 static const IWMReaderAdvanced6Vtbl WMReaderAdvanced6Vtbl = {
843 WMReaderAdvanced_QueryInterface,
844 WMReaderAdvanced_AddRef,
845 WMReaderAdvanced_Release,
846 WMReaderAdvanced_SetUserProvidedClock,
847 WMReaderAdvanced_GetUserProvidedClock,
848 WMReaderAdvanced_DeliverTime,
849 WMReaderAdvanced_SetManualStreamSelection,
850 WMReaderAdvanced_GetManualStreamSelection,
851 WMReaderAdvanced_SetStreamsSelected,
852 WMReaderAdvanced_GetStreamSelected,
853 WMReaderAdvanced_SetReceiveSelectionCallbacks,
854 WMReaderAdvanced_GetReceiveSelectionCallbacks,
855 WMReaderAdvanced_SetReceiveStreamSamples,
856 WMReaderAdvanced_GetReceiveStreamSamples,
857 WMReaderAdvanced_SetAllocateForOutput,
858 WMReaderAdvanced_GetAllocateForOutput,
859 WMReaderAdvanced_SetAllocateForStream,
860 WMReaderAdvanced_GetAllocateForStream,
861 WMReaderAdvanced_GetStatistics,
862 WMReaderAdvanced_SetClientInfo,
863 WMReaderAdvanced_GetMaxOutputSampleSize,
864 WMReaderAdvanced_GetMaxStreamSampleSize,
865 WMReaderAdvanced_NotifyLateDelivery,
866 WMReaderAdvanced2_SetPlayMode,
867 WMReaderAdvanced2_GetPlayMode,
868 WMReaderAdvanced2_GetBufferProgress,
869 WMReaderAdvanced2_GetDownloadProgress,
870 WMReaderAdvanced2_GetSaveAsProgress,
871 WMReaderAdvanced2_SaveFileAs,
872 WMReaderAdvanced2_GetProtocolName,
873 WMReaderAdvanced2_StartAtMarker,
874 WMReaderAdvanced2_GetOutputSetting,
875 WMReaderAdvanced2_SetOutputSetting,
876 WMReaderAdvanced2_Preroll,
877 WMReaderAdvanced2_SetLogClientID,
878 WMReaderAdvanced2_GetLogClientID,
879 WMReaderAdvanced2_StopBuffering,
880 WMReaderAdvanced2_OpenStream,
881 WMReaderAdvanced3_StopNetStreaming,
882 WMReaderAdvanced3_StartAtPosition,
883 WMReaderAdvanced4_GetLanguageCount,
884 WMReaderAdvanced4_GetLanguage,
885 WMReaderAdvanced4_GetMaxSpeedFactor,
886 WMReaderAdvanced4_IsUsingFastCache,
887 WMReaderAdvanced4_AddLogParam,
888 WMReaderAdvanced4_SendLogParams,
889 WMReaderAdvanced4_CanSaveFileAs,
890 WMReaderAdvanced4_CancelSaveFileAs,
891 WMReaderAdvanced4_GetURL,
892 WMReaderAdvanced5_SetPlayerHook,
893 WMReaderAdvanced6_SetProtectStreamSamples
896 static struct async_reader *impl_from_IWMReaderAccelerator(IWMReaderAccelerator *iface)
898 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderAccelerator_iface);
901 static HRESULT WINAPI reader_accl_QueryInterface(IWMReaderAccelerator *iface, REFIID riid, void **object)
903 struct async_reader *This = impl_from_IWMReaderAccelerator(iface);
904 return IWMReader_QueryInterface(&This->IWMReader_iface, riid, object);
907 static ULONG WINAPI reader_accl_AddRef(IWMReaderAccelerator *iface)
909 struct async_reader *This = impl_from_IWMReaderAccelerator(iface);
910 return IWMReader_AddRef(&This->IWMReader_iface);
913 static ULONG WINAPI reader_accl_Release(IWMReaderAccelerator *iface)
915 struct async_reader *This = impl_from_IWMReaderAccelerator(iface);
916 return IWMReader_Release(&This->IWMReader_iface);
919 static HRESULT WINAPI reader_accl_GetCodecInterface(IWMReaderAccelerator *iface, DWORD output, REFIID riid, void **codec)
921 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
923 FIXME("reader %p, output %lu, iid %s, codec %p, stub!\n", reader, output, debugstr_guid(riid), codec);
925 return E_NOTIMPL;
928 static HRESULT WINAPI reader_accl_Notify(IWMReaderAccelerator *iface, DWORD output, WM_MEDIA_TYPE *subtype)
930 struct async_reader *reader = impl_from_IWMReaderAccelerator(iface);
932 FIXME("reader %p, output %lu, subtype %p, stub!\n", reader, output, subtype);
934 return E_NOTIMPL;
937 static const IWMReaderAcceleratorVtbl WMReaderAcceleratorVtbl = {
938 reader_accl_QueryInterface,
939 reader_accl_AddRef,
940 reader_accl_Release,
941 reader_accl_GetCodecInterface,
942 reader_accl_Notify
945 static struct async_reader *impl_from_IWMReaderNetworkConfig2(IWMReaderNetworkConfig2 *iface)
947 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderNetworkConfig2_iface);
950 static HRESULT WINAPI networkconfig_QueryInterface(IWMReaderNetworkConfig2 *iface, REFIID riid, void **ppv)
952 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
953 return IWMReader_QueryInterface(&This->IWMReader_iface, riid, ppv);
956 static ULONG WINAPI networkconfig_AddRef(IWMReaderNetworkConfig2 *iface)
958 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
959 return IWMReader_AddRef(&This->IWMReader_iface);
962 static ULONG WINAPI networkconfig_Release(IWMReaderNetworkConfig2 *iface)
964 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
965 return IWMReader_Release(&This->IWMReader_iface);
968 static HRESULT WINAPI networkconfig_GetBufferingTime(IWMReaderNetworkConfig2 *iface, QWORD *buffering_time)
970 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
971 FIXME("%p, %p\n", This, buffering_time);
972 return E_NOTIMPL;
975 static HRESULT WINAPI networkconfig_SetBufferingTime(IWMReaderNetworkConfig2 *iface, QWORD buffering_time)
977 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
978 FIXME("%p, %s\n", This, wine_dbgstr_longlong(buffering_time));
979 return E_NOTIMPL;
982 static HRESULT WINAPI networkconfig_GetUDPPortRanges(IWMReaderNetworkConfig2 *iface, WM_PORT_NUMBER_RANGE *array,
983 DWORD *ranges)
985 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
986 FIXME("%p, %p, %p\n", This, array, ranges);
987 return E_NOTIMPL;
990 static HRESULT WINAPI networkconfig_SetUDPPortRanges(IWMReaderNetworkConfig2 *iface,
991 WM_PORT_NUMBER_RANGE *ranges, DWORD count)
993 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
995 FIXME("reader %p, ranges %p, count %lu.\n", reader, ranges, count);
997 return E_NOTIMPL;
1000 static HRESULT WINAPI networkconfig_GetProxySettings(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1001 WMT_PROXY_SETTINGS *proxy)
1003 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1004 FIXME("%p, %s, %p\n", This, debugstr_w(protocol), proxy);
1005 return E_NOTIMPL;
1008 static HRESULT WINAPI networkconfig_SetProxySettings(IWMReaderNetworkConfig2 *iface, LPCWSTR protocol,
1009 WMT_PROXY_SETTINGS proxy)
1011 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1012 FIXME("%p, %s, %d\n", This, debugstr_w(protocol), proxy);
1013 return E_NOTIMPL;
1016 static HRESULT WINAPI networkconfig_GetProxyHostName(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1017 WCHAR *hostname, DWORD *size)
1019 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1020 FIXME("%p, %s, %p, %p\n", This, debugstr_w(protocol), hostname, size);
1021 return E_NOTIMPL;
1024 static HRESULT WINAPI networkconfig_SetProxyHostName(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1025 const WCHAR *hostname)
1027 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1028 FIXME("%p, %s, %s\n", This, debugstr_w(protocol), debugstr_w(hostname));
1029 return E_NOTIMPL;
1032 static HRESULT WINAPI networkconfig_GetProxyPort(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1033 DWORD *port)
1035 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1036 FIXME("%p, %s, %p\n", This, debugstr_w(protocol), port);
1037 return E_NOTIMPL;
1040 static HRESULT WINAPI networkconfig_SetProxyPort(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1041 DWORD port)
1043 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1045 FIXME("reader %p, protocol %s, port %lu, stub!\n", reader, debugstr_w(protocol), port);
1047 return E_NOTIMPL;
1050 static HRESULT WINAPI networkconfig_GetProxyExceptionList(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1051 WCHAR *exceptions, DWORD *count)
1053 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1054 FIXME("%p, %s, %p, %p\n", This, debugstr_w(protocol), exceptions, count);
1055 return E_NOTIMPL;
1058 static HRESULT WINAPI networkconfig_SetProxyExceptionList(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1059 const WCHAR *exceptions)
1061 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1062 FIXME("%p, %s, %s\n", This, debugstr_w(protocol), debugstr_w(exceptions));
1063 return E_NOTIMPL;
1066 static HRESULT WINAPI networkconfig_GetProxyBypassForLocal(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1067 BOOL *bypass)
1069 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1070 FIXME("%p, %s, %p\n", This, debugstr_w(protocol), bypass);
1071 return E_NOTIMPL;
1074 static HRESULT WINAPI networkconfig_SetProxyBypassForLocal(IWMReaderNetworkConfig2 *iface, const WCHAR *protocol,
1075 BOOL bypass)
1077 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1078 FIXME("%p, %s, %d\n", This, debugstr_w(protocol), bypass);
1079 return E_NOTIMPL;
1082 static HRESULT WINAPI networkconfig_GetForceRerunAutoProxyDetection(IWMReaderNetworkConfig2 *iface,
1083 BOOL *detection)
1085 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1086 FIXME("%p, %p\n", This, detection);
1087 return E_NOTIMPL;
1090 static HRESULT WINAPI networkconfig_SetForceRerunAutoProxyDetection(IWMReaderNetworkConfig2 *iface,
1091 BOOL detection)
1093 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1094 FIXME("%p, %d\n", This, detection);
1095 return E_NOTIMPL;
1098 static HRESULT WINAPI networkconfig_GetEnableMulticast(IWMReaderNetworkConfig2 *iface, BOOL *multicast)
1100 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1101 FIXME("%p, %p\n", This, multicast);
1102 return E_NOTIMPL;
1105 static HRESULT WINAPI networkconfig_SetEnableMulticast(IWMReaderNetworkConfig2 *iface, BOOL multicast)
1107 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1108 FIXME("%p, %d\n", This, multicast);
1109 return E_NOTIMPL;
1112 static HRESULT WINAPI networkconfig_GetEnableHTTP(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1114 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1115 FIXME("%p, %p\n", This, enable);
1116 return E_NOTIMPL;
1119 static HRESULT WINAPI networkconfig_SetEnableHTTP(IWMReaderNetworkConfig2 *iface, BOOL enable)
1121 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1122 FIXME("%p, %d\n", This, enable);
1123 return E_NOTIMPL;
1126 static HRESULT WINAPI networkconfig_GetEnableUDP(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1128 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1129 FIXME("%p, %p\n", This, enable);
1130 return E_NOTIMPL;
1133 static HRESULT WINAPI networkconfig_SetEnableUDP(IWMReaderNetworkConfig2 *iface, BOOL enable)
1135 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1136 FIXME("%p, %d\n", This, enable);
1137 return E_NOTIMPL;
1140 static HRESULT WINAPI networkconfig_GetEnableTCP(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1142 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1143 FIXME("%p, %p\n", This, enable);
1144 return E_NOTIMPL;
1147 static HRESULT WINAPI networkconfig_SetEnableTCP(IWMReaderNetworkConfig2 *iface, BOOL enable)
1149 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1150 FIXME("%p, %d\n", This, enable);
1151 return E_NOTIMPL;
1154 static HRESULT WINAPI networkconfig_ResetProtocolRollover(IWMReaderNetworkConfig2 *iface)
1156 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1157 FIXME("%p\n", This);
1158 return E_NOTIMPL;
1161 static HRESULT WINAPI networkconfig_GetConnectionBandwidth(IWMReaderNetworkConfig2 *iface, DWORD *bandwidth)
1163 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1164 FIXME("%p, %p\n", This, bandwidth);
1165 return E_NOTIMPL;
1168 static HRESULT WINAPI networkconfig_SetConnectionBandwidth(IWMReaderNetworkConfig2 *iface, DWORD bandwidth)
1170 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1172 FIXME("reader %p, bandwidth %lu, stub!\n", reader, bandwidth);
1174 return E_NOTIMPL;
1177 static HRESULT WINAPI networkconfig_GetNumProtocolsSupported(IWMReaderNetworkConfig2 *iface, DWORD *protocols)
1179 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1180 FIXME("%p, %p\n", This, protocols);
1181 return E_NOTIMPL;
1184 static HRESULT WINAPI networkconfig_GetSupportedProtocolName(IWMReaderNetworkConfig2 *iface, DWORD protocol_num,
1185 WCHAR *protocol, DWORD *size)
1187 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1189 FIXME("reader %p, index %lu, protocol %p, size %p, stub!\n", reader, protocol_num, protocol, size);
1191 return E_NOTIMPL;
1194 static HRESULT WINAPI networkconfig_AddLoggingUrl(IWMReaderNetworkConfig2 *iface, const WCHAR *url)
1196 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1197 FIXME("%p, %s\n", This, debugstr_w(url));
1198 return E_NOTIMPL;
1201 static HRESULT WINAPI networkconfig_GetLoggingUrl(IWMReaderNetworkConfig2 *iface, DWORD index, WCHAR *url,
1202 DWORD *size)
1204 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1206 FIXME("reader %p, index %lu, url %p, size %p, stub!\n", reader, index, url, size);
1208 return E_NOTIMPL;
1211 static HRESULT WINAPI networkconfig_GetLoggingUrlCount(IWMReaderNetworkConfig2 *iface, DWORD *count)
1213 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1214 FIXME("%p, %p\n", This, count);
1215 return E_NOTIMPL;
1218 static HRESULT WINAPI networkconfig_ResetLoggingUrlList(IWMReaderNetworkConfig2 *iface)
1220 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1221 FIXME("%p\n", This);
1222 return E_NOTIMPL;
1225 static HRESULT WINAPI networkconfig_GetEnableContentCaching(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1227 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1228 FIXME("%p, %p\n", This, enable);
1229 return E_NOTIMPL;
1232 static HRESULT WINAPI networkconfig_SetEnableContentCaching(IWMReaderNetworkConfig2 *iface, BOOL enable)
1234 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1235 FIXME("%p, %d\n", This, enable);
1236 return E_NOTIMPL;
1239 static HRESULT WINAPI networkconfig_GetEnableFastCache(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1241 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1242 FIXME("%p, %p\n", This, enable);
1243 return E_NOTIMPL;
1246 static HRESULT WINAPI networkconfig_SetEnableFastCache(IWMReaderNetworkConfig2 *iface, BOOL enable)
1248 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1249 FIXME("%p, %d\n", This, enable);
1250 return E_NOTIMPL;
1253 static HRESULT WINAPI networkconfig_GetAcceleratedStreamingDuration(IWMReaderNetworkConfig2 *iface,
1254 QWORD *duration)
1256 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1257 FIXME("%p, %p\n", This, duration);
1258 return E_NOTIMPL;
1261 static HRESULT WINAPI networkconfig_SetAcceleratedStreamingDuration(IWMReaderNetworkConfig2 *iface,
1262 QWORD duration)
1264 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1265 FIXME("%p, %s\n", This, wine_dbgstr_longlong(duration));
1266 return E_NOTIMPL;
1269 static HRESULT WINAPI networkconfig_GetAutoReconnectLimit(IWMReaderNetworkConfig2 *iface, DWORD *limit)
1271 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1272 FIXME("%p, %p\n", This, limit);
1273 return E_NOTIMPL;
1276 static HRESULT WINAPI networkconfig_SetAutoReconnectLimit(IWMReaderNetworkConfig2 *iface, DWORD limit)
1278 struct async_reader *reader = impl_from_IWMReaderNetworkConfig2(iface);
1280 FIXME("reader %p, limit %lu, stub!\n", reader, limit);
1282 return E_NOTIMPL;
1285 static HRESULT WINAPI networkconfig_GetEnableResends(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1287 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1288 FIXME("%p, %p\n", This, enable);
1289 return E_NOTIMPL;
1292 static HRESULT WINAPI networkconfig_SetEnableResends(IWMReaderNetworkConfig2 *iface, BOOL enable)
1294 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1295 FIXME("%p, %u\n", This, enable);
1296 return E_NOTIMPL;
1299 static HRESULT WINAPI networkconfig_GetEnableThinning(IWMReaderNetworkConfig2 *iface, BOOL *enable)
1301 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1302 FIXME("%p, %p\n", This, enable);
1303 return E_NOTIMPL;
1306 static HRESULT WINAPI networkconfig_SetEnableThinning(IWMReaderNetworkConfig2 *iface, BOOL enable)
1308 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1309 FIXME("%p, %u\n", This, enable);
1310 return E_NOTIMPL;
1313 static HRESULT WINAPI networkconfig_GetMaxNetPacketSize(IWMReaderNetworkConfig2 *iface, DWORD *packet_size)
1315 struct async_reader *This = impl_from_IWMReaderNetworkConfig2(iface);
1316 FIXME("%p, %p\n", This, packet_size);
1317 return E_NOTIMPL;
1320 static const IWMReaderNetworkConfig2Vtbl WMReaderNetworkConfig2Vtbl =
1322 networkconfig_QueryInterface,
1323 networkconfig_AddRef,
1324 networkconfig_Release,
1325 networkconfig_GetBufferingTime,
1326 networkconfig_SetBufferingTime,
1327 networkconfig_GetUDPPortRanges,
1328 networkconfig_SetUDPPortRanges,
1329 networkconfig_GetProxySettings,
1330 networkconfig_SetProxySettings,
1331 networkconfig_GetProxyHostName,
1332 networkconfig_SetProxyHostName,
1333 networkconfig_GetProxyPort,
1334 networkconfig_SetProxyPort,
1335 networkconfig_GetProxyExceptionList,
1336 networkconfig_SetProxyExceptionList,
1337 networkconfig_GetProxyBypassForLocal,
1338 networkconfig_SetProxyBypassForLocal,
1339 networkconfig_GetForceRerunAutoProxyDetection,
1340 networkconfig_SetForceRerunAutoProxyDetection,
1341 networkconfig_GetEnableMulticast,
1342 networkconfig_SetEnableMulticast,
1343 networkconfig_GetEnableHTTP,
1344 networkconfig_SetEnableHTTP,
1345 networkconfig_GetEnableUDP,
1346 networkconfig_SetEnableUDP,
1347 networkconfig_GetEnableTCP,
1348 networkconfig_SetEnableTCP,
1349 networkconfig_ResetProtocolRollover,
1350 networkconfig_GetConnectionBandwidth,
1351 networkconfig_SetConnectionBandwidth,
1352 networkconfig_GetNumProtocolsSupported,
1353 networkconfig_GetSupportedProtocolName,
1354 networkconfig_AddLoggingUrl,
1355 networkconfig_GetLoggingUrl,
1356 networkconfig_GetLoggingUrlCount,
1357 networkconfig_ResetLoggingUrlList,
1358 networkconfig_GetEnableContentCaching,
1359 networkconfig_SetEnableContentCaching,
1360 networkconfig_GetEnableFastCache,
1361 networkconfig_SetEnableFastCache,
1362 networkconfig_GetAcceleratedStreamingDuration,
1363 networkconfig_SetAcceleratedStreamingDuration,
1364 networkconfig_GetAutoReconnectLimit,
1365 networkconfig_SetAutoReconnectLimit,
1366 networkconfig_GetEnableResends,
1367 networkconfig_SetEnableResends,
1368 networkconfig_GetEnableThinning,
1369 networkconfig_SetEnableThinning,
1370 networkconfig_GetMaxNetPacketSize
1373 static struct async_reader *impl_from_IWMReaderStreamClock(IWMReaderStreamClock *iface)
1375 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderStreamClock_iface);
1378 static HRESULT WINAPI readclock_QueryInterface(IWMReaderStreamClock *iface, REFIID riid, void **ppv)
1380 struct async_reader *This = impl_from_IWMReaderStreamClock(iface);
1381 return IWMReader_QueryInterface(&This->IWMReader_iface, riid, ppv);
1384 static ULONG WINAPI readclock_AddRef(IWMReaderStreamClock *iface)
1386 struct async_reader *This = impl_from_IWMReaderStreamClock(iface);
1387 return IWMReader_AddRef(&This->IWMReader_iface);
1390 static ULONG WINAPI readclock_Release(IWMReaderStreamClock *iface)
1392 struct async_reader *This = impl_from_IWMReaderStreamClock(iface);
1393 return IWMReader_Release(&This->IWMReader_iface);
1396 static HRESULT WINAPI readclock_GetTime(IWMReaderStreamClock *iface, QWORD *now)
1398 struct async_reader *This = impl_from_IWMReaderStreamClock(iface);
1399 FIXME("%p, %p\n", This, now);
1400 return E_NOTIMPL;
1403 static HRESULT WINAPI readclock_SetTimer(IWMReaderStreamClock *iface, QWORD when, void *param, DWORD *id)
1405 struct async_reader *This = impl_from_IWMReaderStreamClock(iface);
1406 FIXME("%p, %s, %p, %p\n", This, wine_dbgstr_longlong(when), param, id);
1407 return E_NOTIMPL;
1410 static HRESULT WINAPI readclock_KillTimer(IWMReaderStreamClock *iface, DWORD id)
1412 struct async_reader *reader = impl_from_IWMReaderStreamClock(iface);
1414 FIXME("reader %p, id %lu, stub!\n", reader, id);
1416 return E_NOTIMPL;
1419 static const IWMReaderStreamClockVtbl WMReaderStreamClockVtbl =
1421 readclock_QueryInterface,
1422 readclock_AddRef,
1423 readclock_Release,
1424 readclock_GetTime,
1425 readclock_SetTimer,
1426 readclock_KillTimer
1429 static struct async_reader *impl_from_IWMReaderTypeNegotiation(IWMReaderTypeNegotiation *iface)
1431 return CONTAINING_RECORD(iface, struct async_reader, IWMReaderTypeNegotiation_iface);
1434 static HRESULT WINAPI negotiation_QueryInterface(IWMReaderTypeNegotiation *iface, REFIID riid, void **ppv)
1436 struct async_reader *This = impl_from_IWMReaderTypeNegotiation(iface);
1437 return IWMReader_QueryInterface(&This->IWMReader_iface, riid, ppv);
1440 static ULONG WINAPI negotiation_AddRef(IWMReaderTypeNegotiation *iface)
1442 struct async_reader *This = impl_from_IWMReaderTypeNegotiation(iface);
1443 return IWMReader_AddRef(&This->IWMReader_iface);
1446 static ULONG WINAPI negotiation_Release(IWMReaderTypeNegotiation *iface)
1448 struct async_reader *This = impl_from_IWMReaderTypeNegotiation(iface);
1449 return IWMReader_Release(&This->IWMReader_iface);
1452 static HRESULT WINAPI negotiation_TryOutputProps(IWMReaderTypeNegotiation *iface, DWORD output, IWMOutputMediaProps *props)
1454 struct async_reader *reader = impl_from_IWMReaderTypeNegotiation(iface);
1456 FIXME("reader %p, output %lu, props %p, stub!\n", reader, output, props);
1458 return E_NOTIMPL;
1461 static const IWMReaderTypeNegotiationVtbl WMReaderTypeNegotiationVtbl =
1463 negotiation_QueryInterface,
1464 negotiation_AddRef,
1465 negotiation_Release,
1466 negotiation_TryOutputProps
1469 static struct async_reader *impl_from_IReferenceClock(IReferenceClock *iface)
1471 return CONTAINING_RECORD(iface, struct async_reader, IReferenceClock_iface);
1474 static HRESULT WINAPI refclock_QueryInterface(IReferenceClock *iface, REFIID riid, void **ppv)
1476 struct async_reader *This = impl_from_IReferenceClock(iface);
1477 return IWMReader_QueryInterface(&This->IWMReader_iface, riid, ppv);
1480 static ULONG WINAPI refclock_AddRef(IReferenceClock *iface)
1482 struct async_reader *This = impl_from_IReferenceClock(iface);
1483 return IWMReader_AddRef(&This->IWMReader_iface);
1486 static ULONG WINAPI refclock_Release(IReferenceClock *iface)
1488 struct async_reader *This = impl_from_IReferenceClock(iface);
1489 return IWMReader_Release(&This->IWMReader_iface);
1492 static HRESULT WINAPI refclock_GetTime(IReferenceClock *iface, REFERENCE_TIME *time)
1494 struct async_reader *This = impl_from_IReferenceClock(iface);
1495 FIXME("%p, %p\n", This, time);
1496 return E_NOTIMPL;
1499 static HRESULT WINAPI refclock_AdviseTime(IReferenceClock *iface, REFERENCE_TIME basetime,
1500 REFERENCE_TIME streamtime, HEVENT event, DWORD_PTR *cookie)
1502 struct async_reader *reader = impl_from_IReferenceClock(iface);
1504 FIXME("reader %p, basetime %s, streamtime %s, event %#Ix, cookie %p, stub!\n",
1505 reader, debugstr_time(basetime), debugstr_time(streamtime), event, cookie);
1507 return E_NOTIMPL;
1510 static HRESULT WINAPI refclock_AdvisePeriodic(IReferenceClock *iface, REFERENCE_TIME starttime,
1511 REFERENCE_TIME period, HSEMAPHORE semaphore, DWORD_PTR *cookie)
1513 struct async_reader *reader = impl_from_IReferenceClock(iface);
1515 FIXME("reader %p, starttime %s, period %s, semaphore %#Ix, cookie %p, stub!\n",
1516 reader, debugstr_time(starttime), debugstr_time(period), semaphore, cookie);
1518 return E_NOTIMPL;
1521 static HRESULT WINAPI refclock_Unadvise(IReferenceClock *iface, DWORD_PTR cookie)
1523 struct async_reader *reader = impl_from_IReferenceClock(iface);
1525 FIXME("reader %p, cookie %Iu, stub!\n", reader, cookie);
1527 return E_NOTIMPL;
1530 static const IReferenceClockVtbl ReferenceClockVtbl =
1532 refclock_QueryInterface,
1533 refclock_AddRef,
1534 refclock_Release,
1535 refclock_GetTime,
1536 refclock_AdviseTime,
1537 refclock_AdvisePeriodic,
1538 refclock_Unadvise
1541 static struct async_reader *impl_from_wm_reader(struct wm_reader *iface)
1543 return CONTAINING_RECORD(iface, struct async_reader, reader);
1546 static void *async_reader_query_interface(struct wm_reader *iface, REFIID iid)
1548 struct async_reader *reader = impl_from_wm_reader(iface);
1550 TRACE("reader %p, iid %s.\n", reader, debugstr_guid(iid));
1552 if (IsEqualIID(iid, &IID_IReferenceClock))
1553 return &reader->IReferenceClock_iface;
1555 if (IsEqualIID(iid, &IID_IWMReader))
1556 return &reader->IWMReader_iface;
1558 if (IsEqualIID(iid, &IID_IWMReaderAccelerator))
1559 return &reader->IWMReaderAccelerator_iface;
1561 if (IsEqualIID(iid, &IID_IWMReaderAdvanced)
1562 || IsEqualIID(iid, &IID_IWMReaderAdvanced2)
1563 || IsEqualIID(iid, &IID_IWMReaderAdvanced3)
1564 || IsEqualIID(iid, &IID_IWMReaderAdvanced4)
1565 || IsEqualIID(iid, &IID_IWMReaderAdvanced5)
1566 || IsEqualIID(iid, &IID_IWMReaderAdvanced6))
1567 return &reader->IWMReaderAdvanced6_iface;
1569 if (IsEqualIID(iid, &IID_IWMReaderNetworkConfig)
1570 || IsEqualIID(iid, &IID_IWMReaderNetworkConfig2))
1571 return &reader->IWMReaderNetworkConfig2_iface;
1573 if (IsEqualIID(iid, &IID_IWMReaderStreamClock))
1574 return &reader->IWMReaderStreamClock_iface;
1576 if (IsEqualIID(iid, &IID_IWMReaderTypeNegotiation))
1577 return &reader->IWMReaderTypeNegotiation_iface;
1579 return NULL;
1582 static void async_reader_destroy(struct wm_reader *iface)
1584 struct async_reader *reader = impl_from_wm_reader(iface);
1586 TRACE("reader %p.\n", reader);
1588 if (reader->stream_thread)
1590 WaitForSingleObject(reader->stream_thread, INFINITE);
1591 CloseHandle(reader->stream_thread);
1594 reader->stream_cs.DebugInfo->Spare[0] = 0;
1595 DeleteCriticalSection(&reader->stream_cs);
1597 wm_reader_close(&reader->reader);
1599 if (reader->callback)
1600 IWMReaderCallback_Release(reader->callback);
1602 wm_reader_cleanup(&reader->reader);
1603 free(reader);
1606 static const struct wm_reader_ops async_reader_ops =
1608 .query_interface = async_reader_query_interface,
1609 .destroy = async_reader_destroy,
1612 HRESULT WINAPI winegstreamer_create_wm_async_reader(IWMReader **reader)
1614 struct async_reader *object;
1616 TRACE("reader %p.\n", reader);
1618 if (!(object = calloc(1, sizeof(*object))))
1619 return E_OUTOFMEMORY;
1621 wm_reader_init(&object->reader, &async_reader_ops);
1623 object->IReferenceClock_iface.lpVtbl = &ReferenceClockVtbl;
1624 object->IWMReader_iface.lpVtbl = &WMReaderVtbl;
1625 object->IWMReaderAdvanced6_iface.lpVtbl = &WMReaderAdvanced6Vtbl;
1626 object->IWMReaderAccelerator_iface.lpVtbl = &WMReaderAcceleratorVtbl;
1627 object->IWMReaderNetworkConfig2_iface.lpVtbl = &WMReaderNetworkConfig2Vtbl;
1628 object->IWMReaderStreamClock_iface.lpVtbl = &WMReaderStreamClockVtbl;
1629 object->IWMReaderTypeNegotiation_iface.lpVtbl = &WMReaderTypeNegotiationVtbl;
1631 InitializeCriticalSection(&object->stream_cs);
1632 object->stream_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": async_reader.stream_cs");
1634 QueryPerformanceFrequency(&object->clock_frequency);
1636 TRACE("Created async reader %p.\n", object);
1637 *reader = (IWMReader *)&object->IWMReader_iface;
1638 return S_OK;