39#include "wine/unicode.h"
58#define EVENTS_RING_BUFFER_INCREMENT 64
144#define MAX_ITF_CACHE_ENTRIES 3
219 *ppvObj = &
This->IUnknown_inner;
220 TRACE(
" returning IUnknown interface (%p)\n", *ppvObj);
224 *ppvObj = &
This->IFilterGraph2_iface;
225 TRACE(
" returning IGraphBuilder interface (%p)\n", *ppvObj);
227 *ppvObj = &
This->IMediaControl_iface;
228 TRACE(
" returning IMediaControl interface (%p)\n", *ppvObj);
230 *ppvObj = &
This->IMediaSeeking_iface;
231 TRACE(
" returning IMediaSeeking interface (%p)\n", *ppvObj);
233 *ppvObj = &
This->IBasicAudio_iface;
234 TRACE(
" returning IBasicAudio interface (%p)\n", *ppvObj);
237 *ppvObj = &
This->IBasicVideo2_iface;
238 TRACE(
" returning IBasicVideo2 interface (%p)\n", *ppvObj);
240 *ppvObj = &
This->IVideoWindow_iface;
241 TRACE(
" returning IVideoWindow interface (%p)\n", *ppvObj);
244 *ppvObj = &
This->IMediaEventEx_iface;
245 TRACE(
" returning IMediaEvent(Ex) interface (%p)\n", *ppvObj);
248 *ppvObj = &
This->IMediaFilter_iface;
249 TRACE(
" returning IMediaFilter interface (%p)\n", *ppvObj);
251 *ppvObj = &
This->IMediaEventSink_iface;
252 TRACE(
" returning IMediaEventSink interface (%p)\n", *ppvObj);
254 *ppvObj = &
This->IGraphConfig_iface;
255 TRACE(
" returning IGraphConfig interface (%p)\n", *ppvObj);
257 *ppvObj = &
This->IMediaPosition_iface;
258 TRACE(
" returning IMediaPosition interface (%p)\n", *ppvObj);
260 *ppvObj = &
This->IObjectWithSite_iface;
261 TRACE(
" returning IObjectWithSite interface (%p)\n", *ppvObj);
263 TRACE(
" requesting IFilterMapper interface from aggregated filtermapper (%p)\n", *ppvObj);
264 return IUnknown_QueryInterface(
This->punkFilterMapper2,
riid, ppvObj);
266 TRACE(
" returning IFilterMapper2 interface from aggregated filtermapper (%p)\n", *ppvObj);
267 return IUnknown_QueryInterface(
This->punkFilterMapper2,
riid, ppvObj);
269 TRACE(
" returning IFilterMapper3 interface from aggregated filtermapper (%p)\n", *ppvObj);
270 return IUnknown_QueryInterface(
This->punkFilterMapper2,
riid, ppvObj);
272 *ppvObj = &
This->IGraphConfig_iface;
273 TRACE(
" returning IGraphConfig interface (%p)\n", *ppvObj);
280 IUnknown_AddRef((
IUnknown *)*ppvObj);
306 IMediaControl_Stop(&
This->IMediaControl_iface);
308 while (
This->nFilters)
309 IFilterGraph2_RemoveFilter(&
This->IFilterGraph2_iface,
This->ppFiltersInGraph[0]);
314 for (
i = 0;
i <
This->nItfCacheEntries;
i++)
316 if (
This->ItfCacheEntries[
i].iface)
317 IUnknown_Release(
This->ItfCacheEntries[
i].iface);
320 IUnknown_Release(
This->punkFilterMapper2);
322 if (
This->pSite) IUnknown_Release(
This->pSite);
326 This->cs.DebugInfo->Spare[0] = 0;
346 return IUnknown_QueryInterface(
This->outer_unk,
riid, ppvObj);
355 return IUnknown_AddRef(
This->outer_unk);
364 return IUnknown_Release(
This->outer_unk);
387 for(
i = 0;
i <
This->nFilters;
i++)
390 duplicate_name =
TRUE;
396 if (!
pName || duplicate_name)
398 static const WCHAR wszFmt1[] = {
'%',
's',
' ',
'%',
'0',
'4',
'd',0};
399 static const WCHAR wszFmt2[] = {
'%',
'0',
'4',
'd',0};
401 for (
j = 0;
j < 10000 ;
j++)
411 for(
i = 0;
i <
This->nFilters;
i++)
416 if (
This->nameIndex++ == 10000)
418 if (
i ==
This->nFilters)
431 if (
This->nFilters + 1 >
This->filterCapacity)
433 int newCapacity =
This->filterCapacity ? 2 *
This->filterCapacity : 1;
438 if (
This->filterCapacity)
443 This->ppFiltersInGraph = ppNewFilters;
444 This->pFilterNames = pNewNames;
445 This->filterCapacity = newCapacity;
448 hr = IBaseFilter_JoinFilterGraph(pFilter, (
IFilterGraph *)&
This->IFilterGraph2_iface, wszFilterName);
452 IBaseFilter_AddRef(pFilter);
453 This->ppFiltersInGraph[
This->nFilters] = pFilter;
454 This->pFilterNames[
This->nFilters] = wszFilterName;
457 IBaseFilter_SetSyncSource(pFilter,
This->refClock);
474 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pFilter);
478 for (
i = 0;
i <
This->nFilters;
i++)
480 if (
This->ppFiltersInGraph[
i] == pFilter)
485 if (
This->defaultclock &&
This->refClockProvider == pFilter)
487 IMediaFilter_SetSyncSource(&
This->IMediaFilter_iface,
NULL);
492 IBaseFilter_GetState(pFilter, 0, &
state);
493 if (
state == State_Running)
494 IBaseFilter_Pause(pFilter);
495 if (
state != State_Stopped)
496 IBaseFilter_Stop(pFilter);
498 hr = IBaseFilter_EnumPins(pFilter, &penumpins);
501 while(IEnumPins_Next(penumpins, 1, &ppin,
NULL) ==
S_OK)
505 IPin_ConnectedTo(ppin, &victim);
508 h = IPin_Disconnect(victim);
509 TRACE(
"Disconnect other side: %08x\n",
h);
513 IPin_QueryPinInfo(victim, &pinfo);
515 IBaseFilter_GetState(pinfo.pFilter, 0, &
state);
516 if (
state == State_Running)
517 IBaseFilter_Pause(pinfo.pFilter);
518 IBaseFilter_Stop(pinfo.pFilter);
519 IBaseFilter_Release(pinfo.pFilter);
520 h = IPin_Disconnect(victim);
521 TRACE(
"Disconnect retry: %08x\n",
h);
523 IPin_Release(victim);
525 h = IPin_Disconnect(ppin);
526 TRACE(
"Disconnect 2: %08x\n",
h);
530 IEnumPins_Release(penumpins);
533 hr = IBaseFilter_JoinFilterGraph(pFilter,
NULL,
This->pFilterNames[
i]);
536 IBaseFilter_SetSyncSource(pFilter,
NULL);
537 IBaseFilter_Release(pFilter);
544 for (
i = 0;
i <
This->nItfCacheEntries;
i++)
545 if (pFilter ==
This->ItfCacheEntries[
i].filter)
547 IUnknown_Release(
This->ItfCacheEntries[
i].iface);
564 TRACE(
"(%p/%p)->(%p)\n",
This, iface, ppEnum);
580 for (
i = 0;
i <
This->nFilters;
i++)
584 *ppFilter =
This->ppFiltersInGraph[
i];
585 IBaseFilter_AddRef(*ppFilter);
603 hr = IPin_QueryPinInfo(
out, &info_out);
608 IBaseFilter_Release(info_out.pFilter);
612 hr = IPin_QueryPinInfo(
in, &info_in);
614 IBaseFilter_Release(info_in.pFilter);
623 if (info_out.pFilter == info_in.pFilter)
630 hr = IBaseFilter_EnumPins(info_out.pFilter, &enumpins);
634 IEnumPins_Reset(enumpins);
638 IPin_QueryDirection(
test, &
dir);
642 IPin_ConnectedTo(
test, &victim);
646 IPin_Release(victim);
656 IEnumPins_Release(enumpins);
660 IBaseFilter_Release(info_out.pFilter);
662 ERR(
"Checking filtergraph returned %08x, something's not right!\n",
hr);
680 TRACE(
"(%p/%p)->(%p, %p, %p)\n",
This, iface, ppinIn, ppinOut, pmt);
688 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
692 TRACE(
"Filter owning ppinIn(%p) => %p\n", ppinIn, PinInfo.pFilter);
693 IBaseFilter_Release(PinInfo.pFilter);
695 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
699 TRACE(
"Filter owning ppinOut(%p) => %p\n", ppinOut, PinInfo.pFilter);
700 IBaseFilter_Release(PinInfo.pFilter);
703 hr = IPin_QueryDirection(ppinIn, &
dir);
710 hr = IPin_Connect(ppinOut, ppinIn, pmt);
716 hr = IPin_Connect(ppinIn, ppinOut, pmt);
730 IPin_QueryDirection(ppin, &pindir);
731 hr = IPin_ConnectedTo(ppin, &pConnectedTo);
733 TRACE(
"(%p/%p)->(%p) -- %p\n",
This, iface, ppin, pConnectedTo);
736 TRACE(
"Querying connected to failed: %x\n",
hr);
739 IPin_Disconnect(ppin);
740 IPin_Disconnect(pConnectedTo);
742 hr = IPin_Connect(pConnectedTo, ppin,
NULL);
744 hr = IPin_Connect(ppin, pConnectedTo,
NULL);
745 IPin_Release(pConnectedTo);
747 WARN(
"Reconnecting pins failed, pins are not connected now..\n");
756 TRACE(
"(%p/%p)->(%p)\n",
This, iface, ppin);
761 return IPin_Disconnect(ppin);
771 TRACE(
"(%p/%p)->() live sources not handled properly!\n",
This, iface);
775 for (
i = 0;
i <
This->nFilters; ++
i)
779 IBaseFilter_QueryInterface(
This->ppFiltersInGraph[
i], &IID_IAMFilterMiscFlags, (
void**)&
flags);
782 miscflags = IAMFilterMiscFlags_GetMiscFlags(
flags);
783 IAMFilterMiscFlags_Release(
flags);
785 IBaseFilter_QueryInterface(
This->ppFiltersInGraph[
i], &IID_IReferenceClock, (
void**)&pClock);
796 This->refClockProvider =
This->ppFiltersInGraph[
i];
800 hr = IMediaFilter_SetSyncSource(&
This->IMediaFilter_iface, pClock);
811 static const WCHAR wszFriendlyName[] = {
'F',
'r',
'i',
'e',
'n',
'd',
'l',
'y',
'N',
'a',
'm',
'e',0};
826 IPropertyBag_Release(pPropBagCat);
836 TRACE(
"(%p, %p, %p, %p)\n", pfilter, pinputpin, pppins, pnb);
837 hr = IPin_QueryInternalConnections(pinputpin,
NULL, &nb);
842 hr = IPin_QueryInternalConnections(pinputpin, *pppins, &nb);
851 TRACE(
"E_NOTIMPL\n");
852 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
854 WARN(
"filter Enumpins failed (%x)\n",
hr);
859 while(IEnumPins_Next(penumpins, 1, &ppin, &nb) ==
S_OK) {
861 IPin_QueryDirection(ppin, &pindir);
868 IEnumPins_Reset(penumpins);
870 while(IEnumPins_Next(penumpins, 1, &ppin, &nb) ==
S_OK) {
872 IPin_QueryDirection(ppin, &pindir);
874 (*pppins)[
i++] = ppin;
878 IEnumPins_Release(penumpins);
881 WARN(
"Next failed (%x)\n",
hr);
885 WARN(
"Cannot get internal connection (%x)\n",
hr);
913 TRACE(
"(%p/%p)->(%p, %p)\n",
This, iface, ppinOut, ppinIn);
915 if(!ppinOut || !ppinIn)
920 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
924 TRACE(
"Filter owning ppinIn(%p) => %p\n", ppinIn, PinInfo.pFilter);
925 IBaseFilter_Release(PinInfo.pFilter);
927 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
931 TRACE(
"Filter owning ppinOut(%p) => %p\n", ppinOut, PinInfo.pFilter);
932 IBaseFilter_Release(PinInfo.pFilter);
936 ++
This->recursioncount;
937 if (
This->recursioncount >= 5)
939 WARN(
"Recursion count has reached %d\n",
This->recursioncount);
944 hr = IPin_QueryDirection(ppinOut, &
dir);
952 TRACE(
"Directions seem backwards, swapping pins\n");
964 hr = IPin_Connect(ppinOut, ppinIn,
NULL);
968 TRACE(
"Direct connection failed, trying to render using extra filters\n");
970 hr = IPin_QueryPinInfo(ppinIn, &PinInfo);
974 hr = IBaseFilter_GetClassID(PinInfo.pFilter, &FilterCLSID);
975 IBaseFilter_Release(PinInfo.pFilter);
981 hr = IPin_EnumMediaTypes(ppinOut, &penummt);
984 WARN(
"EnumMediaTypes (%x)\n",
hr);
988 hr = IEnumMediaTypes_Next(penummt, 1, &mt, &nbmt);
990 WARN(
"IEnumMediaTypes_Next (%x)\n",
hr);
996 WARN(
"No media type found!\n");
1003 hr = IUnknown_QueryInterface(
This->punkFilterMapper2, &IID_IFilterMapper2, (
void**)&pFilterMapper2);
1005 WARN(
"Unable to get IFilterMapper2 (%x)\n",
hr);
1010 tab[0] = mt->majortype;
1011 tab[1] = mt->subtype;
1012 hr = IFilterMapper2_EnumMatchingFilters(pFilterMapper2, &pEnumMoniker, 0,
FALSE, MERIT_UNLIKELY,
TRUE, 1, tab,
NULL,
NULL,
FALSE,
FALSE, 0,
NULL,
NULL,
NULL);
1014 WARN(
"Unable to enum filters (%x)\n",
hr);
1019 while(IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) ==
S_OK)
1030 WARN(
"Unable to retrieve filter info (%x)\n",
hr);
1035 IMoniker_Release(pMoniker);
1037 WARN(
"Unable to create filter (%x), trying next one\n",
hr);
1041 hr = IBaseFilter_GetClassID(pfilter, &
clsid);
1044 IBaseFilter_Release(pfilter);
1050 IBaseFilter_Release(pfilter);
1057 IUnknown_QueryInterface(
This->pSite, &IID_IAMGraphBuilderCallback, (
LPVOID*)&
callback);
1061 rc = IAMGraphBuilderCallback_SelectedFilter(
callback, pMoniker);
1064 TRACE(
"Filter rejected by IAMGraphBuilderCallback_SelectedFilter\n");
1065 IAMGraphBuilderCallback_Release(
callback);
1074 rc = IAMGraphBuilderCallback_CreatedFilter(
callback, pfilter);
1075 IAMGraphBuilderCallback_Release(
callback);
1078 IBaseFilter_Release(pfilter);
1080 TRACE(
"Filter rejected by IAMGraphBuilderCallback_CreatedFilter\n");
1085 hr = IFilterGraph2_AddFilter(iface, pfilter,
V_BSTR(&
var));
1087 WARN(
"Unable to add filter (%x)\n",
hr);
1088 IBaseFilter_Release(pfilter);
1095 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
1097 WARN(
"Enumpins (%x)\n",
hr);
1101 hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &
pin);
1102 IEnumPins_Release(penumpins);
1105 WARN(
"Obtaining next pin: (%x)\n",
hr);
1109 WARN(
"Cannot use this filter: no pins\n");
1113 hr = IPin_Connect(ppinOut, ppinfilter,
NULL);
1115 TRACE(
"Cannot connect to filter (%x), trying next one\n",
hr);
1118 TRACE(
"Successfully connected to filter, follow chain...\n");
1125 IPin_Disconnect(ppinfilter);
1126 IPin_Disconnect(ppinOut);
1129 TRACE(
"pins to consider: %d\n", nb);
1130 for(
i = 0;
i < nb;
i++)
1134 TRACE(
"Processing pin %u\n",
i);
1136 hr = IPin_QueryId(ppins[
i], &pinname);
1139 if (pinname[0] ==
'~')
1145 hr = IFilterGraph2_Connect(iface, ppins[
i], ppinIn);
1150 TRACE(
"Cannot connect pin %p (%x)\n", ppinfilter,
hr);
1152 IPin_Release(ppins[
i]);
1155 while (++
i < nb) IPin_Release(ppins[
i]);
1157 IPin_Release(ppinfilter);
1158 IBaseFilter_Release(pfilter);
1161 IPin_Disconnect(ppinfilter);
1162 IPin_Disconnect(ppinOut);
1163 IFilterGraph2_RemoveFilter(iface, pfilter);
1171 if (ppinfilter) IPin_Release(ppinfilter);
1173 IFilterGraph2_RemoveFilter(iface, pfilter);
1174 IBaseFilter_Release(pfilter);
1176 while (++
i < nb) IPin_Release(ppins[
i]);
1180 IEnumMoniker_Release(pEnumMoniker);
1184 IFilterMapper2_Release(pFilterMapper2);
1186 IEnumMediaTypes_Release(penummt);
1189 --
This->recursioncount;
1204 IPin_QueryPinInfo(ppinOut, &
info);
1206 IBaseFilter_EnumPins(
info.pFilter, &enumpins);
1208 IBaseFilter_Release(
info.pFilter);
1210 IEnumPins_Reset(enumpins);
1211 while (IEnumPins_Next(enumpins, 1, &to,
NULL) ==
S_OK)
1215 IPin_QueryDirection(to, &
dir);
1221 IPin_ConnectedTo(to, &
out);
1225 hr = IFilterGraph2_Render(&
This->IFilterGraph2_iface, to);
1238 IEnumPins_Release(enumpins);
1282 TRACE(
"(%p/%p)->(%p)\n",
This, iface, ppinOut);
1288 hr = IPin_QueryPinInfo(ppinOut, &PinInfo);
1292 TRACE(
"Filter owning pin => %p\n", PinInfo.pFilter);
1293 IBaseFilter_Release(PinInfo.pFilter);
1299 for (
x = 0;
x <
This->nFilters; ++
x)
1304 hr = IBaseFilter_EnumPins(
This->ppFiltersInGraph[
x], &enumpins);
1309 IEnumPins_Reset(enumpins);
1310 while (IEnumPins_Next(enumpins, 1, &
pin,
NULL) ==
S_OK)
1315 IPin_QueryDirection(
pin, &
dir);
1321 IPin_ConnectedTo(
pin, &to);
1328 TRACE(
"Connected successfully %p/%p, %08x look if we should render more!\n", ppinOut,
pin,
hr);
1334 IPin_Disconnect(ppinOut);
1335 IPin_Disconnect(
pin);
1338 IEnumPins_Release(enumpins);
1342 WARN(
"Could not connect!\n");
1349 IEnumPins_Release(enumpins);
1354 hr = IPin_EnumMediaTypes(ppinOut, &penummt);
1356 WARN(
"EnumMediaTypes (%x)\n",
hr);
1360 IEnumMediaTypes_Reset(penummt);
1368 hr = IEnumMediaTypes_Next(penummt, 1, &mt, &nbmt);
1370 WARN(
"IEnumMediaTypes_Next (%x)\n",
hr);
1390 if (pFilterMapper2 ==
NULL)
1392 hr = IUnknown_QueryInterface(
This->punkFilterMapper2, &IID_IFilterMapper2, (
void**)&pFilterMapper2);
1395 WARN(
"Unable to query IFilterMapper2 (%x)\n",
hr);
1401 tab[0] = mt->majortype;
1402 tab[1] = mt->subtype;
1403 hr = IFilterMapper2_EnumMatchingFilters(pFilterMapper2, &pEnumMoniker, 0,
FALSE, MERIT_UNLIKELY,
TRUE, 1, tab,
NULL,
NULL,
FALSE,
FALSE, 0,
NULL,
NULL,
NULL);
1406 WARN(
"Unable to enum filters (%x)\n",
hr);
1412 while (IEnumMoniker_Next(pEnumMoniker, 1, &pMoniker, &nb) ==
S_OK)
1422 WARN(
"Unable to retrieve filter info (%x)\n",
hr);
1427 IMoniker_Release(pMoniker);
1430 WARN(
"Unable to create filter (%x), trying next one\n",
hr);
1434 hr = IFilterGraph2_AddFilter(iface, pfilter,
V_BSTR(&
var));
1436 WARN(
"Unable to add filter (%x)\n",
hr);
1437 IBaseFilter_Release(pfilter);
1442 hr = IBaseFilter_EnumPins(pfilter, &penumpins);
1444 WARN(
"Splitter Enumpins (%x)\n",
hr);
1448 while ((
hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &
pin)) ==
S_OK)
1458 hr = IPin_QueryDirection(ppinfilter, &
dir);
1460 IPin_Release(ppinfilter);
1461 WARN(
"QueryDirection failed (%x)\n",
hr);
1465 IPin_Release(ppinfilter);
1470 hr = IPin_Connect(ppinOut, ppinfilter,
NULL);
1471 IPin_Release(ppinfilter);
1483 WARN(
"Unable to connect recursively (%x)\n",
hr);
1486 IBaseFilter_Release(pfilter);
1490 IEnumPins_Release(penumpins);
1495 WARN(
"IEnumPins_Next (%x)\n",
hr);
1501 IEnumPins_Release(penumpins);
1503 IFilterGraph2_RemoveFilter(iface, pfilter);
1504 IBaseFilter_Release(pfilter);
1509 IEnumMoniker_Release(pEnumMoniker);
1518 IFilterMapper2_Release(pFilterMapper2);
1520 IEnumMediaTypes_Release(penummt);
1528 static const WCHAR string[] = {
'R',
'e',
'a',
'd',
'e',
'r',0};
1538 if (lpcwstrPlayList !=
NULL)
1541 hr = IFilterGraph2_AddSourceFilter(iface, lpcwstrFile,
string, &preader);
1545 hr = IBaseFilter_EnumPins(preader, &penumpins);
1548 while (IEnumPins_Next(penumpins, 1, &ppinreader,
NULL) ==
S_OK)
1552 IPin_QueryDirection(ppinreader, &
dir);
1557 hr = IFilterGraph2_Render(iface, ppinreader);
1560 for (
i = 0;
i <
This->nFilters; ++
i)
1568 IPin_Release(ppinreader);
1570 IEnumPins_Release(penumpins);
1579 IBaseFilter_Release(preader);
1596 IBaseFilter_Release(*
filter);
1602 IFileSourceFilter_Release(
source);
1605 IBaseFilter_Release(*
filter);
1633 hr = IBaseFilter_QueryInterface(*
filter, &IID_IFileSourceFilter, (
LPVOID *)&pSource);
1636 IBaseFilter_Release(*
filter);
1641 IFileSourceFilter_Release(pSource);
1644 IBaseFilter_Release(*
filter);
1651 IBaseFilter_Release(*
filter);
1656 IPin_Release(pOutputPin);
1659 IBaseFilter_Release(*
filter);
1665 IAsyncReader_Release(pReader);
1670 IBaseFilter_Release(*
filter);
1693 WARN(
"Unable to create file source filter (%x)\n",
hr);
1697 hr = IFilterGraph2_AddFilter(iface, preader, lpcwstrFilterName);
1699 WARN(
"Unable add filter (%x)\n",
hr);
1700 IBaseFilter_Release(preader);
1704 hr = IBaseFilter_QueryInterface(preader, &IID_IFileSourceFilter, (
LPVOID*)&pfile);
1706 WARN(
"Unable to get IFileSourceInterface (%x)\n",
hr);
1711 hr = IFileSourceFilter_GetCurFile(pfile, &
filename, &mt);
1713 WARN(
"GetCurFile (%x)\n",
hr);
1722 *ppFilter = preader;
1723 IFileSourceFilter_Release(pfile);
1729 IFileSourceFilter_Release(pfile);
1730 IFilterGraph2_RemoveFilter(iface, preader);
1731 IBaseFilter_Release(preader);
1749 TRACE(
"(%p/%p)->(): stub !!!\n",
This, iface);
1758 TRACE(
"(%p/%p)->(): stub !!!\n",
This, iface);
1771 TRACE(
"(%p/%p)->(%p %p %s %p)\n",
This, iface, pMoniker, pCtx,
debugstr_w(lpcwstrFilterName), ppFilter);
1775 WARN(
"Unable to bind moniker to filter object (%x)\n",
hr);
1779 hr = IFilterGraph2_AddFilter(iface, pfilter, lpcwstrFilterName);
1781 WARN(
"Unable to add filter (%x)\n",
hr);
1782 IBaseFilter_Release(pfilter);
1787 *ppFilter = pfilter;
1788 else IBaseFilter_Release(pfilter);
1798 TRACE(
"(%p/%p)->(%p %p): stub !!!\n",
This, iface, ppin, pmt);
1808 TRACE(
"(%p/%p)->(%p %08x %p): stub !!!\n",
This, iface, pPinOut,
dwFlags, pvContext);
1850 return IUnknown_QueryInterface(
This->outer_unk,
riid, ppvObj);
1859 return IUnknown_AddRef(
This->outer_unk);
1868 return IUnknown_Release(
This->outer_unk);
1877 TRACE(
"(%p/%p)->(%p): stub !!!\n",
This, iface, pctinfo);
1887 TRACE(
"(%p/%p)->(%d, %d, %p): stub !!!\n",
This, iface, iTInfo, lcid, ppTInfo);
1898 cNames, lcid, rgDispId);
1909 TRACE(
"(%p/%p)->(%d, %s, %d, %04x, %p, %p, %p, %p): stub !!!\n",
This, iface, dispIdMember,
1926 TRACE(
"%p %p\n", pGraph, pOutputPin);
1927 PinInfo.pFilter =
NULL;
1929 hr = IPin_ConnectedTo(pOutputPin, &pInputPin);
1933 hr = IPin_QueryPinInfo(pInputPin, &PinInfo);
1936 IPin_Release(pInputPin);
1943 TRACE(
"Reached a renderer\n");
1949 for(
i = 0;
i < nb;
i++)
1955 IPin_Release(ppPins[
i]);
1960 TRACE(
"Doing stuff with filter %p\n", PinInfo.pFilter);
1962 FoundFilter(PinInfo.pFilter,
data);
1965 if (PinInfo.pFilter) IBaseFilter_Release(PinInfo.pFilter);
1972 return IBaseFilter_Run(pFilter,
time);
1977 return IBaseFilter_Pause(pFilter);
1982 return IBaseFilter_Stop(pFilter);
1996 else if (time_end > time_now)
1998 wait = time_end - time_now;
2003 return IBaseFilter_GetState(pFilter, wait, &
state);
2021 This->nRenderers = 0;
2024 for(
i = 0;
i <
This->nFilters;
i++)
2027 pfilter =
This->ppFiltersInGraph[
i];
2028 hr = IBaseFilter_EnumPins(pfilter, &pEnum);
2031 WARN(
"Enum pins failed %x\n",
hr);
2035 while(IEnumPins_Next(pEnum, 1, &pPin, &
dummy) ==
S_OK)
2037 IPin_QueryDirection(pPin, &
dir);
2047 TRACE(
"Found a source filter %p\n", pfilter);
2048 IEnumPins_Reset(pEnum);
2049 while(IEnumPins_Next(pEnum, 1, &pPin, &
dummy) ==
S_OK)
2055 FoundFilter(pfilter,
data);
2057 IEnumPins_Release(pEnum);
2071 if (
This->state == State_Running)
2073 This->EcCompleteCount = 0;
2075 if (
This->defaultclock && !
This->refClock)
2076 IFilterGraph2_SetDefaultSyncSource(&
This->IFilterGraph2_iface);
2082 if (
This->state == State_Stopped)
2083 This->start_time =
now + 500000;
2084 else if (
This->pause_time >= 0)
2089 else This->start_time = 0;
2092 This->state = State_Running;
2105 if (
This->state == State_Paused)
2108 if (
This->state == State_Running &&
This->refClock &&
This->start_time >= 0)
2111 This->pause_time = -1;
2114 This->state = State_Paused;
2126 if (
This->state == State_Stopped)
return S_OK;
2131 This->state = State_Stopped;
2142 TRACE(
"(%p/%p)->(%d, %p)\n",
This, iface, msTimeout, pfs);
2154 else if (msTimeout < 0)
2176 return IFilterGraph2_RenderFile(&
This->IFilterGraph2_iface, strFilename,
NULL);
2184 FIXME(
"(%p/%p)->(%s (%p), %p): stub !!!\n",
This, iface,
debugstr_w(strFilename), strFilename, ppUnk);
2193 FIXME(
"(%p/%p)->(%p): stub !!!\n",
This, iface, ppUnk);
2202 FIXME(
"(%p/%p)->(%p): stub !!!\n",
This, iface, ppUnk);
2211 FIXME(
"(%p/%p)->(): stub !!!\n",
This, iface);
2248 return IUnknown_QueryInterface(
This->outer_unk,
riid, ppvObj);
2257 return IUnknown_AddRef(
This->outer_unk);
2266 return IUnknown_Release(
This->outer_unk);
2279 for(
i = 0;
i <
This->nFilters;
i++)
2285 IBaseFilter_QueryInterface(pfilter, &IID_IAMFilterMiscFlags, (
void**)&
flags);
2288 filterflags = IAMFilterMiscFlags_GetMiscFlags(
flags);
2289 IAMFilterMiscFlags_Release(
flags);
2293 IBaseFilter_QueryInterface(pfilter, &IID_IMediaSeeking, (
void**)&
seek);
2297 IMediaSeeking_Release(
seek);
2314 hr = IMediaSeeking_GetCapabilities(
seek, &caps);
2319 *(
DWORD*)pcaps &= caps;
2330 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pCapabilities);
2336 *pCapabilities = 0xffffffff;
2350 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pCapabilities);
2356 originalcaps = *pCapabilities;
2363 if (!*pCapabilities)
2365 if (*pCapabilities != originalcaps)
2379 if (!
IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, pFormat))
2395 FIXME(
"(%p/%p)->(%p): semi-stub !!!\n",
This, iface, pFormat);
2396 memcpy(pFormat, &TIME_FORMAT_MEDIA_TIME,
sizeof(
GUID));
2408 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pFormat);
2418 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pFormat);
2437 if (
This->state != State_Stopped)
2440 if (!
IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, pFormat))
2454 hr = IMediaSeeking_GetDuration(
seek, &duration);
2458 if (*pdur < duration)
2468 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pDuration);
2491 pSourceFormat = &
This->timeformatseek;
2494 pTargetFormat = &
This->timeformatseek;
2513 return IMediaSeeking_SetPositions(
seek,
args->current,
args->curflags,
args->stop,
args->stopflags);
2524 TRACE(
"(%p/%p)->(%p, %08x, %p, %08x)\n",
This, iface, pCurrent, dwCurrentFlags, pStop, dwStopFlags);
2528 TRACE(
"State: %s\n",
state == State_Running ?
"Running" : (
state == State_Paused ?
"Paused" : (
state == State_Stopped ?
"Stopped" :
"UNKNOWN")));
2532 FIXME(
"Adjust method %x not handled yet!\n", dwCurrentFlags & 0x7);
2535 IMediaControl_Pause(&
This->IMediaControl_iface);
2536 args.current = pCurrent;
2538 args.curflags = dwCurrentFlags;
2539 args.stopflags = dwStopFlags;
2543 This->pause_time =
This->start_time = -1;
2545 IMediaControl_Run(&
This->IMediaControl_iface);
2555 return IMediaSeeking_GetPositions(
seek,
args->current,
args->stop);
2566 TRACE(
"(%p/%p)->(%p, %p)\n",
This, iface, pCurrent, pStop);
2568 args.current = pCurrent;
2572 if (
This->state == State_Running &&
This->refClock &&
This->start_time >= 0)
2578 if (
This->pause_time > 0)
2596 TRACE(
"Time: %u.%03u\n", (
DWORD)(*pCurrent / 10000000), (
DWORD)((*pCurrent / 10000)%1000));
2607 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pStop);
2622 FIXME(
"(%p/%p)->(%p, %p): stub !!!\n",
This, iface, pEarliest, pLatest);
2631 FIXME(
"(%p/%p)->(%f): stub !!!\n",
This, iface, dRate);
2640 FIXME(
"(%p/%p)->(%p): stub !!!\n",
This, iface, pdRate);
2654 FIXME(
"(%p/%p)->(%p): stub !!!\n",
This, iface, pllPreroll);
2696 return IUnknown_QueryInterface(
This->outer_unk,
riid, ppvObj);
2705 return IUnknown_AddRef(
This->outer_unk);
2714 return IUnknown_Release(
This->outer_unk);
2720 FIXME(
"(%p) stub!\n", iface);
2726 FIXME(
"(%p) stub!\n", iface);
2732 FIXME(
"(%p) stub!\n", iface);
2738 FIXME(
"(%p) stub!\n", iface);
2750 if (!
IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, &time_format))
2752 FIXME(
"Unsupported time format.\n");
2756 *time_out = (
LONGLONG) (time_in * 10000000);
2768 if (!
IsEqualGUID(&TIME_FORMAT_MEDIA_TIME, &time_format))
2770 FIXME(
"Unsupported time format.\n");
2774 *time_out = (
REFTIME)time_in / 10000000;
2783 HRESULT hr = IMediaSeeking_GetDuration(&
This->IMediaSeeking_iface, &duration);
2798 return IMediaSeeking_SetPositions(&
This->IMediaSeeking_iface, &reftime,
2808 hr = IMediaSeeking_GetCurrentPosition(&
This->IMediaSeeking_iface, &
pos);
2818 HRESULT hr = IMediaSeeking_GetStopPosition(&
This->IMediaSeeking_iface, &
pos);
2839 FIXME(
"(%p)->(%p) stub!\n", iface, pllTime);
2845 FIXME(
"(%p)->(%f) stub!\n", iface, llTime);
2852 return IMediaSeeking_SetRate(&
This->IMediaSeeking_iface, dRate);
2858 return IMediaSeeking_GetRate(&
This->IMediaSeeking_iface, pdRate);
2863 FIXME(
"(%p)->(%p) stub!\n", iface, pCanSeekForward);
2869 FIXME(
"(%p)->(%p) stub!\n", iface, pCanSeekBackward);
2908 return IUnknown_QueryInterface(
This->outer_unk,
riid, ppvObj);
2917 return IUnknown_AddRef(
This->outer_unk);
2926 return IUnknown_Release(
This->outer_unk);
2936 if (
This->pSite) IUnknown_Release(
This->pSite);
2937 This->pSite = pUnkSite;
2938 IUnknown_AddRef(
This->pSite);
2952 return IUnknown_QueryInterface(
This->pSite,
riid, ppvSite);
2985 FIXME(
"Not enough space to store interface in the cache\n");
3020 return IUnknown_QueryInterface(
This->outer_unk,
riid, ppvObj);
3029 return IUnknown_AddRef(
This->outer_unk);
3038 return IUnknown_Release(
This->outer_unk);
3045 IBasicAudio* pBasicAudio;
3048 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pctinfo);
3055 hr = IBasicAudio_GetTypeInfoCount(pBasicAudio, pctinfo);
3066 IBasicAudio* pBasicAudio;
3069 TRACE(
"(%p/%p)->(%d, %d, %p)\n",
This, iface, iTInfo, lcid, ppTInfo);
3076 hr = IBasicAudio_GetTypeInfo(pBasicAudio, iTInfo, lcid, ppTInfo);
3087 IBasicAudio* pBasicAudio;
3090 TRACE(
"(%p/%p)->(%s, %p, %d, %d, %p)\n",
This, iface,
debugstr_guid(
riid), rgszNames, cNames,
3098 hr = IBasicAudio_GetIDsOfNames(pBasicAudio,
riid, rgszNames, cNames, lcid, rgDispId);
3110 IBasicAudio* pBasicAudio;
3113 TRACE(
"(%p/%p)->(%d, %s, %d, %04x, %p, %p, %p, %p)\n",
This, iface, dispIdMember,
3121 hr = IBasicAudio_Invoke(pBasicAudio, dispIdMember,
riid, lcid,
wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
3132 IBasicAudio* pBasicAudio;
3135 TRACE(
"(%p/%p)->(%d)\n",
This, iface, lVolume);
3142 hr = IBasicAudio_put_Volume(pBasicAudio, lVolume);
3152 IBasicAudio* pBasicAudio;
3155 TRACE(
"(%p/%p)->(%p)\n",
This, iface, plVolume);
3162 hr = IBasicAudio_get_Volume(pBasicAudio, plVolume);
3172 IBasicAudio* pBasicAudio;
3175 TRACE(
"(%p/%p)->(%d)\n",
This, iface, lBalance);
3182 hr = IBasicAudio_put_Balance(pBasicAudio, lBalance);
3192 IBasicAudio* pBasicAudio;
3195 TRACE(
"(%p/%p)->(%p)\n",
This, iface, plBalance);
3202 hr = IBasicAudio_get_Balance(pBasicAudio, plBalance);
3235 return IUnknown_QueryInterface(
This->outer_unk,
riid, ppvObj);
3244 return IUnknown_AddRef(
This->outer_unk);
3253 return IUnknown_Release(
This->outer_unk);
3260 IBasicVideo *pBasicVideo;
3263 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pctinfo);
3270 hr = IBasicVideo_GetTypeInfoCount(pBasicVideo, pctinfo);
3281 IBasicVideo *pBasicVideo;
3284 TRACE(
"(%p/%p)->(%d, %d, %p)\n",
This, iface, iTInfo, lcid, ppTInfo);
3291 hr = IBasicVideo_GetTypeInfo(pBasicVideo, iTInfo, lcid, ppTInfo);
3302 IBasicVideo *pBasicVideo;
3305 TRACE(
"(%p/%p)->(%s, %p, %d, %d, %p)\n",
This, iface,
debugstr_guid(
riid), rgszNames, cNames,
3313 hr = IBasicVideo_GetIDsOfNames(pBasicVideo,
riid, rgszNames, cNames, lcid, rgDispId);
3325 IBasicVideo *pBasicVideo;
3328 TRACE(
"(%p/%p)->(%d, %s, %d, %04x, %p, %p, %p, %p)\n",
This, iface, dispIdMember,
3336 hr = IBasicVideo_Invoke(pBasicVideo, dispIdMember,
riid, lcid,
wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
3347 IBasicVideo *pBasicVideo;
3350 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pAvgTimePerFrame);
3357 hr = IBasicVideo_get_AvgTimePerFrame(pBasicVideo, pAvgTimePerFrame);
3367 IBasicVideo *pBasicVideo;
3370 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pBitRate);
3377 hr = IBasicVideo_get_BitRate(pBasicVideo, pBitRate);
3387 IBasicVideo *pBasicVideo;
3390 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pBitErrorRate);
3397 hr = IBasicVideo_get_BitErrorRate(pBasicVideo, pBitErrorRate);
3407 IBasicVideo *pBasicVideo;
3410 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pVideoWidth);
3417 hr = IBasicVideo_get_VideoWidth(pBasicVideo, pVideoWidth);
3427 IBasicVideo *pBasicVideo;
3430 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pVideoHeight);
3437 hr = IBasicVideo_get_VideoHeight(pBasicVideo, pVideoHeight);
3447 IBasicVideo *pBasicVideo;
3450 TRACE(
"(%p/%p)->(%d)\n",
This, iface, SourceLeft);
3457 hr = IBasicVideo_put_SourceLeft(pBasicVideo, SourceLeft);
3467 IBasicVideo *pBasicVideo;
3470 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pSourceLeft);
3477 hr = IBasicVideo_get_SourceLeft(pBasicVideo, pSourceLeft);
3487 IBasicVideo *pBasicVideo;
3490 TRACE(
"(%p/%p)->(%d)\n",
This, iface, SourceWidth);
3497 hr = IBasicVideo_put_SourceWidth(pBasicVideo, SourceWidth);
3507 IBasicVideo *pBasicVideo;
3510 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pSourceWidth);
3517 hr = IBasicVideo_get_SourceWidth(pBasicVideo, pSourceWidth);
3527 IBasicVideo *pBasicVideo;
3530 TRACE(
"(%p/%p)->(%d)\n",
This, iface, SourceTop);
3537 hr = IBasicVideo_put_SourceTop(pBasicVideo, SourceTop);
3547 IBasicVideo *pBasicVideo;
3550 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pSourceTop);
3557 hr = IBasicVideo_get_SourceTop(pBasicVideo, pSourceTop);
3567 IBasicVideo *pBasicVideo;
3570 TRACE(
"(%p/%p)->(%d)\n",
This, iface, SourceHeight);
3577 hr = IBasicVideo_put_SourceHeight(pBasicVideo, SourceHeight);
3587 IBasicVideo *pBasicVideo;
3590 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pSourceHeight);
3597 hr = IBasicVideo_get_SourceHeight(pBasicVideo, pSourceHeight);
3607 IBasicVideo *pBasicVideo;
3610 TRACE(
"(%p/%p)->(%d)\n",
This, iface, DestinationLeft);
3617 hr = IBasicVideo_put_DestinationLeft(pBasicVideo, DestinationLeft);
3627 IBasicVideo *pBasicVideo;
3630 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pDestinationLeft);
3637 hr = IBasicVideo_get_DestinationLeft(pBasicVideo, pDestinationLeft);
3647 IBasicVideo *pBasicVideo;
3650 TRACE(
"(%p/%p)->(%d)\n",
This, iface, DestinationWidth);
3657 hr = IBasicVideo_put_DestinationWidth(pBasicVideo, DestinationWidth);
3667 IBasicVideo *pBasicVideo;
3670 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pDestinationWidth);
3677 hr = IBasicVideo_get_DestinationWidth(pBasicVideo, pDestinationWidth);
3687 IBasicVideo *pBasicVideo;
3690 TRACE(
"(%p/%p)->(%d)\n",
This, iface, DestinationTop);
3697 hr = IBasicVideo_put_DestinationTop(pBasicVideo, DestinationTop);
3707 IBasicVideo *pBasicVideo;
3710 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pDestinationTop);
3717 hr = IBasicVideo_get_DestinationTop(pBasicVideo, pDestinationTop);
3727 IBasicVideo *pBasicVideo;
3730 TRACE(
"(%p/%p)->(%d)\n",
This, iface, DestinationHeight);
3737 hr = IBasicVideo_put_DestinationHeight(pBasicVideo, DestinationHeight);
3745 LONG *pDestinationHeight)
3748 IBasicVideo *pBasicVideo;
3751 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pDestinationHeight);
3758 hr = IBasicVideo_get_DestinationHeight(pBasicVideo, pDestinationHeight);
3769 IBasicVideo *pBasicVideo;
3790 IBasicVideo *pBasicVideo;
3793 TRACE(
"(%p/%p)->(%p, %p, %p, %p)\n",
This, iface, pLeft, pTop, pWidth, pHeight);
3800 hr = IBasicVideo_GetSourcePosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
3810 IBasicVideo *pBasicVideo;
3820 hr = IBasicVideo_SetDefaultSourcePosition(pBasicVideo);
3831 IBasicVideo *pBasicVideo;
3841 hr = IBasicVideo_SetDestinationPosition(pBasicVideo, Left,
Top,
Width,
Height);
3852 IBasicVideo *pBasicVideo;
3855 TRACE(
"(%p/%p)->(%p, %p, %p, %p)\n",
This, iface, pLeft, pTop, pWidth, pHeight);
3862 hr = IBasicVideo_GetDestinationPosition(pBasicVideo, pLeft, pTop, pWidth, pHeight);
3872 IBasicVideo *pBasicVideo;
3882 hr = IBasicVideo_SetDefaultDestinationPosition(pBasicVideo);
3892 IBasicVideo *pBasicVideo;
3895 TRACE(
"(%p/%p)->(%p, %p)\n",
This, iface, pWidth, pHeight);
3902 hr = IBasicVideo_GetVideoSize(pBasicVideo, pWidth, pHeight);
3913 IBasicVideo *pBasicVideo;
3916 TRACE(
"(%p/%p)->(%d, %d, %p, %p)\n",
This, iface, StartIndex,
Entries, pRetrieved, pPalette);
3923 hr = IBasicVideo_GetVideoPaletteEntries(pBasicVideo, StartIndex,
Entries, pRetrieved, pPalette);
3934 IBasicVideo *pBasicVideo;
3944 hr = IBasicVideo_GetCurrentImage(pBasicVideo,
pBufferSize, pDIBImage);
3954 IBasicVideo *pBasicVideo;
3964 hr = IBasicVideo_IsUsingDefaultSource(pBasicVideo);
3974 IBasicVideo *pBasicVideo;
3984 hr = IBasicVideo_IsUsingDefaultDestination(pBasicVideo);
3995 IBasicVideo2 *pBasicVideo2;
4067 return IUnknown_QueryInterface(
This->outer_unk,
riid, ppvObj);
4076 return IUnknown_AddRef(
This->outer_unk);
4085 return IUnknown_Release(
This->outer_unk);
4092 IVideoWindow *pVideoWindow;
4095 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pctinfo);
4102 hr = IVideoWindow_GetTypeInfoCount(pVideoWindow, pctinfo);
4113 IVideoWindow *pVideoWindow;
4116 TRACE(
"(%p/%p)->(%d, %d, %p)\n",
This, iface, iTInfo, lcid, ppTInfo);
4123 hr = IVideoWindow_GetTypeInfo(pVideoWindow, iTInfo, lcid, ppTInfo);