API - Control from another application

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
coltree

API - Control from another application

Postby coltree » 02 Jan 2005 14:29

I'm an amature programer, and I am trying to write on my own an ATI Remote Wonder driver for VLC.

The driver use the windows messages to communicate to the programs it controls. You get the window handle and you deliver a message with PostMessage(handle, message, prm1, prm2). The example provided is of winamp frontend/plug-in control API c file that provides the nessasery constants messages so you know how to control winamp.

I have looked at the VLC API and i've got messed up.
Is there a file like that for VLC?
How do I post a message to VLC to play, stop, open file, volume up...?
I can send WM_CHAR messages to use the HOT KEYS feature but I want to bypass that.

Help will be appreciated.

mokdevel
Blank Cone
Blank Cone
Posts: 36
Joined: 21 Apr 2005 13:53
Contact:

Re: API - Control from another application

Postby mokdevel » 21 Apr 2005 13:58

Hello,
The driver use the windows messages to communicate to the programs it controls. You get the window handle and you deliver a message with PostMessage(handle, message, prm1, prm2). The example provided is of winamp frontend/plug-in control API c file that provides the nessasery constants messages so you know how to control winamp.

I have looked at the VLC API and i've got messed up.
I'm looking for similar information. Is there an API where the messages have been defined? I'd need this for my HTPC project to make it support VLC.

/mokdevel - http://www.netikka.net/jhirvo/mok/

mokdevel
Blank Cone
Blank Cone
Posts: 36
Joined: 21 Apr 2005 13:53
Contact:

Re: API - Control from another application

Postby mokdevel » 19 May 2005 13:56

Hello,

Just to keep you updated. I did *not* find a proper API to support VLC, but I did certain things and can now use VLC in my HTPC project.

- Remote control is done via sending keypresses from remote to VLC window. This would work also for remote control software you might be using (eg. ATI, RealMagic, Girder...)
- Information query is done using the http interface and parsing the html page (look in info.html).

BTW, where could I find proper documentation on what information can be retrieved via the http interface. For examle, I can find a lot of necessary information from info.html (eg. channels).

--- clip from info.html ---
<vlc id="foreach" param1="info" param2="cat.info" />
<vlc id="value" param1="info.name" /> : <vlc id="value" param1="info.value" />
--- clip from info.html ---

Is there any way to show *just* channels information on a web page without using 'cat.info'?

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Re: API - Control from another application

Postby dionoea » 19 May 2005 21:24

Hello,
BTW, where could I find proper documentation on what information can be retrieved via the http interface. For examle, I can find a lot of necessary information from info.html (eg. channels).
http://videolan.org/doc/ in the play howto
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)

mokdevel
Blank Cone
Blank Cone
Posts: 36
Joined: 21 Apr 2005 13:53
Contact:

Re: API - Control from another application

Postby mokdevel » 20 May 2005 09:39

Hello,
BTW, where could I find proper documentation on what information can be retrieved via the http interface. For examle, I can find a lot of necessary information from info.html (eg. channels).
http://videolan.org/doc/ in the play howto
Actually that page does not give me the information I'm looking for. Try to run VLC with the http interface. There is a default web page to use with a couple of buttons, playlist and a link to the info.html page. When you click on that, you get more information on streams; for example amount of audio channels.

How could I show *just* the amount of audio channels on that info-page?

This clip will return the time played at this moment of time.
--- index.html ---
Time: <span id="time"><vlc id="value" param1="stream_time" /> s</span>
--- index.html ---

What kind of a 'param1' could I give the web page to show *just* the channel amount?

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Postby dionoea » 20 May 2005 10:30

i would try "audio-channels". if that doesn't work, i doubt that there is an easy method to retreive that info.
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)

mokdevel
Blank Cone
Blank Cone
Posts: 36
Joined: 21 Apr 2005 13:53
Contact:

Postby mokdevel » 23 May 2005 11:00

i would try "audio-channels". if that doesn't work, i doubt that there is an easy method to retreive that info.
I looked in to the code and it seems that such variable is not available. Oh well, I'll parse the info.html in order to get the information.

dionoea
Cone Master
Cone Master
Posts: 5157
Joined: 03 Dec 2003 23:09
Location: Paris, France

Postby dionoea » 23 May 2005 11:05

audio-channel is available in vlc core. I just don't know if the plugin has access to it
Antoine Cellerier
dionoea
(Please do not use private messages for support questions)

mokdevel
Blank Cone
Blank Cone
Posts: 36
Joined: 21 Apr 2005 13:53
Contact:

Postby mokdevel » 23 May 2005 11:11

audio-channel is available in vlc core. I just don't know if the plugin has access to it
Correct. Sorry for my bad explanation. The plugin just don't give the possibility to ask for it separately.

The DJ
Cone Master
Cone Master
Posts: 5987
Joined: 22 Nov 2003 21:52
VLC version: git
Operating System: Mac OS X
Location: Enschede, Holland
Contact:

Postby The DJ » 23 May 2005 16:49

Still nice to see that you are working on this mokdevel :D
Don't use PMs for support questions.

mokdevel
Blank Cone
Blank Cone
Posts: 36
Joined: 21 Apr 2005 13:53
Contact:

Postby mokdevel » 23 May 2005 19:14

Still nice to see that you are working on this mokdevel :D
:-)

I have the VLC plugin playing movies and mp3's while I enjoy everything on the sofa tapping the keys of the remote...

This player is *amazing*.

