ReactOS 0.4.17-dev-1017-ge38a44d
filtergraph.c
Go to the documentation of this file.
1/* DirectShow FilterGraph object (QUARTZ.DLL)
2 *
3 * Copyright 2002 Lionel Ulmer
4 * Copyright 2004 Christian Costa
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include <assert.h>
22#include <stdarg.h>
23
24#define COBJMACROS
25
26#include "windef.h"
27#include "winbase.h"
28#include "winuser.h"
29#include "winreg.h"
30#include "shlwapi.h"
31#include "dshow.h"
32#include "wine/debug.h"
33#include "quartz_private.h"
34#include "ole2.h"
35#include "olectl.h"
36#include "strmif.h"
37#include "vfwmsgs.h"
38#include "evcode.h"
39#include "wine/heap.h"
40#include "wine/list.h"
41
42
44
46
48{
52};
53
56static unsigned int message_thread_refcount;
57
59{
60 struct list entry;
63};
64
65#define MAX_ITF_CACHE_ENTRIES 3
66typedef struct _ITF_CACHE_ENTRY {
67 const IID* riid;
71
72struct filter
73{
74 struct list entry;
79};
80
82{
85 IMediaControl IMediaControl_iface;
87 IBasicAudio IBasicAudio_iface;
88 IBasicVideo2 IBasicVideo2_iface;
89 IVideoWindow IVideoWindow_iface;
90 IMediaEventEx IMediaEventEx_iface;
94 IMediaPosition IMediaPosition_iface;
97 /* IAMGraphStreams */
98 /* IAMStats */
99 /* IFilterChain */
100 /* IFilterMapper2 */
101 /* IQueueCommand */
102 /* IRegisterServiceProvider */
103 /* IResourceManager */
104 /* IServiceProvider */
106
110
111 struct list filters;
112 unsigned int name_index;
113
114 FILTER_STATE state;
116
119
120 /* We may indirectly wait for streaming threads while holding graph->cs in
121 * IMediaFilter::Stop() or IMediaSeeking::SetPositions(). Since streaming
122 * threads call IMediaEventSink::Notify() to queue EC_COMPLETE, we must
123 * use a separate lock to avoid them deadlocking on graph->cs. */
137 unsigned int got_ec_complete : 1;
138 unsigned int media_events_disabled : 1;
139
147
148 /* Respectively: the last timestamp at which we started streaming, and the
149 * current offset within the stream. */
153
154 unsigned int needs_async_run : 1;
155 unsigned int threaded : 1;
156};
157
159{
164 struct list *cursor;
165};
166
168
170{
172}
173
175{
177 TRACE("enum_filters %p, iid %s, out %p.\n", enum_filters, qzdebugstr_guid(iid), out);
178
179 if (IsEqualGUID(iid, &IID_IUnknown) || IsEqualGUID(iid, &IID_IEnumFilters))
180 {
181 IEnumFilters_AddRef(*out = iface);
182 return S_OK;
183 }
184
185 WARN("%s not implemented, returning E_NOINTERFACE.\n", qzdebugstr_guid(iid));
186 *out = NULL;
187 return E_NOINTERFACE;
188}
189
191{
194
195 TRACE("%p increasing refcount to %lu.\n", enum_filters, ref);
196
197 return ref;
198}
199
201{
204
205 TRACE("%p decreasing refcount to %lu.\n", enum_filters, ref);
206
207 if (!ref)
208 {
209 IUnknown_Release(enum_filters->graph->outer_unk);
211 }
212
213 return ref;
214}
215
217 IBaseFilter **filters, ULONG *fetched)
218{
220 unsigned int i = 0;
221
222 TRACE("enum_filters %p, count %lu, filters %p, fetched %p.\n",
223 enum_filters, count, filters, fetched);
224
225 if (enum_filters->version != enum_filters->graph->version)
227
228 if (!filters)
229 return E_POINTER;
230
231 for (i = 0; i < count; ++i)
232 {
234
235 if (!enum_filters->cursor)
236 break;
237
238 IBaseFilter_AddRef(filters[i] = filter->filter);
240 }
241
242 if (fetched)
243 *fetched = i;
244
245 return (i == count) ? S_OK : S_FALSE;
246}
247
249{
251
252 TRACE("enum_filters %p, count %lu.\n", enum_filters, count);
253
254 if (enum_filters->version != enum_filters->graph->version)
256
257 if (!enum_filters->cursor)
258 return E_INVALIDARG;
259
260 while (count--)
261 {
263 return count ? S_FALSE : S_OK;
264 }
265
266 return S_OK;
267}
268
270{
272
273 TRACE("enum_filters %p.\n", enum_filters);
274
277 return S_OK;
278}
279
281{
283
284 TRACE("enum_filters %p, out %p.\n", enum_filters, out);
285
287}
288
289static const IEnumFiltersVtbl EnumFilters_vtbl =
290{
298};
299
301{
303
304 if (!(enum_filters = heap_alloc(sizeof(*enum_filters))))
305 return E_OUTOFMEMORY;
306
308 enum_filters->ref = 1;
311 IUnknown_AddRef(graph->outer_unk);
312 enum_filters->version = graph->version;
313
315 return S_OK;
316}
317
319 LONG_PTR param1, LONG_PTR param2)
320{
321 struct media_event *event;
322
323 if (!(event = malloc(sizeof(*event))))
324 return FALSE;
325
326 event->code = code;
327 event->param1 = param1;
328 event->param2 = param2;
329 list_add_tail(&graph->media_events, &event->entry);
330
331 SetEvent(graph->media_event_handle);
332 if (graph->media_event_window)
333 PostMessageW(graph->media_event_window, graph->media_event_message, 0, graph->media_event_lparam);
334
335 return TRUE;
336}
337
339{
340 struct list *cursor;
341
342 while ((cursor = list_head(&graph->media_events)))
343 {
344 struct media_event *event = LIST_ENTRY(cursor, struct media_event, entry);
345
347 free(event);
348 }
349}
350
352{
353 return CONTAINING_RECORD(iface, struct filter_graph, IUnknown_inner);
354}
355
357{
358 struct filter_graph *This = impl_from_IUnknown(iface);
359 TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObj);
360
362 *ppvObj = &This->IUnknown_inner;
363 TRACE(" returning IUnknown interface (%p)\n", *ppvObj);
364 } else if (IsEqualGUID(&IID_IFilterGraph, riid) ||
365 IsEqualGUID(&IID_IFilterGraph2, riid) ||
366 IsEqualGUID(&IID_IGraphBuilder, riid)) {
367 *ppvObj = &This->IFilterGraph2_iface;
368 TRACE(" returning IGraphBuilder interface (%p)\n", *ppvObj);
369 } else if (IsEqualGUID(&IID_IMediaControl, riid)) {
370 *ppvObj = &This->IMediaControl_iface;
371 TRACE(" returning IMediaControl interface (%p)\n", *ppvObj);
372 } else if (IsEqualGUID(&IID_IMediaSeeking, riid)) {
373 *ppvObj = &This->IMediaSeeking_iface;
374 TRACE(" returning IMediaSeeking interface (%p)\n", *ppvObj);
375 } else if (IsEqualGUID(&IID_IBasicAudio, riid)) {
376 *ppvObj = &This->IBasicAudio_iface;
377 TRACE(" returning IBasicAudio interface (%p)\n", *ppvObj);
378 } else if (IsEqualGUID(&IID_IBasicVideo, riid) ||
379 IsEqualGUID(&IID_IBasicVideo2, riid)) {
380 *ppvObj = &This->IBasicVideo2_iface;
381 TRACE(" returning IBasicVideo2 interface (%p)\n", *ppvObj);
382 } else if (IsEqualGUID(&IID_IVideoWindow, riid)) {
383 *ppvObj = &This->IVideoWindow_iface;
384 TRACE(" returning IVideoWindow interface (%p)\n", *ppvObj);
385 } else if (IsEqualGUID(&IID_IMediaEvent, riid) ||
386 IsEqualGUID(&IID_IMediaEventEx, riid)) {
387 *ppvObj = &This->IMediaEventEx_iface;
388 TRACE(" returning IMediaEvent(Ex) interface (%p)\n", *ppvObj);
389 } else if (IsEqualGUID(&IID_IMediaFilter, riid) ||
391 *ppvObj = &This->IMediaFilter_iface;
392 TRACE(" returning IMediaFilter interface (%p)\n", *ppvObj);
393 } else if (IsEqualGUID(&IID_IMediaEventSink, riid)) {
394 *ppvObj = &This->IMediaEventSink_iface;
395 TRACE(" returning IMediaEventSink interface (%p)\n", *ppvObj);
396 } else if (IsEqualGUID(&IID_IGraphConfig, riid)) {
397 *ppvObj = &This->IGraphConfig_iface;
398 TRACE(" returning IGraphConfig interface (%p)\n", *ppvObj);
399 } else if (IsEqualGUID(&IID_IMediaPosition, riid)) {
400 *ppvObj = &This->IMediaPosition_iface;
401 TRACE(" returning IMediaPosition interface (%p)\n", *ppvObj);
402 } else if (IsEqualGUID(&IID_IObjectWithSite, riid)) {
403 *ppvObj = &This->IObjectWithSite_iface;
404 TRACE(" returning IObjectWithSite interface (%p)\n", *ppvObj);
405 } else if (IsEqualGUID(&IID_IFilterMapper, riid)) {
406 TRACE(" requesting IFilterMapper interface from aggregated filtermapper (%p)\n", *ppvObj);
407 return IUnknown_QueryInterface(This->punkFilterMapper2, riid, ppvObj);
408 } else if (IsEqualGUID(&IID_IFilterMapper2, riid)) {
409 TRACE(" returning IFilterMapper2 interface from aggregated filtermapper (%p)\n", *ppvObj);
410 return IUnknown_QueryInterface(This->punkFilterMapper2, riid, ppvObj);
411 } else if (IsEqualGUID(&IID_IFilterMapper3, riid)) {
412 TRACE(" returning IFilterMapper3 interface from aggregated filtermapper (%p)\n", *ppvObj);
413 return IUnknown_QueryInterface(This->punkFilterMapper2, riid, ppvObj);
414 } else if (IsEqualGUID(&IID_IGraphVersion, riid)) {
415 *ppvObj = &This->IGraphVersion_iface;
416 TRACE(" returning IGraphVersion interface (%p)\n", *ppvObj);
417 } else if (IsEqualGUID(&IID_IVideoFrameStep, riid)) {
418 *ppvObj = &This->IVideoFrameStep_iface;
419 TRACE(" returning IVideoFrameStep interface (%p)\n", *ppvObj);
420 } else {
421 *ppvObj = NULL;
422 FIXME("unknown interface %s\n", debugstr_guid(riid));
423 return E_NOINTERFACE;
424 }
425
426 IUnknown_AddRef((IUnknown *)*ppvObj);
427 return S_OK;
428}
429
431{
432 struct filter_graph *graph = impl_from_IUnknown(iface);
433 ULONG refcount = InterlockedIncrement(&graph->ref);
434
435 TRACE("%p increasing refcount to %lu.\n", graph, refcount);
436
437 return refcount;
438}
439
441{
442 struct filter_graph *This = impl_from_IUnknown(iface);
443 ULONG refcount = InterlockedDecrement(&This->ref);
444 struct list *cursor;
445
446 TRACE("%p decreasing refcount to %lu.\n", This, refcount);
447
448 if (!refcount)
449 {
450 int i;
451
452 This->ref = 1; /* guard against reentrancy (aggregation). */
453
454 IMediaControl_Stop(&This->IMediaControl_iface);
455
456 while ((cursor = list_head(&This->filters)))
457 {
458 struct filter *filter = LIST_ENTRY(cursor, struct filter, entry);
459
460 IFilterGraph2_RemoveFilter(&This->IFilterGraph2_iface, filter->filter);
461 }
462
463 if (This->refClock)
464 IReferenceClock_Release(This->refClock);
465
466 for (i = 0; i < This->nItfCacheEntries; i++)
467 {
468 if (This->ItfCacheEntries[i].iface)
469 IUnknown_Release(This->ItfCacheEntries[i].iface);
470 }
471
472 IUnknown_Release(This->punkFilterMapper2);
473
474 if (This->pSite) IUnknown_Release(This->pSite);
475
477 CloseHandle(This->media_event_handle);
478
479 EnterCriticalSection(&message_cs);
480 if (This->threaded && !--message_thread_refcount)
481 {
486 }
487 LeaveCriticalSection(&message_cs);
488
489 This->event_cs.DebugInfo->Spare[0] = 0;
490 DeleteCriticalSection(&This->event_cs);
491 This->cs.DebugInfo->Spare[0] = 0;
493 free(This);
494 }
495 return refcount;
496}
497
499{
501}
502
504{
506 return IUnknown_QueryInterface(graph->outer_unk, iid, out);
507}
508
510{
512 return IUnknown_AddRef(graph->outer_unk);
513}
514
516{
518 return IUnknown_Release(graph->outer_unk);
519}
520
522{
523 struct filter *filter;
524
525 LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
526 {
527 if (!wcscmp(filter->name, name))
528 return filter->filter;
529 }
530
531 return NULL;
532}
533
535{
536 IEnumPins *enumpins;
538 IPin *pin;
539
540 if (FAILED(IBaseFilter_EnumPins(filter, &enumpins)))
541 return FALSE;
542
543 while (IEnumPins_Next(enumpins, 1, &pin, NULL) == S_OK)
544 {
545 IPin_QueryDirection(pin, &dir);
546 IPin_Release(pin);
547 if (dir == PINDIR_OUTPUT)
548 {
549 IEnumPins_Release(enumpins);
550 return TRUE;
551 }
552 }
553
554 IEnumPins_Release(enumpins);
555 return FALSE;
556}
557
558static void update_seeking(struct filter *filter)
559{
561
562 if (!filter->seeking)
563 {
564 /* The Legend of Heroes: Trails of Cold Steel II destroys its filter when
565 * its IMediaSeeking interface is released, so cache the interface instead
566 * of querying for it every time.
567 * Some filters (e.g. MediaStreamFilter) can become seekable when they are
568 * already in the graph, so always try to query IMediaSeeking if it's not
569 * cached yet. */
570 if (SUCCEEDED(IBaseFilter_QueryInterface(filter->filter, &IID_IMediaSeeking, (void **)&seeking)))
571 {
572 if (IMediaSeeking_IsFormatSupported(seeking, &TIME_FORMAT_MEDIA_TIME) == S_OK)
574 else
575 IMediaSeeking_Release(seeking);
576 }
577 }
578}
579
581{
582 IMediaPosition *media_position;
584 BOOL ret = FALSE;
585
586 if (SUCCEEDED(IBaseFilter_QueryInterface(filter->filter, &IID_IAMFilterMiscFlags, (void **)&flags)))
587 {
588 if (IAMFilterMiscFlags_GetMiscFlags(flags) & AM_FILTER_MISC_FLAGS_IS_RENDERER)
589 ret = TRUE;
590 IAMFilterMiscFlags_Release(flags);
591 }
592 else if (SUCCEEDED(IBaseFilter_QueryInterface(filter->filter, &IID_IMediaPosition, (void **)&media_position)))
593 {
595 ret = TRUE;
596 IMediaPosition_Release(media_position);
597 }
598 else
599 {
602 ret = TRUE;
603 }
604 return ret;
605}
606
607/*** IFilterGraph methods ***/
609 IBaseFilter *filter, const WCHAR *name)
610{
612 BOOL duplicate_name = FALSE;
613 struct filter *entry;
614 unsigned int i;
615 HRESULT hr;
616
617 TRACE("graph %p, filter %p, name %s.\n", graph, filter, debugstr_w(name));
618
619 if (!filter)
620 return E_POINTER;
621
622 if (!(entry = heap_alloc(sizeof(*entry))))
623 return E_OUTOFMEMORY;
624
625 if (!(entry->name = CoTaskMemAlloc((name ? wcslen(name) + 6 : 5) * sizeof(WCHAR))))
626 {
628 return E_OUTOFMEMORY;
629 }
630
632 duplicate_name = TRUE;
633
634 if (!name || duplicate_name)
635 {
636 for (i = 0; i < 10000 ; ++i)
637 {
638 if (name)
639 swprintf(entry->name, name ? wcslen(name) + 6 : 5, L"%s %04u", name, graph->name_index);
640 else
641 swprintf(entry->name, name ? wcslen(name) + 6 : 5, L"%04u", graph->name_index);
642
643 graph->name_index = (graph->name_index + 1) % 10000;
644
645 if (!find_filter_by_name(graph, entry->name))
646 break;
647 }
648
649 if (i == 10000)
650 {
651 CoTaskMemFree(entry->name);
654 }
655 }
656 else
657 wcscpy(entry->name, name);
658
659 if (FAILED(hr = IBaseFilter_JoinFilterGraph(filter,
661 {
662 CoTaskMemFree(entry->name);
664 return hr;
665 }
666
667 IBaseFilter_SetSyncSource(filter, graph->refClock);
668
669 IBaseFilter_AddRef(entry->filter = filter);
670
671 list_add_head(&graph->filters, &entry->entry);
672 entry->sorting = FALSE;
673 entry->seeking = NULL;
674 ++graph->version;
675
676 return duplicate_name ? VFW_S_DUPLICATE_NAME : hr;
677}
678
680{
682 struct filter *entry;
683 int i;
684 HRESULT hr = E_FAIL;
685
686 TRACE("(%p/%p)->(%p)\n", This, iface, pFilter);
687
688 LIST_FOR_EACH_ENTRY(entry, &This->filters, struct filter, entry)
689 {
690 if (entry->filter == pFilter)
691 {
692 IEnumPins *penumpins = NULL;
693
694 if (This->defaultclock && This->refClockProvider == pFilter)
695 {
696 IMediaFilter_SetSyncSource(&This->IMediaFilter_iface, NULL);
697 This->defaultclock = TRUE;
698 }
699
700 TRACE("Removing filter %s.\n", debugstr_w(entry->name));
701
702 hr = IBaseFilter_EnumPins(pFilter, &penumpins);
703 if (SUCCEEDED(hr)) {
704 IPin *ppin;
705 while(IEnumPins_Next(penumpins, 1, &ppin, NULL) == S_OK)
706 {
707 IPin *peer = NULL;
708 HRESULT hr;
709
710 IPin_ConnectedTo(ppin, &peer);
711 if (peer)
712 {
713 if (FAILED(hr = IPin_Disconnect(peer)))
714 {
715 WARN("Failed to disconnect peer %p, hr %#lx.\n", peer, hr);
716 IPin_Release(peer);
717 IPin_Release(ppin);
718 IEnumPins_Release(penumpins);
719 return hr;
720 }
721 IPin_Release(peer);
722
723 if (FAILED(hr = IPin_Disconnect(ppin)))
724 {
725 WARN("Failed to disconnect pin %p, hr %#lx.\n", ppin, hr);
726 IPin_Release(ppin);
727 IEnumPins_Release(penumpins);
728 return hr;
729 }
730 }
731 IPin_Release(ppin);
732 }
733 IEnumPins_Release(penumpins);
734 }
735
736 hr = IBaseFilter_JoinFilterGraph(pFilter, NULL, NULL);
737 if (SUCCEEDED(hr))
738 {
739 IBaseFilter_SetSyncSource(pFilter, NULL);
740 IBaseFilter_Release(pFilter);
741 if (entry->seeking)
742 IMediaSeeking_Release(entry->seeking);
743 list_remove(&entry->entry);
744 CoTaskMemFree(entry->name);
746 This->version++;
747 /* Invalidate interfaces in the cache */
748 for (i = 0; i < This->nItfCacheEntries; i++)
749 if (pFilter == This->ItfCacheEntries[i].filter)
750 {
751 IUnknown_Release(This->ItfCacheEntries[i].iface);
752 This->ItfCacheEntries[i].iface = NULL;
753 This->ItfCacheEntries[i].filter = NULL;
754 }
755 return S_OK;
756 }
757 break;
758 }
759 }
760
761 return hr; /* FIXME: check this error code */
762}
763
765{
767
768 TRACE("graph %p, out %p.\n", graph, out);
769
770 return create_enum_filters(graph, list_head(&graph->filters), out);
771}
772
774 const WCHAR *name, IBaseFilter **filter)
775{
777
778 TRACE("graph %p, name %s, filter %p.\n", graph, debugstr_w(name), filter);
779
780 if (!filter)
781 return E_POINTER;
782
784 {
785 IBaseFilter_AddRef(*filter);
786 return S_OK;
787 }
788
789 return VFW_E_NOT_FOUND;
790}
791
793{
794 IPin *upstream_source, *upstream_sink;
795 PIN_INFO source_info, sink_info;
796 IEnumPins *enumpins;
797 HRESULT hr;
798
799 hr = IPin_QueryPinInfo(sink, &sink_info);
800 if (FAILED(hr))
801 {
802 ERR("Failed to query pin, hr %#lx.\n", hr);
803 return hr;
804 }
805 IBaseFilter_Release(sink_info.pFilter);
806
807 hr = IPin_QueryPinInfo(source, &source_info);
808 if (FAILED(hr))
809 {
810 ERR("Failed to query pin, hr %#lx.\n", hr);
811 return hr;
812 }
813
814 if (sink_info.pFilter == source_info.pFilter)
815 {
816 WARN("Cyclic connection detected; returning VFW_E_CIRCULAR_GRAPH.\n");
817 IBaseFilter_Release(source_info.pFilter);
819 }
820
821 hr = IBaseFilter_EnumPins(source_info.pFilter, &enumpins);
822 if (FAILED(hr))
823 {
824 ERR("Failed to enumerate pins, hr %#lx.\n", hr);
825 IBaseFilter_Release(source_info.pFilter);
826 return hr;
827 }
828
829 while ((hr = IEnumPins_Next(enumpins, 1, &upstream_sink, NULL)) == S_OK)
830 {
832
833 IPin_QueryDirection(upstream_sink, &dir);
834 if (dir == PINDIR_INPUT && IPin_ConnectedTo(upstream_sink, &upstream_source) == S_OK)
835 {
836 hr = check_cyclic_connection(upstream_source, sink);
837 IPin_Release(upstream_source);
838 if (FAILED(hr))
839 {
840 IPin_Release(upstream_sink);
841 IEnumPins_Release(enumpins);
842 IBaseFilter_Release(source_info.pFilter);
843 return hr;
844 }
845 }
846 IPin_Release(upstream_sink);
847 }
848 IEnumPins_Release(enumpins);
849
850 IBaseFilter_Release(source_info.pFilter);
851 return S_OK;
852}
853
855{
856 struct filter *filter;
857
858 LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
859 {
860 if (filter->filter == iface)
861 return filter;
862 }
863
864 return NULL;
865}
866
867static void sort_filter_recurse(struct filter_graph *graph, struct filter *filter, struct list *sorted)
868{
869 struct filter *peer_filter;
870 IEnumPins *enumpins;
872 IPin *pin, *peer;
874
875 TRACE("Sorting filter %p.\n", filter->filter);
876
877 /* Cyclic connections should be caught by check_cyclic_connection(). */
879
881
882 IBaseFilter_EnumPins(filter->filter, &enumpins);
883 while (IEnumPins_Next(enumpins, 1, &pin, NULL) == S_OK)
884 {
885 IPin_QueryDirection(pin, &dir);
886
887 if (dir == PINDIR_INPUT && IPin_ConnectedTo(pin, &peer) == S_OK)
888 {
889 IPin_QueryPinInfo(peer, &info);
890 /* Note that the filter may have already been sorted. */
891 if ((peer_filter = find_sorted_filter(graph, info.pFilter)))
892 sort_filter_recurse(graph, peer_filter, sorted);
893 IBaseFilter_Release(info.pFilter);
894 IPin_Release(peer);
895 }
896 IPin_Release(pin);
897 }
898 IEnumPins_Release(enumpins);
899
901
903 list_add_head(sorted, &filter->entry);
904}
905
906static void sort_filters(struct filter_graph *graph)
907{
908 struct list sorted = LIST_INIT(sorted), *cursor;
909
910 while ((cursor = list_head(&graph->filters)))
911 {
912 struct filter *filter = LIST_ENTRY(cursor, struct filter, entry);
914 }
915
916 list_move_tail(&graph->filters, &sorted);
917}
918
919/* NOTE: despite the implication, it doesn't matter which
920 * way round you put in the input and output pins */
922 const AM_MEDIA_TYPE *pmt)
923{
926 HRESULT hr;
927
928 TRACE("(%p/%p)->(%p, %p, %p)\n", This, iface, ppinIn, ppinOut, pmt);
930
931 /* FIXME: check pins are in graph */
932
933 if (TRACE_ON(quartz))
934 {
935 PIN_INFO PinInfo;
936
937 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
938 if (FAILED(hr))
939 return hr;
940
941 TRACE("Filter owning ppinIn(%p) => %p\n", ppinIn, PinInfo.pFilter);
942 IBaseFilter_Release(PinInfo.pFilter);
943
944 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
945 if (FAILED(hr))
946 return hr;
947
948 TRACE("Filter owning ppinOut(%p) => %p\n", ppinOut, PinInfo.pFilter);
949 IBaseFilter_Release(PinInfo.pFilter);
950 }
951
952 hr = IPin_QueryDirection(ppinIn, &dir);
953 if (SUCCEEDED(hr))
954 {
955 if (dir == PINDIR_INPUT)
956 {
957 hr = check_cyclic_connection(ppinOut, ppinIn);
958 if (SUCCEEDED(hr))
959 hr = IPin_Connect(ppinOut, ppinIn, pmt);
960 }
961 else
962 {
963 hr = check_cyclic_connection(ppinIn, ppinOut);
964 if (SUCCEEDED(hr))
965 hr = IPin_Connect(ppinIn, ppinOut, pmt);
966 }
967 }
968
969 return hr;
970}
971
973{
975
976 TRACE("graph %p, pin %p.\n", graph, pin);
977
978 return IFilterGraph2_ReconnectEx(iface, pin, NULL);
979}
980
982{
984
985 TRACE("(%p/%p)->(%p)\n", This, iface, ppin);
986
987 if (!ppin)
988 return E_POINTER;
989
990 return IPin_Disconnect(ppin);
991}
992
994{
996 IReferenceClock *pClock = NULL;
997 struct filter *filter;
998 HRESULT hr = S_OK;
999
1000 TRACE("(%p/%p)->() live sources not handled properly!\n", This, iface);
1001
1003
1004 LIST_FOR_EACH_ENTRY(filter, &This->filters, struct filter, entry)
1005 {
1006 if (IBaseFilter_QueryInterface(filter->filter, &IID_IReferenceClock, (void **)&pClock) == S_OK)
1007 break;
1008 }
1009
1010 if (!pClock)
1011 {
1012 hr = CoCreateInstance(&CLSID_SystemClock, NULL, CLSCTX_INPROC_SERVER, &IID_IReferenceClock, (LPVOID*)&pClock);
1013 This->refClockProvider = NULL;
1014 }
1015 else
1016 {
1017 filter = LIST_ENTRY(list_tail(&This->filters), struct filter, entry);
1018 This->refClockProvider = filter->filter;
1019 }
1020
1021 if (SUCCEEDED(hr))
1022 {
1023 hr = IMediaFilter_SetSyncSource(&This->IMediaFilter_iface, pClock);
1024 This->defaultclock = TRUE;
1025 IReferenceClock_Release(pClock);
1026 }
1028
1029 return hr;
1030}
1031
1033{
1034 MSG msg;
1035
1036 SetThreadDescription(GetCurrentThread(), L"wine_qz_graph_worker");
1037
1038 /* Make sure we have a message queue. */
1039 PeekMessageW(&msg, NULL, 0, 0, PM_NOREMOVE);
1041
1043
1044 for (;;)
1045 {
1046 GetMessageW(&msg, NULL, 0, 0);
1047
1048 if (!msg.hwnd && msg.message == WM_USER)
1049 {
1050 struct filter_create_params *params = (struct filter_create_params *)msg.wParam;
1051
1052 params->hr = IMoniker_BindToObject(params->moniker, NULL, NULL,
1053 &IID_IBaseFilter, (void **)&params->filter);
1055 }
1056 else if (!msg.hwnd && msg.message == WM_USER + 1)
1057 {
1058 break;
1059 }
1060 else
1061 {
1064 }
1065 }
1066
1068 return 0;
1069}
1070
1072{
1073 if (graph->threaded)
1074 {
1076
1078
1079 EnterCriticalSection(&message_cs);
1082 LeaveCriticalSection(&message_cs);
1083
1084 *filter = params.filter;
1085 return params.hr;
1086 }
1087 else
1088 return IMoniker_BindToObject(moniker, NULL, NULL, &IID_IBaseFilter, (void **)filter);
1089}
1090
1092 BOOL render_to_existing, unsigned int recursion_depth);
1093
1095 IBaseFilter *filter, IPin *middle_sink, IPin *sink,
1096 BOOL render_to_existing, unsigned int recursion_depth)
1097{
1098 BOOL any = FALSE, all = TRUE;
1099 IPin *middle_source, *peer;
1100 IEnumPins *source_enum;
1102 PIN_INFO info;
1103 HRESULT hr;
1104
1105 TRACE("Trying to autoplug %p to %p through %p.\n", source, sink, middle_sink);
1106
1107 IPin_QueryDirection(middle_sink, &dir);
1108 if (dir != PINDIR_INPUT)
1109 return E_FAIL;
1110
1111 if (IPin_ConnectedTo(middle_sink, &peer) == S_OK)
1112 {
1113 IPin_Release(peer);
1114 return E_FAIL;
1115 }
1116
1117 if (FAILED(hr = IFilterGraph2_ConnectDirect(&graph->IFilterGraph2_iface, source, middle_sink, NULL)))
1118 return E_FAIL;
1119
1120 if (FAILED(hr = IBaseFilter_EnumPins(filter, &source_enum)))
1121 goto err;
1122
1123 while (IEnumPins_Next(source_enum, 1, &middle_source, NULL) == S_OK)
1124 {
1125 IPin_QueryPinInfo(middle_source, &info);
1126 IBaseFilter_Release(info.pFilter);
1127 if (info.dir != PINDIR_OUTPUT)
1128 {
1129 IPin_Release(middle_source);
1130 continue;
1131 }
1132 if (info.achName[0] == '~')
1133 {
1134 TRACE("Skipping non-rendered pin %s.\n", debugstr_w(info.achName));
1135 IPin_Release(middle_source);
1136 continue;
1137 }
1138 if (IPin_ConnectedTo(middle_source, &peer) == S_OK)
1139 {
1140 IPin_Release(peer);
1141 IPin_Release(middle_source);
1142 continue;
1143 }
1144
1145 hr = autoplug(graph, middle_source, sink, render_to_existing, recursion_depth + 1);
1146 IPin_Release(middle_source);
1147 if (SUCCEEDED(hr) && sink)
1148 {
1149 IEnumPins_Release(source_enum);
1150 return hr;
1151 }
1152 if (SUCCEEDED(hr))
1153 any = TRUE;
1154 if (hr != S_OK)
1155 all = FALSE;
1156 }
1157 IEnumPins_Release(source_enum);
1158
1159 if (!sink)
1160 {
1161 if (all)
1162 return S_OK;
1163 if (any)
1164 return VFW_S_PARTIAL_RENDER;
1165 }
1166
1167err:
1168 IFilterGraph2_Disconnect(&graph->IFilterGraph2_iface, source);
1169 IFilterGraph2_Disconnect(&graph->IFilterGraph2_iface, middle_sink);
1170 return E_FAIL;
1171}
1172
1174 IBaseFilter *filter, IPin *sink, BOOL render_to_existing,
1175 unsigned int recursion_depth)
1176{
1177 IEnumPins *sink_enum;
1178 IPin *filter_sink;
1179 HRESULT hr;
1180
1181 TRACE("Trying to autoplug %p to %p through %p.\n", source, sink, filter);
1182
1183 if (FAILED(hr = IBaseFilter_EnumPins(filter, &sink_enum)))
1184 return hr;
1185
1186 while (IEnumPins_Next(sink_enum, 1, &filter_sink, NULL) == S_OK)
1187 {
1188 hr = autoplug_through_sink(graph, source, filter, filter_sink, sink,
1189 render_to_existing, recursion_depth);
1190 IPin_Release(filter_sink);
1191 if (SUCCEEDED(hr))
1192 {
1193 IEnumPins_Release(sink_enum);
1194 return hr;
1195 }
1196 }
1197 IEnumPins_Release(sink_enum);
1198 return VFW_E_CANNOT_CONNECT;
1199}
1200
1201static HRESULT get_autoplug_types(IPin *source, unsigned int *ret_count, GUID **ret_types)
1202{
1203 unsigned int i, mt_count = 0, mt_capacity = 16;
1204 AM_MEDIA_TYPE **mts = NULL;
1205 IEnumMediaTypes *enummt;
1206 GUID *types = NULL;
1207 HRESULT hr;
1208
1209 if (FAILED(hr = IPin_EnumMediaTypes(source, &enummt)))
1210 {
1211 ERR("Failed to enumerate media types, hr %#lx.\n", hr);
1212 return hr;
1213 }
1214
1215 for (;;)
1216 {
1217 ULONG count;
1218
1219 if (!(mts = realloc(mts, mt_capacity * sizeof(*mts))))
1220 {
1221 hr = E_OUTOFMEMORY;
1222 goto out;
1223 }
1224
1225 if (FAILED(hr = IEnumMediaTypes_Next(enummt, mt_capacity - mt_count, mts + mt_count, &count)))
1226 {
1227 ERR("Failed to get media types, hr %#lx.\n", hr);
1228 goto out;
1229 }
1230
1231 mt_count += count;
1232 if (hr == S_FALSE)
1233 break;
1234
1235 mt_capacity *= 2;
1236 }
1237
1238 if (!(types = malloc(mt_count * 2 * sizeof(*types))))
1239 {
1240 hr = E_OUTOFMEMORY;
1241 goto out;
1242 }
1243
1244 for (i = 0; i < mt_count; ++i)
1245 {
1246 types[i * 2] = mts[i]->majortype;
1247 types[i * 2 + 1] = mts[i]->subtype;
1248 DeleteMediaType(mts[i]);
1249 }
1250
1251 *ret_count = mt_count;
1252 *ret_types = types;
1253
1254 hr = S_OK;
1255out:
1256 free(mts);
1257 IEnumMediaTypes_Release(enummt);
1258 return hr;
1259}
1260
1261/* Common helper for IGraphBuilder::Connect() and IGraphBuilder::Render(), which
1262 * share most of the same code. Render() calls this with a NULL sink. */
1264 BOOL render_to_existing, unsigned int recursion_depth)
1265{
1267 struct filter *graph_filter;
1268 IEnumMoniker *enummoniker;
1269 unsigned int type_count;
1270 IFilterMapper2 *mapper;
1272 GUID *types = NULL;
1274 HRESULT hr;
1275
1276 TRACE("Trying to autoplug %p to %p, recursion depth %u.\n", source, sink, recursion_depth);
1277
1278 if (recursion_depth >= 5)
1279 {
1280 WARN("Recursion depth has reached 5; aborting.\n");
1281 return VFW_E_CANNOT_CONNECT;
1282 }
1283
1284 if (sink)
1285 {
1286 /* Try to connect directly to this sink. */
1287 hr = IFilterGraph2_ConnectDirect(&graph->IFilterGraph2_iface, source, sink, NULL);
1288
1289 /* If direct connection succeeded, we should propagate that return value.
1290 * If it returned VFW_E_NOT_CONNECTED or VFW_E_NO_AUDIO_HARDWARE, then don't
1291 * even bother trying intermediate filters, since they won't succeed. */
1293 return hr;
1294 }
1295
1296 /* Always prefer filters in the graph. */
1297 LIST_FOR_EACH_ENTRY(graph_filter, &graph->filters, struct filter, entry)
1298 {
1299 if (SUCCEEDED(hr = autoplug_through_filter(graph, source, graph_filter->filter,
1300 sink, render_to_existing, recursion_depth)))
1301 return hr;
1302 }
1303
1304 IUnknown_QueryInterface(graph->punkFilterMapper2, &IID_IFilterMapper2, (void **)&mapper);
1305
1306 if (FAILED(hr = get_autoplug_types(source, &type_count, &types)))
1307 {
1308 IFilterMapper2_Release(mapper);
1309 return hr;
1310 }
1311
1312 if (graph->pSite)
1313 IUnknown_QueryInterface(graph->pSite, &IID_IAMGraphBuilderCallback, (void **)&callback);
1314
1315 if (FAILED(hr = IFilterMapper2_EnumMatchingFilters(mapper, &enummoniker,
1316 0, FALSE, MERIT_UNLIKELY, TRUE, type_count, types, NULL, NULL, FALSE,
1317 render_to_existing, 0, NULL, NULL, NULL)))
1318 goto out;
1319
1320 while (IEnumMoniker_Next(enummoniker, 1, &moniker, NULL) == S_OK)
1321 {
1322 IPropertyBag *bag;
1323 VARIANT var;
1324
1325 VariantInit(&var);
1326 IMoniker_BindToStorage(moniker, NULL, NULL, &IID_IPropertyBag, (void **)&bag);
1327 hr = IPropertyBag_Read(bag, L"FriendlyName", &var, NULL);
1328 IPropertyBag_Release(bag);
1329 if (FAILED(hr))
1330 {
1331 IMoniker_Release(moniker);
1332 continue;
1333 }
1334
1335 if (callback && FAILED(hr = IAMGraphBuilderCallback_SelectedFilter(callback, moniker)))
1336 {
1337 TRACE("Filter rejected by IAMGraphBuilderCallback::SelectedFilter(), hr %#lx.\n", hr);
1338 IMoniker_Release(moniker);
1339 continue;
1340 }
1341
1343 IMoniker_Release(moniker);
1344 if (FAILED(hr))
1345 {
1346 ERR("Failed to create filter for %s, hr %#lx.\n", debugstr_w(V_BSTR(&var)), hr);
1347 VariantClear(&var);
1348 continue;
1349 }
1350
1351 if (callback && FAILED(hr = IAMGraphBuilderCallback_CreatedFilter(callback, filter)))
1352 {
1353 TRACE("Filter rejected by IAMGraphBuilderCallback::CreatedFilter(), hr %#lx.\n", hr);
1354 IBaseFilter_Release(filter);
1355 continue;
1356 }
1357
1358 hr = IFilterGraph2_AddFilter(&graph->IFilterGraph2_iface, filter, V_BSTR(&var));
1359 VariantClear(&var);
1360 if (FAILED(hr))
1361 {
1362 ERR("Failed to add filter, hr %#lx.\n", hr);
1363 IBaseFilter_Release(filter);
1364 continue;
1365 }
1366
1367 hr = autoplug_through_filter(graph, source, filter, sink, render_to_existing, recursion_depth);
1368 if (SUCCEEDED(hr))
1369 {
1370 IBaseFilter_Release(filter);
1371 goto out;
1372 }
1373
1374 IFilterGraph2_RemoveFilter(&graph->IFilterGraph2_iface, filter);
1375 IBaseFilter_Release(filter);
1376 }
1377 IEnumMoniker_Release(enummoniker);
1378
1380
1381out:
1382 free(types);
1383 if (callback) IAMGraphBuilderCallback_Release(callback);
1384 IFilterMapper2_Release(mapper);
1385 return hr;
1386}
1387
1389{
1392 HRESULT hr;
1393
1394 TRACE("graph %p, source %p, sink %p.\n", graph, source, sink);
1395
1396 if (!source || !sink)
1397 return E_POINTER;
1398
1399 if (FAILED(hr = IPin_QueryDirection(source, &dir)))
1400 return hr;
1401
1402 if (dir == PINDIR_INPUT)
1403 {
1404 IPin *temp;
1405
1406 TRACE("Directions seem backwards, swapping pins\n");
1407
1408 temp = sink;
1409 sink = source;
1410 source = temp;
1411 }
1412
1414
1415 hr = autoplug(graph, source, sink, TRUE, 0);
1416
1418
1419 TRACE("Returning %#lx.\n", hr);
1420 return hr;
1421}
1422
1424{
1426 HRESULT hr;
1427
1428 TRACE("graph %p, source %p.\n", graph, source);
1429
1431 hr = autoplug(graph, source, NULL, FALSE, 0);
1433 if (hr == VFW_E_CANNOT_CONNECT)
1435
1436 TRACE("Returning %#lx.\n", hr);
1437 return hr;
1438}
1439
1441 LPCWSTR lpcwstrPlayList)
1442{
1443 struct filter_graph *This = impl_from_IFilterGraph2(iface);
1444 IBaseFilter* preader = NULL;
1445 IPin* ppinreader = NULL;
1446 IEnumPins* penumpins = NULL;
1447 struct filter *filter;
1448 HRESULT hr;
1449 BOOL partial = FALSE;
1450 BOOL any = FALSE;
1451
1452 TRACE("(%p/%p)->(%s, %s)\n", This, iface, debugstr_w(lpcwstrFile), debugstr_w(lpcwstrPlayList));
1453
1454 if (lpcwstrPlayList != NULL)
1455 return E_INVALIDARG;
1456
1457 hr = IFilterGraph2_AddSourceFilter(iface, lpcwstrFile, L"Reader", &preader);
1458 if (FAILED(hr))
1459 return hr;
1460
1461 hr = IBaseFilter_EnumPins(preader, &penumpins);
1462 if (SUCCEEDED(hr))
1463 {
1464 while (IEnumPins_Next(penumpins, 1, &ppinreader, NULL) == S_OK)
1465 {
1467
1468 IPin_QueryDirection(ppinreader, &dir);
1469 if (dir == PINDIR_OUTPUT)
1470 {
1471 hr = IFilterGraph2_Render(iface, ppinreader);
1472
1473 TRACE("Filters in chain:\n");
1474 LIST_FOR_EACH_ENTRY(filter, &This->filters, struct filter, entry)
1475 TRACE("- %s.\n", debugstr_w(filter->name));
1476
1477 if (SUCCEEDED(hr))
1478 any = TRUE;
1479 if (hr != S_OK)
1480 partial = TRUE;
1481 }
1482 IPin_Release(ppinreader);
1483 }
1484 IEnumPins_Release(penumpins);
1485
1486 if (!any)
1487 {
1488 if (FAILED(hr = IFilterGraph2_RemoveFilter(iface, preader)))
1489 ERR("Failed to remove source filter, hr %#lx.\n", hr);
1491 }
1492 else if (partial)
1493 {
1495 }
1496 else
1497 {
1498 hr = S_OK;
1499 }
1500 }
1501 IBaseFilter_Release(preader);
1502
1503 TRACE("Returning %#lx.\n", hr);
1504 return hr;
1505}
1506
1508 const WCHAR *filename, const WCHAR *filter_name, IBaseFilter **ret_filter)
1509{
1511 IFileSourceFilter *filesource;
1513 HRESULT hr;
1514 GUID clsid;
1515
1516 TRACE("graph %p, filename %s, filter_name %s, ret_filter %p.\n",
1517 graph, debugstr_w(filename), debugstr_w(filter_name), ret_filter);
1518
1519 if (!*filename)
1520 return VFW_E_NOT_FOUND;
1521
1523 clsid = CLSID_AsyncReader;
1524 TRACE("Using source filter %s.\n", debugstr_guid(&clsid));
1525
1526 if (FAILED(hr = CoCreateInstance(&clsid, NULL, CLSCTX_INPROC_SERVER,
1527 &IID_IBaseFilter, (void **)&filter)))
1528 {
1529 WARN("Failed to create filter, hr %#lx.\n", hr);
1530 return hr;
1531 }
1532
1533 if (FAILED(hr = IBaseFilter_QueryInterface(filter, &IID_IFileSourceFilter, (void **)&filesource)))
1534 {
1535 WARN("Failed to get IFileSourceFilter, hr %#lx.\n", hr);
1536 IBaseFilter_Release(filter);
1537 return hr;
1538 }
1539
1540 hr = IFileSourceFilter_Load(filesource, filename, NULL);
1541 IFileSourceFilter_Release(filesource);
1542 if (FAILED(hr))
1543 {
1544 WARN("Failed to load file, hr %#lx.\n", hr);
1545 IBaseFilter_Release(filter);
1546 return hr;
1547 }
1548
1549 if (FAILED(hr = IFilterGraph2_AddFilter(iface, filter, filter_name)))
1550 {
1551 IBaseFilter_Release(filter);
1552 return hr;
1553 }
1554
1555 if (ret_filter)
1556 *ret_filter = filter;
1557 return S_OK;
1558}
1559
1561{
1563
1564 TRACE("graph %p, file %#Ix.\n", graph, file);
1565
1566 return S_OK;
1567}
1568
1570{
1571 struct filter_graph *This = impl_from_IFilterGraph2(iface);
1572
1573 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1574
1575 return S_OK;
1576}
1577
1579{
1580 struct filter_graph *This = impl_from_IFilterGraph2(iface);
1581
1582 TRACE("(%p/%p)->(): stub !!!\n", This, iface);
1583
1584 return S_OK;
1585}
1586
1587/*** IFilterGraph2 methods ***/
1589 IMoniker *pMoniker, IBindCtx *pCtx, LPCWSTR lpcwstrFilterName, IBaseFilter **ppFilter)
1590{
1591 struct filter_graph *This = impl_from_IFilterGraph2(iface);
1592 HRESULT hr;
1593 IBaseFilter* pfilter;
1594
1595 TRACE("(%p/%p)->(%p %p %s %p)\n", This, iface, pMoniker, pCtx, debugstr_w(lpcwstrFilterName), ppFilter);
1596
1597 hr = IMoniker_BindToObject(pMoniker, pCtx, NULL, &IID_IBaseFilter, (void**)&pfilter);
1598 if(FAILED(hr)) {
1599 WARN("Failed to bind moniker, hr %#lx.\n", hr);
1600 return hr;
1601 }
1602
1603 hr = IFilterGraph2_AddFilter(iface, pfilter, lpcwstrFilterName);
1604 if (FAILED(hr)) {
1605 WARN("Failed to add filter, hr %#lx.\n", hr);
1606 IBaseFilter_Release(pfilter);
1607 return hr;
1608 }
1609
1610 if(ppFilter)
1611 *ppFilter = pfilter;
1612 else IBaseFilter_Release(pfilter);
1613
1614 return S_OK;
1615}
1616
1618{
1621 HRESULT hr;
1622 IPin *peer;
1623
1624 TRACE("graph %p, pin %p, mt %p.\n", graph, pin, mt);
1625
1626 if (FAILED(hr = IPin_ConnectedTo(pin, &peer)))
1627 return hr;
1628
1629 IPin_QueryDirection(pin, &dir);
1630 IFilterGraph2_Disconnect(iface, peer);
1631 IFilterGraph2_Disconnect(iface, pin);
1632
1633 if (dir == PINDIR_INPUT)
1634 hr = IFilterGraph2_ConnectDirect(iface, peer, pin, mt);
1635 else
1636 hr = IFilterGraph2_ConnectDirect(iface, pin, peer, mt);
1637
1638 IPin_Release(peer);
1639 return hr;
1640}
1641
1643{
1645 HRESULT hr;
1646
1647 TRACE("graph %p, source %p, flags %#lx, context %p.\n", graph, source, flags, context);
1648
1650 FIXME("Unknown flags %#lx.\n", flags);
1651
1655 if (hr == VFW_E_CANNOT_CONNECT)
1657
1658 TRACE("Returning %#lx.\n", hr);
1659 return hr;
1660}
1661
1662
1663static const IFilterGraph2Vtbl IFilterGraph2_VTable =
1664{
1686};
1687
1688static struct filter_graph *impl_from_IMediaControl(IMediaControl *iface)
1689{
1690 return CONTAINING_RECORD(iface, struct filter_graph, IMediaControl_iface);
1691}
1692
1693static HRESULT WINAPI MediaControl_QueryInterface(IMediaControl *iface, REFIID iid, void **out)
1694{
1696 return IUnknown_QueryInterface(graph->outer_unk, iid, out);
1697}
1698
1699static ULONG WINAPI MediaControl_AddRef(IMediaControl *iface)
1700{
1702 return IUnknown_AddRef(graph->outer_unk);
1703}
1704
1705static ULONG WINAPI MediaControl_Release(IMediaControl *iface)
1706{
1708 return IUnknown_Release(graph->outer_unk);
1709
1710}
1711
1713{
1714 TRACE("iface %p, count %p.\n", iface, count);
1715 *count = 1;
1716 return S_OK;
1717}
1718
1719static HRESULT WINAPI MediaControl_GetTypeInfo(IMediaControl *iface, UINT index,
1721{
1722 TRACE("iface %p, index %u, lcid %#lx, typeinfo %p.\n", iface, index, lcid, typeinfo);
1724}
1725
1726static HRESULT WINAPI MediaControl_GetIDsOfNames(IMediaControl *iface, REFIID iid,
1727 LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
1728{
1730 HRESULT hr;
1731
1732 TRACE("iface %p, iid %s, names %p, count %u, lcid %#lx, ids %p.\n",
1733 iface, debugstr_guid(iid), names, count, lcid, ids);
1734
1736 {
1737 hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids);
1738 ITypeInfo_Release(typeinfo);
1739 }
1740 return hr;
1741}
1742
1743static HRESULT WINAPI MediaControl_Invoke(IMediaControl *iface, DISPID id, REFIID iid, LCID lcid,
1744 WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
1745{
1747 HRESULT hr;
1748
1749 TRACE("iface %p, id %ld, iid %s, lcid %#lx, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n",
1750 iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg);
1751
1753 {
1754 hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg);
1755 ITypeInfo_Release(typeinfo);
1756 }
1757 return hr;
1758}
1759
1761{
1762 /* Some filters (e.g. MediaStreamFilter) can become renderers when they are
1763 * already in the graph. */
1764 struct filter *filter;
1765 graph->nRenderers = 0;
1766 LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
1767 {
1768 if (is_renderer(filter))
1769 ++graph->nRenderers;
1770 }
1771}
1772
1773/* Perform the paused -> running transition. The caller must hold graph->cs. */
1775{
1776 struct media_event *event, *next;
1777 REFERENCE_TIME stream_stop;
1778 struct filter *filter;
1779 HRESULT hr = S_OK;
1780
1781 EnterCriticalSection(&graph->event_cs);
1782 graph->EcCompleteCount = 0;
1784 LeaveCriticalSection(&graph->event_cs);
1785
1786 LIST_FOR_EACH_ENTRY_SAFE(event, next, &graph->media_events, struct media_event, entry)
1787 {
1788 if (event->code == EC_COMPLETE)
1789 {
1791 free(event);
1792 }
1793 }
1794 if (list_empty(&graph->media_events))
1795 ResetEvent(graph->media_event_handle);
1796
1797 if (graph->defaultclock && !graph->refClock)
1798 IFilterGraph2_SetDefaultSyncSource(&graph->IFilterGraph2_iface);
1799
1800 if (!stream_start && graph->refClock)
1801 {
1802 IReferenceClock_GetTime(graph->refClock, &graph->stream_start);
1803 stream_start = graph->stream_start - graph->stream_elapsed;
1804 /* Delay presentation time by 200 ms, to give filters time to
1805 * initialize. */
1806 stream_start += 200 * 10000;
1807 }
1808
1809 if (SUCCEEDED(IMediaSeeking_GetStopPosition(&graph->IMediaSeeking_iface, &stream_stop)))
1810 graph->stream_stop = stream_stop;
1811
1812 LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
1813 {
1814 HRESULT filter_hr = IBaseFilter_Run(filter->filter, stream_start);
1815 if (hr == S_OK)
1816 hr = filter_hr;
1817 TRACE("Filter %p returned %#lx.\n", filter->filter, filter_hr);
1818 }
1819
1820 if (FAILED(hr))
1821 WARN("Failed to start stream, hr %#lx.\n", hr);
1822
1823 return hr;
1824}
1825
1827{
1828 struct filter_graph *graph = context;
1829 struct filter *filter;
1830 FILTER_STATE state;
1831 HRESULT hr;
1832
1833 TRACE("Performing asynchronous state change.\n");
1834
1835 /* We can't just call GetState(), since that will return State_Running and
1836 * VFW_S_STATE_INTERMEDIATE regardless of whether we're done pausing yet.
1837 * Instead replicate it here. */
1838
1839 for (;;)
1840 {
1841 IBaseFilter *async_filter = NULL;
1842
1843 hr = S_OK;
1844
1846
1847 if (!graph->needs_async_run)
1848 break;
1849
1850 LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
1851 {
1852 hr = IBaseFilter_GetState(filter->filter, 0, &state);
1853
1855 async_filter = filter->filter;
1856
1857 if (SUCCEEDED(hr) && state != State_Paused)
1858 ERR("Filter %p reported incorrect state %u.\n", filter->filter, state);
1859
1860 if (hr != S_OK)
1861 break;
1862 }
1863
1865 break;
1866
1868
1869 IBaseFilter_GetState(async_filter, 10, &state);
1870 }
1871
1872 if (hr == S_OK && graph->needs_async_run)
1873 {
1875 graph_start(graph, 0);
1876 graph->needs_async_run = 0;
1877 }
1878
1880}
1881
1882static HRESULT WINAPI MediaControl_Run(IMediaControl *iface)
1883{
1885 BOOL need_async_run = TRUE;
1886 struct filter *filter;
1887 FILTER_STATE state;
1888 HRESULT hr = S_OK;
1889
1890 TRACE("graph %p.\n", graph);
1891
1893
1894 if (graph->state == State_Running)
1895 {
1897 return S_OK;
1898 }
1899
1901
1902 EnterCriticalSection(&graph->event_cs);
1904 LeaveCriticalSection(&graph->event_cs);
1905
1906 if (graph->state == State_Stopped)
1907 {
1908 if (graph->defaultclock && !graph->refClock)
1909 IFilterGraph2_SetDefaultSyncSource(&graph->IFilterGraph2_iface);
1910
1911 LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
1912 {
1913 HRESULT filter_hr = IBaseFilter_Pause(filter->filter);
1914 if (hr == S_OK)
1915 hr = filter_hr;
1916 TRACE("Filter %p returned %#lx.\n", filter->filter, filter_hr);
1917
1918 /* If a filter returns VFW_S_CANT_CUE, we shouldn't wait for a
1919 * paused state. */
1920 filter_hr = IBaseFilter_GetState(filter->filter, 0, &state);
1921 if (filter_hr != S_OK && filter_hr != VFW_S_STATE_INTERMEDIATE)
1922 need_async_run = FALSE;
1923 }
1924
1925 if (FAILED(hr))
1926 {
1928 WARN("Failed to pause, hr %#lx.\n", hr);
1929 return hr;
1930 }
1931 }
1932
1933 graph->state = State_Running;
1934
1935 if (SUCCEEDED(hr))
1936 {
1937 if (hr != S_OK && need_async_run)
1938 {
1939 if (!graph->async_run_work)
1940 graph->async_run_work = CreateThreadpoolWork(async_run_cb, graph, NULL);
1941 graph->needs_async_run = 1;
1942 SubmitThreadpoolWork(graph->async_run_work);
1943 }
1944 else
1945 {
1946 hr = graph_start(graph, 0);
1947 }
1948 }
1949
1951 return hr;
1952}
1953
1954static HRESULT WINAPI MediaControl_Pause(IMediaControl *iface)
1955{
1957
1958 TRACE("graph %p.\n", graph);
1959
1960 return IMediaFilter_Pause(&graph->IMediaFilter_iface);
1961}
1962
1963static HRESULT WINAPI MediaControl_Stop(IMediaControl *iface)
1964{
1966
1967 TRACE("graph %p.\n", graph);
1968
1969 return IMediaFilter_Stop(&graph->IMediaFilter_iface);
1970}
1971
1972static HRESULT WINAPI MediaControl_GetState(IMediaControl *iface, LONG timeout, OAFilterState *state)
1973{
1975
1976 TRACE("graph %p, timeout %ld, state %p.\n", graph, timeout, state);
1977
1978 if (timeout < 0) timeout = INFINITE;
1979
1980 return IMediaFilter_GetState(&graph->IMediaFilter_iface, timeout, (FILTER_STATE *)state);
1981}
1982
1983static HRESULT WINAPI MediaControl_RenderFile(IMediaControl *iface, BSTR strFilename)
1984{
1985 struct filter_graph *This = impl_from_IMediaControl(iface);
1986
1987 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strFilename), strFilename);
1988
1989 return IFilterGraph2_RenderFile(&This->IFilterGraph2_iface, strFilename, NULL);
1990}
1991
1992static HRESULT WINAPI MediaControl_AddSourceFilter(IMediaControl *iface, BSTR strFilename,
1993 IDispatch **ppUnk)
1994{
1995 struct filter_graph *This = impl_from_IMediaControl(iface);
1996
1997 FIXME("(%p/%p)->(%s (%p), %p): stub !!!\n", This, iface, debugstr_w(strFilename), strFilename, ppUnk);
1998
1999 return S_OK;
2000}
2001
2002static HRESULT WINAPI MediaControl_get_FilterCollection(IMediaControl *iface, IDispatch **ppUnk)
2003{
2004 struct filter_graph *This = impl_from_IMediaControl(iface);
2005
2006 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
2007
2008 return S_OK;
2009}
2010
2012{
2013 struct filter_graph *This = impl_from_IMediaControl(iface);
2014
2015 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, ppUnk);
2016
2017 return S_OK;
2018}
2019
2021{
2022 IMediaControl *control = context;
2023 OAFilterState state;
2024 HRESULT hr;
2025
2026 if ((hr = IMediaControl_GetState(control, INFINITE, &state)) != S_OK)
2027 ERR("Failed to get paused state, hr %#lx.\n", hr);
2028
2029 if (FAILED(hr = IMediaControl_Stop(control)))
2030 ERR("Failed to stop, hr %#lx.\n", hr);
2031
2032 if ((hr = IMediaControl_GetState(control, INFINITE, &state)) != S_OK)
2033 ERR("Failed to get paused state, hr %#lx.\n", hr);
2034
2035 IMediaControl_Release(control);
2036}
2037
2039{
2040 IMediaControl *control = context;
2041 OAFilterState state;
2042 HRESULT hr;
2043
2044 if ((hr = IMediaControl_GetState(control, INFINITE, &state)) != S_OK)
2045 ERR("Failed to get state, hr %#lx.\n", hr);
2046
2047 IMediaControl_Release(control);
2048}
2049
2050static HRESULT WINAPI MediaControl_StopWhenReady(IMediaControl *iface)
2051{
2053 HRESULT hr;
2054
2055 TRACE("graph %p.\n", graph);
2056
2057 /* Even if we are already stopped, we still pause. */
2058 hr = IMediaControl_Pause(iface);
2059 if (FAILED(hr))
2060 return hr;
2061 else if (hr == S_FALSE)
2062 {
2063 IMediaControl_AddRef(iface);
2065 return S_FALSE;
2066 }
2067
2068 hr = IMediaControl_Stop(iface);
2069 if (FAILED(hr))
2070 return hr;
2071 else if (hr == S_FALSE)
2072 {
2073 IMediaControl_AddRef(iface);
2075 return S_FALSE;
2076 }
2077
2078 return S_OK;
2079}
2080
2081
2082static const IMediaControlVtbl IMediaControl_VTable =
2083{
2100};
2101
2103{
2104 return CONTAINING_RECORD(iface, struct filter_graph, IMediaSeeking_iface);
2105}
2106
2108{
2110 return IUnknown_QueryInterface(graph->outer_unk, iid, out);
2111}
2112
2114{
2116 return IUnknown_AddRef(graph->outer_unk);
2117}
2118
2120{
2122 return IUnknown_Release(graph->outer_unk);
2123}
2124
2126
2128 BOOL allnotimpl = TRUE;
2129 HRESULT hr, hr_return = S_OK;
2130 struct filter *filter;
2131
2132 LIST_FOR_EACH_ENTRY(filter, &This->filters, struct filter, entry)
2133 {
2135 if (!filter->seeking)
2136 continue;
2137 hr = FoundSeek(This, filter->seeking, arg);
2138 if (hr_return != E_NOTIMPL)
2139 allnotimpl = FALSE;
2140 if (hr_return == S_OK || (FAILED(hr) && hr != E_NOTIMPL && SUCCEEDED(hr_return)))
2141 hr_return = hr;
2142 }
2143
2144 if (allnotimpl)
2145 return E_NOTIMPL;
2146 return hr_return;
2147}
2148
2150{
2151 HRESULT hr;
2152 DWORD caps = 0;
2153
2154 hr = IMediaSeeking_GetCapabilities(seek, &caps);
2155 if (FAILED(hr))
2156 return hr;
2157
2158 /* Only add common capabilities everything supports */
2159 *(DWORD*)pcaps &= caps;
2160
2161 return hr;
2162}
2163
2164/*** IMediaSeeking methods ***/
2166{
2167 struct filter_graph *This = impl_from_IMediaSeeking(iface);
2168 HRESULT hr;
2169
2170 TRACE("(%p/%p)->(%p)\n", This, iface, pCapabilities);
2171
2172 if (!pCapabilities)
2173 return E_POINTER;
2174
2176 *pCapabilities = 0xffffffff;
2177
2180
2181 return hr;
2182}
2183
2185{
2186 struct filter_graph *This = impl_from_IMediaSeeking(iface);
2187 DWORD originalcaps;
2188 HRESULT hr;
2189
2190 TRACE("(%p/%p)->(%p)\n", This, iface, pCapabilities);
2191
2192 if (!pCapabilities)
2193 return E_POINTER;
2194
2196 originalcaps = *pCapabilities;
2199
2200 if (FAILED(hr))
2201 return hr;
2202
2203 if (!*pCapabilities)
2204 return E_FAIL;
2205 if (*pCapabilities != originalcaps)
2206 return S_FALSE;
2207 return S_OK;
2208}
2209
2211{
2212 struct filter_graph *This = impl_from_IMediaSeeking(iface);
2213
2214 if (!pFormat)
2215 return E_POINTER;
2216
2217 TRACE("(%p/%p)->(%s)\n", This, iface, debugstr_guid(pFormat));
2218
2219 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, pFormat))
2220 {
2221 WARN("Unhandled time format %s\n", debugstr_guid(pFormat));
2222 return S_FALSE;
2223 }
2224
2225 return S_OK;
2226}
2227
2229{
2230 struct filter_graph *This = impl_from_IMediaSeeking(iface);
2231
2232 if (!pFormat)
2233 return E_POINTER;
2234
2235 FIXME("(%p/%p)->(%p): semi-stub !!!\n", This, iface, pFormat);
2236 memcpy(pFormat, &TIME_FORMAT_MEDIA_TIME, sizeof(GUID));
2237
2238 return S_OK;
2239}
2240
2242{
2243 struct filter_graph *This = impl_from_IMediaSeeking(iface);
2244
2245 if (!pFormat)
2246 return E_POINTER;
2247
2248 TRACE("(%p/%p)->(%p)\n", This, iface, pFormat);
2249 memcpy(pFormat, &This->timeformatseek, sizeof(GUID));
2250
2251 return S_OK;
2252}
2253
2255{
2256 struct filter_graph *This = impl_from_IMediaSeeking(iface);
2257
2258 TRACE("(%p/%p)->(%p)\n", This, iface, pFormat);
2259 if (!pFormat)
2260 return E_POINTER;
2261
2262 if (memcmp(pFormat, &This->timeformatseek, sizeof(GUID)))
2263 return S_FALSE;
2264
2265 return S_OK;
2266}
2267
2269{
2270 struct filter_graph *This = impl_from_IMediaSeeking(iface);
2271
2272 if (!pFormat)
2273 return E_POINTER;
2274
2275 TRACE("(%p/%p)->(%s)\n", This, iface, debugstr_guid(pFormat));
2276
2277 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, pFormat))
2278 {
2279 FIXME("Unhandled time format %s\n", debugstr_guid(pFormat));
2280 return E_INVALIDARG;
2281 }
2282
2283 return S_OK;
2284}
2285
2287{
2289 HRESULT hr = E_NOTIMPL, filter_hr;
2290 LONGLONG filter_duration;
2291 struct filter *filter;
2292
2293 TRACE("graph %p, duration %p.\n", graph, duration);
2294
2295 if (!duration)
2296 return E_POINTER;
2297
2298 *duration = 0;
2299
2301
2302 LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
2303 {
2305 if (!filter->seeking)
2306 continue;
2307
2308 filter_hr = IMediaSeeking_GetDuration(filter->seeking, &filter_duration);
2309 if (SUCCEEDED(filter_hr))
2310 {
2311 hr = S_OK;
2312 *duration = max(*duration, filter_duration);
2313 }
2314 else if (filter_hr != E_NOTIMPL)
2315 {
2317 return filter_hr;
2318 }
2319 }
2320
2322
2323 TRACE("Returning hr %#lx, duration %s (%s seconds).\n", hr,
2324 wine_dbgstr_longlong(*duration), debugstr_time(*duration));
2325 return hr;
2326}
2327
2329{
2331 HRESULT hr = E_NOTIMPL, filter_hr;
2332 struct filter *filter;
2333 LONGLONG filter_stop;
2334
2335 TRACE("graph %p, stop %p.\n", graph, stop);
2336
2337 if (!stop)
2338 return E_POINTER;
2339
2340 *stop = 0;
2341
2343
2344 LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
2345 {
2347 if (!filter->seeking)
2348 continue;
2349
2350 filter_hr = IMediaSeeking_GetStopPosition(filter->seeking, &filter_stop);
2351 if (SUCCEEDED(filter_hr))
2352 {
2353 hr = S_OK;
2354 *stop = max(*stop, filter_stop);
2355 }
2356 else if (filter_hr != E_NOTIMPL)
2357 {
2359 return filter_hr;
2360 }
2361 }
2362
2364
2365 TRACE("Returning %s (%s seconds).\n", wine_dbgstr_longlong(*stop), debugstr_time(*stop));
2366 return hr;
2367}
2368
2370{
2372 LONGLONG ret = graph->current_pos;
2373
2374 TRACE("graph %p, current %p.\n", graph, current);
2375
2376 if (!current)
2377 return E_POINTER;
2378
2380
2381 if (graph->got_ec_complete)
2382 {
2383 ret = graph->stream_stop;
2384 }
2385 else if (graph->state == State_Running && !graph->needs_async_run && graph->refClock)
2386 {
2388 IReferenceClock_GetTime(graph->refClock, &time);
2389 if (time)
2390 ret += time - graph->stream_start;
2391 }
2392
2394
2395 TRACE("Returning %s (%s seconds).\n", wine_dbgstr_longlong(ret), debugstr_time(ret));
2396 *current = ret;
2397
2398 return S_OK;
2399}
2400
2402 const GUID *pTargetFormat, LONGLONG Source, const GUID *pSourceFormat)
2403{
2404 struct filter_graph *This = impl_from_IMediaSeeking(iface);
2405
2406 TRACE("(%p/%p)->(%p, %s, 0x%s, %s)\n", This, iface, pTarget,
2407 debugstr_guid(pTargetFormat), wine_dbgstr_longlong(Source), debugstr_guid(pSourceFormat));
2408
2409 if (!pSourceFormat)
2410 pSourceFormat = &This->timeformatseek;
2411
2412 if (!pTargetFormat)
2413 pTargetFormat = &This->timeformatseek;
2414
2415 if (IsEqualGUID(pTargetFormat, pSourceFormat))
2416 *pTarget = Source;
2417 else
2418 FIXME("conversion %s->%s not supported\n", debugstr_guid(pSourceFormat), debugstr_guid(pTargetFormat));
2419
2420 return S_OK;
2421}
2422
2424 DWORD current_flags, LONGLONG *stop_ptr, DWORD stop_flags)
2425{
2427 HRESULT hr = E_NOTIMPL, filter_hr;
2428 struct filter *filter;
2429 FILTER_STATE state;
2430
2431 TRACE("graph %p, current %s, current_flags %#lx, stop %s, stop_flags %#lx.\n", graph,
2432 current_ptr ? wine_dbgstr_longlong(*current_ptr) : "<null>", current_flags,
2433 stop_ptr ? wine_dbgstr_longlong(*stop_ptr): "<null>", stop_flags);
2434 if (current_ptr)
2435 TRACE("Setting current position to %s (%s seconds).\n",
2436 wine_dbgstr_longlong(*current_ptr), debugstr_time(*current_ptr));
2437 if (stop_ptr)
2438 TRACE("Setting stop position to %s (%s seconds).\n",
2439 wine_dbgstr_longlong(*stop_ptr), debugstr_time(*stop_ptr));
2440
2441 if ((current_flags & 0x7) != AM_SEEKING_AbsolutePositioning
2442 && (current_flags & 0x7) != AM_SEEKING_NoPositioning)
2443 FIXME("Unhandled current_flags %#lx.\n", current_flags & 0x7);
2444
2445 if ((stop_flags & 0x7) != AM_SEEKING_NoPositioning
2446 && (stop_flags & 0x7) != AM_SEEKING_AbsolutePositioning)
2447 FIXME("Unhandled stop_flags %#lx.\n", stop_flags & 0x7);
2448
2450
2451 state = graph->state;
2452 if (state == State_Running && !graph->needs_async_run)
2453 IMediaControl_Pause(&graph->IMediaControl_iface);
2454
2455 LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
2456 {
2457 LONGLONG current = current_ptr ? *current_ptr : 0, stop = stop_ptr ? *stop_ptr : 0;
2458
2460 if (!filter->seeking)
2461 continue;
2462
2463 filter_hr = IMediaSeeking_SetPositions(filter->seeking, &current,
2464 current_flags | AM_SEEKING_ReturnTime, &stop, stop_flags);
2465 if (SUCCEEDED(filter_hr))
2466 {
2467 hr = S_OK;
2468
2469 if (current_ptr && (current_flags & AM_SEEKING_ReturnTime))
2470 *current_ptr = current;
2471 if (stop_ptr && (stop_flags & AM_SEEKING_ReturnTime))
2472 *stop_ptr = stop;
2473 graph->current_pos = current;
2474 }
2475 else if (filter_hr != E_NOTIMPL)
2476 {
2478 return filter_hr;
2479 }
2480 }
2481
2482 if ((current_flags & 0x7) != AM_SEEKING_NoPositioning && graph->refClock)
2483 {
2484 IReferenceClock_GetTime(graph->refClock, &graph->stream_start);
2485 graph->stream_elapsed = 0;
2486 }
2487
2488 if (state == State_Running && !graph->needs_async_run)
2489 IMediaControl_Run(&graph->IMediaControl_iface);
2490
2492 return hr;
2493}
2494
2496 LONGLONG *current, LONGLONG *stop)
2497{
2499 HRESULT hr = S_OK;
2500
2501 TRACE("graph %p, current %p, stop %p.\n", graph, current, stop);
2502
2503 if (current)
2504 hr = IMediaSeeking_GetCurrentPosition(iface, current);
2505 if (SUCCEEDED(hr) && stop)
2506 hr = IMediaSeeking_GetStopPosition(iface, stop);
2507
2508 return hr;
2509}
2510
2512 LONGLONG *pLatest)
2513{
2514 struct filter_graph *This = impl_from_IMediaSeeking(iface);
2515
2516 FIXME("(%p/%p)->(%p, %p): stub !!!\n", This, iface, pEarliest, pLatest);
2517
2518 return S_OK;
2519}
2520
2522{
2523 struct filter_graph *This = impl_from_IMediaSeeking(iface);
2524
2525 FIXME("(%p/%p)->(%f): stub !!!\n", This, iface, dRate);
2526
2527 return S_OK;
2528}
2529
2530static HRESULT WINAPI MediaSeeking_GetRate(IMediaSeeking *iface, double *pdRate)
2531{
2532 struct filter_graph *This = impl_from_IMediaSeeking(iface);
2533
2534 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pdRate);
2535
2536 if (!pdRate)
2537 return E_POINTER;
2538
2539 *pdRate = 1.0;
2540
2541 return S_OK;
2542}
2543
2545{
2546 struct filter_graph *This = impl_from_IMediaSeeking(iface);
2547
2548 FIXME("(%p/%p)->(%p): stub !!!\n", This, iface, pllPreroll);
2549
2550 return S_OK;
2551}
2552
2553
2554static const IMediaSeekingVtbl IMediaSeeking_VTable =
2555{
2576};
2577
2578static struct filter_graph *impl_from_IMediaPosition(IMediaPosition *iface)
2579{
2581}
2582
2583/*** IUnknown methods ***/
2584static HRESULT WINAPI MediaPosition_QueryInterface(IMediaPosition *iface, REFIID iid, void **out)
2585{
2587 return IUnknown_QueryInterface(graph->outer_unk, iid, out);
2588}
2589
2590static ULONG WINAPI MediaPosition_AddRef(IMediaPosition *iface)
2591{
2593 return IUnknown_AddRef(graph->outer_unk);
2594}
2595
2596static ULONG WINAPI MediaPosition_Release(IMediaPosition *iface)
2597{
2599 return IUnknown_Release(graph->outer_unk);
2600}
2601
2603{
2604 TRACE("iface %p, count %p.\n", iface, count);
2605 *count = 1;
2606 return S_OK;
2607}
2608
2609static HRESULT WINAPI MediaPosition_GetTypeInfo(IMediaPosition *iface, UINT index,
2611{
2612 TRACE("iface %p, index %u, lcid %#lx, typeinfo %p.\n", iface, index, lcid, typeinfo);
2614}
2615
2616static HRESULT WINAPI MediaPosition_GetIDsOfNames(IMediaPosition *iface, REFIID iid,
2617 LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
2618{
2620 HRESULT hr;
2621
2622 TRACE("iface %p, iid %s, names %p, count %u, lcid %#lx, ids %p.\n",
2623 iface, debugstr_guid(iid), names, count, lcid, ids);
2624
2626 {
2627 hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids);
2628 ITypeInfo_Release(typeinfo);
2629 }
2630 return hr;
2631}
2632
2633static HRESULT WINAPI MediaPosition_Invoke(IMediaPosition *iface, DISPID id, REFIID iid, LCID lcid,
2634 WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
2635{
2637 HRESULT hr;
2638
2639 TRACE("iface %p, id %ld, iid %s, lcid %#lx, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n",
2640 iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg);
2641
2643 {
2644 hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg);
2645 ITypeInfo_Release(typeinfo);
2646 }
2647 return hr;
2648}
2649
2651{
2652 GUID time_format;
2653 HRESULT hr;
2654
2655 hr = MediaSeeking_GetTimeFormat(seek, &time_format);
2656 if (FAILED(hr))
2657 return hr;
2658 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, &time_format))
2659 {
2660 FIXME("Unsupported time format.\n");
2661 return E_NOTIMPL;
2662 }
2663
2664 *time_out = (LONGLONG) (time_in * 10000000); /* convert from 1 second intervals to 100 ns intervals */
2665 return S_OK;
2666}
2667
2669{
2670 GUID time_format;
2671 HRESULT hr;
2672
2673 hr = MediaSeeking_GetTimeFormat(seek, &time_format);
2674 if (FAILED(hr))
2675 return hr;
2676 if (!IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, &time_format))
2677 {
2678 FIXME("Unsupported time format.\n");
2679 return E_NOTIMPL;
2680 }
2681
2682 *time_out = (REFTIME)time_in / 10000000; /* convert from 100 ns intervals to 1 second intervals */
2683 return S_OK;
2684}
2685
2686/*** IMediaPosition methods ***/
2687static HRESULT WINAPI MediaPosition_get_Duration(IMediaPosition * iface, REFTIME *plength)
2688{
2689 LONGLONG duration;
2690 struct filter_graph *This = impl_from_IMediaPosition( iface );
2691 HRESULT hr = IMediaSeeking_GetDuration(&This->IMediaSeeking_iface, &duration);
2692 if (FAILED(hr))
2693 return hr;
2694 return ConvertToREFTIME(&This->IMediaSeeking_iface, duration, plength);
2695}
2696
2697static HRESULT WINAPI MediaPosition_put_CurrentPosition(IMediaPosition * iface, REFTIME llTime)
2698{
2699 struct filter_graph *This = impl_from_IMediaPosition( iface );
2700 LONGLONG reftime;
2701 HRESULT hr;
2702
2703 hr = ConvertFromREFTIME(&This->IMediaSeeking_iface, llTime, &reftime);
2704 if (FAILED(hr))
2705 return hr;
2706 return IMediaSeeking_SetPositions(&This->IMediaSeeking_iface, &reftime,
2708}
2709
2710static HRESULT WINAPI MediaPosition_get_CurrentPosition(IMediaPosition * iface, REFTIME *pllTime)
2711{
2712 struct filter_graph *This = impl_from_IMediaPosition( iface );
2713 LONGLONG pos;
2714 HRESULT hr;
2715
2716 hr = IMediaSeeking_GetCurrentPosition(&This->IMediaSeeking_iface, &pos);
2717 if (FAILED(hr))
2718 return hr;
2719 return ConvertToREFTIME(&This->IMediaSeeking_iface, pos, pllTime);
2720}
2721
2722static HRESULT WINAPI MediaPosition_get_StopTime(IMediaPosition * iface, REFTIME *pllTime)
2723{
2724 struct filter_graph *This = impl_from_IMediaPosition( iface );
2725 LONGLONG pos;
2726 HRESULT hr = IMediaSeeking_GetStopPosition(&This->IMediaSeeking_iface, &pos);
2727 if (FAILED(hr))
2728 return hr;
2729 return ConvertToREFTIME(&This->IMediaSeeking_iface, pos, pllTime);
2730}
2731
2732static HRESULT WINAPI MediaPosition_put_StopTime(IMediaPosition * iface, REFTIME llTime)
2733{
2734 struct filter_graph *This = impl_from_IMediaPosition( iface );
2735 LONGLONG reftime;
2736 HRESULT hr;
2737
2738 hr = ConvertFromREFTIME(&This->IMediaSeeking_iface, llTime, &reftime);
2739 if (FAILED(hr))
2740 return hr;
2741 return IMediaSeeking_SetPositions(&This->IMediaSeeking_iface, NULL, AM_SEEKING_NoPositioning,
2743}
2744
2745static HRESULT WINAPI MediaPosition_get_PrerollTime(IMediaPosition * iface, REFTIME *pllTime)
2746{
2747 FIXME("(%p)->(%p) stub!\n", iface, pllTime);
2748 return E_NOTIMPL;
2749}
2750
2751static HRESULT WINAPI MediaPosition_put_PrerollTime(IMediaPosition * iface, REFTIME llTime)
2752{
2753 FIXME("(%p)->(%f) stub!\n", iface, llTime);
2754 return E_NOTIMPL;
2755}
2756
2757static HRESULT WINAPI MediaPosition_put_Rate(IMediaPosition * iface, double dRate)
2758{
2759 struct filter_graph *This = impl_from_IMediaPosition( iface );
2760 return IMediaSeeking_SetRate(&This->IMediaSeeking_iface, dRate);
2761}
2762
2763static HRESULT WINAPI MediaPosition_get_Rate(IMediaPosition * iface, double *pdRate)
2764{
2765 struct filter_graph *This = impl_from_IMediaPosition( iface );
2766 return IMediaSeeking_GetRate(&This->IMediaSeeking_iface, pdRate);
2767}
2768
2769static HRESULT WINAPI MediaPosition_CanSeekForward(IMediaPosition * iface, LONG *pCanSeekForward)
2770{
2771 FIXME("(%p)->(%p) stub!\n", iface, pCanSeekForward);
2772 return E_NOTIMPL;
2773}
2774
2775static HRESULT WINAPI MediaPosition_CanSeekBackward(IMediaPosition * iface, LONG *pCanSeekBackward)
2776{
2777 FIXME("(%p)->(%p) stub!\n", iface, pCanSeekBackward);
2778 return E_NOTIMPL;
2779}
2780
2781
2782static const IMediaPositionVtbl IMediaPosition_VTable =
2783{
2802};
2803
2805{
2807}
2808
2809/*** IUnknown methods ***/
2811{
2813 return IUnknown_QueryInterface(graph->outer_unk, iid, out);
2814}
2815
2817{
2819 return IUnknown_AddRef(graph->outer_unk);
2820}
2821
2823{
2825 return IUnknown_Release(graph->outer_unk);
2826}
2827
2828/*** IObjectWithSite methods ***/
2829
2831{
2832 struct filter_graph *This = impl_from_IObjectWithSite( iface );
2833
2834 TRACE("(%p/%p)->()\n", This, iface);
2835 if (This->pSite) IUnknown_Release(This->pSite);
2836 This->pSite = pUnkSite;
2837 IUnknown_AddRef(This->pSite);
2838 return S_OK;
2839}
2840
2842{
2843 struct filter_graph *This = impl_from_IObjectWithSite( iface );
2844
2845 TRACE("(%p/%p)->(%s)\n", This, iface,debugstr_guid(riid));
2846
2847 *ppvSite = NULL;
2848 if (!This->pSite)
2849 return E_FAIL;
2850 else
2851 return IUnknown_QueryInterface(This->pSite, riid, ppvSite);
2852}
2853
2854static const IObjectWithSiteVtbl IObjectWithSite_VTable =
2855{
2861};
2862
2864{
2865 struct filter *filter;
2866 HRESULT hr;
2867 int entry;
2868
2869 /* Check if the interface type is already registered */
2870 for (entry = 0; entry < pGraph->nItfCacheEntries; entry++)
2871 if (riid == pGraph->ItfCacheEntries[entry].riid)
2872 {
2873 if (pGraph->ItfCacheEntries[entry].iface)
2874 {
2875 /* Return the interface if available */
2876 *ppvObj = pGraph->ItfCacheEntries[entry].iface;
2877 return S_OK;
2878 }
2879 break;
2880 }
2881
2883 {
2884 FIXME("Not enough space to store interface in the cache\n");
2885 return E_OUTOFMEMORY;
2886 }
2887
2888 /* Find a filter supporting the requested interface */
2889 LIST_FOR_EACH_ENTRY(filter, &pGraph->filters, struct filter, entry)
2890 {
2891 hr = IBaseFilter_QueryInterface(filter->filter, riid, ppvObj);
2892 if (hr == S_OK)
2893 {
2894 pGraph->ItfCacheEntries[entry].riid = riid;
2896 pGraph->ItfCacheEntries[entry].iface = *ppvObj;
2897 if (entry >= pGraph->nItfCacheEntries)
2898 pGraph->nItfCacheEntries++;
2899 return S_OK;
2900 }
2901 if (hr != E_NOINTERFACE)
2902 return hr;
2903 }
2904
2905 return IsEqualGUID(riid, &IID_IBasicAudio) ? E_NOTIMPL : E_NOINTERFACE;
2906}
2907
2908static struct filter_graph *impl_from_IBasicAudio(IBasicAudio *iface)
2909{
2910 return CONTAINING_RECORD(iface, struct filter_graph, IBasicAudio_iface);
2911}
2912
2913static HRESULT WINAPI BasicAudio_QueryInterface(IBasicAudio *iface, REFIID iid, void **out)
2914{
2915 struct filter_graph *graph = impl_from_IBasicAudio(iface);
2916 return IUnknown_QueryInterface(graph->outer_unk, iid, out);
2917}
2918
2919static ULONG WINAPI BasicAudio_AddRef(IBasicAudio *iface)
2920{
2921 struct filter_graph *graph = impl_from_IBasicAudio(iface);
2922 return IUnknown_AddRef(graph->outer_unk);
2923}
2924
2925static ULONG WINAPI BasicAudio_Release(IBasicAudio *iface)
2926{
2927 struct filter_graph *graph = impl_from_IBasicAudio(iface);
2928 return IUnknown_Release(graph->outer_unk);
2929}
2930
2932{
2933 TRACE("iface %p, count %p.\n", iface, count);
2934 *count = 1;
2935 return S_OK;
2936}
2937
2940{
2941 TRACE("iface %p, index %u, lcid %#lx, typeinfo %p.\n", iface, index, lcid, typeinfo);
2943}
2944
2945static HRESULT WINAPI BasicAudio_GetIDsOfNames(IBasicAudio *iface, REFIID iid,
2946 LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
2947{
2949 HRESULT hr;
2950
2951 TRACE("iface %p, iid %s, names %p, count %u, lcid %#lx, ids %p.\n",
2952 iface, debugstr_guid(iid), names, count, lcid, ids);
2953
2955 {
2956 hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids);
2957 ITypeInfo_Release(typeinfo);
2958 }
2959 return hr;
2960}
2961
2962static HRESULT WINAPI BasicAudio_Invoke(IBasicAudio *iface, DISPID id, REFIID iid, LCID lcid,
2963 WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
2964{
2966 HRESULT hr;
2967
2968 TRACE("iface %p, id %ld, iid %s, lcid %#lx, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n",
2969 iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg);
2970
2972 {
2973 hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg);
2974 ITypeInfo_Release(typeinfo);
2975 }
2976 return hr;
2977}
2978
2979/*** IBasicAudio methods ***/
2980static HRESULT WINAPI BasicAudio_put_Volume(IBasicAudio *iface, LONG lVolume)
2981{
2982 struct filter_graph *This = impl_from_IBasicAudio(iface);
2983 IBasicAudio* pBasicAudio;
2984 HRESULT hr;
2985
2986 TRACE("graph %p, volume %ld.\n", This, lVolume);
2987
2989
2990 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
2991
2992 if (hr == S_OK)
2993 hr = IBasicAudio_put_Volume(pBasicAudio, lVolume);
2994
2996
2997 return hr;
2998}
2999
3000static HRESULT WINAPI BasicAudio_get_Volume(IBasicAudio *iface, LONG *plVolume)
3001{
3002 struct filter_graph *This = impl_from_IBasicAudio(iface);
3003 IBasicAudio* pBasicAudio;
3004 HRESULT hr;
3005
3006 TRACE("(%p/%p)->(%p)\n", This, iface, plVolume);
3007
3009
3010 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
3011
3012 if (hr == S_OK)
3013 hr = IBasicAudio_get_Volume(pBasicAudio, plVolume);
3014
3016
3017 return hr;
3018}
3019
3020static HRESULT WINAPI BasicAudio_put_Balance(IBasicAudio *iface, LONG lBalance)
3021{
3022 struct filter_graph *This = impl_from_IBasicAudio(iface);
3023 IBasicAudio* pBasicAudio;
3024 HRESULT hr;
3025
3026 TRACE("graph %p, balance %ld.\n", This, lBalance);
3027
3029
3030 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
3031
3032 if (hr == S_OK)
3033 hr = IBasicAudio_put_Balance(pBasicAudio, lBalance);
3034
3036
3037 return hr;
3038}
3039
3040static HRESULT WINAPI BasicAudio_get_Balance(IBasicAudio *iface, LONG *plBalance)
3041{
3042 struct filter_graph *This = impl_from_IBasicAudio(iface);
3043 IBasicAudio* pBasicAudio;
3044 HRESULT hr;
3045
3046 TRACE("(%p/%p)->(%p)\n", This, iface, plBalance);
3047
3049
3050 hr = GetTargetInterface(This, &IID_IBasicAudio, (LPVOID*)&pBasicAudio);
3051
3052 if (hr == S_OK)
3053 hr = IBasicAudio_get_Balance(pBasicAudio, plBalance);
3054
3056
3057 return hr;
3058}
3059
3060static const IBasicAudioVtbl IBasicAudio_VTable =
3061{
3073};
3074
3075static struct filter_graph *impl_from_IBasicVideo2(IBasicVideo2 *iface)
3076{
3077 return CONTAINING_RECORD(iface, struct filter_graph, IBasicVideo2_iface);
3078}
3079
3080static HRESULT WINAPI BasicVideo_QueryInterface(IBasicVideo2 *iface, REFIID iid, void **out)
3081{
3082 struct filter_graph *graph = impl_from_IBasicVideo2(iface);
3083 return IUnknown_QueryInterface(graph->outer_unk, iid, out);
3084}
3085
3086static ULONG WINAPI BasicVideo_AddRef(IBasicVideo2 *iface)
3087{
3088 struct filter_graph *graph = impl_from_IBasicVideo2(iface);
3089 return IUnknown_AddRef(graph->outer_unk);
3090}
3091
3092static ULONG WINAPI BasicVideo_Release(IBasicVideo2 *iface)
3093{
3094 struct filter_graph *graph = impl_from_IBasicVideo2(iface);
3095 return IUnknown_Release(graph->outer_unk);
3096}
3097
3099{
3100 TRACE("iface %p, count %p.\n", iface, count);
3101 *count = 1;
3102 return S_OK;
3103}
3104
3105static HRESULT WINAPI BasicVideo_GetTypeInfo(IBasicVideo2 *iface, UINT index,
3107{
3108 TRACE("iface %p, index %u, lcid %#lx, typeinfo %p.\n", iface, index, lcid, typeinfo);
3110}
3111
3112static HRESULT WINAPI BasicVideo_GetIDsOfNames(IBasicVideo2 *iface, REFIID iid,
3113 LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
3114{
3116 HRESULT hr;
3117
3118 TRACE("iface %p, iid %s, names %p, count %u, lcid %#lx, ids %p.\n",
3119 iface, debugstr_guid(iid), names, count, lcid, ids);
3120
3122 {
3123 hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids);
3124 ITypeInfo_Release(typeinfo);
3125 }
3126 return hr;
3127}
3128
3129static HRESULT WINAPI BasicVideo_Invoke(IBasicVideo2 *iface, DISPID id, REFIID iid, LCID lcid,
3130 WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
3131{
3133 HRESULT hr;
3134
3135 TRACE("iface %p, id %ld, iid %s, lcid %#lx, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n",
3136 iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg);
3137
3139 {
3140 hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg);
3141 ITypeInfo_Release(typeinfo);
3142 }
3143 return hr;
3144}
3145
3146/*** IBasicVideo methods ***/
3147static HRESULT WINAPI BasicVideo_get_AvgTimePerFrame(IBasicVideo2 *iface, REFTIME *pAvgTimePerFrame)
3148{
3149 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3150 IBasicVideo *pBasicVideo;
3151 HRESULT hr;
3152
3153 TRACE("(%p/%p)->(%p)\n", This, iface, pAvgTimePerFrame);
3154
3156
3157 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3158
3159 if (hr == S_OK)
3160 hr = IBasicVideo_get_AvgTimePerFrame(pBasicVideo, pAvgTimePerFrame);
3161
3163
3164 return hr;
3165}
3166
3167static HRESULT WINAPI BasicVideo_get_BitRate(IBasicVideo2 *iface, LONG *pBitRate)
3168{
3169 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3170 IBasicVideo *pBasicVideo;
3171 HRESULT hr;
3172
3173 TRACE("(%p/%p)->(%p)\n", This, iface, pBitRate);
3174
3176
3177 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3178
3179 if (hr == S_OK)
3180 hr = IBasicVideo_get_BitRate(pBasicVideo, pBitRate);
3181
3183
3184 return hr;
3185}
3186
3187static HRESULT WINAPI BasicVideo_get_BitErrorRate(IBasicVideo2 *iface, LONG *pBitErrorRate)
3188{
3189 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3190 IBasicVideo *pBasicVideo;
3191 HRESULT hr;
3192
3193 TRACE("(%p/%p)->(%p)\n", This, iface, pBitErrorRate);
3194
3196
3197 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3198
3199 if (hr == S_OK)
3200 hr = IBasicVideo_get_BitErrorRate(pBasicVideo, pBitErrorRate);
3201
3203
3204 return hr;
3205}
3206
3207static HRESULT WINAPI BasicVideo_get_VideoWidth(IBasicVideo2 *iface, LONG *pVideoWidth)
3208{
3209 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3210 IBasicVideo *pBasicVideo;
3211 HRESULT hr;
3212
3213 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoWidth);
3214
3216
3217 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3218
3219 if (hr == S_OK)
3220 hr = IBasicVideo_get_VideoWidth(pBasicVideo, pVideoWidth);
3221
3223
3224 return hr;
3225}
3226
3227static HRESULT WINAPI BasicVideo_get_VideoHeight(IBasicVideo2 *iface, LONG *pVideoHeight)
3228{
3229 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3230 IBasicVideo *pBasicVideo;
3231 HRESULT hr;
3232
3233 TRACE("(%p/%p)->(%p)\n", This, iface, pVideoHeight);
3234
3236
3237 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3238
3239 if (hr == S_OK)
3240 hr = IBasicVideo_get_VideoHeight(pBasicVideo, pVideoHeight);
3241
3243
3244 return hr;
3245}
3246
3247static HRESULT WINAPI BasicVideo_put_SourceLeft(IBasicVideo2 *iface, LONG SourceLeft)
3248{
3249 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3250 IBasicVideo *pBasicVideo;
3251 HRESULT hr;
3252
3253 TRACE("graph %p, left %ld.\n", This, SourceLeft);
3254
3256
3257 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3258
3259 if (hr == S_OK)
3260 hr = IBasicVideo_put_SourceLeft(pBasicVideo, SourceLeft);
3261
3263
3264 return hr;
3265}
3266
3267static HRESULT WINAPI BasicVideo_get_SourceLeft(IBasicVideo2 *iface, LONG *pSourceLeft)
3268{
3269 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3270 IBasicVideo *pBasicVideo;
3271 HRESULT hr;
3272
3273 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceLeft);
3274
3276
3277 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3278
3279 if (hr == S_OK)
3280 hr = IBasicVideo_get_SourceLeft(pBasicVideo, pSourceLeft);
3281
3283
3284 return hr;
3285}
3286
3288{
3289 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3290 IBasicVideo *pBasicVideo;
3291 HRESULT hr;
3292
3293 TRACE("graph %p, width %ld.\n", This, SourceWidth);
3294
3296
3297 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3298
3299 if (hr == S_OK)
3300 hr = IBasicVideo_put_SourceWidth(pBasicVideo, SourceWidth);
3301
3303
3304 return hr;
3305}
3306
3307static HRESULT WINAPI BasicVideo_get_SourceWidth(IBasicVideo2 *iface, LONG *pSourceWidth)
3308{
3309 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3310 IBasicVideo *pBasicVideo;
3311 HRESULT hr;
3312
3313 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceWidth);
3314
3316
3317 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3318
3319 if (hr == S_OK)
3320 hr = IBasicVideo_get_SourceWidth(pBasicVideo, pSourceWidth);
3321
3323
3324 return hr;
3325}
3326
3327static HRESULT WINAPI BasicVideo_put_SourceTop(IBasicVideo2 *iface, LONG SourceTop)
3328{
3329 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3330 IBasicVideo *pBasicVideo;
3331 HRESULT hr;
3332
3333 TRACE("graph %p, top %ld.\n", This, SourceTop);
3334
3336
3337 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3338
3339 if (hr == S_OK)
3340 hr = IBasicVideo_put_SourceTop(pBasicVideo, SourceTop);
3341
3343
3344 return hr;
3345}
3346
3347static HRESULT WINAPI BasicVideo_get_SourceTop(IBasicVideo2 *iface, LONG *pSourceTop)
3348{
3349 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3350 IBasicVideo *pBasicVideo;
3351 HRESULT hr;
3352
3353 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceTop);
3354
3356
3357 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3358
3359 if (hr == S_OK)
3360 hr = IBasicVideo_get_SourceTop(pBasicVideo, pSourceTop);
3361
3363
3364 return hr;
3365}
3366
3368{
3369 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3370 IBasicVideo *pBasicVideo;
3371 HRESULT hr;
3372
3373 TRACE("graph %p, height %ld.\n", This, SourceHeight);
3374
3376
3377 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3378
3379 if (hr == S_OK)
3380 hr = IBasicVideo_put_SourceHeight(pBasicVideo, SourceHeight);
3381
3383
3384 return hr;
3385}
3386
3387static HRESULT WINAPI BasicVideo_get_SourceHeight(IBasicVideo2 *iface, LONG *pSourceHeight)
3388{
3389 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3390 IBasicVideo *pBasicVideo;
3391 HRESULT hr;
3392
3393 TRACE("(%p/%p)->(%p)\n", This, iface, pSourceHeight);
3394
3396
3397 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3398
3399 if (hr == S_OK)
3400 hr = IBasicVideo_get_SourceHeight(pBasicVideo, pSourceHeight);
3401
3403
3404 return hr;
3405}
3406
3407static HRESULT WINAPI BasicVideo_put_DestinationLeft(IBasicVideo2 *iface, LONG DestinationLeft)
3408{
3409 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3410 IBasicVideo *pBasicVideo;
3411 HRESULT hr;
3412
3413 TRACE("graph %p, left %ld.\n", This, DestinationLeft);
3414
3416
3417 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3418
3419 if (hr == S_OK)
3420 hr = IBasicVideo_put_DestinationLeft(pBasicVideo, DestinationLeft);
3421
3423
3424 return hr;
3425}
3426
3427static HRESULT WINAPI BasicVideo_get_DestinationLeft(IBasicVideo2 *iface, LONG *pDestinationLeft)
3428{
3429 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3430 IBasicVideo *pBasicVideo;
3431 HRESULT hr;
3432
3433 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationLeft);
3434
3436
3437 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3438
3439 if (hr == S_OK)
3440 hr = IBasicVideo_get_DestinationLeft(pBasicVideo, pDestinationLeft);
3441
3443
3444 return hr;
3445}
3446
3447static HRESULT WINAPI BasicVideo_put_DestinationWidth(IBasicVideo2 *iface, LONG DestinationWidth)
3448{
3449 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3450 IBasicVideo *pBasicVideo;
3451 HRESULT hr;
3452
3453 TRACE("graph %p, width %ld.\n", This, DestinationWidth);
3454
3456
3457 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3458
3459 if (hr == S_OK)
3460 hr = IBasicVideo_put_DestinationWidth(pBasicVideo, DestinationWidth);
3461
3463
3464 return hr;
3465}
3466
3467static HRESULT WINAPI BasicVideo_get_DestinationWidth(IBasicVideo2 *iface, LONG *pDestinationWidth)
3468{
3469 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3470 IBasicVideo *pBasicVideo;
3471 HRESULT hr;
3472
3473 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationWidth);
3474
3476
3477 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3478
3479 if (hr == S_OK)
3480 hr = IBasicVideo_get_DestinationWidth(pBasicVideo, pDestinationWidth);
3481
3483
3484 return hr;
3485}
3486
3487static HRESULT WINAPI BasicVideo_put_DestinationTop(IBasicVideo2 *iface, LONG DestinationTop)
3488{
3489 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3490 IBasicVideo *pBasicVideo;
3491 HRESULT hr;
3492
3493 TRACE("graph %p, top %ld.\n", This, DestinationTop);
3494
3496
3497 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3498
3499 if (hr == S_OK)
3500 hr = IBasicVideo_put_DestinationTop(pBasicVideo, DestinationTop);
3501
3503
3504 return hr;
3505}
3506
3507static HRESULT WINAPI BasicVideo_get_DestinationTop(IBasicVideo2 *iface, LONG *pDestinationTop)
3508{
3509 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3510 IBasicVideo *pBasicVideo;
3511 HRESULT hr;
3512
3513 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationTop);
3514
3516
3517 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3518
3519 if (hr == S_OK)
3520 hr = IBasicVideo_get_DestinationTop(pBasicVideo, pDestinationTop);
3521
3523
3524 return hr;
3525}
3526
3527static HRESULT WINAPI BasicVideo_put_DestinationHeight(IBasicVideo2 *iface, LONG DestinationHeight)
3528{
3529 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3530 IBasicVideo *pBasicVideo;
3531 HRESULT hr;
3532
3533 TRACE("graph %p, height %ld.\n", This, DestinationHeight);
3534
3536
3537 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3538
3539 if (hr == S_OK)
3540 hr = IBasicVideo_put_DestinationHeight(pBasicVideo, DestinationHeight);
3541
3543
3544 return hr;
3545}
3546
3548 LONG *pDestinationHeight)
3549{
3550 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3551 IBasicVideo *pBasicVideo;
3552 HRESULT hr;
3553
3554 TRACE("(%p/%p)->(%p)\n", This, iface, pDestinationHeight);
3555
3557
3558 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3559
3560 if (hr == S_OK)
3561 hr = IBasicVideo_get_DestinationHeight(pBasicVideo, pDestinationHeight);
3562
3564
3565 return hr;
3566}
3567
3568static HRESULT WINAPI BasicVideo_SetSourcePosition(IBasicVideo2 *iface, LONG Left, LONG Top,
3570{
3571 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3572 IBasicVideo *pBasicVideo;
3573 HRESULT hr;
3574
3575 TRACE("graph %p, left %ld, top %ld, width %ld, height %ld.\n", This, Left, Top, Width, Height);
3576
3578
3579 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3580
3581 if (hr == S_OK)
3582 hr = IBasicVideo_SetSourcePosition(pBasicVideo, Left, Top, Width, Height);
3583
3585
3586 return hr;
3587}
3588
3589static HRESULT WINAPI BasicVideo_GetSourcePosition(IBasicVideo2 *iface, LONG *pLeft, LONG *pTop,
3590 LONG *pWidth, LONG *pHeight)
3591{
3592 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3593 IBasicVideo *pBasicVideo;
3594 HRESULT hr;
3595
3596 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3597
3599
3600 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3601
3602 if (hr == S_OK)
3603 hr = IBasicVideo_GetSourcePosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
3604
3606
3607 return hr;
3608}
3609
3611{
3612 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3613 IBasicVideo *pBasicVideo;
3614 HRESULT hr;
3615
3616 TRACE("(%p/%p)->()\n", This, iface);
3617
3619
3620 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3621
3622 if (hr == S_OK)
3623 hr = IBasicVideo_SetDefaultSourcePosition(pBasicVideo);
3624
3626
3627 return hr;
3628}
3629
3632{
3633 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3634 IBasicVideo *pBasicVideo;
3635 HRESULT hr;
3636
3637 TRACE("graph %p, left %ld, top %ld, width %ld, height %ld.\n", This, Left, Top, Width, Height);
3638
3640
3641 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3642
3643 if (hr == S_OK)
3644 hr = IBasicVideo_SetDestinationPosition(pBasicVideo, Left, Top, Width, Height);
3645
3647
3648 return hr;
3649}
3650
3651static HRESULT WINAPI BasicVideo_GetDestinationPosition(IBasicVideo2 *iface, LONG *pLeft,
3652 LONG *pTop, LONG *pWidth, LONG *pHeight)
3653{
3654 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3655 IBasicVideo *pBasicVideo;
3656 HRESULT hr;
3657
3658 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
3659
3661
3662 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3663
3664 if (hr == S_OK)
3665 hr = IBasicVideo_GetDestinationPosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
3666
3668
3669 return hr;
3670}
3671
3673{
3674 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3675 IBasicVideo *pBasicVideo;
3676 HRESULT hr;
3677
3678 TRACE("(%p/%p)->()\n", This, iface);
3679
3681
3682 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3683
3684 if (hr == S_OK)
3685 hr = IBasicVideo_SetDefaultDestinationPosition(pBasicVideo);
3686
3688
3689 return hr;
3690}
3691
3692static HRESULT WINAPI BasicVideo_GetVideoSize(IBasicVideo2 *iface, LONG *pWidth, LONG *pHeight)
3693{
3694 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3695 IBasicVideo *pBasicVideo;
3696 HRESULT hr;
3697
3698 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
3699
3701
3702 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3703
3704 if (hr == S_OK)
3705 hr = IBasicVideo_GetVideoSize(pBasicVideo, pWidth, pHeight);
3706
3708
3709 return hr;
3710}
3711
3712static HRESULT WINAPI BasicVideo_GetVideoPaletteEntries(IBasicVideo2 *iface, LONG StartIndex,
3713 LONG Entries, LONG *pRetrieved, LONG *pPalette)
3714{
3715 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3716 IBasicVideo *pBasicVideo;
3717 HRESULT hr;
3718
3719 TRACE("graph %p, start_index %ld, count %ld, ret_count %p, entries %p.\n",
3720 This, StartIndex, Entries, pRetrieved, pPalette);
3721
3723
3724 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3725
3726 if (hr == S_OK)
3727 hr = IBasicVideo_GetVideoPaletteEntries(pBasicVideo, StartIndex, Entries, pRetrieved, pPalette);
3728
3730
3731 return hr;
3732}
3733
3735 LONG *pDIBImage)
3736{
3737 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3738 IBasicVideo *pBasicVideo;
3739 HRESULT hr;
3740
3741 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pBufferSize, pDIBImage);
3742
3744
3745 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3746
3747 if (hr == S_OK)
3748 hr = IBasicVideo_GetCurrentImage(pBasicVideo, pBufferSize, pDIBImage);
3749
3751
3752 return hr;
3753}
3754
3756{
3757 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3758 IBasicVideo *pBasicVideo;
3759 HRESULT hr;
3760
3761 TRACE("(%p/%p)->()\n", This, iface);
3762
3764
3765 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3766
3767 if (hr == S_OK)
3768 hr = IBasicVideo_IsUsingDefaultSource(pBasicVideo);
3769
3771
3772 return hr;
3773}
3774
3776{
3777 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3778 IBasicVideo *pBasicVideo;
3779 HRESULT hr;
3780
3781 TRACE("(%p/%p)->()\n", This, iface);
3782
3784
3785 hr = GetTargetInterface(This, &IID_IBasicVideo, (LPVOID*)&pBasicVideo);
3786
3787 if (hr == S_OK)
3788 hr = IBasicVideo_IsUsingDefaultDestination(pBasicVideo);
3789
3791
3792 return hr;
3793}
3794
3795static HRESULT WINAPI BasicVideo2_GetPreferredAspectRatio(IBasicVideo2 *iface, LONG *plAspectX,
3796 LONG *plAspectY)
3797{
3798 struct filter_graph *This = impl_from_IBasicVideo2(iface);
3799 IBasicVideo2 *pBasicVideo2;
3800 HRESULT hr;
3801
3802 TRACE("(%p/%p)->()\n", This, iface);
3803
3805
3806 hr = GetTargetInterface(This, &IID_IBasicVideo2, (LPVOID*)&pBasicVideo2);
3807
3808 if (hr == S_OK)
3809 hr = BasicVideo2_GetPreferredAspectRatio(iface, plAspectX, plAspectY);
3810
3812
3813 return hr;
3814}
3815
3816static const IBasicVideo2Vtbl IBasicVideo_VTable =
3817{
3858};
3859
3860static struct filter_graph *impl_from_IVideoWindow(IVideoWindow *iface)
3861{
3862 return CONTAINING_RECORD(iface, struct filter_graph, IVideoWindow_iface);
3863}
3864
3865static HRESULT WINAPI VideoWindow_QueryInterface(IVideoWindow *iface, REFIID iid, void **out)
3866{
3867 struct filter_graph *graph = impl_from_IVideoWindow(iface);
3868 return IUnknown_QueryInterface(graph->outer_unk, iid, out);
3869}
3870
3871static ULONG WINAPI VideoWindow_AddRef(IVideoWindow *iface)
3872{
3873 struct filter_graph *graph = impl_from_IVideoWindow(iface);
3874 return IUnknown_AddRef(graph->outer_unk);
3875}
3876
3877static ULONG WINAPI VideoWindow_Release(IVideoWindow *iface)
3878{
3879 struct filter_graph *graph = impl_from_IVideoWindow(iface);
3880 return IUnknown_Release(graph->outer_unk);
3881}
3882
3884{
3885 TRACE("iface %p, count %p.\n", iface, count);
3886 *count = 1;
3887 return S_OK;
3888}
3889
3892{
3893 TRACE("iface %p, index %u, lcid %#lx, typeinfo %p.\n", iface, index, lcid, typeinfo);
3895}
3896
3898 LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
3899{
3901 HRESULT hr;
3902
3903 TRACE("iface %p, iid %s, names %p, count %u, lcid %#lx, ids %p.\n",
3904 iface, debugstr_guid(iid), names, count, lcid, ids);
3905
3907 {
3908 hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids);
3909 ITypeInfo_Release(typeinfo);
3910 }
3911 return hr;
3912}
3913
3914static HRESULT WINAPI VideoWindow_Invoke(IVideoWindow *iface, DISPID id, REFIID iid, LCID lcid,
3915 WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
3916{
3918 HRESULT hr;
3919
3920 TRACE("iface %p, id %ld, iid %s, lcid %#lx, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n",
3921 iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg);
3922
3924 {
3925 hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg);
3926 ITypeInfo_Release(typeinfo);
3927 }
3928 return hr;
3929}
3930
3931/*** IVideoWindow methods ***/
3932static HRESULT WINAPI VideoWindow_put_Caption(IVideoWindow *iface, BSTR strCaption)
3933{
3934 struct filter_graph *This = impl_from_IVideoWindow(iface);
3935 IVideoWindow *pVideoWindow;
3936 HRESULT hr;
3937
3938 TRACE("(%p/%p)->(%s (%p))\n", This, iface, debugstr_w(strCaption), strCaption);
3939
3941
3942 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3943
3944 if (hr == S_OK)
3945 hr = IVideoWindow_put_Caption(pVideoWindow, strCaption);
3946
3948
3949 return hr;
3950}
3951
3952static HRESULT WINAPI VideoWindow_get_Caption(IVideoWindow *iface, BSTR *strCaption)
3953{
3954 struct filter_graph *This = impl_from_IVideoWindow(iface);
3955 IVideoWindow *pVideoWindow;
3956 HRESULT hr;
3957
3958 TRACE("(%p/%p)->(%p)\n", This, iface, strCaption);
3959
3961
3962 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3963
3964 if (hr == S_OK)
3965 hr = IVideoWindow_get_Caption(pVideoWindow, strCaption);
3966
3968
3969 return hr;
3970}
3971
3972static HRESULT WINAPI VideoWindow_put_WindowStyle(IVideoWindow *iface, LONG WindowStyle)
3973{
3974 struct filter_graph *This = impl_from_IVideoWindow(iface);
3975 IVideoWindow *pVideoWindow;
3976 HRESULT hr;
3977
3978 TRACE("graph %p, style %#lx.\n", This, WindowStyle);
3979
3981
3982 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
3983
3984 if (hr == S_OK)
3985 hr = IVideoWindow_put_WindowStyle(pVideoWindow, WindowStyle);
3986
3988
3989 return hr;
3990}
3991
3992static HRESULT WINAPI VideoWindow_get_WindowStyle(IVideoWindow *iface, LONG *WindowStyle)
3993{
3994 struct filter_graph *This = impl_from_IVideoWindow(iface);
3995 IVideoWindow *pVideoWindow;
3996 HRESULT hr;
3997
3998 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyle);
3999
4001
4002 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4003
4004 if (hr == S_OK)
4005 hr = IVideoWindow_get_WindowStyle(pVideoWindow, WindowStyle);
4006
4008
4009 return hr;
4010}
4011
4012static HRESULT WINAPI VideoWindow_put_WindowStyleEx(IVideoWindow *iface, LONG WindowStyleEx)
4013{
4014 struct filter_graph *This = impl_from_IVideoWindow(iface);
4015 IVideoWindow *pVideoWindow;
4016 HRESULT hr;
4017
4018 TRACE("graph %p, style %#lx.\n", This, WindowStyleEx);
4019
4021
4022 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4023
4024 if (hr == S_OK)
4025 hr = IVideoWindow_put_WindowStyleEx(pVideoWindow, WindowStyleEx);
4026
4028
4029 return hr;
4030}
4031
4032static HRESULT WINAPI VideoWindow_get_WindowStyleEx(IVideoWindow *iface, LONG *WindowStyleEx)
4033{
4034 struct filter_graph *This = impl_from_IVideoWindow(iface);
4035 IVideoWindow *pVideoWindow;
4036 HRESULT hr;
4037
4038 TRACE("(%p/%p)->(%p)\n", This, iface, WindowStyleEx);
4039
4041
4042 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4043
4044 if (hr == S_OK)
4045 hr = IVideoWindow_get_WindowStyleEx(pVideoWindow, WindowStyleEx);
4046
4048
4049 return hr;
4050}
4051
4052static HRESULT WINAPI VideoWindow_put_AutoShow(IVideoWindow *iface, LONG AutoShow)
4053{
4054 struct filter_graph *This = impl_from_IVideoWindow(iface);
4055 IVideoWindow *pVideoWindow;
4056 HRESULT hr;
4057
4058 TRACE("graph %p, show %#lx.\n", This, AutoShow);
4059
4061
4062 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4063
4064 if (hr == S_OK)
4065 hr = IVideoWindow_put_AutoShow(pVideoWindow, AutoShow);
4066
4068
4069 return hr;
4070}
4071
4072static HRESULT WINAPI VideoWindow_get_AutoShow(IVideoWindow *iface, LONG *AutoShow)
4073{
4074 struct filter_graph *This = impl_from_IVideoWindow(iface);
4075 IVideoWindow *pVideoWindow;
4076 HRESULT hr;
4077
4078 TRACE("(%p/%p)->(%p)\n", This, iface, AutoShow);
4079
4081
4082 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4083
4084 if (hr == S_OK)
4085 hr = IVideoWindow_get_AutoShow(pVideoWindow, AutoShow);
4086
4088
4089 return hr;
4090}
4091
4092static HRESULT WINAPI VideoWindow_put_WindowState(IVideoWindow *iface, LONG WindowState)
4093{
4094 struct filter_graph *This = impl_from_IVideoWindow(iface);
4095 IVideoWindow *pVideoWindow;
4096 HRESULT hr;
4097
4098 TRACE("graph %p, state %ld.\n", This, WindowState);
4099
4101
4102 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4103
4104 if (hr == S_OK)
4105 hr = IVideoWindow_put_WindowState(pVideoWindow, WindowState);
4106
4108
4109 return hr;
4110}
4111
4112static HRESULT WINAPI VideoWindow_get_WindowState(IVideoWindow *iface, LONG *WindowState)
4113{
4114 struct filter_graph *This = impl_from_IVideoWindow(iface);
4115 IVideoWindow *pVideoWindow;
4116 HRESULT hr;
4117
4118 TRACE("(%p/%p)->(%p)\n", This, iface, WindowState);
4119
4121
4122 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4123
4124 if (hr == S_OK)
4125 hr = IVideoWindow_get_WindowState(pVideoWindow, WindowState);
4126
4128
4129 return hr;
4130}
4131
4132static HRESULT WINAPI VideoWindow_put_BackgroundPalette(IVideoWindow *iface, LONG BackgroundPalette)
4133{
4134 struct filter_graph *This = impl_from_IVideoWindow(iface);
4135 IVideoWindow *pVideoWindow;
4136 HRESULT hr;
4137
4138 TRACE("graph %p, palette %ld.\n", This, BackgroundPalette);
4139
4141
4142 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4143
4144 if (hr == S_OK)
4145 hr = IVideoWindow_put_BackgroundPalette(pVideoWindow, BackgroundPalette);
4146
4148
4149 return hr;
4150}
4151
4153 LONG *pBackgroundPalette)
4154{
4155 struct filter_graph *This = impl_from_IVideoWindow(iface);
4156 IVideoWindow *pVideoWindow;
4157 HRESULT hr;
4158
4159 TRACE("(%p/%p)->(%p)\n", This, iface, pBackgroundPalette);
4160
4162
4163 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4164
4165 if (hr == S_OK)
4166 hr = IVideoWindow_get_BackgroundPalette(pVideoWindow, pBackgroundPalette);
4167
4169
4170 return hr;
4171}
4172
4173static HRESULT WINAPI VideoWindow_put_Visible(IVideoWindow *iface, LONG Visible)
4174{
4175 struct filter_graph *This = impl_from_IVideoWindow(iface);
4176 IVideoWindow *pVideoWindow;
4177 HRESULT hr;
4178
4179 TRACE("graph %p, visible %ld.\n", This, Visible);
4180
4182
4183 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4184
4185 if (hr == S_OK)
4186 hr = IVideoWindow_put_Visible(pVideoWindow, Visible);
4187
4189
4190 return hr;
4191}
4192
4193static HRESULT WINAPI VideoWindow_get_Visible(IVideoWindow *iface, LONG *pVisible)
4194{
4195 struct filter_graph *This = impl_from_IVideoWindow(iface);
4196 IVideoWindow *pVideoWindow;
4197 HRESULT hr;
4198
4199 TRACE("(%p/%p)->(%p)\n", This, iface, pVisible);
4200
4202
4203 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4204
4205 if (hr == S_OK)
4206 hr = IVideoWindow_get_Visible(pVideoWindow, pVisible);
4207
4209
4210 return hr;
4211}
4212
4213static HRESULT WINAPI VideoWindow_put_Left(IVideoWindow *iface, LONG Left)
4214{
4215 struct filter_graph *This = impl_from_IVideoWindow(iface);
4216 IVideoWindow *pVideoWindow;
4217 HRESULT hr;
4218
4219 TRACE("graph %p, left %ld.\n", This, Left);
4220
4222
4223 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4224
4225 if (hr == S_OK)
4226 hr = IVideoWindow_put_Left(pVideoWindow, Left);
4227
4229
4230 return hr;
4231}
4232
4233static HRESULT WINAPI VideoWindow_get_Left(IVideoWindow *iface, LONG *pLeft)
4234{
4235 struct filter_graph *This = impl_from_IVideoWindow(iface);
4236 IVideoWindow *pVideoWindow;
4237 HRESULT hr;
4238
4239 TRACE("(%p/%p)->(%p)\n", This, iface, pLeft);
4240
4242
4243 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4244
4245 if (hr == S_OK)
4246 hr = IVideoWindow_get_Left(pVideoWindow, pLeft);
4247
4249
4250 return hr;
4251}
4252
4253static HRESULT WINAPI VideoWindow_put_Width(IVideoWindow *iface, LONG Width)
4254{
4255 struct filter_graph *This = impl_from_IVideoWindow(iface);
4256 IVideoWindow *pVideoWindow;
4257 HRESULT hr;
4258
4259 TRACE("graph %p, width %ld.\n", This, Width);
4260
4262
4263 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4264
4265 if (hr == S_OK)
4266 hr = IVideoWindow_put_Width(pVideoWindow, Width);
4267
4269
4270 return hr;
4271}
4272
4273static HRESULT WINAPI VideoWindow_get_Width(IVideoWindow *iface, LONG *pWidth)
4274{
4275 struct filter_graph *This = impl_from_IVideoWindow(iface);
4276 IVideoWindow *pVideoWindow;
4277 HRESULT hr;
4278
4279 TRACE("(%p/%p)->(%p)\n", This, iface, pWidth);
4280
4282
4283 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4284
4285 if (hr == S_OK)
4286 hr = IVideoWindow_get_Width(pVideoWindow, pWidth);
4287
4289
4290 return hr;
4291}
4292
4293static HRESULT WINAPI VideoWindow_put_Top(IVideoWindow *iface, LONG Top)
4294{
4295 struct filter_graph *This = impl_from_IVideoWindow(iface);
4296 IVideoWindow *pVideoWindow;
4297 HRESULT hr;
4298
4299 TRACE("graph %p, top %ld.\n", This, Top);
4300
4302
4303 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4304
4305 if (hr == S_OK)
4306 hr = IVideoWindow_put_Top(pVideoWindow, Top);
4307
4309
4310 return hr;
4311}
4312
4313static HRESULT WINAPI VideoWindow_get_Top(IVideoWindow *iface, LONG *pTop)
4314{
4315 struct filter_graph *This = impl_from_IVideoWindow(iface);
4316 IVideoWindow *pVideoWindow;
4317 HRESULT hr;
4318
4319 TRACE("(%p/%p)->(%p)\n", This, iface, pTop);
4320
4322
4323 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4324
4325 if (hr == S_OK)
4326 hr = IVideoWindow_get_Top(pVideoWindow, pTop);
4327
4329
4330 return hr;
4331}
4332
4334{
4335 struct filter_graph *This = impl_from_IVideoWindow(iface);
4336 IVideoWindow *pVideoWindow;
4337 HRESULT hr;
4338
4339 TRACE("graph %p, height %ld.\n", This, Height);
4340
4342
4343 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4344
4345 if (hr == S_OK)
4346 hr = IVideoWindow_put_Height(pVideoWindow, Height);
4347
4349
4350 return hr;
4351}
4352
4353static HRESULT WINAPI VideoWindow_get_Height(IVideoWindow *iface, LONG *pHeight)
4354{
4355 struct filter_graph *This = impl_from_IVideoWindow(iface);
4356 IVideoWindow *pVideoWindow;
4357 HRESULT hr;
4358
4359 TRACE("(%p/%p)->(%p)\n", This, iface, pHeight);
4360
4362
4363 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4364
4365 if (hr == S_OK)
4366 hr = IVideoWindow_get_Height(pVideoWindow, pHeight);
4367
4369
4370 return hr;
4371}
4372
4373static HRESULT WINAPI VideoWindow_put_Owner(IVideoWindow *iface, OAHWND Owner)
4374{
4375 struct filter_graph *This = impl_from_IVideoWindow(iface);
4376 IVideoWindow *pVideoWindow;
4377 HRESULT hr;
4378
4379 TRACE("graph %p, owner %#Ix.\n", This, Owner);
4380
4382
4383 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4384
4385 if (hr == S_OK)
4386 hr = IVideoWindow_put_Owner(pVideoWindow, Owner);
4387
4389
4390 return hr;
4391}
4392
4393static HRESULT WINAPI VideoWindow_get_Owner(IVideoWindow *iface, OAHWND *Owner)
4394{
4395 struct filter_graph *This = impl_from_IVideoWindow(iface);
4396 IVideoWindow *pVideoWindow;
4397 HRESULT hr;
4398
4399 TRACE("(%p/%p)->(%p)\n", This, iface, Owner);
4400
4402
4403 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4404
4405 if (hr == S_OK)
4406 hr = IVideoWindow_get_Owner(pVideoWindow, Owner);
4407
4409
4410 return hr;
4411}
4412
4413static HRESULT WINAPI VideoWindow_put_MessageDrain(IVideoWindow *iface, OAHWND Drain)
4414{
4415 struct filter_graph *This = impl_from_IVideoWindow(iface);
4416 IVideoWindow *pVideoWindow;
4417 HRESULT hr;
4418
4419 TRACE("graph %p, drain %#Ix.\n", This, Drain);
4420
4422
4423 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4424
4425 if (hr == S_OK)
4426 hr = IVideoWindow_put_MessageDrain(pVideoWindow, Drain);
4427
4429
4430 return hr;
4431}
4432
4433static HRESULT WINAPI VideoWindow_get_MessageDrain(IVideoWindow *iface, OAHWND *Drain)
4434{
4435 struct filter_graph *This = impl_from_IVideoWindow(iface);
4436 IVideoWindow *pVideoWindow;
4437 HRESULT hr;
4438
4439 TRACE("(%p/%p)->(%p)\n", This, iface, Drain);
4440
4442
4443 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4444
4445 if (hr == S_OK)
4446 hr = IVideoWindow_get_MessageDrain(pVideoWindow, Drain);
4447
4449
4450 return hr;
4451}
4452
4454{
4455 struct filter_graph *This = impl_from_IVideoWindow(iface);
4456 IVideoWindow *pVideoWindow;
4457 HRESULT hr;
4458
4459 TRACE("(%p/%p)->(%p)\n", This, iface, Color);
4460
4462
4463 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4464
4465 if (hr == S_OK)
4466 hr = IVideoWindow_get_BorderColor(pVideoWindow, Color);
4467
4469
4470 return hr;
4471}
4472
4474{
4475 struct filter_graph *This = impl_from_IVideoWindow(iface);
4476 IVideoWindow *pVideoWindow;
4477 HRESULT hr;
4478
4479 TRACE("graph %p, colour %#lx.\n", This, Color);
4480
4482
4483 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4484
4485 if (hr == S_OK)
4486 hr = IVideoWindow_put_BorderColor(pVideoWindow, Color);
4487
4489
4490 return hr;
4491}
4492
4493static HRESULT WINAPI VideoWindow_get_FullScreenMode(IVideoWindow *iface, LONG *FullScreenMode)
4494{
4495 struct filter_graph *This = impl_from_IVideoWindow(iface);
4496 IVideoWindow *pVideoWindow;
4497 HRESULT hr;
4498
4499 TRACE("(%p/%p)->(%p)\n", This, iface, FullScreenMode);
4500
4502
4503 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4504
4505 if (hr == S_OK)
4506 hr = IVideoWindow_get_FullScreenMode(pVideoWindow, FullScreenMode);
4507 if (hr == E_NOTIMPL)
4508 {
4509 *FullScreenMode = OAFALSE;
4510 hr = S_OK;
4511 }
4512
4514
4515 return hr;
4516}
4517
4518static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface, LONG FullScreenMode)
4519{
4520 struct filter_graph *This = impl_from_IVideoWindow(iface);
4521 IVideoWindow *pVideoWindow;
4522 HRESULT hr;
4523
4524 TRACE("graph %p, fullscreen %ld.\n", This, FullScreenMode);
4525
4527
4528 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4529
4530 if (hr == S_OK)
4531 hr = IVideoWindow_put_FullScreenMode(pVideoWindow, FullScreenMode);
4532 if (hr == E_NOTIMPL && FullScreenMode == OAFALSE)
4533 hr = S_FALSE;
4534
4536
4537 return hr;
4538}
4539
4540static HRESULT WINAPI VideoWindow_SetWindowForeground(IVideoWindow *iface, LONG Focus)
4541{
4542 struct filter_graph *This = impl_from_IVideoWindow(iface);
4543 IVideoWindow *pVideoWindow;
4544 HRESULT hr;
4545
4546 TRACE("graph %p, focus %ld.\n", This, Focus);
4547
4549
4550 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4551
4552 if (hr == S_OK)
4553 hr = IVideoWindow_SetWindowForeground(pVideoWindow, Focus);
4554
4556
4557 return hr;
4558}
4559
4560static HRESULT WINAPI VideoWindow_NotifyOwnerMessage(IVideoWindow *iface, OAHWND hwnd, LONG uMsg,
4562{
4563 struct filter_graph *This = impl_from_IVideoWindow(iface);
4564 IVideoWindow *pVideoWindow;
4565 HRESULT hr;
4566
4567 TRACE("graph %p, hwnd %#Ix, message %#lx, wparam %#Ix, lparam %#Ix.\n", This, hwnd, uMsg, wParam, lParam);
4568
4570
4571 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4572
4573 if (hr == S_OK)
4574 hr = IVideoWindow_NotifyOwnerMessage(pVideoWindow, hwnd, uMsg, wParam, lParam);
4575
4577
4578 return hr;
4579}
4580
4581static HRESULT WINAPI VideoWindow_SetWindowPosition(IVideoWindow *iface, LONG Left, LONG Top,
4583{
4584 struct filter_graph *This = impl_from_IVideoWindow(iface);
4585 IVideoWindow *pVideoWindow;
4586 HRESULT hr;
4587
4588 TRACE("graph %p, left %ld, top %ld, width %ld, height %ld.\n", This, Left, Top, Width, Height);
4589
4591
4592 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4593
4594 if (hr == S_OK)
4595 hr = IVideoWindow_SetWindowPosition(pVideoWindow, Left, Top, Width, Height);
4596
4598
4599 return hr;
4600}
4601
4602static HRESULT WINAPI VideoWindow_GetWindowPosition(IVideoWindow *iface, LONG *pLeft, LONG *pTop,
4603 LONG *pWidth, LONG *pHeight)
4604{
4605 struct filter_graph *This = impl_from_IVideoWindow(iface);
4606 IVideoWindow *pVideoWindow;
4607 HRESULT hr;
4608
4609 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
4610
4612
4613 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4614
4615 if (hr == S_OK)
4616 hr = IVideoWindow_GetWindowPosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
4617
4619
4620 return hr;
4621}
4622
4623static HRESULT WINAPI VideoWindow_GetMinIdealImageSize(IVideoWindow *iface, LONG *pWidth,
4624 LONG *pHeight)
4625{
4626 struct filter_graph *This = impl_from_IVideoWindow(iface);
4627 IVideoWindow *pVideoWindow;
4628 HRESULT hr;
4629
4630 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
4631
4633
4634 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4635
4636 if (hr == S_OK)
4637 hr = IVideoWindow_GetMinIdealImageSize(pVideoWindow, pWidth, pHeight);
4638
4640
4641 return hr;
4642}
4643
4644static HRESULT WINAPI VideoWindow_GetMaxIdealImageSize(IVideoWindow *iface, LONG *pWidth,
4645 LONG *pHeight)
4646{
4647 struct filter_graph *This = impl_from_IVideoWindow(iface);
4648 IVideoWindow *pVideoWindow;
4649 HRESULT hr;
4650
4651 TRACE("(%p/%p)->(%p, %p)\n", This, iface, pWidth, pHeight);
4652
4654
4655 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4656
4657 if (hr == S_OK)
4658 hr = IVideoWindow_GetMaxIdealImageSize(pVideoWindow, pWidth, pHeight);
4659
4661
4662 return hr;
4663}
4664
4665static HRESULT WINAPI VideoWindow_GetRestorePosition(IVideoWindow *iface, LONG *pLeft, LONG *pTop,
4666 LONG *pWidth, LONG *pHeight)
4667{
4668 struct filter_graph *This = impl_from_IVideoWindow(iface);
4669 IVideoWindow *pVideoWindow;
4670 HRESULT hr;
4671
4672 TRACE("(%p/%p)->(%p, %p, %p, %p)\n", This, iface, pLeft, pTop, pWidth, pHeight);
4673
4675
4676 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4677
4678 if (hr == S_OK)
4679 hr = IVideoWindow_GetRestorePosition(pVideoWindow, pLeft, pTop, pWidth, pHeight);
4680
4682
4683 return hr;
4684}
4685
4686static HRESULT WINAPI VideoWindow_HideCursor(IVideoWindow *iface, LONG HideCursor)
4687{
4688 struct filter_graph *This = impl_from_IVideoWindow(iface);
4689 IVideoWindow *pVideoWindow;
4690 HRESULT hr;
4691
4692 TRACE("graph %p, hide %ld.\n", This, HideCursor);
4693
4695
4696 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4697
4698 if (hr == S_OK)
4699 hr = IVideoWindow_HideCursor(pVideoWindow, HideCursor);
4700
4702
4703 return hr;
4704}
4705
4706static HRESULT WINAPI VideoWindow_IsCursorHidden(IVideoWindow *iface, LONG *CursorHidden)
4707{
4708 struct filter_graph *This = impl_from_IVideoWindow(iface);
4709 IVideoWindow *pVideoWindow;
4710 HRESULT hr;
4711
4712 TRACE("(%p/%p)->(%p)\n", This, iface, CursorHidden);
4713
4715
4716 hr = GetTargetInterface(This, &IID_IVideoWindow, (LPVOID*)&pVideoWindow);
4717
4718 if (hr == S_OK)
4719 hr = IVideoWindow_IsCursorHidden(pVideoWindow, CursorHidden);
4720
4722
4723 return hr;
4724}
4725
4726
4727static const IVideoWindowVtbl IVideoWindow_VTable =
4728{
4775};
4776
4777static struct filter_graph *impl_from_IMediaEventEx(IMediaEventEx *iface)
4778{
4779 return CONTAINING_RECORD(iface, struct filter_graph, IMediaEventEx_iface);
4780}
4781
4782static HRESULT WINAPI MediaEvent_QueryInterface(IMediaEventEx *iface, REFIID iid, void **out)
4783{
4785 return IUnknown_QueryInterface(graph->outer_unk, iid, out);
4786}
4787
4788static ULONG WINAPI MediaEvent_AddRef(IMediaEventEx *iface)
4789{
4791 return IUnknown_AddRef(graph->outer_unk);
4792}
4793
4794static ULONG WINAPI MediaEvent_Release(IMediaEventEx *iface)
4795{
4797 return IUnknown_Release(graph->outer_unk);
4798}
4799
4801{
4802 TRACE("iface %p, count %p.\n", iface, count);
4803 *count = 1;
4804 return S_OK;
4805}
4806
4807static HRESULT WINAPI MediaEvent_GetTypeInfo(IMediaEventEx *iface, UINT index,
4809{
4810 TRACE("iface %p, index %u, lcid %#lx, typeinfo %p.\n", iface, index, lcid, typeinfo);
4812}
4813
4814static HRESULT WINAPI MediaEvent_GetIDsOfNames(IMediaEventEx *iface, REFIID iid,
4815 LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
4816{
4818 HRESULT hr;
4819
4820 TRACE("iface %p, iid %s, names %p, count %u, lcid %#lx, ids %p.\n",
4821 iface, debugstr_guid(iid), names, count, lcid, ids);
4822
4824 {
4825 hr = ITypeInfo_GetIDsOfNames(typeinfo, names, count, ids);
4826 ITypeInfo_Release(typeinfo);
4827 }
4828 return hr;
4829}
4830
4831static HRESULT WINAPI MediaEvent_Invoke(IMediaEventEx *iface, DISPID id, REFIID iid, LCID lcid,
4832 WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
4833{
4835 HRESULT hr;
4836
4837 TRACE("iface %p, id %ld, iid %s, lcid %#lx, flags %#x, params %p, result %p, excepinfo %p, error_arg %p.\n",
4838 iface, id, debugstr_guid(iid), lcid, flags, params, result, excepinfo, error_arg);
4839
4841 {
4842 hr = ITypeInfo_Invoke(typeinfo, iface, id, flags, params, result, excepinfo, error_arg);
4843 ITypeInfo_Release(typeinfo);
4844 }
4845 return hr;
4846}
4847
4848static HRESULT WINAPI MediaEvent_GetEventHandle(IMediaEventEx *iface, OAEVENT *event)
4849{
4851
4852 TRACE("graph %p, event %p.\n", graph, event);
4853
4854 *event = (OAEVENT)graph->media_event_handle;
4855 return S_OK;
4856}
4857
4858static HRESULT WINAPI MediaEvent_GetEvent(IMediaEventEx *iface, LONG *code,
4859 LONG_PTR *param1, LONG_PTR *param2, LONG timeout)
4860{
4862 struct media_event *event;
4863 struct list *entry;
4864
4865 TRACE("graph %p, code %p, param1 %p, param2 %p, timeout %ld.\n", graph, code, param1, param2, timeout);
4866
4867 *code = 0;
4868
4869 if (WaitForSingleObject(graph->media_event_handle, timeout))
4870 return E_ABORT;
4871
4872 EnterCriticalSection(&graph->event_cs);
4873
4874 if (!(entry = list_head(&graph->media_events)))
4875 {
4876 ResetEvent(graph->media_event_handle);
4877 LeaveCriticalSection(&graph->event_cs);
4878 return E_ABORT;
4879 }
4880 event = LIST_ENTRY(entry, struct media_event, entry);
4882 *code = event->code;
4883 *param1 = event->param1;
4884 *param2 = event->param2;
4885 free(event);
4886
4887 LeaveCriticalSection(&graph->event_cs);
4888 return S_OK;
4889}
4890
4891static HRESULT WINAPI MediaEvent_WaitForCompletion(IMediaEventEx *iface, LONG msTimeout,
4892 LONG *pEvCode)
4893{
4894 struct filter_graph *This = impl_from_IMediaEventEx(iface);
4895
4896 TRACE("graph %p, timeout %ld, code %p.\n", This, msTimeout, pEvCode);
4897
4898 if (This->state != State_Running)
4899 return VFW_E_WRONG_STATE;
4900
4901 if (WaitForSingleObject(This->hEventCompletion, msTimeout) == WAIT_OBJECT_0)
4902 {
4903 *pEvCode = This->CompletionStatus;
4904 return S_OK;
4905 }
4906
4907 *pEvCode = 0;
4908 return E_ABORT;
4909}
4910
4911static HRESULT WINAPI MediaEvent_CancelDefaultHandling(IMediaEventEx *iface, LONG lEvCode)
4912{
4913 struct filter_graph *This = impl_from_IMediaEventEx(iface);
4914
4915 TRACE("graph %p, code %#lx.\n", This, lEvCode);
4916
4917 if (lEvCode == EC_COMPLETE)
4918 This->HandleEcComplete = FALSE;
4919 else if (lEvCode == EC_REPAINT)
4920 This->HandleEcRepaint = FALSE;
4921 else if (lEvCode == EC_CLOCK_CHANGED)
4922 This->HandleEcClockChanged = FALSE;
4923 else
4924 return S_FALSE;
4925
4926 return S_OK;
4927}
4928
4929static HRESULT WINAPI MediaEvent_RestoreDefaultHandling(IMediaEventEx *iface, LONG lEvCode)
4930{
4931 struct filter_graph *This = impl_from_IMediaEventEx(iface);
4932
4933 TRACE("graph %p, code %#lx.\n", This, lEvCode);
4934
4935 if (lEvCode == EC_COMPLETE)
4936 This->HandleEcComplete = TRUE;
4937 else if (lEvCode == EC_REPAINT)
4938 This->HandleEcRepaint = TRUE;
4939 else if (lEvCode == EC_CLOCK_CHANGED)
4940 This->HandleEcClockChanged = TRUE;
4941 else
4942 return S_FALSE;
4943
4944 return S_OK;
4945}
4946
4948 LONG_PTR param1, LONG_PTR param2)
4949{
4951
4952 WARN("graph %p, code %#lx, param1 %Id, param2 %Id, stub!\n", graph, code, param1, param2);
4953
4954 return S_OK;
4955}
4956
4957/*** IMediaEventEx methods ***/
4958static HRESULT WINAPI MediaEvent_SetNotifyWindow(IMediaEventEx *iface,
4960{
4962
4963 TRACE("graph %p, window %#Ix, message %#lx, lparam %#Ix.\n", graph, window, message, lparam);
4964
4965 graph->media_event_window = (HWND)window;
4966 graph->media_event_message = message;
4967 graph->media_event_lparam = lparam;
4968
4969 return S_OK;
4970}
4971
4973{
4975
4976 TRACE("graph %p, flags %#lx.\n", graph, flags);
4977
4979 {
4980 WARN("Invalid flags %#lx, returning E_INVALIDARG.\n", flags);
4981 return E_INVALIDARG;
4982 }
4983
4984 graph->media_events_disabled = flags;
4985
4986 if (flags)
4987 {
4989 ResetEvent(graph->media_event_handle);
4990 }
4991
4992 return S_OK;
4993}
4994
4995static HRESULT WINAPI MediaEvent_GetNotifyFlags(IMediaEventEx *iface, LONG *flags)
4996{
4998
4999 TRACE("graph %p, flags %p.\n", graph, flags);
5000
5001 if (!flags)
5002 return E_POINTER;
5003
5004 *flags = graph->media_events_disabled;
5005
5006 return S_OK;
5007}
5008
5009
5010static const IMediaEventExVtbl IMediaEventEx_VTable =
5011{
5028};
5029
5030
5032{
5033 return CONTAINING_RECORD(iface, struct filter_graph, IMediaFilter_iface);
5034}
5035
5037{
5038 struct filter_graph *graph = impl_from_IMediaFilter(iface);
5039
5040 return IUnknown_QueryInterface(graph->outer_unk, iid, out);
5041}
5042
5044{
5045 struct filter_graph *graph = impl_from_IMediaFilter(iface);
5046
5047 return IUnknown_AddRef(graph->outer_unk);
5048}
5049
5051{
5052 struct filter_graph *graph = impl_from_IMediaFilter(iface);
5053
5054 return IUnknown_Release(graph->outer_unk);
5055}
5056
5058{
5059 FIXME("(%p): stub\n", pClassID);
5060
5061 return E_NOTIMPL;
5062}
5063
5065{
5066 struct filter_graph *graph = impl_from_IMediaFilter(iface);
5067 HRESULT hr = S_OK, filter_hr;
5068 struct filter *filter;
5069 TP_WORK *work;
5070
5071 TRACE("graph %p.\n", graph);
5072
5074
5075 if (graph->state == State_Stopped)
5076 {
5078 return S_OK;
5079 }
5080
5082
5083 if (graph->state == State_Running)
5084 {
5085 LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
5086 {
5087 filter_hr = IBaseFilter_Pause(filter->filter);
5088 if (hr == S_OK)
5089 hr = filter_hr;
5090 }
5091 }
5092
5093 LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
5094 {
5095 filter_hr = IBaseFilter_Stop(filter->filter);
5096 if (hr == S_OK)
5097 hr = filter_hr;
5098 }
5099
5100 graph->state = State_Stopped;
5101 graph->needs_async_run = 0;
5102 work = graph->async_run_work;
5103 graph->got_ec_complete = 0;
5104
5105 /* Update the current position, probably to synchronize multiple streams. */
5106 IMediaSeeking_SetPositions(&graph->IMediaSeeking_iface, &graph->current_pos,
5108
5110
5111 if (work)
5113
5114 return hr;
5115}
5116
5118{
5119 struct filter_graph *graph = impl_from_IMediaFilter(iface);
5120 HRESULT hr = S_OK, filter_hr;
5121 struct filter *filter;
5122 TP_WORK *work;
5123
5124 TRACE("graph %p.\n", graph);
5125
5127
5128 if (graph->state == State_Paused)
5129 {
5131 return S_OK;
5132 }
5133
5135
5136 EnterCriticalSection(&graph->event_cs);
5138 LeaveCriticalSection(&graph->event_cs);
5139
5140 if (graph->defaultclock && !graph->refClock)
5141 IFilterGraph2_SetDefaultSyncSource(&graph->IFilterGraph2_iface);
5142
5143 if (graph->state == State_Running && !graph->needs_async_run && graph->refClock)
5144 {
5146 IReferenceClock_GetTime(graph->refClock, &time);
5147 graph->stream_elapsed += time - graph->stream_start;
5148 graph->current_pos += graph->stream_elapsed;
5149 }
5150
5151 LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
5152 {
5153 filter_hr = IBaseFilter_Pause(filter->filter);
5154 if (hr == S_OK)
5155 hr = filter_hr;
5156 }
5157
5158 graph->state = State_Paused;
5159 graph->needs_async_run = 0;
5160 work = graph->async_run_work;
5161
5163
5164 if (work)
5166
5167 return hr;
5168}
5169
5171{
5172 struct filter_graph *graph = impl_from_IMediaFilter(iface);
5173 HRESULT hr;
5174
5175 TRACE("graph %p, start %s.\n", graph, debugstr_time(start));
5176
5178
5179 if (graph->state == State_Running)
5180 {
5182 return S_OK;
5183 }
5184
5186
5188
5189 graph->state = State_Running;
5190 graph->needs_async_run = 0;
5191
5193 return hr;
5194}
5195
5197{
5198 struct filter_graph *graph = impl_from_IMediaFilter(iface);
5200 HRESULT hr;
5201
5202 TRACE("graph %p, timeout %lu, state %p.\n", graph, timeout, state);
5203
5204 if (!state)
5205 return E_POINTER;
5206
5207 /* Thread safety is a little tricky here. GetState() shouldn't block other
5208 * functions from being called on the filter graph. However, we can't just
5209 * call IBaseFilter::GetState() in one loop and drop the lock on every
5210 * iteration, since the filter list might change beneath us. So instead we
5211 * do what native does, and poll for it every 10 ms. */
5212
5214 *state = graph->state;
5215
5216 for (;;)
5217 {
5218 IBaseFilter *async_filter = NULL;
5219 FILTER_STATE filter_state;
5220 struct filter *filter;
5221
5222 hr = S_OK;
5223
5224 LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry)
5225 {
5226 HRESULT filter_hr = IBaseFilter_GetState(filter->filter, 0, &filter_state);
5227
5228 TRACE("Filter %p returned hr %#lx, state %u.\n", filter->filter, filter_hr, filter_state);
5229
5230 if (filter_hr == VFW_S_STATE_INTERMEDIATE)
5231 async_filter = filter->filter;
5232
5233 if (hr == S_OK && filter_hr == VFW_S_STATE_INTERMEDIATE)
5235 else if (filter_hr != S_OK && filter_hr != VFW_S_STATE_INTERMEDIATE)
5236 hr = filter_hr;
5237
5238 if (hr == S_OK && filter_state == State_Paused && graph->state != State_Paused)
5239 {
5240 async_filter = filter->filter;
5242 }
5243 else if (filter_state != graph->state && filter_state != State_Paused)
5244 hr = E_FAIL;
5245
5246 if (graph->needs_async_run)
5247 {
5248 if (filter_state != State_Paused && filter_state != State_Running)
5249 ERR("Filter %p reported incorrect state %u (expected %u or %u).\n",
5250 filter->filter, filter_state, State_Paused, State_Running);
5251 }
5252 else
5253 {
5254 if (filter_state != graph->state)
5255 ERR("Filter %p reported incorrect state %u (expected %u).\n",
5256 filter->filter, filter_state, graph->state);
5257 }
5258 }
5259
5261
5263 break;
5264
5265 IBaseFilter_GetState(async_filter, 10, &filter_state);
5266
5268 }
5269
5270 TRACE("Returning %#lx, state %u.\n", hr, *state);
5271 return hr;
5272}
5273
5275{
5276 struct filter_graph *This = impl_from_IMediaFilter(iface);
5277 struct filter *filter;
5278 HRESULT hr = S_OK;
5279
5280 TRACE("(%p/%p)->(%p)\n", This, iface, pClock);
5281
5283 {
5284 LIST_FOR_EACH_ENTRY(filter, &This->filters, struct filter, entry)
5285 {
5286 hr = IBaseFilter_SetSyncSource(filter->filter, pClock);
5287 if (FAILED(hr))
5288 break;
5289 }
5290
5291 if (FAILED(hr))
5292 {
5293 LIST_FOR_EACH_ENTRY(filter, &This->filters, struct filter, entry)
5294 IBaseFilter_SetSyncSource(filter->filter, This->refClock);
5295 }
5296 else
5297 {
5298 if (This->refClock)
5299 IReferenceClock_Release(This->refClock);
5300 This->refClock = pClock;
5301 if (This->refClock)
5302 IReferenceClock_AddRef(This->refClock);
5303 This->defaultclock = FALSE;
5304
5305 if (This->HandleEcClockChanged)
5306 {
5307 IMediaEventSink *pEventSink;
5308 HRESULT eshr;
5309
5310 eshr = IMediaFilter_QueryInterface(iface, &IID_IMediaEventSink, (void **)&pEventSink);
5311 if (SUCCEEDED(eshr))
5312 {
5313 IMediaEventSink_Notify(pEventSink, EC_CLOCK_CHANGED, 0, 0);
5314 IMediaEventSink_Release(pEventSink);
5315 }
5316 }
5317 }
5318 }
5320
5321 return hr;
5322}
5323
5325{
5326 struct filter_graph *This = impl_from_IMediaFilter(iface);
5327
5328 TRACE("(%p/%p)->(%p)\n", This, iface, ppClock);
5329
5330 if (!ppClock)
5331 return E_POINTER;
5332
5334 {
5335 *ppClock = This->refClock;
5336 if (*ppClock)
5337 IReferenceClock_AddRef(*ppClock);
5338 }
5340
5341 return S_OK;
5342}
5343
5344static const IMediaFilterVtbl IMediaFilter_VTable =
5345{
5356};
5357
5359{
5361}
5362
5364{
5366
5367 return IUnknown_QueryInterface(graph->outer_unk, iid, out);
5368}
5369
5371{
5373
5374 return IUnknown_AddRef(graph->outer_unk);
5375}
5376
5378{
5380
5381 return IUnknown_Release(graph->outer_unk);
5382}
5383
5385 LONG_PTR param1, LONG_PTR param2)
5386{
5388
5389 TRACE("graph %p, code %#lx, param1 %#Ix, param2 %#Ix.\n", graph, code, param1, param2);
5390
5391 EnterCriticalSection(&graph->event_cs);
5392
5393 if (code == EC_COMPLETE && graph->HandleEcComplete)
5394 {
5395 if (++graph->EcCompleteCount == graph->nRenderers)
5396 {
5397 if (graph->media_events_disabled)
5398 SetEvent(graph->media_event_handle);
5399 else
5401 graph->CompletionStatus = EC_COMPLETE;
5402 graph->got_ec_complete = 1;
5403 SetEvent(graph->hEventCompletion);
5404 }
5405 }
5406 else if ((code == EC_REPAINT) && graph->HandleEcRepaint)
5407 {
5408 FIXME("EC_REPAINT is not handled.\n");
5409 }
5410 else if (!graph->media_events_disabled)
5411 {
5412 queue_media_event(graph, code, param1, param2);
5413 }
5414
5415 LeaveCriticalSection(&graph->event_cs);
5416 return S_OK;
5417}
5418
5419static const IMediaEventSinkVtbl IMediaEventSink_VTable =
5420{
5425};
5426
5428{
5429 return CONTAINING_RECORD(iface, struct filter_graph, IGraphConfig_iface);
5430}
5431
5433{
5434 struct filter_graph *graph = impl_from_IGraphConfig(iface);
5435
5436 return IUnknown_QueryInterface(graph->outer_unk, iid, out);
5437}
5438
5440{
5441 struct filter_graph *graph = impl_from_IGraphConfig(iface);
5442
5443 return IUnknown_AddRef(graph->outer_unk);
5444}
5445
5447{
5448 struct filter_graph *graph = impl_from_IGraphConfig(iface);
5449
5450 return IUnknown_Release(graph->outer_unk);
5451}
5452
5454 const AM_MEDIA_TYPE *mt, IBaseFilter *filter, HANDLE abort_event, DWORD flags)
5455{
5456 struct filter_graph *graph = impl_from_IGraphConfig(iface);
5457
5458 FIXME("graph %p, source %p, sink %p, mt %p, filter %p, abort_event %p, flags %#lx, stub!\n",
5459 graph, source, sink, mt, filter, abort_event, flags);
5461
5462 return E_NOTIMPL;
5463}
5464
5466 IGraphConfigCallback *callback, void *context, DWORD flags, HANDLE abort_event)
5467{
5468 struct filter_graph *graph = impl_from_IGraphConfig(iface);
5469 HRESULT hr;
5470
5471 TRACE("graph %p, callback %p, context %p, flags %#lx, abort_event %p.\n",
5472 graph, callback, context, flags, abort_event);
5473
5474 if (abort_event)
5475 FIXME("The parameter hAbortEvent is not handled!\n");
5476
5478
5479 hr = IGraphConfigCallback_Reconfigure(callback, context, flags);
5480
5482
5483 return hr;
5484}
5485
5487{
5488 struct filter_graph *This = impl_from_IGraphConfig(iface);
5489
5490 FIXME("(%p)->(%p): stub!\n", This, pFilter);
5491
5492 return E_NOTIMPL;
5493}
5494
5496{
5497 struct filter_graph *This = impl_from_IGraphConfig(iface);
5498
5499 FIXME("(%p)->(%p): stub!\n", This, pEnum);
5500
5501 return E_NOTIMPL;
5502}
5503
5505{
5506 struct filter_graph *This = impl_from_IGraphConfig(iface);
5507
5508 FIXME("(%p)->(%p): stub!\n", This, pFilter);
5509
5510 return E_NOTIMPL;
5511}
5512
5514{
5515 struct filter_graph *This = impl_from_IGraphConfig(iface);
5516
5517 FIXME("(%p)->(%p): stub!\n", This, prtStart);
5518
5519 return E_NOTIMPL;
5520}
5521
5523 IPinConnection *pConnection, HANDLE hEventAbort)
5524{
5525 struct filter_graph *This = impl_from_IGraphConfig(iface);
5526
5527 FIXME("(%p)->(%p, %p, %p): stub!\n", This, pOutputPin, pConnection, hEventAbort);
5528
5529 return E_NOTIMPL;
5530}
5531
5533{
5534 struct filter_graph *graph = impl_from_IGraphConfig(iface);
5535
5536 FIXME("graph %p, filter %p, flags %#lx, stub!\n", graph, filter, flags);
5537
5538 return E_NOTIMPL;
5539}
5540
5542 DWORD *dwFlags)
5543{
5544 struct filter_graph *This = impl_from_IGraphConfig(iface);
5545
5546 FIXME("(%p)->(%p, %p): stub!\n", This, pFilter, dwFlags);
5547
5548 return E_NOTIMPL;
5549}
5550
5552{
5553 struct filter_graph *graph = impl_from_IGraphConfig(iface);
5554
5555 FIXME("graph %p, filter %p, flags %#lx, stub!\n", graph, filter, flags);
5556
5557 return E_NOTIMPL;
5558}
5559
5560static const IGraphConfigVtbl IGraphConfig_VTable =
5561{
5575};
5576
5578{
5579 return CONTAINING_RECORD(iface, struct filter_graph, IGraphVersion_iface);
5580}
5581
5583{
5585
5586 return IUnknown_QueryInterface(graph->outer_unk, iid, out);
5587}
5588
5590{
5592
5593 return IUnknown_AddRef(graph->outer_unk);
5594}
5595
5597{
5599
5600 return IUnknown_Release(graph->outer_unk);
5601}
5602
5604{
5606
5607 TRACE("graph %p, version %p, returning %ld.\n", graph, version, graph->version);
5608
5609 if (!version)
5610 return E_POINTER;
5611
5612 *version = graph->version;
5613 return S_OK;
5614}
5615
5616static const IGraphVersionVtbl IGraphVersion_VTable =
5617{
5622};
5623
5625{
5627}
5628
5630{
5632 return IUnknown_QueryInterface(graph->outer_unk, iid, out);
5633}
5634
5636{
5638 return IUnknown_AddRef(graph->outer_unk);
5639}
5640
5642{
5644 return IUnknown_Release(graph->outer_unk);
5645}
5646
5648{
5649 FIXME("iface %p, frame_count %lu, filter %p, stub!\n", iface, frame_count, filter);
5650 return E_NOTIMPL;
5651}
5652
5654{
5655 FIXME("iface %p, multiple %ld, filter %p, stub!\n", iface, multiple, filter);
5656 return E_NOTIMPL;
5657}
5658
5660{
5661 FIXME("iface %p, stub!\n", iface);
5662 return E_NOTIMPL;
5663}
5664
5665static const IVideoFrameStepVtbl VideoFrameStep_vtbl =
5666{
5673};
5674
5675static const IUnknownVtbl IInner_VTable =
5676{
5680};
5681
5683{
5684 struct filter_graph *object;
5685 HRESULT hr;
5686
5687 *out = NULL;
5688
5689 if (!(object = calloc(1, sizeof(*object))))
5690 return E_OUTOFMEMORY;
5691
5692 object->IBasicAudio_iface.lpVtbl = &IBasicAudio_VTable;
5693 object->IBasicVideo2_iface.lpVtbl = &IBasicVideo_VTable;
5694 object->IFilterGraph2_iface.lpVtbl = &IFilterGraph2_VTable;
5695 object->IGraphConfig_iface.lpVtbl = &IGraphConfig_VTable;
5696 object->IGraphVersion_iface.lpVtbl = &IGraphVersion_VTable;
5697 object->IMediaControl_iface.lpVtbl = &IMediaControl_VTable;
5698 object->IMediaEventEx_iface.lpVtbl = &IMediaEventEx_VTable;
5699 object->IMediaEventSink_iface.lpVtbl = &IMediaEventSink_VTable;
5700 object->IMediaFilter_iface.lpVtbl = &IMediaFilter_VTable;
5701 object->IMediaPosition_iface.lpVtbl = &IMediaPosition_VTable;
5702 object->IMediaSeeking_iface.lpVtbl = &IMediaSeeking_VTable;
5703 object->IObjectWithSite_iface.lpVtbl = &IObjectWithSite_VTable;
5704 object->IUnknown_inner.lpVtbl = &IInner_VTable;
5705 object->IVideoFrameStep_iface.lpVtbl = &VideoFrameStep_vtbl;
5706 object->IVideoWindow_iface.lpVtbl = &IVideoWindow_VTable;
5707 object->ref = 1;
5708 object->outer_unk = outer ? outer : &object->IUnknown_inner;
5709
5710 if (FAILED(hr = CoCreateInstance(&CLSID_FilterMapper2, object->outer_unk,
5711 CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&object->punkFilterMapper2)))
5712 {
5713 ERR("Failed to create filter mapper, hr %#lx.\n", hr);
5714 free(object);
5715 return hr;
5716 }
5717
5719 object->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": filter_graph.cs");
5721 object->event_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": filter_graph.event_cs");
5722
5723 object->defaultclock = TRUE;
5724
5725 object->media_event_handle = CreateEventW(NULL, TRUE, FALSE, NULL);
5726 list_init(&object->media_events);
5727 list_init(&object->filters);
5728 object->HandleEcClockChanged = TRUE;
5729 object->HandleEcComplete = TRUE;
5730 object->HandleEcRepaint = TRUE;
5731 object->hEventCompletion = CreateEventW(0, TRUE, FALSE, 0);
5732
5733 object->name_index = 1;
5734 object->timeformatseek = TIME_FORMAT_MEDIA_TIME;
5735
5736 object->threaded = !!threaded;
5737
5738 EnterCriticalSection(&message_cs);
5740 {
5744 }
5745 LeaveCriticalSection(&message_cs);
5746
5747 TRACE("Created %sthreaded filter graph %p.\n", threaded ? "" : "non-", object);
5748 *out = &object->IUnknown_inner;
5749 return S_OK;
5750}
5751
5753{
5755}
5756
5758{
5760}
@ lparam
Definition: SystemMenu.c:31
HRESULT WINAPI DECLSPEC_HOTPATCH SetThreadDescription(_In_ HANDLE hThread, _In_ PCWSTR lpThreadDescription)
static int state
Definition: maze.c:121
unsigned int dir
Definition: maze.c:112
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define msg(x)
Definition: auth_time.c:54
@ AM_SEEKING_NoPositioning
Definition: axcore.idl:591
@ AM_SEEKING_AbsolutePositioning
Definition: axcore.idl:592
@ AM_SEEKING_ReturnTime
Definition: axcore.idl:597
DOUBLE REFTIME
Definition: axcore.idl:57
enum _PinDirection PIN_DIRECTION
@ AM_MEDIAEVENT_NONOTIFY
Definition: axcore.idl:670
@ PINDIR_OUTPUT
Definition: axcore.idl:42
@ PINDIR_INPUT
Definition: axcore.idl:41
@ AM_FILTER_MISC_FLAGS_IS_RENDERER
Definition: axextend.idl:1244
@ AM_RENDEREX_RENDERTOEXISTINGRENDERERS
Definition: axextend.idl:860
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static int list_empty(struct list_entry *head)
Definition: list.h:58
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
static void list_init(struct list_entry *head)
Definition: list.h:51
static LPHIST_ENTRY Top
Definition: history.c:53
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
const GUID IID_IUnknown
Definition: list.h:39
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
HRESULT hr
Definition: delayimp.cpp:582
const GUID IID_IBaseFilter
_Check_return_ _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ PDXGKARG_SYSTEM_DISPLAY_ENABLE_FLAGS _Out_ UINT _Out_ UINT * Height
Definition: dispmprt.h:1445
_Check_return_ _In_ D3DDDI_VIDEO_PRESENT_TARGET_ID _In_ PDXGKARG_SYSTEM_DISPLAY_ENABLE_FLAGS _Out_ UINT * Width
Definition: dispmprt.h:1444
_In_ UINT _In_ UINT SourceHeight
Definition: dispmprt.h:1457
_In_ UINT SourceWidth
Definition: dispmprt.h:1456
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static HINSTANCE instance
Definition: main.c:35
BOOL get_media_type(const WCHAR *filename, GUID *majortype, GUID *subtype, GUID *source_clsid)
Definition: filesource.c:198
static HRESULT WINAPI MediaPosition_Invoke(IMediaPosition *iface, DISPID id, REFIID iid, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
Definition: filtergraph.c:2633
static HRESULT WINAPI MediaPosition_put_StopTime(IMediaPosition *iface, REFTIME llTime)
Definition: filtergraph.c:2732
HRESULT filter_graph_no_thread_create(IUnknown *outer, IUnknown **out)
Definition: filtergraph.c:5757
static struct filter_graph * impl_from_IMediaEventEx(IMediaEventEx *iface)
Definition: filtergraph.c:4777
static HRESULT WINAPI FilterGraph2_ReconnectEx(IFilterGraph2 *iface, IPin *pin, const AM_MEDIA_TYPE *mt)
Definition: filtergraph.c:1617
static HRESULT WINAPI MediaEvent_SetNotifyWindow(IMediaEventEx *iface, OAHWND window, LONG message, LONG_PTR lparam)
Definition: filtergraph.c:4958
static HRESULT WINAPI MediaSeeking_GetCapabilities(IMediaSeeking *iface, DWORD *pCapabilities)
Definition: filtergraph.c:2165
static ULONG WINAPI ObjectWithSite_Release(IObjectWithSite *iface)
Definition: filtergraph.c:2822
static HRESULT WINAPI BasicVideo_get_BitErrorRate(IBasicVideo2 *iface, LONG *pBitErrorRate)
Definition: filtergraph.c:3187
static HRESULT WINAPI GraphConfig_Reconnect(IGraphConfig *iface, IPin *source, IPin *sink, const AM_MEDIA_TYPE *mt, IBaseFilter *filter, HANDLE abort_event, DWORD flags)
Definition: filtergraph.c:5453
static HRESULT create_enum_filters(struct filter_graph *graph, struct list *cursor, IEnumFilters **out)
Definition: filtergraph.c:300
static HRESULT WINAPI MediaEventSink_Notify(IMediaEventSink *iface, LONG code, LONG_PTR param1, LONG_PTR param2)
Definition: filtergraph.c:5384
static HRESULT WINAPI BasicAudio_QueryInterface(IBasicAudio *iface, REFIID iid, void **out)
Definition: filtergraph.c:2913
static HRESULT WINAPI MediaPosition_CanSeekBackward(IMediaPosition *iface, LONG *pCanSeekBackward)
Definition: filtergraph.c:2775
static HRESULT WINAPI BasicVideo_put_DestinationTop(IBasicVideo2 *iface, LONG DestinationTop)
Definition: filtergraph.c:3487
static HRESULT WINAPI VideoWindow_put_Height(IVideoWindow *iface, LONG Height)
Definition: filtergraph.c:4333
static HRESULT WINAPI VideoWindow_get_FullScreenMode(IVideoWindow *iface, LONG *FullScreenMode)
Definition: filtergraph.c:4493
static void sort_filters(struct filter_graph *graph)
Definition: filtergraph.c:906
static HRESULT WINAPI ObjectWithSite_QueryInterface(IObjectWithSite *iface, REFIID iid, void **out)
Definition: filtergraph.c:2810
static HRESULT WINAPI FilterGraph2_EnumFilters(IFilterGraph2 *iface, IEnumFilters **out)
Definition: filtergraph.c:764
static ULONG WINAPI MediaPosition_AddRef(IMediaPosition *iface)
Definition: filtergraph.c:2590
static HRESULT WINAPI BasicVideo_SetDefaultSourcePosition(IBasicVideo2 *iface)
Definition: filtergraph.c:3610
static ULONG WINAPI MediaEventSink_Release(IMediaEventSink *iface)
Definition: filtergraph.c:5377
static ULONG WINAPI MediaEvent_Release(IMediaEventEx *iface)
Definition: filtergraph.c:4794
static ULONG WINAPI ObjectWithSite_AddRef(IObjectWithSite *iface)
Definition: filtergraph.c:2816
static struct filter_graph * impl_from_IUnknown(IUnknown *iface)
Definition: filtergraph.c:351
static HRESULT autoplug(struct filter_graph *graph, IPin *source, IPin *sink, BOOL render_to_existing, unsigned int recursion_depth)
Definition: filtergraph.c:1263
static HRESULT WINAPI BasicVideo_put_DestinationHeight(IBasicVideo2 *iface, LONG DestinationHeight)
Definition: filtergraph.c:3527
static HRESULT WINAPI MediaControl_GetTypeInfoCount(IMediaControl *iface, UINT *count)
Definition: filtergraph.c:1712
static ULONG WINAPI FilterGraph2_Release(IFilterGraph2 *iface)
Definition: filtergraph.c:515
static HRESULT WINAPI MediaPosition_put_Rate(IMediaPosition *iface, double dRate)
Definition: filtergraph.c:2757
static HRESULT WINAPI VideoWindow_put_Width(IVideoWindow *iface, LONG Width)
Definition: filtergraph.c:4253
static HRESULT WINAPI MediaFilter_GetState(IMediaFilter *iface, DWORD timeout, FILTER_STATE *state)
Definition: filtergraph.c:5196
static HRESULT WINAPI MediaEvent_GetTypeInfo(IMediaEventEx *iface, UINT index, LCID lcid, ITypeInfo **typeinfo)
Definition: filtergraph.c:4807
static HRESULT WINAPI EnumFilters_Skip(IEnumFilters *iface, ULONG count)
Definition: filtergraph.c:248
static HRESULT WINAPI MediaSeeking_GetAvailable(IMediaSeeking *iface, LONGLONG *pEarliest, LONGLONG *pLatest)
Definition: filtergraph.c:2511
static ULONG WINAPI FilterGraph2_AddRef(IFilterGraph2 *iface)
Definition: filtergraph.c:509
static HRESULT WINAPI VideoWindow_put_Top(IVideoWindow *iface, LONG Top)
Definition: filtergraph.c:4293
static HRESULT WINAPI GraphConfig_RemoveFilterFromCache(IGraphConfig *iface, IBaseFilter *pFilter)
Definition: filtergraph.c:5504
static HRESULT WINAPI BasicVideo_GetTypeInfo(IBasicVideo2 *iface, UINT index, LCID lcid, ITypeInfo **typeinfo)
Definition: filtergraph.c:3105
static const IMediaEventExVtbl IMediaEventEx_VTable
Definition: filtergraph.c:5010
static HRESULT WINAPI BasicAudio_GetTypeInfo(IBasicAudio *iface, UINT index, LCID lcid, ITypeInfo **typeinfo)
Definition: filtergraph.c:2938
static BOOL is_renderer(struct filter *filter)
Definition: filtergraph.c:580
static HRESULT WINAPI VideoWindow_SetWindowForeground(IVideoWindow *iface, LONG Focus)
Definition: filtergraph.c:4540
HRESULT WINAPI VideoWindow_GetTypeInfo(IVideoWindow *iface, UINT index, LCID lcid, ITypeInfo **typeinfo)
Definition: filtergraph.c:3890
static HRESULT WINAPI MediaControl_RenderFile(IMediaControl *iface, BSTR strFilename)
Definition: filtergraph.c:1983
HRESULT(WINAPI * fnFoundSeek)(struct filter_graph *This, IMediaSeeking *, DWORD_PTR arg)
Definition: filtergraph.c:2125
static ULONG WINAPI MediaFilter_AddRef(IMediaFilter *iface)
Definition: filtergraph.c:5043
static HRESULT WINAPI MediaFilter_Pause(IMediaFilter *iface)
Definition: filtergraph.c:5117
static HRESULT WINAPI BasicVideo_put_DestinationLeft(IBasicVideo2 *iface, LONG DestinationLeft)
Definition: filtergraph.c:3407
static HRESULT WINAPI VideoWindow_put_MessageDrain(IVideoWindow *iface, OAHWND Drain)
Definition: filtergraph.c:4413
static HRESULT WINAPI MediaControl_GetState(IMediaControl *iface, LONG timeout, OAFilterState *state)
Definition: filtergraph.c:1972
static HRESULT WINAPI VideoWindow_put_WindowState(IVideoWindow *iface, LONG WindowState)
Definition: filtergraph.c:4092
static HRESULT WINAPI EnumFilters_QueryInterface(IEnumFilters *iface, REFIID iid, void **out)
Definition: filtergraph.c:174
static HRESULT WINAPI BasicVideo_GetTypeInfoCount(IBasicVideo2 *iface, UINT *count)
Definition: filtergraph.c:3098
static HRESULT WINAPI VideoWindow_put_WindowStyleEx(IVideoWindow *iface, LONG WindowStyleEx)
Definition: filtergraph.c:4012
static void CALLBACK async_run_cb(TP_CALLBACK_INSTANCE *instance, void *context, TP_WORK *work)
Definition: filtergraph.c:1826
static ULONG WINAPI BasicVideo_AddRef(IBasicVideo2 *iface)
Definition: filtergraph.c:3086
static HRESULT WINAPI GraphConfig_RemoveFilterEx(IGraphConfig *iface, IBaseFilter *filter, DWORD flags)
Definition: filtergraph.c:5551
static void flush_media_events(struct filter_graph *graph)
Definition: filtergraph.c:338
static void update_seeking(struct filter *filter)
Definition: filtergraph.c:558
static HRESULT WINAPI MediaControl_Run(IMediaControl *iface)
Definition: filtergraph.c:1882
static ULONG WINAPI MediaControl_Release(IMediaControl *iface)
Definition: filtergraph.c:1705
static HRESULT WINAPI MediaControl_AddSourceFilter(IMediaControl *iface, BSTR strFilename, IDispatch **ppUnk)
Definition: filtergraph.c:1992
static HRESULT WINAPI FilterGraph2_RenderFile(IFilterGraph2 *iface, LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList)
Definition: filtergraph.c:1440
static HRESULT create_filter(struct filter_graph *graph, IMoniker *moniker, IBaseFilter **filter)
Definition: filtergraph.c:1071
static HRESULT WINAPI VideoWindow_get_Left(IVideoWindow *iface, LONG *pLeft)
Definition: filtergraph.c:4233
static struct filter_graph * impl_from_IVideoFrameStep(IVideoFrameStep *iface)
Definition: filtergraph.c:5624
static HRESULT WINAPI MediaPosition_get_Duration(IMediaPosition *iface, REFTIME *plength)
Definition: filtergraph.c:2687
static HRESULT WINAPI FilterGraph2_SetLogFile(IFilterGraph2 *iface, DWORD_PTR file)
Definition: filtergraph.c:1560
static HRESULT WINAPI VideoWindow_put_Owner(IVideoWindow *iface, OAHWND Owner)
Definition: filtergraph.c:4373
static HRESULT WINAPI MediaControl_QueryInterface(IMediaControl *iface, REFIID iid, void **out)
Definition: filtergraph.c:1693
static HRESULT WINAPI MediaSeeking_IsFormatSupported(IMediaSeeking *iface, const GUID *pFormat)
Definition: filtergraph.c:2210
static HRESULT WINAPI MediaFilter_Run(IMediaFilter *iface, REFERENCE_TIME start)
Definition: filtergraph.c:5170
static HRESULT WINAPI FoundCapabilities(struct filter_graph *This, IMediaSeeking *seek, DWORD_PTR pcaps)
Definition: filtergraph.c:2149
static HRESULT WINAPI BasicVideo_get_DestinationLeft(IBasicVideo2 *iface, LONG *pDestinationLeft)
Definition: filtergraph.c:3427
static struct filter_graph * impl_from_IBasicVideo2(IBasicVideo2 *iface)
Definition: filtergraph.c:3075
static const IBasicAudioVtbl IBasicAudio_VTable
Definition: filtergraph.c:3060
static HRESULT WINAPI MediaControl_get_RegFilterCollection(IMediaControl *iface, IDispatch **ppUnk)
Definition: filtergraph.c:2011
static HRESULT WINAPI MediaSeeking_GetPositions(IMediaSeeking *iface, LONGLONG *current, LONGLONG *stop)
Definition: filtergraph.c:2495
static HRESULT WINAPI BasicVideo_GetVideoPaletteEntries(IBasicVideo2 *iface, LONG StartIndex, LONG Entries, LONG *pRetrieved, LONG *pPalette)
Definition: filtergraph.c:3712
static HRESULT WINAPI VideoWindow_put_FullScreenMode(IVideoWindow *iface, LONG FullScreenMode)
Definition: filtergraph.c:4518
static HRESULT WINAPI MediaControl_get_FilterCollection(IMediaControl *iface, IDispatch **ppUnk)
Definition: filtergraph.c:2002
static HRESULT WINAPI MediaFilter_GetSyncSource(IMediaFilter *iface, IReferenceClock **ppClock)
Definition: filtergraph.c:5324
HRESULT WINAPI VideoWindow_GetIDsOfNames(IVideoWindow *iface, REFIID iid, LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
Definition: filtergraph.c:3897
static HRESULT WINAPI MediaEvent_GetNotifyFlags(IMediaEventEx *iface, LONG *flags)
Definition: filtergraph.c:4995
static HRESULT WINAPI BasicVideo_IsUsingDefaultDestination(IBasicVideo2 *iface)
Definition: filtergraph.c:3775
static HRESULT WINAPI BasicVideo_IsUsingDefaultSource(IBasicVideo2 *iface)
Definition: filtergraph.c:3755
static HRESULT WINAPI FilterGraph2_Abort(IFilterGraph2 *iface)
Definition: filtergraph.c:1569
static HRESULT WINAPI MediaControl_GetIDsOfNames(IMediaControl *iface, REFIID iid, LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
Definition: filtergraph.c:1726
static HRESULT WINAPI ObjectWithSite_GetSite(IObjectWithSite *iface, REFIID riid, PVOID *ppvSite)
Definition: filtergraph.c:2841
static ULONG WINAPI GraphConfig_Release(IGraphConfig *iface)
Definition: filtergraph.c:5446
static struct filter_graph * impl_from_IMediaFilter(IMediaFilter *iface)
Definition: filtergraph.c:5031
static ULONG WINAPI VideoFrameStep_AddRef(IVideoFrameStep *iface)
Definition: filtergraph.c:5635
static HRESULT WINAPI VideoWindow_SetWindowPosition(IVideoWindow *iface, LONG Left, LONG Top, LONG Width, LONG Height)
Definition: filtergraph.c:4581
static struct filter * find_sorted_filter(struct filter_graph *graph, IBaseFilter *iface)
Definition: filtergraph.c:854
static HRESULT WINAPI GraphConfig_SetFilterFlags(IGraphConfig *iface, IBaseFilter *filter, DWORD flags)
Definition: filtergraph.c:5532
static HRESULT filter_graph_common_create(IUnknown *outer, IUnknown **out, BOOL threaded)
Definition: filtergraph.c:5682
static HRESULT WINAPI MediaSeeking_CheckCapabilities(IMediaSeeking *iface, DWORD *pCapabilities)
Definition: filtergraph.c:2184
static HRESULT WINAPI GraphConfig_AddFilterToCache(IGraphConfig *iface, IBaseFilter *pFilter)
Definition: filtergraph.c:5486
static ULONG WINAPI FilterGraphInner_Release(IUnknown *iface)
Definition: filtergraph.c:440
static HRESULT WINAPI BasicVideo_put_SourceLeft(IBasicVideo2 *iface, LONG SourceLeft)
Definition: filtergraph.c:3247
static BOOL has_output_pins(IBaseFilter *filter)
Definition: filtergraph.c:534
static HRESULT WINAPI MediaSeeking_IsUsingTimeFormat(IMediaSeeking *iface, const GUID *pFormat)
Definition: filtergraph.c:2254
static HANDLE message_thread_ret
Definition: filtergraph.c:54
static HRESULT WINAPI BasicVideo_put_DestinationWidth(IBasicVideo2 *iface, LONG DestinationWidth)
Definition: filtergraph.c:3447
static HRESULT WINAPI BasicAudio_get_Volume(IBasicAudio *iface, LONG *plVolume)
Definition: filtergraph.c:3000
static HRESULT WINAPI MediaEvent_FreeEventParams(IMediaEventEx *iface, LONG code, LONG_PTR param1, LONG_PTR param2)
Definition: filtergraph.c:4947
static HRESULT WINAPI VideoWindow_IsCursorHidden(IVideoWindow *iface, LONG *CursorHidden)
Definition: filtergraph.c:4706
static HRESULT WINAPI BasicVideo_GetIDsOfNames(IBasicVideo2 *iface, REFIID iid, LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
Definition: filtergraph.c:3112
static HRESULT WINAPI BasicVideo_SetDestinationPosition(IBasicVideo2 *iface, LONG Left, LONG Top, LONG Width, LONG Height)
Definition: filtergraph.c:3630
static HRESULT WINAPI MediaSeeking_GetPreroll(IMediaSeeking *iface, LONGLONG *pllPreroll)
Definition: filtergraph.c:2544
static HRESULT WINAPI MediaFilter_QueryInterface(IMediaFilter *iface, REFIID iid, void **out)
Definition: filtergraph.c:5036
static HRESULT WINAPI FilterGraph2_AddSourceFilterForMoniker(IFilterGraph2 *iface, IMoniker *pMoniker, IBindCtx *pCtx, LPCWSTR lpcwstrFilterName, IBaseFilter **ppFilter)
Definition: filtergraph.c:1588
static HRESULT WINAPI BasicVideo_GetCurrentImage(IBasicVideo2 *iface, LONG *pBufferSize, LONG *pDIBImage)
Definition: filtergraph.c:3734
static ULONG WINAPI MediaEventSink_AddRef(IMediaEventSink *iface)
Definition: filtergraph.c:5370
static HRESULT WINAPI BasicVideo_get_VideoHeight(IBasicVideo2 *iface, LONG *pVideoHeight)
Definition: filtergraph.c:3227
static HRESULT WINAPI VideoWindow_HideCursor(IVideoWindow *iface, LONG HideCursor)
Definition: filtergraph.c:4686
static HRESULT WINAPI MediaPosition_GetIDsOfNames(IMediaPosition *iface, REFIID iid, LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
Definition: filtergraph.c:2616
static HRESULT WINAPI MediaPosition_get_PrerollTime(IMediaPosition *iface, REFTIME *pllTime)
Definition: filtergraph.c:2745
static const IFilterGraph2Vtbl IFilterGraph2_VTable
Definition: filtergraph.c:1663
static HRESULT WINAPI BasicVideo_SetDefaultDestinationPosition(IBasicVideo2 *iface)
Definition: filtergraph.c:3672
static HRESULT WINAPI MediaSeeking_SetRate(IMediaSeeking *iface, double dRate)
Definition: filtergraph.c:2521
static HRESULT WINAPI VideoWindow_get_Visible(IVideoWindow *iface, LONG *pVisible)
Definition: filtergraph.c:4193
static HRESULT WINAPI BasicAudio_GetTypeInfoCount(IBasicAudio *iface, UINT *count)
Definition: filtergraph.c:2931
static HRESULT WINAPI VideoFrameStep_QueryInterface(IVideoFrameStep *iface, REFIID iid, void **out)
Definition: filtergraph.c:5629
static HRESULT WINAPI BasicVideo_GetVideoSize(IBasicVideo2 *iface, LONG *pWidth, LONG *pHeight)
Definition: filtergraph.c:3692
static HRESULT WINAPI BasicVideo_SetSourcePosition(IBasicVideo2 *iface, LONG Left, LONG Top, LONG Width, LONG Height)
Definition: filtergraph.c:3568
static ULONG WINAPI GraphVersion_Release(IGraphVersion *iface)
Definition: filtergraph.c:5596
static HRESULT WINAPI BasicVideo_get_DestinationHeight(IBasicVideo2 *iface, LONG *pDestinationHeight)
Definition: filtergraph.c:3547
static void CALLBACK wait_pause_cb(TP_CALLBACK_INSTANCE *instance, void *context)
Definition: filtergraph.c:2020
static HRESULT WINAPI VideoWindow_put_AutoShow(IVideoWindow *iface, LONG AutoShow)
Definition: filtergraph.c:4052
static HRESULT WINAPI BasicVideo_GetDestinationPosition(IBasicVideo2 *iface, LONG *pLeft, LONG *pTop, LONG *pWidth, LONG *pHeight)
Definition: filtergraph.c:3651
static struct filter_graph * impl_from_IVideoWindow(IVideoWindow *iface)
Definition: filtergraph.c:3860
static HRESULT WINAPI VideoWindow_get_Height(IVideoWindow *iface, LONG *pHeight)
Definition: filtergraph.c:4353
static HRESULT WINAPI GraphConfig_GetFilterFlags(IGraphConfig *iface, IBaseFilter *pFilter, DWORD *dwFlags)
Definition: filtergraph.c:5541
static HRESULT WINAPI BasicVideo_get_SourceWidth(IBasicVideo2 *iface, LONG *pSourceWidth)
Definition: filtergraph.c:3307
static const IEnumFiltersVtbl EnumFilters_vtbl
Definition: filtergraph.c:289
static HRESULT WINAPI MediaControl_Pause(IMediaControl *iface)
Definition: filtergraph.c:1954
static HRESULT WINAPI BasicVideo_get_SourceLeft(IBasicVideo2 *iface, LONG *pSourceLeft)
Definition: filtergraph.c:3267
static HRESULT WINAPI BasicAudio_GetIDsOfNames(IBasicAudio *iface, REFIID iid, LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
Definition: filtergraph.c:2945
static HRESULT WINAPI MediaSeeking_GetDuration(IMediaSeeking *iface, LONGLONG *duration)
Definition: filtergraph.c:2286
static HRESULT WINAPI VideoWindow_get_WindowStyle(IVideoWindow *iface, LONG *WindowStyle)
Definition: filtergraph.c:3992
struct _ITF_CACHE_ENTRY ITF_CACHE_ENTRY
static HRESULT WINAPI MediaEvent_GetIDsOfNames(IMediaEventEx *iface, REFIID iid, LPOLESTR *names, UINT count, LCID lcid, DISPID *ids)
Definition: filtergraph.c:4814
static HRESULT WINAPI VideoWindow_GetWindowPosition(IVideoWindow *iface, LONG *pLeft, LONG *pTop, LONG *pWidth, LONG *pHeight)
Definition: filtergraph.c:4602
static HRESULT WINAPI VideoWindow_get_BorderColor(IVideoWindow *iface, LONG *Color)
Definition: filtergraph.c:4453
static HRESULT WINAPI BasicVideo_put_SourceHeight(IBasicVideo2 *iface, LONG SourceHeight)
Definition: filtergraph.c:3367
static const IMediaSeekingVtbl IMediaSeeking_VTable
Definition: filtergraph.c:2554
static HRESULT WINAPI MediaFilter_Stop(IMediaFilter *iface)
Definition: filtergraph.c:5064
static HRESULT WINAPI BasicAudio_put_Volume(IBasicAudio *iface, LONG lVolume)
Definition: filtergraph.c:2980
static HRESULT WINAPI VideoWindow_get_Caption(IVideoWindow *iface, BSTR *strCaption)
Definition: filtergraph.c:3952
static ULONG WINAPI EnumFilters_AddRef(IEnumFilters *iface)
Definition: filtergraph.c:190
static HRESULT WINAPI VideoWindow_Invoke(IVideoWindow *iface, DISPID id, REFIID iid, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
Definition: filtergraph.c:3914
static HRESULT WINAPI VideoWindow_put_BorderColor(IVideoWindow *iface, LONG Color)
Definition: filtergraph.c:4473
static HRESULT WINAPI VideoWindow_GetMinIdealImageSize(IVideoWindow *iface, LONG *pWidth, LONG *pHeight)
Definition: filtergraph.c:4623
static const IMediaControlVtbl IMediaControl_VTable
Definition: filtergraph.c:2082
static HRESULT WINAPI MediaSeeking_GetRate(IMediaSeeking *iface, double *pdRate)
Definition: filtergraph.c:2530
static HRESULT WINAPI VideoWindow_get_BackgroundPalette(IVideoWindow *iface, LONG *pBackgroundPalette)
Definition: filtergraph.c:4152
static HRESULT WINAPI VideoWindow_get_Owner(IVideoWindow *iface, OAHWND *Owner)
Definition: filtergraph.c:4393
static HRESULT WINAPI GraphVersion_QueryVersion(IGraphVersion *iface, LONG *version)
Definition: filtergraph.c:5603
HRESULT WINAPI VideoWindow_GetTypeInfoCount(IVideoWindow *iface, UINT *count)
Definition: filtergraph.c:3883
static const IMediaEventSinkVtbl IMediaEventSink_VTable
Definition: filtergraph.c:5419
static ULONG WINAPI EnumFilters_Release(IEnumFilters *iface)
Definition: filtergraph.c:200
static HRESULT WINAPI VideoWindow_get_Width(IVideoWindow *iface, LONG *pWidth)
Definition: filtergraph.c:4273
static HRESULT WINAPI MediaSeeking_QueryInterface(IMediaSeeking *iface, REFIID iid, void **out)
Definition: filtergraph.c:2107
static HRESULT WINAPI MediaControl_Stop(IMediaControl *iface)
Definition: filtergraph.c:1963
static HRESULT WINAPI MediaPosition_put_PrerollTime(IMediaPosition *iface, REFTIME llTime)
Definition: filtergraph.c:2751
static struct filter_graph * impl_from_IGraphConfig(IGraphConfig *iface)
Definition: filtergraph.c:5427
static HRESULT WINAPI MediaEvent_GetEvent(IMediaEventEx *iface, LONG *code, LONG_PTR *param1, LONG_PTR *param2, LONG timeout)
Definition: filtergraph.c:4858
static struct filter_graph * impl_from_IObjectWithSite(IObjectWithSite *iface)
Definition: filtergraph.c:2804
static ULONG WINAPI VideoWindow_Release(IVideoWindow *iface)
Definition: filtergraph.c:3877
static IBaseFilter * find_filter_by_name(struct filter_graph *graph, const WCHAR *name)
Definition: filtergraph.c:521
static HRESULT WINAPI VideoWindow_get_MessageDrain(IVideoWindow *iface, OAHWND *Drain)
Definition: filtergraph.c:4433
static HRESULT WINAPI VideoWindow_put_Caption(IVideoWindow *iface, BSTR strCaption)
Definition: filtergraph.c:3932
static HRESULT WINAPI BasicVideo_Invoke(IBasicVideo2 *iface, DISPID id, REFIID iid, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
Definition: filtergraph.c:3129
static HRESULT WINAPI GraphConfig_QueryInterface(IGraphConfig *iface, REFIID iid, void **out)
Definition: filtergraph.c:5432
static ULONG WINAPI GraphVersion_AddRef(IGraphVersion *iface)
Definition: filtergraph.c:5589
static HRESULT WINAPI VideoWindow_GetRestorePosition(IVideoWindow *iface, LONG *pLeft, LONG *pTop, LONG *pWidth, LONG *pHeight)
Definition: filtergraph.c:4665
static HRESULT WINAPI MediaEvent_WaitForCompletion(IMediaEventEx *iface, LONG msTimeout, LONG *pEvCode)
Definition: filtergraph.c:4891
#define MAX_ITF_CACHE_ENTRIES
Definition: filtergraph.c:65
static HRESULT autoplug_through_sink(struct filter_graph *graph, IPin *source, IBaseFilter *filter, IPin *middle_sink, IPin *sink, BOOL render_to_existing, unsigned int recursion_depth)
Definition: filtergraph.c:1094
static struct filter_graph * impl_from_IMediaControl(IMediaControl *iface)
Definition: filtergraph.c:1688
static HRESULT WINAPI VideoFrameStep_CanStep(IVideoFrameStep *iface, LONG multiple, IUnknown *filter)
Definition: filtergraph.c:5653
static HRESULT WINAPI VideoWindow_QueryInterface(IVideoWindow *iface, REFIID iid, void **out)
Definition: filtergraph.c:3865
static HRESULT WINAPI BasicVideo_put_SourceWidth(IBasicVideo2 *iface, LONG SourceWidth)
Definition: filtergraph.c:3287
static struct filter_graph * impl_from_IGraphVersion(IGraphVersion *iface)
Definition: filtergraph.c:5577
static HRESULT WINAPI BasicAudio_put_Balance(IBasicAudio *iface, LONG lBalance)
Definition: filtergraph.c:3020
static HRESULT WINAPI BasicVideo_get_VideoWidth(IBasicVideo2 *iface, LONG *pVideoWidth)
Definition: filtergraph.c:3207
static ULONG WINAPI GraphConfig_AddRef(IGraphConfig *iface)
Definition: filtergraph.c:5439
static HRESULT WINAPI EnumFilters_Next(IEnumFilters *iface, ULONG count, IBaseFilter **filters, ULONG *fetched)
Definition: filtergraph.c:216
static struct filter_graph * impl_from_IMediaPosition(IMediaPosition *iface)
Definition: filtergraph.c:2578
static HRESULT WINAPI MediaEvent_Invoke(IMediaEventEx *iface, DISPID id, REFIID iid, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
Definition: filtergraph.c:4831
static HRESULT WINAPI BasicVideo_get_SourceHeight(IBasicVideo2 *iface, LONG *pSourceHeight)
Definition: filtergraph.c:3387
static HRESULT WINAPI BasicVideo2_GetPreferredAspectRatio(IBasicVideo2 *iface, LONG *plAspectX, LONG *plAspectY)
Definition: filtergraph.c:3795
static HRESULT ConvertFromREFTIME(IMediaSeeking *seek, REFTIME time_in, LONGLONG *time_out)
Definition: filtergraph.c:2650
static HRESULT WINAPI GraphConfig_Reconfigure(IGraphConfig *iface, IGraphConfigCallback *callback, void *context, DWORD flags, HANDLE abort_event)
Definition: filtergraph.c:5465
static HRESULT WINAPI MediaFilter_SetSyncSource(IMediaFilter *iface, IReferenceClock *pClock)
Definition: filtergraph.c:5274
static HRESULT WINAPI VideoWindow_put_Visible(IVideoWindow *iface, LONG Visible)
Definition: filtergraph.c:4173
static HRESULT graph_start(struct filter_graph *graph, REFERENCE_TIME stream_start)
Definition: filtergraph.c:1774
static ULONG WINAPI MediaSeeking_AddRef(IMediaSeeking *iface)
Definition: filtergraph.c:2113
static HRESULT WINAPI VideoWindow_get_WindowStyleEx(IVideoWindow *iface, LONG *WindowStyleEx)
Definition: filtergraph.c:4032
static HRESULT WINAPI MediaControl_StopWhenReady(IMediaControl *iface)
Definition: filtergraph.c:2050
static HRESULT WINAPI MediaPosition_get_StopTime(IMediaPosition *iface, REFTIME *pllTime)
Definition: filtergraph.c:2722
static HRESULT WINAPI MediaPosition_get_CurrentPosition(IMediaPosition *iface, REFTIME *pllTime)
Definition: filtergraph.c:2710
static HRESULT WINAPI MediaEventSink_QueryInterface(IMediaEventSink *iface, REFIID iid, void **out)
Definition: filtergraph.c:5363
static const IVideoWindowVtbl IVideoWindow_VTable
Definition: filtergraph.c:4727
static HRESULT WINAPI MediaEvent_GetTypeInfoCount(IMediaEventEx *iface, UINT *count)
Definition: filtergraph.c:4800
static HRESULT GetTargetInterface(struct filter_graph *pGraph, REFIID riid, LPVOID *ppvObj)
Definition: filtergraph.c:2863
static HANDLE message_thread
Definition: filtergraph.c:54
static const IVideoFrameStepVtbl VideoFrameStep_vtbl
Definition: filtergraph.c:5665
static HRESULT WINAPI MediaEvent_RestoreDefaultHandling(IMediaEventEx *iface, LONG lEvCode)
Definition: filtergraph.c:4929
static ULONG WINAPI BasicAudio_AddRef(IBasicAudio *iface)
Definition: filtergraph.c:2919
static HRESULT WINAPI MediaSeeking_SetTimeFormat(IMediaSeeking *iface, const GUID *pFormat)
Definition: filtergraph.c:2268
static HRESULT WINAPI FilterGraph2_Connect(IFilterGraph2 *iface, IPin *source, IPin *sink)
Definition: filtergraph.c:1388
static HRESULT WINAPI FilterGraph2_Render(IFilterGraph2 *iface, IPin *source)
Definition: filtergraph.c:1423
static DWORD message_thread_id
Definition: filtergraph.c:55
static ULONG WINAPI MediaControl_AddRef(IMediaControl *iface)
Definition: filtergraph.c:1699
static HRESULT WINAPI MediaEvent_QueryInterface(IMediaEventEx *iface, REFIID iid, void **out)
Definition: filtergraph.c:4782
static ULONG WINAPI FilterGraphInner_AddRef(IUnknown *iface)
Definition: filtergraph.c:430
static HRESULT WINAPI BasicVideo_put_SourceTop(IBasicVideo2 *iface, LONG SourceTop)
Definition: filtergraph.c:3327
static HRESULT WINAPI VideoWindow_put_Left(IVideoWindow *iface, LONG Left)
Definition: filtergraph.c:4213
static HRESULT WINAPI VideoFrameStep_Step(IVideoFrameStep *iface, DWORD frame_count, IUnknown *filter)
Definition: filtergraph.c:5647
static HRESULT WINAPI ObjectWithSite_SetSite(IObjectWithSite *iface, IUnknown *pUnkSite)
Definition: filtergraph.c:2830
static void sort_filter_recurse(struct filter_graph *graph, struct filter *filter, struct list *sorted)
Definition: filtergraph.c:867
static void update_render_count(struct filter_graph *graph)
Definition: filtergraph.c:1760
HRESULT filter_graph_create(IUnknown *outer, IUnknown **out)
Definition: filtergraph.c:5752
static HRESULT WINAPI FilterGraph2_ShouldOperationContinue(IFilterGraph2 *iface)
Definition: filtergraph.c:1578
static HRESULT WINAPI MediaSeeking_GetTimeFormat(IMediaSeeking *iface, GUID *pFormat)
Definition: filtergraph.c:2241
static unsigned int message_thread_refcount
Definition: filtergraph.c:56
static HRESULT WINAPI EnumFilters_Reset(IEnumFilters *iface)
Definition: filtergraph.c:269
static HRESULT WINAPI BasicAudio_get_Balance(IBasicAudio *iface, LONG *plBalance)
Definition: filtergraph.c:3040
static HRESULT WINAPI MediaEvent_CancelDefaultHandling(IMediaEventEx *iface, LONG lEvCode)
Definition: filtergraph.c:4911
static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface, LONGLONG *current_ptr, DWORD current_flags, LONGLONG *stop_ptr, DWORD stop_flags)
Definition: filtergraph.c:2423
static HRESULT all_renderers_seek(struct filter_graph *This, fnFoundSeek FoundSeek, DWORD_PTR arg)
Definition: filtergraph.c:2127
static HRESULT get_autoplug_types(IPin *source, unsigned int *ret_count, GUID **ret_types)
Definition: filtergraph.c:1201
static ULONG WINAPI MediaFilter_Release(IMediaFilter *iface)
Definition: filtergraph.c:5050
static struct filter_graph * impl_from_IMediaEventSink(IMediaEventSink *iface)
Definition: filtergraph.c:5358
static HRESULT WINAPI FilterGraph2_AddSourceFilter(IFilterGraph2 *iface, const WCHAR *filename, const WCHAR *filter_name, IBaseFilter **ret_filter)
Definition: filtergraph.c:1507
static HRESULT WINAPI MediaSeeking_QueryPreferredFormat(IMediaSeeking *iface, GUID *pFormat)
Definition: filtergraph.c:2228
static HRESULT WINAPI GraphConfig_EnumCacheFilter(IGraphConfig *iface, IEnumFilters **pEnum)
Definition: filtergraph.c:5495
static const IBasicVideo2Vtbl IBasicVideo_VTable
Definition: filtergraph.c:3816
static HRESULT WINAPI VideoWindow_get_WindowState(IVideoWindow *iface, LONG *WindowState)
Definition: filtergraph.c:4112
static HRESULT WINAPI MediaControl_Invoke(IMediaControl *iface, DISPID id, REFIID iid, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
Definition: filtergraph.c:1743
static HRESULT WINAPI FilterGraph2_ConnectDirect(IFilterGraph2 *iface, IPin *ppinIn, IPin *ppinOut, const AM_MEDIA_TYPE *pmt)
Definition: filtergraph.c:921
static HRESULT WINAPI GraphConfig_PushThroughData(IGraphConfig *iface, IPin *pOutputPin, IPinConnection *pConnection, HANDLE hEventAbort)
Definition: filtergraph.c:5522
static const IMediaPositionVtbl IMediaPosition_VTable
Definition: filtergraph.c:2782
static ULONG WINAPI MediaSeeking_Release(IMediaSeeking *iface)
Definition: filtergraph.c:2119
static ULONG WINAPI MediaEvent_AddRef(IMediaEventEx *iface)
Definition: filtergraph.c:4788
static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface, LONGLONG *current)
Definition: filtergraph.c:2369
static HRESULT WINAPI VideoWindow_put_BackgroundPalette(IVideoWindow *iface, LONG BackgroundPalette)
Definition: filtergraph.c:4132
static HRESULT WINAPI MediaPosition_put_CurrentPosition(IMediaPosition *iface, REFTIME llTime)
Definition: filtergraph.c:2697
static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface, LONGLONG *stop)
Definition: filtergraph.c:2328
static HRESULT check_cyclic_connection(IPin *source, IPin *sink)
Definition: filtergraph.c:792
static HRESULT WINAPI BasicVideo_get_DestinationTop(IBasicVideo2 *iface, LONG *pDestinationTop)
Definition: filtergraph.c:3507
static HRESULT WINAPI MediaPosition_GetTypeInfo(IMediaPosition *iface, UINT index, LCID lcid, ITypeInfo **typeinfo)
Definition: filtergraph.c:2609
static ULONG WINAPI VideoFrameStep_Release(IVideoFrameStep *iface)
Definition: filtergraph.c:5641
static HRESULT WINAPI MediaPosition_QueryInterface(IMediaPosition *iface, REFIID iid, void **out)
Definition: filtergraph.c:2584
static HRESULT WINAPI FilterGraph2_SetDefaultSyncSource(IFilterGraph2 *iface)
Definition: filtergraph.c:993
static HRESULT WINAPI MediaEvent_SetNotifyFlags(IMediaEventEx *iface, LONG flags)
Definition: filtergraph.c:4972
static HRESULT WINAPI VideoWindow_NotifyOwnerMessage(IVideoWindow *iface, OAHWND hwnd, LONG uMsg, LONG_PTR wParam, LONG_PTR lParam)
Definition: filtergraph.c:4560
static ULONG WINAPI BasicVideo_Release(IBasicVideo2 *iface)
Definition: filtergraph.c:3092
static struct filter_graph * impl_from_IMediaSeeking(IMediaSeeking *iface)
Definition: filtergraph.c:2102
static BOOL queue_media_event(struct filter_graph *graph, LONG code, LONG_PTR param1, LONG_PTR param2)
Definition: filtergraph.c:318
static HRESULT WINAPI VideoWindow_get_AutoShow(IVideoWindow *iface, LONG *AutoShow)
Definition: filtergraph.c:4072
static HRESULT WINAPI MediaPosition_CanSeekForward(IMediaPosition *iface, LONG *pCanSeekForward)
Definition: filtergraph.c:2769
static HRESULT WINAPI BasicVideo_GetSourcePosition(IBasicVideo2 *iface, LONG *pLeft, LONG *pTop, LONG *pWidth, LONG *pHeight)
Definition: filtergraph.c:3589
static const IGraphVersionVtbl IGraphVersion_VTable
Definition: filtergraph.c:5616
static HRESULT WINAPI FilterGraph2_QueryInterface(IFilterGraph2 *iface, REFIID iid, void **out)
Definition: filtergraph.c:503
static HRESULT WINAPI GraphConfig_GetStartTime(IGraphConfig *iface, REFERENCE_TIME *prtStart)
Definition: filtergraph.c:5513
static HRESULT WINAPI GraphVersion_QueryInterface(IGraphVersion *iface, REFIID iid, void **out)
Definition: filtergraph.c:5582
static HRESULT ConvertToREFTIME(IMediaSeeking *seek, LONGLONG time_in, REFTIME *time_out)
Definition: filtergraph.c:2668
static HRESULT WINAPI BasicVideo_get_BitRate(IBasicVideo2 *iface, LONG *pBitRate)
Definition: filtergraph.c:3167
static HRESULT WINAPI FilterGraph2_AddFilter(IFilterGraph2 *iface, IBaseFilter *filter, const WCHAR *name)
Definition: filtergraph.c:608
static ULONG WINAPI VideoWindow_AddRef(IVideoWindow *iface)
Definition: filtergraph.c:3871
static HRESULT WINAPI VideoWindow_get_Top(IVideoWindow *iface, LONG *pTop)
Definition: filtergraph.c:4313
static const IGraphConfigVtbl IGraphConfig_VTable
Definition: filtergraph.c:5560
static HRESULT WINAPI FilterGraph2_FindFilterByName(IFilterGraph2 *iface, const WCHAR *name, IBaseFilter **filter)
Definition: filtergraph.c:773
static HRESULT WINAPI EnumFilters_Clone(IEnumFilters *iface, IEnumFilters **out)
Definition: filtergraph.c:280
static struct filter_graph * impl_from_IBasicAudio(IBasicAudio *iface)
Definition: filtergraph.c:2908
static HRESULT WINAPI VideoWindow_put_WindowStyle(IVideoWindow *iface, LONG WindowStyle)
Definition: filtergraph.c:3972
static HRESULT WINAPI BasicVideo_get_SourceTop(IBasicVideo2 *iface, LONG *pSourceTop)
Definition: filtergraph.c:3347
static HRESULT WINAPI MediaSeeking_ConvertTimeFormat(IMediaSeeking *iface, LONGLONG *pTarget, const GUID *pTargetFormat, LONGLONG Source, const GUID *pSourceFormat)
Definition: filtergraph.c:2401
static HRESULT WINAPI MediaEvent_GetEventHandle(IMediaEventEx *iface, OAEVENT *event)
Definition: filtergraph.c:4848
static const IMediaFilterVtbl IMediaFilter_VTable
Definition: filtergraph.c:5344
static struct filter_graph * impl_from_IFilterGraph2(IFilterGraph2 *iface)
Definition: filtergraph.c:498
static HRESULT WINAPI BasicAudio_Invoke(IBasicAudio *iface, DISPID id, REFIID iid, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepinfo, UINT *error_arg)
Definition: filtergraph.c:2962
static HRESULT WINAPI BasicVideo_QueryInterface(IBasicVideo2 *iface, REFIID iid, void **out)
Definition: filtergraph.c:3080
static HRESULT WINAPI MediaPosition_GetTypeInfoCount(IMediaPosition *iface, UINT *count)
Definition: filtergraph.c:2602
static HRESULT WINAPI FilterGraph2_RemoveFilter(IFilterGraph2 *iface, IBaseFilter *pFilter)
Definition: filtergraph.c:679
static HRESULT WINAPI FilterGraph2_RenderEx(IFilterGraph2 *iface, IPin *source, DWORD flags, DWORD *context)
Definition: filtergraph.c:1642
static const IUnknownVtbl IInner_VTable
Definition: filtergraph.c:5675
static HRESULT WINAPI FilterGraphInner_QueryInterface(IUnknown *iface, REFIID riid, void **ppvObj)
Definition: filtergraph.c:356
static HRESULT WINAPI FilterGraph2_Disconnect(IFilterGraph2 *iface, IPin *ppin)
Definition: filtergraph.c:981
static void CALLBACK wait_stop_cb(TP_CALLBACK_INSTANCE *instance, void *context)
Definition: filtergraph.c:2038
static HRESULT WINAPI VideoWindow_GetMaxIdealImageSize(IVideoWindow *iface, LONG *pWidth, LONG *pHeight)
Definition: filtergraph.c:4644
static DWORD WINAPI message_thread_run(void *ctx)
Definition: filtergraph.c:1032
static struct enum_filters * impl_from_IEnumFilters(IEnumFilters *iface)
Definition: filtergraph.c:169
static HRESULT WINAPI BasicVideo_get_DestinationWidth(IBasicVideo2 *iface, LONG *pDestinationWidth)
Definition: filtergraph.c:3467
static HRESULT autoplug_through_filter(struct filter_graph *graph, IPin *source, IBaseFilter *filter, IPin *sink, BOOL render_to_existing, unsigned int recursion_depth)
Definition: filtergraph.c:1173
static HRESULT WINAPI MediaControl_GetTypeInfo(IMediaControl *iface, UINT index, LCID lcid, ITypeInfo **typeinfo)
Definition: filtergraph.c:1719
static HRESULT WINAPI MediaPosition_get_Rate(IMediaPosition *iface, double *pdRate)
Definition: filtergraph.c:2763
static HRESULT WINAPI MediaFilter_GetClassID(IMediaFilter *iface, CLSID *pClassID)
Definition: filtergraph.c:5057
static ULONG WINAPI MediaPosition_Release(IMediaPosition *iface)
Definition: filtergraph.c:2596
static HRESULT WINAPI VideoFrameStep_CancelStep(IVideoFrameStep *iface)
Definition: filtergraph.c:5659
static const IObjectWithSiteVtbl IObjectWithSite_VTable
Definition: filtergraph.c:2854
static HRESULT WINAPI BasicVideo_get_AvgTimePerFrame(IBasicVideo2 *iface, REFTIME *pAvgTimePerFrame)
Definition: filtergraph.c:3147
static HRESULT WINAPI FilterGraph2_Reconnect(IFilterGraph2 *iface, IPin *pin)
Definition: filtergraph.c:972
static ULONG WINAPI BasicAudio_Release(IBasicAudio *iface)
Definition: filtergraph.c:2925
const char * qzdebugstr_guid(const GUID *id)
Definition: main.c:671
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(void *reserved, DWORD model)
Definition: combase.c:2803
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: combase.c:2842
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, IUnknown *outer, DWORD cls_context, REFIID riid, void **obj)
Definition: combase.c:1685
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
#define CloseHandle
Definition: compat.h:739
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
OLECHAR * BSTR
Definition: compat.h:2293
HANDLE HWND
Definition: compat.h:19
#define TRACE_ON(x)
Definition: compat.h:75
#define CALLBACK
Definition: compat.h:35
static const WCHAR version[]
Definition: asmname.c:66
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
BOOL WINAPI InitializeCriticalSectionEx(OUT LPCRITICAL_SECTION lpCriticalSection, IN DWORD dwSpinCount, IN DWORD flags)
Definition: sync.c:107
BOOL WINAPI DECLSPEC_HOTPATCH TrySubmitThreadpoolCallback(PTP_SIMPLE_CALLBACK callback, PVOID userdata, TP_CALLBACK_ENVIRON *environment)
Definition: threadpool.c:99
PTP_WORK WINAPI DECLSPEC_HOTPATCH CreateThreadpoolWork(PTP_WORK_CALLBACK callback, PVOID userdata, TP_CALLBACK_ENVIRON *environment)
Definition: threadpool.c:82
LCID lcid
Definition: locale.c:5660
ULONG WINAPI DECLSPEC_HOTPATCH GetTickCount(void)
Definition: sync.c:182
#define assert(_expr)
Definition: assert.h:32
_ACRTIMP size_t __cdecl wcslen(const wchar_t *)
Definition: wcs.c:2988
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1977
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2807
#define swprintf
Definition: precomp.h:40
LONGLONG REFERENCE_TIME
Definition: dmusicks.h:9
static void list_move_tail(struct list_head *list, struct list_head *head)
Definition: list.h:122
return ret
Definition: mutex.c:147
#define L(x)
Definition: resources.c:13
#define INFINITE
Definition: serial.h:102
#define OAFALSE
Definition: dshow.h:53
#define EC_COMPLETE
Definition: evcode.h:17
#define EC_REPAINT
Definition: evcode.h:36
#define EC_CLOCK_CHANGED
Definition: evcode.h:15
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
_Must_inspect_result_ _In_ ULONG _Out_writes_bytes_ pBufferSize PVOID _Inout_ PULONG pBufferSize
Definition: fsrtlfuncs.h:1165
FxIoTarget * pTarget
Definition: fxdeviceapi.cpp:97
GLuint start
Definition: gl.h:1545
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLuint * ids
Definition: glext.h:5907
GLuint GLuint * names
Definition: glext.h:11545
GLuint index
Definition: glext.h:6031
GLbitfield flags
Definition: glext.h:7161
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
GLuint64EXT * result
Definition: glext.h:11304
GLenum const GLfloat * params
Definition: glext.h:5645
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: sysinfo.c:13
const char cursor[]
Definition: icontest.c:13
REFIID riid
Definition: atlbase.h:39
Definition: axcore.idl:92
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
const char * filename
Definition: ioapi.h:137
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_w
Definition: kernel32.h:32
LONG_PTR LPARAM
Definition: minwindef.h:175
UINT_PTR WPARAM
Definition: minwindef.h:174
__u16 time
Definition: mkdosfs.c:8
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
struct task_struct * current
Definition: linux.c:32
static const ENTRY Entries[]
static IPrintDialogCallback callback
Definition: printdlg.c:325
const IID IID_IObjectWithSite
const char * var
Definition: shader.c:5879
static IHTMLWindow2 * window
Definition: events.c:77
static EXCEPINFO excepinfo
Definition: automation.c:47
static IUnknown * outer
Definition: compobj.c:82
static VARIANTARG static DISPID
Definition: ordinal.c:49
static DWORD filter_state
Definition: protocol.c:164
const CLSID * clsid
Definition: msctf.cpp:50
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3169
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ SaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ OwnerSize PSID Owner
Definition: rtlfuncs.h:1629
_In_ LPWSTR _In_ DWORD _In_ DWORD _In_ DWORD dwFlags
Definition: netsh.h:141
@ COINIT_MULTITHREADED
Definition: objbase.h:280
#define V_BSTR(A)
Definition: oleauto.h:226
const GUID IID_IPropertyBag
short WCHAR
Definition: pedump.c:58
long LONG
Definition: pedump.c:60
const GUID IID_IPersist
Definition: proxy.cpp:14
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI PeekMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT, _In_ UINT)
BOOL WINAPI PostThreadMessageW(_In_ DWORD, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
#define WM_USER
Definition: winuser.h:1923
#define PM_NOREMOVE
Definition: winuser.h:1206
#define DECLARE_CRITICAL_SECTION(cs)
#define err(...)
#define calloc
Definition: rosglue.h:14
static calc_node_t temp
Definition: rpn_ieee.c:38
DWORD LCID
Definition: nls.h:13
wcscpy
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:236
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:242
__WINE_SERVER_LIST_INLINE struct list * list_next(const struct list *list, const struct list *elem)
Definition: list.h:117
__WINE_SERVER_LIST_INLINE struct list * list_tail(const struct list *list)
Definition: list.h:139
int seek(void *fd, ulong off, int mode)
Definition: pe.c:51
#define TRACE(s)
Definition: solgame.cpp:4
static const char * debugstr_time(REFERENCE_TIME time)
Definition: strmbase.h:32
@ IBasicVideo_tid
Definition: strmbase.h:226
@ IVideoWindow_tid
Definition: strmbase.h:230
@ IBasicAudio_tid
Definition: strmbase.h:225
@ IMediaEvent_tid
Definition: strmbase.h:228
@ IMediaPosition_tid
Definition: strmbase.h:229
@ IMediaControl_tid
Definition: strmbase.h:227
HRESULT strmbase_get_typeinfo(enum strmbase_type_id tid, ITypeInfo **typeinfo)
Definition: dispatch.c:38
void strmbase_dump_media_type(const AM_MEDIA_TYPE *mt)
Definition: mediatype.c:58
void WINAPI DeleteMediaType(AM_MEDIA_TYPE *pMediaType)
Definition: mediatype.c:193
Definition: filtergraph.c:66
IUnknown * iface
Definition: filtergraph.c:69
const IID * riid
Definition: filtergraph.c:67
IBaseFilter * filter
Definition: filtergraph.c:68
Definition: inflate.c:139
Definition: http.c:7252
Definition: dialog.c:52
struct filter_graph * graph
Definition: filtergraph.c:162
struct list * cursor
Definition: filtergraph.c:164
IEnumFilters IEnumFilters_iface
Definition: filtergraph.c:160
Definition: filter.c:185
struct list entry
Definition: filter.c:186
Definition: fci.c:123
IMoniker * moniker
Definition: filtergraph.c:50
IBaseFilter * filter
Definition: filtergraph.c:51
IMediaEventSink IMediaEventSink_iface
Definition: filtergraph.c:92
IBaseFilter * refClockProvider
Definition: filtergraph.c:118
FILTER_STATE state
Definition: filtergraph.c:114
IMediaControl IMediaControl_iface
Definition: filtergraph.c:85
IMediaFilter IMediaFilter_iface
Definition: filtergraph.c:91
int nItfCacheEntries
Definition: filtergraph.c:142
REFERENCE_TIME stream_start
Definition: filtergraph.c:150
int CompletionStatus
Definition: filtergraph.c:131
ITF_CACHE_ENTRY ItfCacheEntries[MAX_ITF_CACHE_ENTRIES]
Definition: filtergraph.c:141
REFERENCE_TIME stream_stop
Definition: filtergraph.c:151
HANDLE media_event_handle
Definition: filtergraph.c:126
IMediaEventEx IMediaEventEx_iface
Definition: filtergraph.c:90
IUnknown IUnknown_inner
Definition: filtergraph.c:83
IUnknown * pSite
Definition: filtergraph.c:145
int HandleEcRepaint
Definition: filtergraph.c:135
int HandleEcClockChanged
Definition: filtergraph.c:136
IObjectWithSite IObjectWithSite_iface
Definition: filtergraph.c:95
unsigned int needs_async_run
Definition: filtergraph.c:154
TP_WORK * async_run_work
Definition: filtergraph.c:115
LONGLONG current_pos
Definition: filtergraph.c:152
IReferenceClock * refClock
Definition: filtergraph.c:117
UINT media_event_message
Definition: filtergraph.c:128
CRITICAL_SECTION cs
Definition: filtergraph.c:140
struct list filters
Definition: filtergraph.c:111
IVideoWindow IVideoWindow_iface
Definition: filtergraph.c:89
IVideoFrameStep IVideoFrameStep_iface
Definition: filtergraph.c:105
HWND media_event_window
Definition: filtergraph.c:127
IBasicAudio IBasicAudio_iface
Definition: filtergraph.c:87
IMediaSeeking IMediaSeeking_iface
Definition: filtergraph.c:86
IGraphVersion IGraphVersion_iface
Definition: filtergraph.c:96
int EcCompleteCount
Definition: filtergraph.c:133
struct list media_events
Definition: filtergraph.c:125
unsigned int threaded
Definition: filtergraph.c:155
IFilterGraph2 IFilterGraph2_iface
Definition: filtergraph.c:84
HANDLE hEventCompletion
Definition: filtergraph.c:130
REFERENCE_TIME stream_elapsed
Definition: filtergraph.c:150
IGraphConfig IGraphConfig_iface
Definition: filtergraph.c:93
LPARAM media_event_lparam
Definition: filtergraph.c:129
GUID timeformatseek
Definition: filtergraph.c:144
CRITICAL_SECTION event_cs
Definition: filtergraph.c:124
IBasicVideo2 IBasicVideo2_iface
Definition: filtergraph.c:88
unsigned int name_index
Definition: filtergraph.c:112
BOOL defaultclock
Definition: filtergraph.c:143
IUnknown * outer_unk
Definition: filtergraph.c:107
unsigned int media_events_disabled
Definition: filtergraph.c:138
int HandleEcComplete
Definition: filtergraph.c:134
IMediaPosition IMediaPosition_iface
Definition: filtergraph.c:94
IUnknown * punkFilterMapper2
Definition: filtergraph.c:109
unsigned int got_ec_complete
Definition: filtergraph.c:137
Definition: filter.c:165
IBaseFilter * filter
Definition: filtergraph.c:75
IMediaSeeking * seeking
Definition: filtergraph.c:76
BOOL sorting
Definition: filtergraph.c:78
LONG refcount
Definition: filter.c:168
struct list entry
Definition: filtergraph.c:74
WCHAR name[128]
Definition: filter.c:172
WCHAR * name
Definition: filtergraph.c:77
Definition: graph.c:32
LONG ref
Definition: graph.c:35
IFilterGraph2 IFilterGraph2_iface
Definition: amstream.c:2168
Definition: list.h:15
LONG_PTR param2
Definition: filtergraph.c:62
LONG_PTR param1
Definition: filtergraph.c:62
struct list entry
Definition: filtergraph.c:60
Definition: tftpd.h:60
Definition: name.c:39
Definition: send.c:48
Definition: dhcpd.h:248
Definition: cmds.c:130
#define max(a, b)
Definition: svc.c:63
PSYMCRYPT_PARALLEL_HASH_OPERATION next
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:587
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:669
BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent(IN HANDLE hEvent)
Definition: synch.c:650
#define LIST_INIT(head)
Definition: queue.h:197
#define LIST_ENTRY(type)
Definition: queue.h:175
WINBASEAPI VOID WINAPI WaitForThreadpoolWorkCallbacks(_Inout_ PTP_WORK pwk, _In_ BOOL fCancelPendingCallbacks)
WINBASEAPI VOID WINAPI SubmitThreadpoolWork(_Inout_ PTP_WORK pwk)
#define DWORD_PTR
Definition: treelist.c:76
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
const uint16_t * LPCWSTR
Definition: typedefs.h:57
uint32_t DWORD_PTR
Definition: typedefs.h:65
int64_t LONGLONG
Definition: typedefs.h:68
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:626
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:547
#define VFW_E_CIRCULAR_GRAPH
Definition: vfwmsgs.h:88
#define VFW_E_DUPLICATE_NAME
Definition: vfwmsgs.h:84
#define VFW_E_WRONG_STATE
Definition: vfwmsgs.h:78
#define VFW_S_PARTIAL_RENDER
Definition: vfwmsgs.h:22
#define VFW_S_STATE_INTERMEDIATE
Definition: vfwmsgs.h:21
#define VFW_E_ENUM_OUT_OF_SYNC
Definition: vfwmsgs.h:42
#define VFW_E_NO_AUDIO_HARDWARE
Definition: vfwmsgs.h:109
#define VFW_E_CANNOT_CONNECT
Definition: vfwmsgs.h:62
#define VFW_E_NOT_FOUND
Definition: vfwmsgs.h:61
#define VFW_S_DUPLICATE_NAME
Definition: vfwmsgs.h:20
#define VFW_E_NOT_CONNECTED
Definition: vfwmsgs.h:48
#define VFW_E_CANNOT_RENDER
Definition: vfwmsgs.h:63
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
HANDLE WINAPI GetCurrentThread(void)
Definition: proc.c:1195
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define WAIT_OBJECT_0
Definition: winbase.h:383
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
void * arg
Definition: msvc.h:10
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:3451
#define E_NOINTERFACE
Definition: winerror.h:3479
#define E_POINTER
Definition: winerror.h:3480
#define E_ABORT
Definition: winerror.h:3481
#define RTL_CRITICAL_SECTION_FLAG_FORCE_DEBUG_INFO
Definition: winnt_old.h:1156
struct _TP_WORK TP_WORK
Definition: winnt_old.h:4758
struct _TP_CALLBACK_INSTANCE TP_CALLBACK_INSTANCE
Definition: winnt_old.h:4759