将文件编写器添加到GSSF示例 [英] Add a file writer to the GSSF sample

查看:55
本文介绍了将文件编写器添加到GSSF示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在标题中提到我想在GSSF Sample的图形中添加一个File Writer,而不是渲染它。



实际上我真正想要完成的是,添加第二个文件源过滤器,然后将GSSF和文件源过滤器连接到AVI Mux,最后连接到文件编写器。



GSSF +文件来源 - > AVI MUX - >文件编写者。



但单独的第一步将有很大帮助。



我的目标是创建一个包含2个来源的视频:

1-我的桌面捕获2-另一个视频(已录制一个凸轮)2个源也必须同步

我已经创建了一个带有2个视频源的图表等。但是我找不到如何延迟其中一个源。我需要文件源1比第二个文件源晚几毫秒才开始。



我尝试了什么:



关于在GSSF中为图形示例添加文件编写器我尝试了以下内容:



代码



Hi,
as I mentioned in the title I would like to add a File Writer into the graph of the GSSF Sample, instead of rendering it.

Actually What I really try to accomplish is, to add a second file Source Filter, then connect the GSSF and File source filter to an AVI Mux and finally to a File Writer.

GSSF+File Source -> AVI MUX -> File Writer.

But the first step alone would help a lot.

My goal is to create a video with 2 sources:
1- a capture of my desktop 2- another video (already recorded with a cam) also the 2 sources must be synchronous
I already created a Graph with 2 Video Sources etc.. but I couldn't find out how to delay one of the sources. I need that the File source 1 just start a few milliseconds later than the second file source.

What I have tried:

regarding adding a File Writer to the graph sample in GSSF I tried the following:

after the code

// Add the filter to the graph
                    hr = m_FilterGraph.AddFilter(ipsb, "GenericSampleSourceFilter");
                    Marshal.ThrowExceptionForHR( hr );





我试图添加文件编写器过滤器并将其连接到GSSF,但是没有结果





I tried to add a File Writer Filter and connect it to the GSSF, but without result

//add File writer
IBaseFilter pFilewriter2 = (IBaseFilter)new FileWriter();
hr = m_FilterGraph.AddFilter(pFilewriter2, "File writer");               
//set destination filename
IFileSinkFilter pFilewriter2_sink = pFilewriter2 as IFileSinkFilter;               
hr = pFilewriter2_sink.SetFileName("D:\\Test.avi", null);

//connect File writer
hr = m_FilterGraph.ConnectDirect(GetPin(ipsb, "Out"), GetPin(pFilewriter2, "in"), null);





这是GetPin方法



and this is the GetPin method

private IPin GetPin(IBaseFilter filter, string pinname)
{
   IEnumPins epins;
   int hr = filter.EnumPins(out epins);         
   IntPtr fetched = Marshal.AllocCoTaskMem(4);
   IPin[] pins = new IPin[1];
   while (epins.Next(1, pins, fetched) == 0)
   {
      PinInfo pinfo;
      pins[0].QueryPinInfo(out pinfo);
      bool found = ((pinfo.name == pinname) || (pinfo.name.Contains(pinname)));
      DsUtils.FreePinInfo(pinfo);
      if (found) return pins[0];
   }         
   return null;
}

推荐答案

不要在快速答案下发布 - 如果您从文章中获得了代码,那么该文章底部的添加评论或问题按钮,会将电子邮件发送给作者。然后他们会被告知你希望与他们交谈。

在这里发布这个依赖于他们匆匆而过并意识到这是为了他们。



如果你从不同的网站获得它,那么你需要从那里开始问他们 - 我们不知道你提到的GSSF样本是什么!
Don't post this under Quick Answers - if you got the code from an article, then there is a "Add a Comment or Question" button at the bottom of that article, which causes an email to be sent to the author. They are then alerted that you wish to speak to them.
Posting this here relies on them "dropping by" and realising it is for them.

If you got it from a different site, then you need to start there and ask them - we have no idea what the "GSSF sample" you mention is!


参见 DirectShow .NET /讨论/公开讨论:GSSF样本和色彩空间转换器 [ ^ ]


这篇关于将文件编写器添加到GSSF示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