How can i tell when a Directshow.net conversion is done?
-
26-10-2019 - |
Question
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?
Solution
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); }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow