由于过滤器处于错误状态GetCurrentBuffer,因此无法执行该操作 [英] The operation could not be performed because the filter is in the wrong state GetCurrentBuffer

查看:111
本文介绍了由于过滤器处于错误状态GetCurrentBuffer,因此无法执行该操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于过滤器处于错误状态而无法执行操作

The operation could not be performed because the filter is in the wrong state

当我尝试运行hr = m_pGrabber-> GetCurrentBuffer(& cbBuffer,NULL);。

I am getting this error when attemting to run hr = m_pGrabber->GetCurrentBuffer(&cbBuffer, NULL);.

奇怪的部分是-最初在我停止图表时起作用,现在在运行或停止图表时失败。
所以-它应该处于什么状态?

Strange part is - it initially worked when I stopped the graph, now it fails on running or stopped graph. So - what state it should be in??

我复制的MSDN中的示例采集器代码并未说明是否应停止或运行图形以获取图形缓冲区大小-但是图表的显示方式正在运行。我认为该图应该正在运行以填充缓冲区,但是我没有通过缓冲区的大小调整。

The sample grabber code in MSDN I copied does not say if the graph should be stopped or running to get the buffer size - but the way it is presented the graph is running. I assume the graph should be running to fill the buffer, but I am not getting pass the sizing the buffer.

该图还可以,所有过滤器均已连接并呈现为必需,可以在may app和GraphEdit中使用。

The graph is OK, all filters are conncted and renders as required, in may app and in GraphEdit.

我试图将捕获的静止帧保存到位图文件中,因此我需要缓冲区中已捕获的数据。

I am trying to save the captured still frame into bitmap file so I need the capured data in the buffer.

推荐答案

缓冲和 GetCurrentBuffer 为您提供了最新已知媒体示例的副本。因此,您可能遇到以下条件:尚无要复制的媒体样本和由于过渡到停止状态而释放了最新的已知媒体样本。在这两种情况下,相关请求都可能失败。从 SampleCB 复制数据,而不是从缓冲模式复制数据,这将是100%可靠的。

Buffering and GetCurrentBuffer expose you a copy of last known media sample. Hence, you might hit conditions "no media sample available yet to copy from" and "last known media sample is released due to transition to stopped state". In both cases the request in question might fail. Copy data from SampleCB instead of buffered mode and this is going to be one hundred percent reliable.

另请参见: ISampleGrabber :: GetCurrentBuffer()返回VFW_E_WRONG_STATE

这篇关于由于过滤器处于错误状态GetCurrentBuffer,因此无法执行该操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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