views:

26

answers:

1

Hi

I'm using mplayer in my C# app running in .NET on Windows and Mono on Linux. I start mplayer using Process.Start and run it in -slave -idle.

To play a video, I write to stdin like this:

loadfile {filename}

When I'm ready to play the next video, I call loadfile again with the new filename.

Problem: if I play a video and then sometime go to delete that file, I can't - on Windows I get "The process cannot access the file because it is being used by another process". I check with Process Explorer and see that mplayer still has a handle open on the file, even though it finished playing it some time ago.

Any ideas on how I can get mplayer to release handles on files that it has finished playing?

Thanks in advance

A: 

Use a pipe.

supercheetah
Thanks. I couldn't make MPlayer work with a named pipe on Windows - I got it to connect to my pipe, but then it wouldn't listen to any commands... And documentation for doing this on Windows is thin on the ground. I have ended up using two MPlayer processes and switching between them (closing and restarting one to release handles while the other is playing)
TheNextman