Shoutbox

[?] VLC API - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [?] VLC API (/showthread.php?tid=69882)

[?] VLC API by Spunky on 12-25-2006 at 01:27 AM

There are 2 DLLs that come with VLC (one optional) that cotain it's own (fairly limited) API. I don't seem to be able to use either as I don't know if it's a mistake I'm making in the code or if it's just not possible in JScript. I know it's possible by embedding VLC into a HTML page(using JavaScript to control it), but this isn't really any good for what I want.

Can anybody offer any advice on a way of getting it working? (if possible, I've seen loads of Delphi, Python and C tutorials that just go straight over my head)


RE: [?] VLC API by -dt- on 12-25-2006 at 02:11 AM

quote:
Originally posted by SpunkyLoveMuff
Can anybody offer any advice on a way of getting it working? (if possible, I've seen loads of Delphi, Python and C tutorials that just go straight over my head)
link to any of them?, and ill help you do it
RE: [?] VLC API by matty on 12-25-2006 at 02:11 AM

What exactly are you trying to do?


RE: [?] VLC API by J-Thread on 12-25-2006 at 12:11 PM

quote:
Originally posted by SpunkyLoveMuff
C tutorials that just go straight over my head)

Translating C is not easy, but I think it should be possible in a lot of cases. For example all windows api calls (as normal functions in C) can be done in JScript, and using structs can be done in JScript, etc... What part troubles you?
RE: [?] VLC API by Spunky on 12-25-2006 at 01:13 PM

Example written in C

Thanks for offering to help guys

@Matty: At the moment, I'm just seeing what is possible, but I do have a few ideas.


RE: [?] VLC API by J-Thread on 12-25-2006 at 11:47 PM

That's C# and not C! Ok, it's of course no coincidence that the language was named C#, but it actually is different;).

As far as I can see it will not be very hard to translate this. I have not tested this, but it should be something like:

code:
var DllPath = "libvlc.dll"; // the full path to your dll

function VLC_Create() {
   return Interop.Call(DllPath, "VLC_Create"); // Interop expects an int
}

function VLC_TimeSet(/*int*/ iVLC, /*int*/ Seconds, /*bool*/ Relative) {
   return Interop.Call(DllPath, "VLC_TimeSet", iVLC, Seconds, (Relative?1:0));
}

// [...]



This way you should be able to create wrapper functions for all functions in the dll. Some points to notice:
ints (or Numbers in JScript) can be passed directly through interop.call
ref ints can be passed by assigning a 4 bytes databloc, use WriteDWORD to write the number on position 0 and then pass the datablocs pointer. After the function returns, you can read the int again.
bool's should be casted to 0 (=false) or 1 (=true)
strings can be passed directly, plus automatically passes the pointer
I'm not sure about the string array, maybe you can pass it directly, else you will have to use a databloc of size (total characters in the array strings) + (number of strings * 2).
Error, Mode and Pos can be seen as an int, just use the values described in their enums.
The structure will be the only hard part, use a databloc for that. Add the sizes and write the types to the right part of the bloc. I don't know the sizes of the types by heart, so can't give you those now, maybe I can help with that later, or maybe (I hope so) you can figure it out yourself. Int32 means 32 bits = 4 bytes, so Int64 = 8 bytes, not sure about the rest:P

Anybody correct me if I am wrong here, this is it in a nuttshell, I am doing this all right out of my head (I am not sure if that is correct english, but at least the dutchies will get what I say there :P) so there might be some mistakes. It should at least point you in the right direction!
RE: [?] VLC API by Spunky on 12-26-2006 at 02:22 AM

Thanks J-Thread, I'll give it a try first thing tomorrow and let you know :p