首页 > 解决方案 > 发送位图到directshow源过滤器

问题描述

寻找一种从代码发送位图而不将其作为直接显示输出源保存到文件的方法。

我从 Windows7.1SDK 中找到了示例“PushSource”,但它是用 C++ 编写的,甚至无法编译。

标签: c#bitmapdirectshow

解决方案


The question is overly broad for detailed reply, but I will still outline the steps.

First, Push Source Filters are in good standing. They are buildable, but you might need to build BaseClasses project there first because it's a required dependency.

Then, PushSourceBitmap shows how to inject a bitmap into streaming pipeline. You are to extend the filter to be able to accept a bitmap externally, esp. with C# friendly interface such as COM interface.

Next thing is to realize that a filter is operating in a process that streaming pipeline, which might be different from the application that sends/produces the bitmap. If this is the case you are to care about interprocess communication, which might be not that trivial. Also, if multiple processes are involved there is a question of potential bitness mismatch and/or multiple senders.

As you mentioned source filter and C#, you might also be interested in looking at DirectShow.NET's GSSF: Generic Sample Source Filter:

The Generic Sample Source Filter - A way to implement a source filter in c#


推荐阅读