HyperHacker
Cone that earned his stripes
Cone that earned his stripes
Posts: 132
Joined: 18 Jan 2005 05:30
VLC version: 0.8.6e
Operating System: WinXP SP2
Location: Not there.
Contact:

Postby HyperHacker » 24 May 2005 04:31

I've done something like this before. What you need to do is find the handle of each individual button and send WM_LBUTTONDOWN and WM_LBUTTONUP messages to simulate clicking it. Unfortunately I don't know if VLC uses real buttons or just fakes it by drawing them on the screen...
[ PC: WXP Pro SP2 | 1GB RAM | 250GB HD | 256MB Radeon 9550 | 1.7ghz AMD Sempron | VLC 0.8.6e (wxWidgets) ]
[ Laptop: Gateway MX7515 | WXP Pro SP2 | 1GB RAM | 100GB HD | 128MB Mobility Radeon X600 | 2.6ghz AMD Athlon | VLC 0.8.6e (wxWidgets) ]

mokdevel
Blank Cone
Blank Cone
Posts: 36
Joined: 21 Apr 2005 13:53
Contact:

Postby mokdevel » 24 May 2005 08:40

I've done something like this before. What you need to do is find the handle of each individual button and send WM_LBUTTONDOWN and WM_LBUTTONUP messages to simulate clicking it. Unfortunately I don't know if VLC uses real buttons or just fakes it by drawing them on the screen...
You could do it that way. I've done it by sending 'hotkeys' which I read from the vlcrc file. Then you don't have to worry about the buttons. Actually you don't even need to worry about the GUI as you could only use http-interface and send the hotkeys to the movie window.

What I miss is the possibility to select a certain listposition in the playlist and start playing it. As there is no button/interface for 'play item nro 12' I have used the http interface to control that (=works, not nice though).

Guest

Postby Guest » 24 May 2005 09:33

I've done something like this before. What you need to do is find the handle of each individual button and send WM_LBUTTONDOWN and WM_LBUTTONUP messages to simulate clicking it. Unfortunately I don't know if VLC uses real buttons or just fakes it by drawing them on the screen...
You could do it that way. I've done it by sending 'hotkeys' which I read from the vlcrc file. Then you don't have to worry about the buttons. Actually you don't even need to worry about the GUI as you could only use http-interface and send the hotkeys to the movie window.
How do you sending 'hotkeys'? I've been trying to that but without success.

Thanks.

mokdevel
Blank Cone
Blank Cone
Posts: 36
Joined: 21 Apr 2005 13:53
Contact:

Postby mokdevel » 24 May 2005 11:49

How do you sending 'hotkeys'? I've been trying to that but without success.
This is then only for Windows.

First look in your vlcrc file (in C:\Documents and Settings\<YourUsername>\Application Data\vlc

From the file you'll find:
# Play/Pause (key)
#key-play-pause=Space

The key for play/pause if by default 'space'. If you've changed it to something else, you should read the hotkey from this file.

The idea is simple.
- Convert the key in to a scan code (space = #32, enter = #13, F1 = #228, ...)
- Make a program that launches VLC
- Searches for it's window handle (formname is 'wxWindowClassNR')
- Bring VLC to front (or set the focus to it)
- Use a 'sendkeys' function that makes it possible to send keypresses to a specific window handle.
- SendKeys(ToWindowHandle, KeyScanCode);

Pretty much everything can be found from the net via google.

HTH,

HyperHacker
Cone that earned his stripes
Cone that earned his stripes
Posts: 132
Joined: 18 Jan 2005 05:30
VLC version: 0.8.6e
Operating System: WinXP SP2
Location: Not there.
Contact:

Postby HyperHacker » 25 May 2005 02:50

Problem with hotkeys, though, is the program needs to know what key does what.
[ PC: WXP Pro SP2 | 1GB RAM | 250GB HD | 256MB Radeon 9550 | 1.7ghz AMD Sempron | VLC 0.8.6e (wxWidgets) ]
[ Laptop: Gateway MX7515 | WXP Pro SP2 | 1GB RAM | 100GB HD | 128MB Mobility Radeon X600 | 2.6ghz AMD Athlon | VLC 0.8.6e (wxWidgets) ]

mokdevel
Blank Cone
Blank Cone
Posts: 36
Joined: 21 Apr 2005 13:53
Contact:

Postby mokdevel » 25 May 2005 08:17

Problem with hotkeys, though, is the program needs to know what key does what.
Umm,
I don't exactly know what kind of a problem are you thinking of... In (Win)VLC there are only some twenty different hotkeys that are known by the application. Those are listed in vlcrc and with those you can do pretty much everything you need (except set a certain position in playlist).

pete^
New Cone
New Cone
Posts: 4
Joined: 25 May 2005 15:04

Postby pete^ » 26 May 2005 20:32

mokdevel: How do I find the window handle to VLC? And does SendKeys work in Visual C++? And if it works in Visual C++, is there any special libraries I have to include?

thanks in advance :)

pete

mokdevel
Blank Cone
Blank Cone
Posts: 36
Joined: 21 Apr 2005 13:53
Contact:

Postby mokdevel » 26 May 2005 21:06

mokdevel: How do I find the window handle to VLC? And does SendKeys work in Visual C++? And if it works in Visual C++, is there any special libraries I have to include?
I do my coding in Delphi so I can not give you help on how to do this in VC++. Finding window handles and sending keys to it, it really basic stuff. With basic stuff I mean that there must be others who have had the same problem in VC++. Try google...


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 14 guests