46#include "wine/unicode.h"
82 TRACE(
"(%p, %p)\n", pUnkOuter, phr);
117 *
ppv = &
This->ICaptureGraphBuilder2_iface;
119 *
ppv = &
This->ICaptureGraphBuilder_iface;
121 *
ppv = &
This->ICaptureGraphBuilder2_iface;
126 TRACE (
"-- Interface = %p\n", *
ppv);
130 TRACE (
"-- Interface: E_NOINTERFACE\n");
140 TRACE(
"(%p/%p)->() AddRef from %d\n",
This, iface,
ref - 1);
149 TRACE(
"(%p/%p)->() Release from %d\n",
This, iface,
ref + 1);
153 This->csFilter.DebugInfo->Spare[0] = 0;
156 IGraphBuilder_Release(
This->mygraph);
173 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pfg);
182 IGraphBuilder_AddRef(
This->mygraph);
184 &IID_IMediaEvent, (
LPVOID *)&pmev)))
186 IMediaEvent_CancelDefaultHandling(pmev,
EC_REPAINT);
187 IMediaEvent_Release(pmev);
198 TRACE(
"(%p/%p)->(%p)\n",
This, iface, pfg);
203 *pfg =
This->mygraph;
206 TRACE(
"(%p) Getting NULL filtergraph\n", iface);
210 IGraphBuilder_AddRef(
This->mygraph);
212 TRACE(
"(%p) return filtergraph %p\n", iface, *pfg);
225 FIXME(
"(%p/%p)->(%s, %s, %p, %p) Stub!\n",
This, iface,
233 const GUID *pCategory,
241 FIXME(
"(%p/%p)->(%s, %s, %p, %s, %p) - workaround stub!\n",
This, iface,
245 return IBaseFilter_QueryInterface(pf,
riid, ppint);
253 const GUID *pCategory,
258 static const WCHAR inputW[] = {
'I',
'n',
'p',
'u',
't',0};
259 static const WCHAR captureW[] = {
'C',
'a',
'p',
't',
'u',
'r',
'e',0};
260 static const WCHAR previewW[] = {
'P',
'r',
'e',
'v',
'i',
'e',
'w',0};
269 hr = ICaptureGraphBuilder2_FindPin(&
This->ICaptureGraphBuilder2_iface, pSource,
272 hr = ICaptureGraphBuilder2_FindPin(&
This->ICaptureGraphBuilder2_iface, pSource,
281 if (
IsEqualIID(pCategory, &PIN_CATEGORY_CAPTURE)) {
282 hr = IPin_ConnectedTo(capture, &peer);
284 *source_out = capture;
285 IPin_AddRef(*source_out);
293 IPin_AddRef(*source_out);
300 hr = IPin_ConnectedTo(capture, &peer);
304 hr = IPin_QueryPinInfo(peer, &pinInfo);
306 hr = IBaseFilter_GetClassID(pinInfo.pFilter, &classID);
309 smartTee = pinInfo.pFilter;
310 IBaseFilter_AddRef(smartTee);
313 IBaseFilter_Release(pinInfo.pFilter);
323 hr = IGraphBuilder_AddFilter(
This->mygraph, smartTee,
NULL);
326 hr = IBaseFilter_FindPin(smartTee,
inputW, &smartTeeInput);
328 hr = IGraphBuilder_ConnectDirect(
This->mygraph, capture, smartTeeInput,
NULL);
329 IPin_Release(smartTeeInput);
334 TRACE(
"adding SmartTee failed with hr=0x%08x\n",
hr);
342 if (
IsEqualIID(pCategory, &PIN_CATEGORY_CAPTURE))
343 hr = IBaseFilter_FindPin(smartTee, captureW, source_out);
345 hr = IBaseFilter_FindPin(smartTee, previewW, source_out);
352 IPin_Release(capture);
358 IBaseFilter_Release(smartTee);
359 TRACE(
"for %s returning hr=0x%08x, *source_out=%p\n",
IsEqualIID(pCategory, &PIN_CATEGORY_CAPTURE) ?
"capture" :
"preview",
hr, source_out ? *source_out : 0);
376 if (pCategory && (
IsEqualIID(pCategory, &PIN_CATEGORY_CAPTURE) ||
IsEqualIID(pCategory, &PIN_CATEGORY_PREVIEW))){
382 usedSmartTeePreviewPin =
TRUE;
383 IBaseFilter_Release(sourceFilter);
395 hr = IPin_ConnectedTo(source_out, &nextpin);
399 IPin_Release(source_out);
401 hr = IPin_QueryPinInfo(nextpin, &
info);
403 WARN(
"QueryPinInfo failed: %08x\n",
hr);
409 IBaseFilter_Release(
info.pFilter);
414 *out_pin = source_out;
415 if(usedSmartTeePreviewPin)
426 const GUID *pCategory,
433 IPin *source_out =
NULL, *renderer_in;
437 FIXME(
"(%p/%p)->(%s, %s, %p, %p, %p) semi-stub!\n",
This, iface,
439 pSource, pfCompressor, pfRenderer);
443 FIXME(
"Need a capture graph\n");
447 if (pCategory &&
IsEqualIID(pCategory, &PIN_CATEGORY_VBI)) {
448 FIXME(
"Tee/Sink-to-Sink filter not supported\n");
460 hr = IPin_EnumMediaTypes(source_out, &enumMedia);
463 hr = IEnumMediaTypes_Next(enumMedia, 1, &mediaType,
NULL);
465 if (
IsEqualIID(&mediaType->majortype, &MEDIATYPE_Video)) {
468 }
else if (
IsEqualIID(&mediaType->majortype, &MEDIATYPE_Audio)) {
472 FIXME(
"cannot automatically load renderer for majortype %s\n",
debugstr_guid(&mediaType->majortype));
476 rendererNeedsRelease =
TRUE;
477 hr = IGraphBuilder_AddFilter(
This->mygraph, pfRenderer,
NULL);
481 IEnumMediaTypes_Release(enumMedia);
484 if (rendererNeedsRelease)
485 IBaseFilter_Release(pfRenderer);
486 IPin_Release(source_out);
494 if (rendererNeedsRelease)
495 IBaseFilter_Release(pfRenderer);
496 IPin_Release(source_out);
501 hr = IGraphBuilder_Connect(
This->mygraph, source_out, renderer_in);
504 IPin *compressor_in, *compressor_out;
506 hr = ICaptureGraphBuilder2_FindPin(iface, (
IUnknown*)pfCompressor,
510 hr = IGraphBuilder_Connect(
This->mygraph, source_out, compressor_in);
511 IPin_Release(compressor_in);
516 hr = ICaptureGraphBuilder2_FindPin(iface, (
IUnknown*)pfCompressor,
520 hr = IGraphBuilder_Connect(
This->mygraph, compressor_out, renderer_in);
521 IPin_Release(compressor_out);
526 IPin_Release(source_out);
527 IPin_Release(renderer_in);
528 if (rendererNeedsRelease)
529 IBaseFilter_Release(pfRenderer);
537 const GUID *pCategory,
547 FIXME(
"(%p/%p)->(%s, %s, %p, %p, %p, %i, %i) Stub!\n",
This, iface,
549 pFilter, pstart, pstop, wStartCookie, wStopCookie);
561 FIXME(
"(%p/%p)->(%s, 0x%s) Stub!\n",
This, iface,
576 FIXME(
"(%p/%p)->(%s, %s, %i, %p) Stub!\n",
This, iface,
589 hr = IPin_QueryDirection(
pin, &pindir);
591 if (unconnected && IPin_ConnectedTo(
pin, &partner) ==
S_OK && partner!=
NULL)
593 IPin_Release(partner);
594 TRACE(
"No match, %p already connected to %p\n",
pin, partner);
630 IEnumMediaTypes_Reset(
types);
632 if (IEnumMediaTypes_Next(
types, 1, &media_type, &fetched) !=
S_OK || fetched != 1)
634 IEnumMediaTypes_Release(
types);
645 IEnumMediaTypes_Release(
types);
648 TRACE(
"Pin matched\n");
656 const GUID *pCategory,
667 TRACE(
"(%p/%p)->(%p, %x, %s, %s, %d, %i, %p)\n",
This, iface,
669 fUnconnected,
num, ppPin);
673 hr = IUnknown_QueryInterface(pSource, &
IID_IPin, (
void**)&
pin);
682 WARN(
"Input not filter or pin?!\n");
686 hr = IBaseFilter_EnumPins(
filter, &enumpins);
689 WARN(
"Could not enumerate\n");
690 IBaseFilter_Release(
filter);
698 hr = IEnumPins_Next(enumpins, 1, &
pin, &fetched);
702 IEnumPins_Reset(enumpins);
714 TRACE(
"Testing match\n");
723 IEnumPins_Release(enumpins);
724 IBaseFilter_Release(
filter);
728 WARN(
"Could not find %s pin # %d\n", (pindir ==
PINDIR_OUTPUT ?
"output" :
"input"), numcurrent);
764 TRACE(
"%p --> Forwarding to v2 (%p)\n", iface,
This);
765 return ICaptureGraphBuilder2_QueryInterface(&
This->ICaptureGraphBuilder2_iface,
riid,
ppv);
772 TRACE(
"%p --> Forwarding to v2 (%p)\n", iface,
This);
773 return ICaptureGraphBuilder2_AddRef(&
This->ICaptureGraphBuilder2_iface);
780 TRACE(
"%p --> Forwarding to v2 (%p)\n", iface,
This);
781 return ICaptureGraphBuilder2_Release(&
This->ICaptureGraphBuilder2_iface);
789 TRACE(
"%p --> Forwarding to v2 (%p)\n", iface,
This);
790 return ICaptureGraphBuilder2_SetFiltergraph(&
This->ICaptureGraphBuilder2_iface, pfg);
798 TRACE(
"%p --> Forwarding to v2 (%p)\n", iface,
This);
799 return ICaptureGraphBuilder2_GetFiltergraph(&
This->ICaptureGraphBuilder2_iface, pfg);
804 const GUID *pType, LPCOLESTR lpstrFile,
808 TRACE(
"%p --> Forwarding to v2 (%p)\n", iface,
This);
809 return ICaptureGraphBuilder2_SetOutputFileName(&
This->ICaptureGraphBuilder2_iface, pType,
810 lpstrFile, ppf, ppSink);
819 TRACE(
"%p --> Forwarding to v2 (%p)\n", iface,
This);
820 return ICaptureGraphBuilder2_FindInterface(&
This->ICaptureGraphBuilder2_iface, pCategory,
NULL,
830 TRACE(
"%p --> Forwarding to v2 (%p)\n", iface,
This);
831 return ICaptureGraphBuilder2_RenderStream(&
This->ICaptureGraphBuilder2_iface, pCategory,
NULL,
832 pSource, pfCompressor, pfRenderer);
839 WORD wStartCookie,
WORD wStopCookie)
842 TRACE(
"%p --> Forwarding to v2 (%p)\n", iface,
This);
843 return ICaptureGraphBuilder2_ControlStream(&
This->ICaptureGraphBuilder2_iface, pCategory,
NULL,
844 pFilter, pstart, pstop, wStartCookie, wStopCookie);
852 TRACE(
"%p --> Forwarding to v2 (%p)\n", iface,
This);
853 return ICaptureGraphBuilder2_AllocCapFile(&
This->ICaptureGraphBuilder2_iface,
lpstr, dwlSize);
863 TRACE(
"%p --> Forwarding to v2 (%p)\n", iface,
This);
864 return ICaptureGraphBuilder2_CopyCaptureFile(&
This->ICaptureGraphBuilder2_iface, lpwstrOld,
#define InterlockedIncrement
#define InterlockedDecrement
enum _PinDirection PIN_DIRECTION
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
static previewinfo preview
static HRESULT WINAPI fnCaptureGraphBuilder2_RenderStream(ICaptureGraphBuilder2 *iface, const GUID *pCategory, const GUID *pType, IUnknown *pSource, IBaseFilter *pfCompressor, IBaseFilter *pfRenderer)
static HRESULT WINAPI fnCaptureGraphBuilder_CopyCaptureFile(ICaptureGraphBuilder *iface, LPOLESTR lpwstrOld, LPOLESTR lpwstrNew, int fAllowEscAbort, IAMCopyCaptureFileProgress *pCallback)
static HRESULT WINAPI fnCaptureGraphBuilder_RenderStream(ICaptureGraphBuilder *iface, const GUID *pCategory, IUnknown *pSource, IBaseFilter *pfCompressor, IBaseFilter *pfRenderer)
static ULONG WINAPI fnCaptureGraphBuilder_Release(ICaptureGraphBuilder *iface)
static HRESULT WINAPI fnCaptureGraphBuilder_QueryInterface(ICaptureGraphBuilder *iface, REFIID riid, LPVOID *ppv)
static HRESULT WINAPI fnCaptureGraphBuilder_FindInterface(ICaptureGraphBuilder *iface, const GUID *pCategory, IBaseFilter *pf, REFIID riid, void **ppint)
static CaptureGraphImpl * impl_from_ICaptureGraphBuilder(ICaptureGraphBuilder *iface)
static HRESULT match_smart_tee_pin(CaptureGraphImpl *This, const GUID *pCategory, const GUID *pType, IUnknown *pSource, IPin **source_out)
static CaptureGraphImpl * impl_from_ICaptureGraphBuilder2(ICaptureGraphBuilder2 *iface)
static HRESULT WINAPI fnCaptureGraphBuilder2_ControlStream(ICaptureGraphBuilder2 *iface, const GUID *pCategory, const GUID *pType, IBaseFilter *pFilter, REFERENCE_TIME *pstart, REFERENCE_TIME *pstop, WORD wStartCookie, WORD wStopCookie)
static const ICaptureGraphBuilder2Vtbl builder2_Vtbl
static ULONG WINAPI fnCaptureGraphBuilder2_Release(ICaptureGraphBuilder2 *iface)
static HRESULT WINAPI fnCaptureGraphBuilder_SetOutputFileName(ICaptureGraphBuilder *iface, const GUID *pType, LPCOLESTR lpstrFile, IBaseFilter **ppf, IFileSinkFilter **ppSink)
static HRESULT WINAPI fnCaptureGraphBuilder2_SetFilterGraph(ICaptureGraphBuilder2 *iface, IGraphBuilder *pfg)
static HRESULT WINAPI fnCaptureGraphBuilder2_FindInterface(ICaptureGraphBuilder2 *iface, const GUID *pCategory, const GUID *pType, IBaseFilter *pf, REFIID riid, void **ppint)
static ULONG WINAPI fnCaptureGraphBuilder_AddRef(ICaptureGraphBuilder *iface)
static HRESULT WINAPI fnCaptureGraphBuilder2_SetOutputFileName(ICaptureGraphBuilder2 *iface, const GUID *pType, LPCOLESTR lpstrFile, IBaseFilter **ppf, IFileSinkFilter **ppSink)
static HRESULT WINAPI fnCaptureGraphBuilder2_FindPin(ICaptureGraphBuilder2 *iface, IUnknown *pSource, PIN_DIRECTION pindir, const GUID *pCategory, const GUID *pType, BOOL fUnconnected, INT num, IPin **ppPin)
static HRESULT WINAPI fnCaptureGraphBuilder_ControlStream(ICaptureGraphBuilder *iface, const GUID *pCategory, IBaseFilter *pFilter, REFERENCE_TIME *pstart, REFERENCE_TIME *pstop, WORD wStartCookie, WORD wStopCookie)
static HRESULT WINAPI fnCaptureGraphBuilder2_QueryInterface(ICaptureGraphBuilder2 *iface, REFIID riid, LPVOID *ppv)
static HRESULT WINAPI fnCaptureGraphBuilder_AllocCapFile(ICaptureGraphBuilder *iface, LPCOLESTR lpstr, DWORDLONG dwlSize)
static HRESULT WINAPI fnCaptureGraphBuilder2_GetFilterGraph(ICaptureGraphBuilder2 *iface, IGraphBuilder **pfg)
static ULONG WINAPI fnCaptureGraphBuilder2_AddRef(ICaptureGraphBuilder2 *iface)
static HRESULT WINAPI fnCaptureGraphBuilder_SetFiltergraph(ICaptureGraphBuilder *iface, IGraphBuilder *pfg)
static HRESULT WINAPI fnCaptureGraphBuilder2_AllocCapFile(ICaptureGraphBuilder2 *iface, LPCOLESTR lpwstr, DWORDLONG dwlSize)
static const ICaptureGraphBuilderVtbl builder_Vtbl
static HRESULT WINAPI fnCaptureGraphBuilder_GetFiltergraph(ICaptureGraphBuilder *iface, IGraphBuilder **pfg)
IUnknown *CALLBACK QCAP_createCaptureGraphBuilder2(IUnknown *pUnkOuter, HRESULT *phr)
static HRESULT find_unconnected_pin(CaptureGraphImpl *This, const GUID *pCategory, const GUID *pType, IUnknown *pSource, IPin **out_pin)
static HRESULT pin_matches(IPin *pin, PIN_DIRECTION direction, const GUID *cat, const GUID *type, BOOL unconnected)
static HRESULT WINAPI fnCaptureGraphBuilder2_CopyCaptureFile(ICaptureGraphBuilder2 *iface, LPOLESTR lpwstrOld, LPOLESTR lpwstrNew, int fAllowEscAbort, IAMCopyCaptureFileProgress *pCallback)
const GUID IID_IKsPropertySet
const GUID IID_IBaseFilter
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
#define IKsPropertySet_Release(p)
#define IKsPropertySet_Get(p, a, b, c, d, e, f, g)
FxPnpStateCallbackInfo * pCallback
GLuint GLuint GLsizei GLenum type
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
static const WCHAR inputW[]
VOID WINAPI CoTaskMemFree(LPVOID ptr)
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
unsigned long long DWORDLONG
static void DeleteMediaType(AM_MEDIA_TYPE *pMediaType)
#define IsEqualIID(riid1, riid2)
DWORD ObjectRefCount(BOOL increment)
CRITICAL_SECTION csFilter
ICaptureGraphBuilder ICaptureGraphBuilder_iface
ICaptureGraphBuilder2 ICaptureGraphBuilder2_iface
DWORD_PTR Spare[8/sizeof(DWORD_PTR)]
PCRITICAL_SECTION_DEBUG DebugInfo
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
#define CONTAINING_RECORD(address, type, field)
#define VFW_E_ENUM_OUT_OF_SYNC
#define VFW_E_NOT_CONNECTED
#define VFW_S_NOPREVIEWPIN
static const WCHAR props[]
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define CLASS_E_NOAGGREGATION