首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我在使用samplegrabber时发现了一个错误

我在使用samplegrabber时发现了一个错误
EN

Stack Overflow用户
提问于 2014-01-14 19:12:39
回答 1查看 373关注 0票数 1
代码语言:javascript
复制
graphBuilder = (IGraphBuilder)new FilterGraph();
//Create the Capture Graph Builder
ICaptureGraphBuilder2 captureGraphBuilder = null;
captureGraphBuilder = (ICaptureGraphBuilder2)new CaptureGraphBuilder2();

//Create the media control for controlling the graph
mediaControl = (IMediaControl)this.graphBuilder;

// Attach the filter graph to the capture graph
int hr = captureGraphBuilder.SetFiltergraph(this.graphBuilder);
DsError.ThrowExceptionForHR(hr);

//Add the Video input device to the graph
hr = graphBuilder.AddFilter(theDevice, "source filter");
DsError.ThrowExceptionForHR(hr);


//Add the Video compressor filter to the graph
hr = graphBuilder.AddFilter(theCompressor, "compressor filter");
DsError.ThrowExceptionForHR(hr);


//////////// Smart Tee
IBaseFilter smartTeeFilter = (IBaseFilter)new SmartTee();
graphBuilder.AddFilter(smartTeeFilter, "Smart Tee");

IPin outPin = DsFindPin.ByDirection(theDevice, PinDirection.Output, 0);
IPin inPin = DsFindPin.ByDirection(smartTeeFilter, PinDirection.Input, 0);
graphBuilder.Connect(outPin, inPin);



/////
ISampleGrabber sampGrabber = new SampleGrabber() as ISampleGrabber;
IBaseFilter baseGrabFilter = sampGrabber as IBaseFilter;
graphBuilder.AddFilter(baseGrabFilter, "Grabber");


IPin sourcePin, grabPin;
sourcePin = DsFindPin.ByDirection(theDevice, PinDirection.Output, 0);
grabPin = DsFindPin.ByDirection(baseGrabFilter, PinDirection.Input, 0);
graphBuilder.Connect(sourcePin, grabPin);

graphBuilder.Render(DsFindPin.ByDirection(baseGrabFilter, PinDirection.Output, 0));
ConfigureSampleGrabber(sampGrabber);

hr = graphBuilder.AddFilter(baseGrabFilter, "Ds.NET Grabber");
DsError.ThrowExceptionForHR(hr);
        ////

SaveSizeInfo(sampGrabber);

在这里,我得到一个题为“由于引脚没有连接而无法执行的操作”的错误。我的问题在哪里?!我试图添加一个覆盖文本到捕获的视频,然后保存它。如有任何建议,将不胜感激。

代码语言:javascript
复制
hr = captureGraphBuilder.RenderStream(null, null, smartTeeFilter, null, null);
DsError.ThrowExceptionForHR(hr);
EN

回答 1

Stack Overflow用户

发布于 2014-01-14 21:19:27

像这样连接引脚:

代码语言:javascript
复制
FilterGraphTools.ConnectFilters(graphBuilder, inPin, outPin);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21121958

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档