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

谁都会走 提交于 2020-01-17 04:38:30

问题


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() 

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?


回答1:


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


来源:https://stackoverflow.com/questions/6312084/how-can-i-tell-when-a-directshow-net-conversion-is-done

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!