本文介绍了在地方修改IMediaSample的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 
$


我正在开发自己的直接显示过滤器并且有一个简单的问题。



视频帧通过IMemInputPin :: Receive(IMediaSample * pSample)从上游过滤器传递到我的过滤器,我只是想知道,我可以直接编辑视频帧内容(而不是将其复制到其他地方)并编辑)?我担心如果我改变视频
帧数据,并且上游过滤器重新使用该帧来生成下一帧,那么修改后的帧将在上游过滤器中产生不正确的输出。

Hi, 

I'm developing my own direct show filter and have an easy question.

Video frames get delivered from upstream filter to my filter by IMemInputPin::Receive(IMediaSample *pSample), I just want to know, can I directly edit the video frame content (instead of copying it to somewhere else and edit)? I'm afraid if I change the video frame data in place, and upstream filter reuses the frame to generate next frame, then the modified frame will produce incorrect output in upstream filter.

感谢您的帮助。




推荐答案

如果您的过滤器是变换过滤器,则更容易从TransInPlace过滤器类派生它。

If your filter is a transform filter, it is easier to derive it from the TransInPlace filter class.

上游过滤器不会重复使用介质样本,直到您将其释放(或者下游过滤器已释放它,如果您将该样本传递到下游)。

The media sample will not be reused by the upstream filter until you have released it (or filters downstream have released it, in cases where you pass this sample further downstream).

如果需要保留样本一段时间,可以在本地复制数据,或者增加请求的缓冲区数量。

If you need to hold to the sample for some time, you can either copy the data locally, or increase the requested number of buffers.


这篇关于在地方修改IMediaSample的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 02:45