我怎样才能知道何时完成Directshow.net转换? [英] How can i tell when a Directshow.net conversion is done?

查看:93
本文介绍了我怎样才能知道何时完成Directshow.net转换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我有一个Directshow.net图形,它可以接收视频文件并将其编码为文件,但是它仍然可以继续运行

right now I have a Directshow.net graph that takes in a video file and encodes it to a file, however it just continues to run

int x = program.Run() 

在DirectShow.net中,我想要程序完成完全转换后就关闭了,而不必我猜测。

in DirectShow.net and i want the program to close when the full conversion is done instead of me having to guess.

我怎么知道它是否以编程方式完成了编码?

how can i tell if its done encoding programatically?

推荐答案

如果具有mediaEvent变量,则可以对照WaitForCompletion函数检查代码是否已完成运行。如果waitforcompletion的结果(在本例中为gh)不为0,则它​​正在运行;如果等于0,则完成。

If you have a mediaEvent variable you can check against the WaitForCompletion function to see if the code is done running. if the result of the waitforcompletion ( gh in this case) is not 0, it is running, if it is equal to 0, then its done.

const int E_Abort = unchecked((int)0x80004004); 
EventCode evCode; 
int gh = mediaEvent.WaitForCompletion(1000, out evCode); 
DsROTEntry rot = new DsROTEntry(filter); 
while (gh == E_Abort) 
{ System.Windows.Forms.Application.DoEvents(); 
gh = this.mediaEvent.WaitForCompletion(1000, out evCode); }  

这篇关于我怎样才能知道何时完成Directshow.net转换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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