genius257

libvlc. Anyone interested?

Something you would be interrested in?   3 members have voted

  1. 1. Something you would be interrested in?

    • Yes
      3
    • No
      0

Please sign in or register to vote in this poll.

2 posts in this topic

#1 ·  Posted (edited)

So I've been playing around with libvlc.dll and i'm wondering if anyone's interested in the code and some examples?
Can't seem to find anyone who has done this in AutoIt, via the dll.

 

Thanks for your time :)

 

Edit:

Well I'm happy to know someone finds it interesting :)

I'll post the half done stuff here for now, but i will create a post in AutoIt Example Scripts, When i get more examples done :).

For now, any feedback would be great :D

The file itself: LibVLC.au3

Note: Before running the examples you need libvlc.dll, libvlccore.dll and the plugins folder from VLC. If you have it installed, you can copy them from your install folder, however i would recommend a fresh download, as i personally had some old plugins that gave me annoying message-boxes i have yet to find a way to deal with.

So getting the files without installing: download the windows installer (2.2.4 is the current as of this post). Open the exe with 7zip or your preferred program and extract the files and folder to the folder you wish to run the examples.

As i have not looked into rules and legal matters with VLC files i won't upload them ^^'

Example:

#include "LibVLC.au3"

Opt("GuiOnEventMode", 1)

$hWnd = GUICreate("AutoIt + VLC Example", 700, 320)
GUISetState(@SW_SHOW, $hWnd)

;pick a short video/audio-file, if you want to get the event
$sFilePath = FileOpenDialog("Select VLC compatible file", "", "All (*.*)", 1+2, "", $hWnd)
If @error<>0 Then Exit

$hLibVLC_dll = DllOpen("libvlc.dll")

$hVLC = libvlc_new($hLibVLC_dll, 0, 0)
$m = libvlc_media_new_path($hLibVLC_dll, $hVLC, $sFilePath);path object
$mp = libvlc_media_player_new_from_media($hLibVLC_dll, $m);player object
libvlc_media_release($hLibVLC_dll, $m);release the path object. We're done with it.
$mp_em = libvlc_media_player_event_manager($hLibVLC_dll, $mp);player event manager

;Create dllcallback to function and set to event: media player end reached
$pEndReached = DllCallbackRegister("_VLC_Event_EndReached", "none:cdecl", "handle;handle")
libvlc_event_attach($hLibVLC_dll, $mp_em, $libvlc_MediaPlayerEndReached, DllCallbackGetPtr($pEndReached), 0)

libvlc_media_player_set_hwnd($hLibVLC_dll, $mp, $hWnd)
libvlc_media_player_play($hLibVLC_dll, $mp)

;~ OnAutoItExitRegister("_CleanUp")
GUISetOnEvent(-3, "_MyExit", $hWnd)

While 1
    Sleep(10)
WEnd

Func _CleanUp()
    libvlc_media_player_stop($hLibVLC_dll, $mp);stop the video
    libvlc_media_player_release($hLibVLC_dll, $mp)
    libvlc_release($hLibVLC_dll, $hVLC)
    DllClose($hLibVLC_dll)
    DllCallbackFree($pEndReached)
    GUIDelete($hWnd)
EndFunc

Func _MyExit()
    _CleanUp()
    Exit
EndFunc

Func _VLC_Event_EndReached($event, $data); the event function
    ConsoleWrite("EndReached"&@CRLF)
EndFunc

The script sometimes won't shut down. Not sure what's causing it.

Edited by genius257
Re-phrasing
1 person likes this

Share this post


Link to post
Share on other sites



I votes "yes" :).

1 person likes this

Spoiler

My contributions to the AutoIt Community

Some messages & Apologizes:

If I hurt you, Please accept my apologies, I never (regardless of the situation) mean to hurt anybody!!!

Also, I am very busy with my project so I will appear in the last row of the online list, if you want to contact me: Email@TheDcoder.xyz

Or you can have a nice chat with me in freenode, I use the same nick on freenode too!

3fHNZJ.gif

PLEASE JOIN ##AutoIt AND HELP THE IRC AUTOIT COMMUNITY!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now