简体   繁体   English

我如何知道 Directshow.net 转换何时完成?

[英]How can i tell when a Directshow.net conversion is done?

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现在我有一个 Directshow.net 图,它接收一个视频文件并将其编码为一个文件,但它只是继续运行

int x = program.Run() 

in DirectShow.net and i want the program to close when the full conversion is done instead of me having to guess.在 DirectShow.net 中,我希望程序在完全转换完成后关闭,而不是我不得不猜测。

how can i tell if its done encoding programatically?我怎么知道它是否以编程方式完成编码?

If you have a mediaEvent variable you can check against the WaitForCompletion function to see if the code is done running.如果您有一个 mediaEvent 变量,您可以检查 WaitForCompletion function 以查看代码是否已完成运行。 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.如果 waitforcompletion 的结果(在本例中为 gh)不为 0,则它正在运行,如果它等于 0,则它已完成。

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); }  

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM