Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
31st January 2008, 18:30 | #1 | Link |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
MPC HC - Feature Requests: advanced API for complete control from another program
Dear developers!
As i said before i'm looking for API to control MPC from my HTPC application, written in C#. What I really need: 1) obtain notifications (playback started/completed) 2) now playing file info including properties, lenght and position 3) obtain list of avaluable audio tracks and current audio track 4) obtain list of avaluable subtitles and current subtitle 5) obtain chapter list 6) manipulate current playlist 7) turn subtitle by name/index (obtained from 3) 8) turn audio by name/index (obtained from 2) 9) get and set current audio delay 10) set current position You can implement this via WM_COPYDATA or via NamedPipes or via HTTP.
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
31st January 2008, 19:59 | #2 | Link |
Registered User
Join Date: Jan 2007
Posts: 455
|
Check you mailbox
__________________
Tired of tearing? Try this Media Player Classic mod : http://mpc-hc.sourceforge.net |
1st February 2008, 15:13 | #3 | Link |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
Hi!
Unfortunally I havn't Internet Connection at my home and I can't use MSM at my office. Oh, and my Inbox is 97% full. So why not just discuss this API into thread? talking about implementation I think the best way will be to use STDIN/STDOUT and special command-line parameter, for example /SLAVE. In this case MPC will listen commands from STDIN and reply to STDOUT. For example I can propose such protocol EXEC MPC.EXE /SLAVE STDOUT: MPC, version XXX, bla-bla-bla STDIN:CREATE PLAYLIST n // where n means playlist size STDIN:fileName1.avi STDIN:fileName2.avi ... STDIN:fileNamen.avi STDIN:PLAY x // where [B]x[X] means playlist position STDOUT:PLAYBACK STARTED STDOUT:fileName STDIN:LIST AUDIO STREAMS STDOUT:n m // where n means count, m means current stream STDOUT:STREAM NAME 1 STDOUT:STREAM NAME 2 ... STDOUT:STREAM NAME n STDIN: SET AUDIO STREAM [b]x[b] etc... What does You think?
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
1st February 2008, 19:06 | #4 | Link |
Registered User
Join Date: Jan 2007
Posts: 455
|
I think the WM_COPYDATA will be easier. As argument you give me you app main windows handle :
Start : EXEC MPC.EXE /SLAVE 0x1000D1 Dialog message could then be a string starting with a code and the parameters : Ex : // After launch MPC -> Your App : code 1 follow by MPC window handle 1|0x120120 // Add to playlist Your App -> MPC : code 2 follow by filenames 2|filename1|filename2 ... Is it ok for you?
__________________
Tired of tearing? Try this Media Player Classic mod : http://mpc-hc.sourceforge.net |
4th February 2008, 14:35 | #5 | Link |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
I think yes, WM_COPYDATA is sutable too
by the way: to avoid any mistakes let's use UTF8 encoding for filenames etc.
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
10th February 2008, 12:29 | #6 | Link |
Registered User
Join Date: Jan 2007
Posts: 455
|
It's not entirely finished, but i have a first release for mpc API downloadable from here : http://www.zshare.net/download/7381233e7c777c/
API test program is available on SF here : http://mpc-hc.svn.sourceforge.net/vi...ps/MPCTestAPI/ Currently available functions are : 1) obtain notifications (playback started/completed) 2) now playing file info including properties, lenght and position 6) manipulate current playlist (add, clear, start playing) 9) set current audio delay (no get yet) 10) set current position + Standard commands : open, play, pause, stop, close For the "Get" functions how do you want to proceed? You send a cmd "Ask for XXX" and i return a notification with the value? It's not possible to return data via WM_COPYDATA messages isn't it?
__________________
Tired of tearing? Try this Media Player Classic mod : http://mpc-hc.sourceforge.net |
11th February 2008, 13:22 | #7 | Link | ||
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
Quote:
Quote:
1) if value is small (fits to 32bit signed integer) it's possible return it as LRESULT 2) send WM_COPYDATA as answer
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS Last edited by dimzon; 11th February 2008 at 13:31. |
||
11th February 2008, 14:07 | #8 | Link |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
Hey, Casimir666 I found yet another way for "Get" functions
Actually we can use WM_GETTEXT to obtain data from MPC. So you just need to create special invisible window or control witch contains everything in XML form (and update it every time something changed). For example: Code:
<mpc-info> <current-file>C:\myvideo.avi<current-file> <duration>01:21:57</duration> <position>01:09:32</position> <audio-delay-in-ms>0</audio-delay-in-ms> <subtitle-delay-in-ms>0</subtitle-delay-in-ms> <audio-track index="1" active="yes">AC3 Russian</audio-track> <audio-track index="2">AC3 English</audio-track> <show-subtitles>no</show-subtitles> </mpc-info>
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
11th February 2008, 16:11 | #9 | Link |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
what information I need asap:
Code:
private string[] audioTracks; private string[] subtitles; private int currentAudioTrack; private int currentSubtitle; private int audioDelay; private int subtitleDelay; private string[] playlist; private int currentFile; private string[] chapters; private int currentChapter; private TimeSpan duration; private TimeSpan position;
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
24th February 2008, 23:37 | #10 | Link |
Registered User
Join Date: Apr 2004
Posts: 402
|
what about define a string model and send it by a WM_COPYDATA message ?
for example for a CMD_GETPLAYLIST : current_file|nb_of_files|file1|file2|... CMD_GETAUDIOTRACKS : current_audio|nb_of_audio|audio1|audio2|... CMD_GETSUBTRACKS : sub_are_active|current_sub|nb_of_sub|sub1|sub2|... I will try to implement something like that during the week. |
25th February 2008, 08:24 | #11 | Link |
Registered User
Join Date: Jan 2007
Posts: 455
|
Dimzon I'm terribly confused i realize i haven't respond to your questions, and i didn't works on you API for the last 2 weeks. MatMaul is now a member of mpc-hc and he can give you a hand for this :-)
I agree with him it's better to stay on wm_copy messages to communicate between both application. About you question on OSD : the actual implementation in mpc is far from perfect, and it have several problems : - didn't works with all renderer - on windowed vmr, OSD is set before resizing - it's quite ugly Maybe you can keep you OSD solution for the moment, and we will see later if we can do better osd than can be pilot remotly...
__________________
Tired of tearing? Try this Media Player Classic mod : http://mpc-hc.sourceforge.net |
26th February 2008, 12:24 | #12 | Link |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
Hi!
Actually obtaining information via WM_GETTEXT is much more easy to implement in both sides (MPC must update this invisible window and client don't need to catch to many different messages. And some additional ideas (just ideas, what do you think) 1) How about to make MPC out-of-process COM server? 2) How about to split MPC into 2 parts. First part - mplayerc.dll will contain everything playback-related. Second part mplayerc.exe will be frontend.
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
26th February 2008, 16:09 | #13 | Link |
Registered User
Join Date: Apr 2004
Posts: 402
|
sorry I don't know very well how to do with WM_GETTEXT and I began to do it yesterday with WM_COPYDATA.
here is my work : http://www.etud.insa-toulouse.fr/~mv...pc_api_test.7z I will think about how to do with WM_GETTEXT. EDIT : in this case we also need a XML API. I don't want to use msxml because it will add a dependancy (it is not staticaly linkable). Last edited by MatMaul; 26th February 2008 at 16:13. |
26th February 2008, 17:41 | #14 | Link | |
BeHappy/MeGUI developer
Join Date: Oct 2003
Location: Moscow, Russia
Posts: 1,727
|
Quote:
You doesn't need any XML API in this case - everything you need is simple string concatenation and special symbol replacement
__________________
BeHappy - AviSynth-based audio transcoding tool Audio encoding via AviSynth On2 VP7 is great in quality but it is unusable for long-term video backup puposes! Sincerely Yours, MCPD/MCTS |
|
26th February 2008, 22:32 | #16 | Link |
Registered User
Join Date: Jan 2007
Posts: 455
|
It's a little more complicated (need one interface for command and one for callback), and need to be register executable on machine to works. Maybe we will stay on the wm_copymessage solution for the moment
Could be interesting, but i have no idea how complicated it will be to transform mpc in dll...
__________________
Tired of tearing? Try this Media Player Classic mod : http://mpc-hc.sourceforge.net |
2nd March 2008, 00:30 | #17 | Link | |
Registered User
Join Date: Feb 2006
Posts: 149
|
Quote:
|
|
7th March 2008, 15:33 | #18 | Link |
Registered User
Join Date: Mar 2005
Location: Region 4
Posts: 518
|
@Casimir666
When will we see this API added to the latest releases of MPC HC? I am very interested in seeing MPC have an API. |
7th March 2008, 22:50 | #19 | Link |
Registered User
Join Date: Apr 2004
Posts: 402
|
commited in the svn repository.
here is a build : http://www.etud.insa-toulouse.fr/~mv...layerc_r443.7z Some features are still missing. |
7th March 2008, 23:12 | #20 | Link | |
Registered User
Join Date: Jan 2007
Posts: 455
|
Quote:
http://mpc-hc.svn.sourceforge.net/vi...ps/MPCTestAPI/
__________________
Tired of tearing? Try this Media Player Classic mod : http://mpc-hc.sourceforge.net |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|