Video Player based on VLC

Windows specific forum
Philippe-felixer76-2
Enthusiast
Enthusiast
Posts: 135
Joined: Sat Aug 18, 2007 7:09 am
Location: Netherlands

Video Player based on VLC

Post by Philippe-felixer76-2 »

Code: Select all

Global *base = OpenLibrary(0, "C:\Program Files\VideoLAN\VLC\libvlc.dll")
Global file$

OpenWindow(1, 0, 0, 60, 20, "PureBasic VLC dll", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#WS_CLIPCHILDREN|#PB_Window_SizeGadget| #PB_Window_Maximize )
ScrollBarGadget(0, 40, 0, 0, 20, 0, 1000, 1)
ButtonGadget(1, 0, 0, 20, 20, "F") ; file
ButtonGadget(2, 20, 0, 20, 20, ">") ; play
SetGadgetText(2, "||")
OpenWindow(0, 0, 0, 60, 0, "", #PB_Window_BorderLess)
SetWindowColor(0, RGB(0,0,0))
SetParent_(WindowID(0), WindowID(1))

If *base
    Dim vlc_args.s(8)
    vlc_args(0) = "-I"
    vlc_args(1) = "dummy"
    vlc_args(2) = "--ignore-config"
    vlc_args(3) = "--plugin-path=C:\\Program Files\\VideoLAN\\VLC\\plugins\\"
    CallFunction(0, "libvlc_exception_init", @ex)
    *inst = CallFunction(0, "libvlc_new", 4, @vlc_args(), @ex)
    ; 0.8.6 method
    If Len(file$)=0
       file$ = OpenFileRequester("Select media file", "", "*.*", 0)
       If Len(file$)=0
          End
       EndIf   
    EndIf
    item = CallFunction(0, "libvlc_playlist_add", *inst, file$, #Null, @ex)
    CallFunction(0, "libvlc_playlist_play", *inst, item, 0, #Null, @ex)
    drawable = WindowID(0)
    CallFunction(0, "libvlc_video_set_parent", *inst, drawable, @ex)     
    While wevent<>#PB_Event_CloseWindow
        wevent = WindowEvent()
        If EventWindow()=0
           SetActiveWindow(1)
        EndIf
        If wevent = #PB_Event_Gadget
           Select EventGadget()
              Case 0 ; slider
                 procent.l = GetGadgetState(0)     
                 CallFunction(0, "libvlc_media_player_set_time", *mp, stukje.q*procent, @ex)
              Case 1 ; file
                 file$ = OpenFileRequester("Select media file", "", "*.*", 0)
                 If Len(file$)
                    CallFunction(0, "libvlc_playlist_stop", *inst, @ex)
                    CallFunction(0, "libvlc_playlist_clear", *inst, @ex)
                    item = CallFunction(0, "libvlc_playlist_add", *inst, file$, #Null, @ex)
                    CallFunction(0, "libvlc_playlist_play", *inst, item, 0, #Null, @ex)                   
                    Delay(100)
                 EndIf
              Case 2 ; play / pause
                 If GetGadgetText(2) = ">"
                    CallFunction(0, "libvlc_media_player_play", *mp, @ex)
                    SetGadgetText(2, "||")                 
                 Else
                    CallFunction(0, "libvlc_media_player_pause", *mp, @ex)
                    SetGadgetText(2, ">")
                 EndIf
           EndSelect
        EndIf
        If wevent=#PB_Event_SizeWindow
           If IsGadget(0)
              ResizeGadget(0, 40, WindowHeight(1)-20, WindowWidth(1)-40, 20)
           EndIf
           If IsGadget(1)
              ResizeGadget(1, 0, WindowHeight(1)-20, 20, 20)
           EndIf
           If IsGadget(2)
              ResizeGadget(2, 20, WindowHeight(1)-20, 20, 20)
           EndIf
           ResizeWindow(0, 0, 0, WindowWidth(1), WindowHeight(1)-20)
        EndIf
        Delay(10)
        *mp = CallFunction(0, "libvlc_playlist_get_media_player", *inst, @ex)
        state = CallFunction(0, "libvlc_media_player_get_state", *mp, @ex)           
        Select state
           Case 0 ; libvlc_NothingSpecial    
           Case 1 ; libvlc_Opening    
           Case 2 ; libvlc_Buffering    
           Case 3 ; libvlc_Playing    
              osizex = CallFunction(0, "libvlc_video_get_width", *mp, @ex)
              osizey = CallFunction(0, "libvlc_video_get_height", *mp, @ex)
              If sizex<>osizex And sizey<>osizey
                 sizex=osizex
                 sizey=osizey
                 ResizeWindow(0, #PB_Ignore, #PB_Ignore, sizex, sizey)
                 ResizeWindow(1, #PB_Ignore, #PB_Ignore, sizex, sizey+20)
                 length.q = CallFunction(0, "libvlc_media_player_get_length", *mp, @ex)                 
                 stukje.q = length.q / 1000
                 If length=0
                    DisableGadget(0, 1)
                 Else
                    DisableGadget(0, 0)
                 EndIf
                 SetGadgetText(2, "||")                             
              EndIf   
              curpos.q = CallFunction(0, "libvlc_media_player_get_time", *mp, @ex)
              If curpos.q<>curposo.q
                 curposo.q = curpos.q
                 stukje.q = length.q / 1000
                 If stukje>0 And curpos>0
                    percentage.l = curpos/stukje
                    SetGadgetState(0, percentage)
                 EndIf
              EndIf
           Case 4 ; libvlc_Paused    
           Case 5 ; libvlc_Stopped    
                 DisableGadget(2, 0)
           Case 6 ; libvlc_Forward    
           Case 7 ; libvlc_Backward    
           Case 8 ; libvlc_Ended    
           Case 9 ; libvlc_Error
        EndSelect   
    Wend
    If *mp
       CallFunction(0, "libvlc_media_player_stop", *mp, @ex)
       CallFunction(0, "libvlc_media_player_release", *mp)
    EndIf
    CallFunction(0, "libvlc_release", *inst)
    CloseLibrary(0)
EndIf
CloseLibrary(0)
End 
Is it possible to use this same code under linux or macosx
with purebasic? (Using the .so under linux and library for osx)

Gr,
Phil.
User avatar
Progi1984
Addict
Addict
Posts: 806
Joined: Fri Feb 25, 2005 1:01 am
Location: France > Rennes
Contact:

Post by Progi1984 »

A road :

Code: Select all




CompilerSelect #PB_Compiler_OS
  CompilerCase #PB_OS_Linux
  ;{
    #WS_CLIPCHILDREN = 0
    Global *base = OpenLibrary(0, "/usr/lib/libvlc.so.0.0.0")
  ;}
  CompilerCase #PB_OS_Windows
  ;{
    Global *base = OpenLibrary(0, "C:\Program Files\VideoLAN\VLC\libvlc.dll")
  ;}
  
CompilerEndSelect


Global file$
OpenWindow(1, 0, 0, 60, 20, "PureBasic VLC dll", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#WS_CLIPCHILDREN|#PB_Window_SizeGadget| #PB_Window_Maximize )
ScrollBarGadget(0, 40, 0, 0, 20, 0, 1000, 1)
ButtonGadget(1, 0, 0, 20, 20, "F") ; file
ButtonGadget(2, 20, 0, 20, 20, ">") ; play
SetGadgetText(2, "||")
OpenWindow(0, 0, 0, 60, 0, "", #PB_Window_BorderLess)
SetWindowColor(0, RGB(0,0,0))
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
  SetParent_(WindowID(0), WindowID(1))
CompilerEndIf
If *base
    Dim vlc_args.s(8)
    vlc_args(0) = "-I"
    vlc_args(1) = "dummy"
    vlc_args(2) = "--ignore-config"
    vlc_args(3) = "--plugin-path=C:\\Program Files\\VideoLAN\\VLC\\plugins\\"
    CallFunction(0, "libvlc_exception_init", @ex)
    *inst = CallFunction(0, "libvlc_new", 4, @vlc_args(), @ex)
    ; 0.8.6 method
    If Len(file$)=0
       file$ = OpenFileRequester("Select media file", "", "*.*", 0)
       If Len(file$)=0
          End
       EndIf   
    EndIf
    item = CallFunction(0, "libvlc_playlist_add", *inst, file$, #Null, @ex)
    CallFunction(0, "libvlc_playlist_play", *inst, item, 0, #Null, @ex)
    drawable = WindowID(0)
    CallFunction(0, "libvlc_video_set_parent", *inst, drawable, @ex)     
    While wevent<>#PB_Event_CloseWindow
        wevent = WindowEvent()
        If EventWindow()=0
           SetActiveWindow(1)
        EndIf
        If wevent = #PB_Event_Gadget
           Select EventGadget()
              Case 0 ; slider
                 procent.l = GetGadgetState(0)     
                 CallFunction(0, "libvlc_media_player_set_time", *mp, stukje.q*procent, @ex)
              Case 1 ; file
                 file$ = OpenFileRequester("Select media file", "", "*.*", 0)
                 If Len(file$)
                    CallFunction(0, "libvlc_playlist_stop", *inst, @ex)
                    CallFunction(0, "libvlc_playlist_clear", *inst, @ex)
                    item = CallFunction(0, "libvlc_playlist_add", *inst, file$, #Null, @ex)
                    CallFunction(0, "libvlc_playlist_play", *inst, item, 0, #Null, @ex)                   
                    Delay(100)
                 EndIf
              Case 2 ; play / pause
                 If GetGadgetText(2) = ">"
                    CallFunction(0, "libvlc_media_player_play", *mp, @ex)
                    SetGadgetText(2, "||")                 
                 Else
                    CallFunction(0, "libvlc_media_player_pause", *mp, @ex)
                    SetGadgetText(2, ">")
                 EndIf
           EndSelect
        EndIf
        If wevent=#PB_Event_SizeWindow
           If IsGadget(0)
              ResizeGadget(0, 40, WindowHeight(1)-20, WindowWidth(1)-40, 20)
           EndIf
           If IsGadget(1)
              ResizeGadget(1, 0, WindowHeight(1)-20, 20, 20)
           EndIf
           If IsGadget(2)
              ResizeGadget(2, 20, WindowHeight(1)-20, 20, 20)
           EndIf
           ResizeWindow(0, 0, 0, WindowWidth(1), WindowHeight(1)-20)
        EndIf
        Delay(10)
        *mp = CallFunction(0, "libvlc_playlist_get_media_player", *inst, @ex)
        state = CallFunction(0, "libvlc_media_player_get_state", *mp, @ex)           
        Select state
           Case 0 ; libvlc_NothingSpecial   
           Case 1 ; libvlc_Opening   
           Case 2 ; libvlc_Buffering   
           Case 3 ; libvlc_Playing   
              osizex = CallFunction(0, "libvlc_video_get_width", *mp, @ex)
              osizey = CallFunction(0, "libvlc_video_get_height", *mp, @ex)
              If sizex<>osizex And sizey<>osizey
                 sizex=osizex
                 sizey=osizey
                 ResizeWindow(0, #PB_Ignore, #PB_Ignore, sizex, sizey)
                 ResizeWindow(1, #PB_Ignore, #PB_Ignore, sizex, sizey+20)
                 length.q = CallFunction(0, "libvlc_media_player_get_length", *mp, @ex)                 
                 stukje.q = length.q / 1000
                 If length=0
                    DisableGadget(0, 1)
                 Else
                    DisableGadget(0, 0)
                 EndIf
                 SetGadgetText(2, "||")                             
              EndIf   
              curpos.q = CallFunction(0, "libvlc_media_player_get_time", *mp, @ex)
              If curpos.q<>curposo.q
                 curposo.q = curpos.q
                 stukje.q = length.q / 1000
                 If stukje>0 And curpos>0
                    percentage.l = curpos/stukje
                    SetGadgetState(0, percentage)
                 EndIf
              EndIf
           Case 4 ; libvlc_Paused   
           Case 5 ; libvlc_Stopped   
                 DisableGadget(2, 0)
           Case 6 ; libvlc_Forward   
           Case 7 ; libvlc_Backward   
           Case 8 ; libvlc_Ended   
           Case 9 ; libvlc_Error
        EndSelect   
    Wend
    If *mp
       CallFunction(0, "libvlc_media_player_stop", *mp, @ex)
       CallFunction(0, "libvlc_media_player_release", *mp)
    EndIf
    CallFunction(0, "libvlc_release", *inst)
    CloseLibrary(0)
EndIf
CloseLibrary(0)
End 
Philippe-felixer76-2
Enthusiast
Enthusiast
Posts: 135
Joined: Sat Aug 18, 2007 7:09 am
Location: Netherlands

Strange stuff using external dll's

Post by Philippe-felixer76-2 »

Progi1984 wrote:A road :
....
Thx, ill try that later on..

Meanwhile can someone explain to me what i'm doing wrong,
i always have problems using external DLL's.

Code: Select all

Global *base = OpenLibrary(0, "C:\Program Files\VideoLAN\VLC\libvlc.dll")
Global file$, *inst

OpenWindow(1, 0, 0, 60, 20, "PureBasic VLC dll", #PB_Window_SystemMenu|#PB_Window_ScreenCentered|#WS_CLIPCHILDREN|#PB_Window_SizeGadget| #PB_Window_Maximize )
;If CreateGadgetList(WindowID(1)) ; pb 4.20-
   ScrollBarGadget(0, 40, sizey, sizex-40, 20, 0, 1000, 1)
   ButtonGadget(1, 0, sizey, 20, 20, "F") ; file
   ButtonGadget(2, 20, sizey, 20, 20, ">") ; play
   SetGadgetText(2, "||")
;EndIf
OpenWindow(0, 0, 0, 60, 0, "", #PB_Window_BorderLess, WindowID(1))
SetWindowColor(0, RGB(0,0,0))

Procedure newfile(file$)
   If Len(file$)
      item = CallFunction(0, "libvlc_playlist_add", *inst, file$, #Null, @ex) 
      CallFunction(0, "libvlc_playlist_play", *inst, item, 0, #Null, @ex)                    
   EndIf
EndProcedure

If *base
    Dim vlc_args.s(8) 
    vlc_args(0) = "-I"
    vlc_args(1) = "dummy"
    vlc_args(2) = "--ignore-config"
    vlc_args(3) = "--plugin-path=C:\\Program Files\\VideoLAN\\VLC\\plugins\"
    CallFunction(0, "libvlc_exception_init", @ex) 
    *inst = CallFunction(0, "libvlc_new", 4, @vlc_args(), @ex)
    
    file$ = ""
    If Len(file$)=0
       file$ = OpenFileRequester("Select media file", "", "*.*", 0)
       If Len(file$)=0
          End
       EndIf   
    EndIf
    
    item = CallFunction(0, "libvlc_playlist_add", *inst, file$, #Null, @ex) 
    CallFunction(0, "libvlc_playlist_play", *inst, item, 0, #Null, @ex) 
    drawable = WindowID(0) 
    CallFunction(0, "libvlc_video_set_parent", *inst, drawable, @ex)  
    
   start:
    
    While wevent<>#PB_Event_CloseWindow
        wevent = WindowEvent()
        If EventWindow()=0
           SetActiveWindow(1)
        EndIf
        If wevent = #PB_Event_Gadget
           Select EventGadget()
              Case 0 ; slider
                 procent.l = GetGadgetState(0)      
                 CallFunction(0, "libvlc_media_player_set_time", *mp, stukje.q*procent, @ex)
              Case 1 ; file
                 file$ = OpenFileRequester("Select media file", "", "*.*", 0)
                 If Len(file$)
                    CallFunction(0, "libvlc_playlist_stop", *inst, @ex) 
                    CallFunction(0, "libvlc_playlist_clear", *inst, @ex)
                    
                    ; Library function TO ADD A NEW FILE
                    ; ----------------------------------
                    ; - comment 2 lines below 
                    ; - uncomment  ';newfile(file$)' below

                    item = CallFunction(0, "libvlc_playlist_add", *inst, file$, #Null, @ex) 
                    CallFunction(0, "libvlc_playlist_play", *inst, item, 0, #Null, @ex)                    
                           
                    ;Gosub newfile  ; Works when 'goto start' below is uncommented, not with return!
                    ;newfile(file$) ; Doesn't work!
                    ;Goto newfile   ; Works (when 'goto start' below is uncommented..)
                 EndIf
              Case 2 ; play / pause
                 If GetGadgetText(2) = ">"
                    CallFunction(0, "libvlc_media_player_play", *mp, @ex) 
                    SetGadgetText(2, "||")                  
                 Else
                    CallFunction(0, "libvlc_media_player_pause", *mp, @ex)
                    SetGadgetText(2, ">")
                 EndIf
           EndSelect
        EndIf
        If wevent=#PB_Event_SizeWindow
           If IsGadget(0)
              ResizeGadget(0, 40, WindowHeight(1)-20, WindowWidth(1)-40, 20)
           EndIf
           If IsGadget(1)
              ResizeGadget(1, 0, WindowHeight(1)-20, 20, 20)
           EndIf
           If IsGadget(2)
              ResizeGadget(2, 20, WindowHeight(1)-20, 20, 20)
           EndIf
           ResizeWindow(0, 0, 0, WindowWidth(1), WindowHeight(1)-20)
        EndIf
        Delay(10)
       
        *mp = CallFunction(0, "libvlc_playlist_get_media_player", *inst, @ex)
        state = CallFunction(0, "libvlc_media_player_get_state", *mp, @ex)
            
        Select state
           Case 0 ; libvlc_NothingSpecial 	
           Case 1 ; libvlc_Opening 	
           Case 2 ; libvlc_Buffering 	
           Case 3 ; libvlc_Playing 	
              osizex = CallFunction(0, "libvlc_video_get_width", *mp, @ex)
              osizey = CallFunction(0, "libvlc_video_get_height", *mp, @ex)
              If sizex<>osizex And sizey<>osizey
                 sizex=osizex
                 sizey=osizey
                 ResizeWindow(0, #PB_Ignore, #PB_Ignore, sizex, sizey)
                 ResizeWindow(1, #PB_Ignore, #PB_Ignore, sizex, sizey+20)
                 length.q = CallFunction(0, "libvlc_media_player_get_length", *mp, @ex)                 
                 stukje.q = length.q / 1000
                 If length=0
                    DisableGadget(0, 1)
                 Else
                    DisableGadget(0, 0)
                 EndIf
                 SetGadgetText(2, "||")                              
              EndIf   
              curpos.q = CallFunction(0, "libvlc_media_player_get_time", *mp, @ex)
              If curpos.q<>curposo.q
                 curposo.q = curpos.q
                 stukje.q = length.q / 1000
                 If stukje>0 And curpos>0
                    percentage.l = curpos/stukje
                    SetGadgetState(0, percentage)
                 EndIf
              EndIf
           Case 4 ; libvlc_Paused 	
           Case 5 ; libvlc_Stopped 	
                 DisableGadget(2, 0)
           Case 6 ; libvlc_Forward 	
           Case 7 ; libvlc_Backward 	
           Case 8 ; libvlc_Ended 	
           Case 9 ; libvlc_Error
        EndSelect   
    Wend
    If *mp
       CallFunction(0, "libvlc_media_player_stop", *mp, @ex)
       CallFunction(0, "libvlc_media_player_release", *mp)
    EndIf
    CallFunction(0, "libvlc_release", *inst)
    CloseLibrary(0)
EndIf
CloseLibrary(0)
End

newfile:
item = CallFunction(0, "libvlc_playlist_add", *inst, file$, #Null, @ex) 
CallFunction(0, "libvlc_playlist_play", *inst, item, 0, #Null, @ex)                    
;Goto start
Return                 
Above code will let you select a video file and it will play, but
when using the newfile() procedure to load another video file
then PB gives memory error on the EndProcedure line of
procedure newfile().

I also tried to import commands from a .lib file, i tried
gosub and return, but it all fails. Only thing that works
is the goto command, goto newfile, and uncomment
goto start.

I also noticed sometimes using dll commands from a lib
will change the value of types. Lets say i dim a.l(10) and a(1)=10,
using a library command will change that value in some
cases. Very strange..

Gr,
Phil.
X
Enthusiast
Enthusiast
Posts: 311
Joined: Tue Apr 04, 2006 6:27 am

Post by X »

This is very very very very good! Please keep this going!
lexvictory
Addict
Addict
Posts: 1027
Joined: Sun May 15, 2005 5:15 am
Location: Australia
Contact:

Post by lexvictory »

for the ima on procedurereturn, have you tried CallFunctionC/ImportC/PrototypeC?

see freak's post for an explanation: http://www.purebasic.fr/blog/?p=49

and by the way: this code will only work when compiled in ascii mode, as the arguments passed to libvlc_new have to be in ascii/utf8

try this if you want unicode support (although i have not tested it in 4.30)

Code: Select all

Procedure makeargs(Array.s(1), num, newarr(1))
For i = 0 To num
  newarr(i) = AllocateMemory(StringByteLength(Array(i))+1)
  PokeS(newarr(i), Array(i), -1, #PB_UTF8)
Next i
EndProcedure

OpenWindow(0,0,0,100,100,"vlc test")

excp.libvlc_exception_t
Dim myarg.s(4)
Dim utf8args(4)
myarg(0) = "-I"
myarg(1) = "dummy"
myarg(2) = "--plugin-path=c:\\program files\\videolan\\vlc\\plugins"
makeargs(myarg(), 4, utf8args())
Demonio Ardente

Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!
Philippe-felixer76-2
Enthusiast
Enthusiast
Posts: 135
Joined: Sat Aug 18, 2007 7:09 am
Location: Netherlands

videolan libvlc with PB

Post by Philippe-felixer76-2 »

lexvictory wrote:for the ima on procedurereturn, have you tried CallFunctionC/ImportC/PrototypeC?

see freak's post for an explanation: http://www.purebasic.fr/blog/?p=49

and by the way: this code will only work when compiled in ascii mode, as the arguments passed to libvlc_new have to be in ascii/utf8

try this if you want unicode support (although i have not tested it in 4.30)

Code: Select all

Procedure makeargs(Array.s(1), num, newarr(1))
For i = 0 To num
  newarr(i) = AllocateMemory(StringByteLength(Array(i))+1)
  PokeS(newarr(i), Array(i), -1, #PB_UTF8)
Next i
EndProcedure

OpenWindow(0,0,0,100,100,"vlc test")

excp.libvlc_exception_t
Dim myarg.s(4)
Dim utf8args(4)
myarg(0) = "-I"
myarg(1) = "dummy"
myarg(2) = "--plugin-path=c:\\program files\\videolan\\vlc\\plugins"
makeargs(myarg(), 4, utf8args())
Hi lexvictory,

Tnx for the tip, it seems this is my problem explained.
Changing from CallFunction to CallCFunction didn't help.

I added your procedure, i also put in a program structure
and add enableexplicit, and i now render the video into
a containergadget, much better this way.

I installed unbuntu with VLC and purebasic, and on linux
your procedure gives a error: Syntax error in de procedure arguments. I do use VMWare.

Anyway, if i pass vlc_args() not using your procedure on linux,
then the window will openup and all seems that the video is
starting, and then the window closes and a message appears
saying: The debugged executable quit unexpetedly.

So i have to puzzle it out better i quess.. not metioning
to get it to work on macosx.

Here's the latest source, seems to work nice on windows on my setup.

Code: Select all

EnableExplicit

Structure prog
   *inst
   *base
   *mp
   *m
   *state
   *item
   drawable.l
   wevent.l
   procent.l
   stukje.q
   reload.b
   sizex.l
   sizey.l
   osizex.l
   osizey.l
   length.q
   curpos.q
   curposo.q
   ex.l
   file$
   i.l
EndStructure

Global Dim vlc_args.s(8) 
Global Dim utf8args(8)
Global p.prog

CompilerSelect #PB_Compiler_OS
  CompilerCase #PB_OS_Linux
    Global p\base = OpenLibrary(0, "/usr/lib/libvlc.so")
    SetCurrentDirectory("/usr/lib/")
  CompilerCase #PB_OS_Windows
    Global p\base = OpenLibrary(0, "C:\Program Files\VideoLAN\VLC\libvlc.dll") 
    SetCurrentDirectory("C:\Program Files\VideoLAN\VLC")
CompilerEndSelect 

Procedure makeargs(Array.s(1), num, newarr(1))
  p\i = 0
  Repeat
     newarr(p\i) = AllocateMemory(StringByteLength(Array(p\i))+1)
     PokeS(newarr(p\i), Array(p\i), -1, #PB_UTF8)
     p\i+1
  Until p\i>=num
EndProcedure 

If p\base
    OpenWindow(1, 0, 0, 60, 20, "PureBasic VLC", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget)
    ScrollBarGadget(0, 0, 0, 0, 0, 0, 1000, 1)
    ButtonGadget(1, 0, 0, 0, 0, "F")
    ButtonGadget(2, 0, 0, 0, 0, ">")
    SetGadgetText(2, "||")
    ContainerGadget(3, 0, 0, 0, 0)
    vlc_args(0) = "-I"
    vlc_args(1) = "dummy"
    vlc_args(2) = "--ignore-config"
    CompilerIf #PB_Compiler_OS = #PB_OS_Linux
        vlc_args(3) = "--plugin-path=/usr/lib/vlc/codecs/"
    CompilerEndIf      
    CompilerIf #PB_Compiler_OS = #PB_OS_Windows
        vlc_args(3) = "--plugin-path=C:\\Program Files\\VideoLAN\\VLC\\plugins\"
    CompilerEndIf      
    vlc_args(4) = "--mms-caching"
    vlc_args(5) = "3200"
    vlc_args(6) = "--http-caching"
    vlc_args(7) = "3200"  
    makeargs(vlc_args(), 8, utf8args())
    CallFunction(0, "libvlc_exception_init", @p\ex) 
    p\inst = CallFunction(0, "libvlc_new", 8, @utf8args(), @p\ex) ;vlc_args(), @p\ex)
    p\file$ = "mms://85.119.217.29/TMFLive"  
    p\item = CallFunction(0, "libvlc_playlist_add", p\inst, p\file$, #Null, @p\ex) 
    p\drawable = GadgetID(3)
    CallFunction(0, "libvlc_video_set_parent", p\inst, p\drawable, @p\ex)  
    CallFunction(0, "libvlc_playlist_play", p\inst, p\item, 0, #Null, @p\ex) 
    While p\wevent<>#PB_Event_CloseWindow
        p\wevent = WindowEvent()
        
        If p\wevent = #PB_Event_Gadget
           Select EventGadget()
              Case 0 ; slider
                 If p\mp
                    p\procent.l = GetGadgetState(0)      
                    CallFunction(0, "libvlc_media_player_set_time", p\mp, p\stukje.q*p\procent, @p\ex)
                 EndIf
              Case 1 ; file
                 p\file$ = OpenFileRequester("Select media file", "", "*.*", 0)
                 If Len(p\file$)
                    CallFunction(0, "libvlc_playlist_stop", p\inst, @p\ex) 
                    CallFunction(0, "libvlc_playlist_clear", p\inst, @p\ex)
                    p\item = CallFunction(0, "libvlc_playlist_add", p\inst, p\file$, #Null, @p\ex) 
                    CallFunction(0, "libvlc_playlist_play", p\inst, p\item, 0, #Null, @p\ex)
                    p\reload=0                
                 EndIf
              Case 2 ; play / pause
                 If GetGadgetText(2) = ">"
                    CallFunction(0, "libvlc_media_player_play", p\mp, @p\ex) 
                    SetGadgetText(2, "||")                  
                 Else
                    CallFunction(0, "libvlc_media_player_pause", p\mp, @p\ex)
                    SetGadgetText(2, ">")
                 EndIf
           EndSelect
        EndIf
        
        If p\wevent=#PB_Event_SizeWindow
           If IsGadget(0)
              ResizeGadget(0, 40, WindowHeight(1)-20, WindowWidth(1)-40, 20)
           EndIf
           If IsGadget(1)
              ResizeGadget(1, 0, WindowHeight(1)-20, 20, 20)
           EndIf
           If IsGadget(2)
              ResizeGadget(2, 20, WindowHeight(1)-20, 20, 20)
           EndIf
           If IsGadget(3)
              ResizeGadget(3, 0, 0, WindowWidth(1), WindowHeight(1)-20)
           EndIf
        EndIf
        
        Delay(10)
       
        If p\reload=0
           p\mp = CallFunction(0, "libvlc_playlist_get_media_player", p\inst, @p\ex)
           If p\mp And p\m=0
              p\m = CallFunction(0, "libvlc_media_player_get_media", p\mp, @p\ex)  		 
              p\reload=1
           EndIf
        EndIf
        
        p\state = CallFunction(0, "libvlc_media_player_get_state", p\mp, @p\ex)
        Select p\state
           Case 0 ; libvlc_NothingSpecial 	
           Case 1 ; libvlc_Opening 	
           Case 2 ; libvlc_Buffering 	
           Case 3 ; libvlc_Playing 	
              p\sizex = CallFunction(0, "libvlc_video_get_width", p\mp, @p\ex)
              p\sizey = CallFunction(0, "libvlc_video_get_height", p\mp, @p\ex)
              If p\sizex<>p\osizex And p\sizey<>p\osizey
                 p\osizex=p\sizex
                 p\osizey=p\sizey
                 ResizeWindow(1, #PB_Ignore, #PB_Ignore, p\sizex, p\sizey+20)
                 p\length.q = CallFunction(0, "libvlc_media_player_get_length", p\mp, @p\ex)                 
                 p\stukje.q = p\length.q / 1000
                 If p\length=0
                    DisableGadget(0, 1)
                 Else
                    DisableGadget(0, 0)
                 EndIf
                 SetGadgetText(2, "||")                              
              EndIf   
              p\curpos.q = CallFunction(0, "libvlc_media_player_get_time", p\mp, @p\ex)
              If p\curpos.q<>p\curposo.q
                 p\curposo.q = p\curpos.q
                 p\stukje.q = p\length.q / 1000
                 If p\stukje>0 And p\curpos>0
                    SetGadgetState(0, p\curpos/p\stukje)
                 EndIf
              EndIf
           Case 4 ; libvlc_Paused 	
           Case 5 ; libvlc_Stopped 	
           Case 6 ; libvlc_Forward 	
           Case 7 ; libvlc_Backward 	
           Case 8 ; libvlc_Ended 	
           Case 9 ; libvlc_Error
        EndSelect
        
    Wend
    If p\mp
       CallFunction(0, "libvlc_media_player_stop", p\mp, @p\ex)
       CallFunction(0, "libvlc_media_player_release", p\mp)
    EndIf
    CallFunction(0, "libvlc_release", p\inst)
    CloseLibrary(0)
EndIf
CloseLibrary(0)
End
Last edited by Philippe-felixer76-2 on Sun Dec 21, 2008 4:14 pm, edited 1 time in total.
lexvictory
Addict
Addict
Posts: 1027
Joined: Sun May 15, 2005 5:15 am
Location: Australia
Contact:

Re: videolan libvlc with PB

Post by lexvictory »

Philippe-felixer76-2 wrote:I installed unbuntu with VLC and purebasic, and on linux
your procedure gives a error: Syntax error in de procedure arguments. I do use VMWare.
because it was PB 4.20 code, now that im a bit more versed in PB 4.30 changes, you should get around the syntax error by changing the declaration to:

Code: Select all

Procedure makeargs(Array Array.s(1), num, Array newarr(1));you may need to take out the 1's - i havent tested
i'll have a test in linux tomorrow, after i install a distro in vmware myself, as debian amd64 doesnt like my wireless card... (with supposed x64 marvel drivers :evil: )
Demonio Ardente

Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!
Philippe-felixer76-2
Enthusiast
Enthusiast
Posts: 135
Joined: Sat Aug 18, 2007 7:09 am
Location: Netherlands

Re: videolan libvlc with PB

Post by Philippe-felixer76-2 »

lexvictory wrote:
Philippe-felixer76-2 wrote:I installed unbuntu with VLC and purebasic, and on linux
your procedure gives a error: Syntax error in de procedure arguments. I do use VMWare.
because it was PB 4.20 code, now that im a bit more versed in PB 4.30 changes, you should get around the syntax error by changing the declaration to:

Code: Select all

Procedure makeargs(Array Array.s(1), num, Array newarr(1));you may need to take out the 1's - i havent tested
i'll have a test in linux tomorrow, after i install a distro in vmware myself, as debian amd64 doesnt like my wireless card... (with supposed x64 marvel drivers :evil: )
Hi lexvictory,

I got your procedure to work in linux, tnx for the tip, strange
thing is, i use PB 4.30 final for Windows and Linux, but linux
gives the error and windows doesn't.

Anyway, still no working video on linux.

Hope you can help! Tnx

Code: Select all

EnableExplicit

Structure prog
   *inst
   *base
   *mp
   *m
   *state
   *item
   drawable.l
   wevent.l
   procent.l
   stukje.q
   reload.b
   sizex.l
   sizey.l
   osizex.l
   osizey.l
   length.q
   curpos.q
   curposo.q
   ex.l
   file$
   i.l
EndStructure

Global Dim vlc_args.s(8) 
Global Dim utf8args(8)
Global p.prog

CompilerSelect #PB_Compiler_OS
  CompilerCase #PB_OS_Linux
    Global p\base = OpenLibrary(0, "/usr/lib/libvlc.so")
    SetCurrentDirectory("/usr/lib/")
    Procedure makeargs(array Array.s(1), num, array newarr(1))
      p\i = 0
      Repeat
         newarr(p\i) = AllocateMemory(StringByteLength(Array(p\i))+1)
         PokeS(newarr(p\i), Array(p\i), -1, #PB_UTF8)
         p\i+1
      Until p\i>=num
    EndProcedure 
  CompilerCase #PB_OS_Windows
    Global p\base = OpenLibrary(0, "C:\Program Files\VideoLAN\VLC\libvlc.dll") 
    SetCurrentDirectory("C:\Program Files\VideoLAN\VLC")
    Procedure makeargs(Array.s(1), num, newarr(1))
      p\i = 0
      Repeat
         newarr(p\i) = AllocateMemory(StringByteLength(Array(p\i))+1)
         PokeS(newarr(p\i), Array(p\i), -1, #PB_UTF8)
         p\i+1
      Until p\i>=num
    EndProcedure 
CompilerEndSelect 

If p\base
    OpenWindow(1, 0, 0, 60, 20, "PureBasic VLC", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget)
    ScrollBarGadget(0, 0, 0, 0, 0, 0, 1000, 1)
    ButtonGadget(1, 0, 0, 0, 0, "F")
    ButtonGadget(2, 0, 0, 0, 0, ">")
    SetGadgetText(2, "||")
    ContainerGadget(3, 0, 0, 0, 0)
    vlc_args(0) = "-I"
    vlc_args(1) = "dummy"
    vlc_args(2) = "--ignore-config"
    CompilerIf #PB_Compiler_OS = #PB_OS_Linux
        vlc_args(3) = "--plugin-path=/usr/lib/vlc/codecs/"
    CompilerEndIf      
    CompilerIf #PB_Compiler_OS = #PB_OS_Windows
        vlc_args(3) = "--plugin-path=C:\\Program Files\\VideoLAN\\VLC\\plugins\"
    CompilerEndIf      
    vlc_args(4) = "--mms-caching"
    vlc_args(5) = "3200"
    vlc_args(6) = "--http-caching"
    vlc_args(7) = "3200"  
    makeargs(vlc_args(), 8, utf8args())
    CallFunction(0, "libvlc_exception_init", @p\ex) 
    p\inst = CallFunction(0, "libvlc_new", 8, @utf8args(), @p\ex) ;vlc_args(), @p\ex)
    p\file$ = "mms://85.119.217.29/TMFLive"  

    ;; 0.9+ way
    ;p\m = CallFunction(0, "libvlc_media_new", p\inst, p\file$, @p\ex) 
    ;p\mp = CallFunction(0, "libvlc_media_player_new_from_media", p\m, @p\ex)
    ;CallFunction(0, "libvlc_media_release", p\m, @p\ex) 
    ;p\drawable = GadgetID(3) 
    ;CallFunction(0, "libvlc_media_player_set_drawable", p\mp, p\drawable, @p\ex)
    ;CallFunction(0, "libvlc_media_player_play", p\mp, @p\ex) 
    ;p\reload=1
    
    ; 0.9- way
    p\item = CallFunction(0, "libvlc_playlist_add", p\inst, p\file$, #Null, @p\ex) 
    p\drawable = GadgetID(3)
    CallFunction(0, "libvlc_video_set_parent", p\inst, p\drawable, @p\ex)  
    CallFunction(0, "libvlc_playlist_play", p\inst, p\item, 0, #Null, @p\ex) 

    While p\wevent<>#PB_Event_CloseWindow
        p\wevent = WindowEvent()
        
        If p\wevent = #PB_Event_Gadget
           Select EventGadget()
              Case 0 ; slider
                 If p\mp
                    p\procent.l = GetGadgetState(0)      
                    CallFunction(0, "libvlc_media_player_set_time", p\mp, p\stukje.q*p\procent, @p\ex)
                 EndIf
              Case 1 ; file
                 p\file$ = OpenFileRequester("Select media file", "", "*.*", 0)
                 If Len(p\file$)
                    ; v9-
                    CallFunction(0, "libvlc_playlist_stop", p\inst, @p\ex) 
                    CallFunction(0, "libvlc_playlist_clear", p\inst, @p\ex)
                    p\item = CallFunction(0, "libvlc_playlist_add", p\inst, p\file$, #Null, @p\ex) 
                    CallFunction(0, "libvlc_playlist_play", p\inst, p\item, 0, #Null, @p\ex)
                    p\reload=0                                  
                 EndIf
              Case 2 ; play / pause
                 If GetGadgetText(2) = ">"
                    CallFunction(0, "libvlc_media_player_play", p\mp, @p\ex) 
                    SetGadgetText(2, "||")                  
                 Else
                    CallFunction(0, "libvlc_media_player_pause", p\mp, @p\ex)
                    SetGadgetText(2, ">")
                 EndIf
           EndSelect
        EndIf
        
        If p\wevent=#PB_Event_SizeWindow
           If IsGadget(0)
              ResizeGadget(0, 40, WindowHeight(1)-20, WindowWidth(1)-40, 20)
           EndIf
           If IsGadget(1)
              ResizeGadget(1, 0, WindowHeight(1)-20, 20, 20)
           EndIf
           If IsGadget(2)
              ResizeGadget(2, 20, WindowHeight(1)-20, 20, 20)
           EndIf
           If IsGadget(3)
              ResizeGadget(3, 0, 0, WindowWidth(1), WindowHeight(1)-20)
           EndIf
        EndIf
        
        Delay(10)
       
        If p\reload=0
           p\mp = CallFunction(0, "libvlc_playlist_get_media_player", p\inst, @p\ex)
           If p\mp And p\m=0
              p\m = CallFunction(0, "libvlc_media_player_get_media", p\mp, @p\ex)  		 
              p\reload=1
           EndIf
        EndIf
        
        p\state = CallFunction(0, "libvlc_media_player_get_state", p\mp, @p\ex)
        Select p\state
           Case 0 ; libvlc_NothingSpecial 	
           Case 1 ; libvlc_Opening 	
           Case 2 ; libvlc_Buffering 	
           Case 3 ; libvlc_Playing 	
              p\sizex = CallFunction(0, "libvlc_video_get_width", p\mp, @p\ex)
              p\sizey = CallFunction(0, "libvlc_video_get_height", p\mp, @p\ex)
              If p\sizex<>p\osizex And p\sizey<>p\osizey
                 p\osizex=p\sizex
                 p\osizey=p\sizey
                 ResizeWindow(1, #PB_Ignore, #PB_Ignore, p\sizex, p\sizey+20)
                 p\length.q = CallFunction(0, "libvlc_media_player_get_length", p\mp, @p\ex)                 
                 p\stukje.q = p\length.q / 1000
                 If p\length=0
                    DisableGadget(0, 1)
                 Else
                    DisableGadget(0, 0)
                 EndIf
                 SetGadgetText(2, "||")                              
              EndIf   
              p\curpos.q = CallFunction(0, "libvlc_media_player_get_time", p\mp, @p\ex)
              If p\curpos.q<>p\curposo.q
                 p\curposo.q = p\curpos.q
                 p\stukje.q = p\length.q / 1000
                 If p\stukje>0 And p\curpos>0
                    SetGadgetState(0, p\curpos/p\stukje)
                 EndIf
              EndIf
           Case 4 ; libvlc_Paused 	
           Case 5 ; libvlc_Stopped 	
           Case 6 ; libvlc_Forward 	
           Case 7 ; libvlc_Backward 	
           Case 8 ; libvlc_Ended 	
           Case 9 ; libvlc_Error
        EndSelect
        
    Wend
    If p\mp
       CallFunction(0, "libvlc_media_player_stop", p\mp, @p\ex)
       CallFunction(0, "libvlc_media_player_release", p\mp)
    EndIf
    CallFunction(0, "libvlc_release", p\inst)
    CloseLibrary(0)
EndIf
CloseLibrary(0)
End
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

CallCFunctionFast - For Linux works better I've found
Philippe-felixer76-2
Enthusiast
Enthusiast
Posts: 135
Joined: Sat Aug 18, 2007 7:09 am
Location: Netherlands

VLC multiOS??!

Post by Philippe-felixer76-2 »

Inner wrote:CallCFunctionFast - For Linux works better I've found
Hi Inner,

Ill try that next time, in the meantime i foundout the
current source crashes on windows also when using it
for a long time.

Tnx for your response, all the help available is needed.

Gr,
Phil.
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Re: VLC multiOS??!

Post by Inner »

Philippe-felixer76-2 wrote:
Inner wrote:CallCFunctionFast - For Linux works better I've found
Hi Inner,

Ill try that next time, in the meantime i foundout the
current source crashes on windows also when using it
for a long time.

Tnx for your response, all the help available is needed.

Gr,
Phil.
Yeah I am an interested on looker at this actually for a posiable place in my audio player (linux only).
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

* Working on an Include I can't promise it'll work but I'll give it a go.
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Post by Inner »

Philippe-felixer76-2
Enthusiast
Enthusiast
Posts: 135
Joined: Sat Aug 18, 2007 7:09 am
Location: Netherlands

LibVLC using ImportC

Post by Philippe-felixer76-2 »

Inner wrote:http://rainbowplayer.googlecode.com/files/pbVLC.zip

This is where I'm up to.
Wow Inner, nice work. I adjusted your code a bit so that
is't also usable under windows using a .lib file created with
polib.

Strange thing is, under windows it works more or less, i get
audio/video output. But i NEED to set the current directory
in the compiler options to the directory of VLC, otherwise
i get the same error as in Linux, quit unexpectedly.

Here's the libvlc.pb i adjusted, im out of options ATM:

Code: Select all

;/*****************************************************************************
; * libvlc.h:  libvlc external API
; *****************************************************************************
; * Copyright (C) 1998-2005 the VideoLAN team
; * $Id$
; *
; * Authors: Clément Stenac <zorglub@videolan.org>
; *          Jean-Paul Saman <jpsaman@videolan.org>
; *          Pierre d'Herbemont <pdherbemont@videolan.org>
; *
; * This program is free software; you can redistribute it and/or modify
; * it under the terms of the GNU General Public License as published by
; * the Free Software Foundation; either version 2 of the License, or
; * (at your option) any later version.
; *
; * This program is distributed in the hope that it will be useful,
; * but WITHOUT ANY WARRANTY; without even the implied warranty of
; * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
; * GNU General Public License for more details.
; *
; * You should have received a copy of the GNU General Public License
; * along with this program; if not, write to the Free Software
; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
; *****************************************************************************/


IncludeFile "libvlc_events.pb"
IncludeFile "libvlc_media_list.pb"
IncludeFile "libvlc_structures.pb"
IncludeFile "libvlc_vlm.pb"
IncludeFile "mediacontrol.pb"
IncludeFile "mediacontrol_structures.pb"

;/*****************************************************************************
; * Exception handling
; *****************************************************************************/


CompilerIf #PB_Compiler_OS = #PB_OS_Windows
   SetCurrentDirectory("C:\Program Files\VideoLAN\VLC")
   ;"C:\Program Files\Purebasic\Compilers\polib /out:libvlc.lib libvlc.dll"
   ImportC  "C:\Program Files\VideoLAN\VLC\libvlc.lib"
CompilerEndIf
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
   ;SetCurrentDirectory("/usr/lib/")
   ImportC  "/usr/lib/libvlc.so"
CompilerEndIf



;/**
; * Initialize an exception structure. This can be called several times to
; * reuse an exception structure.
; *
; * \param p_exception the exception to initialize
; */
;  VLC_PUBLIC_API void libvlc_exception_init( libvlc_exception_t *p_exception );
  libvlc_exception_init( *exception.l ) ;As "libvlc_exception_init"

;/**
; * Has an exception been raised?
; *
; * \param p_exception the exception to query
; * \return 0 if the exception was raised, 1 otherwise
; */
;  VLC_PUBLIC_API int libvlc_exception_raised( const libvlc_exception_t *p_exception );
  libvlc_exception_raised( *exception.l ) As "libvlc_exception_raised"

;/**
; * Raise an exception using a user-provided message.
; *
; * \param p_exception the exception to raise
; * \param psz_format the exception message format string
; * \param ... the format string arguments
; */
;  VLC_PUBLIC_API void libvlc_exception_raise( libvlc_exception_t *p_exception,const char *psz_format, ... );
  libvlc_exception_raise( *exception.l,psz_format.s ) As "libvlc_exception_raise" ;== WARNING THIS MAY BREAK ==

;/**
; * Clear an exception object so it can be reused.
; * The exception object must have be initialized.
; *
; * \param p_exception the exception to clear
; */
;  VLC_PUBLIC_API void libvlc_exception_clear( libvlc_exception_t * );
  libvlc_exception_clear( *exception.l ) As "libvlc_exception_clear"

;/**
; * Get an exception's message.
; *
; * \param p_exception the exception to query
; * \return the exception message or NULL if not applicable (exception not
; *         raised, for example)
; */
;  VLC_PUBLIC_API const char *libvlc_exception_get_message( const libvlc_exception_t *p_exception );
  libvlc_exception_get_message( *exception.l ) As "libvlc_exception_get_message"

;/*****************************************************************************
; * Core handling
; *****************************************************************************/
;/**
; * Create and initialize a libvlc instance.
; *
; * \param argc the number of arguments
; * \param argv command-line-type arguments. argv[0] must be the path of the
; *        calling program.
; * \param p_e an initialized exception pointer
; * \return the libvlc instance
; */
;  VLC_PUBLIC_API libvlc_instance_t *libvlc_new( int , const char *const *, libvlc_exception_t *);
  libvlc_new(argc.l,*argv.c,*exception.l) ;As "libvlc_new"

;/**
; * Return a libvlc instance identifier for legacy APIs. Use of this
; * function is discouraged, you should convert your program to use the
; * new API.
; *
; * \param p_instance the instance
; * \return the instance identifier
; */
;  VLC_PUBLIC_API int libvlc_get_vlc_id( libvlc_instance_t *p_instance );
  libvlc_get_vlc_id( *instance.l ) As "libvlc_get_vlc_id"

;/**
; * Decrement the reference count of a libvlc instance, and destroy it
; * if it reaches zero.
; *
; * \param p_instance the instance to destroy
; */
;  VLC_PUBLIC_API void libvlc_release( libvlc_instance_t * );
  libvlc_release( *instance.l );

;/**
; * Increments the reference count of a libvlc instance.
; * The initial reference count is 1 after libvlc_new() returns.
; *
; * \param p_instance the instance to reference
; */
;  VLC_PUBLIC_API void libvlc_retain( libvlc_instance_t * );
  libvlc_retain( *instance.l );

;/**
; * Try to start a user interface for the libvlc instance, and wait until the
; * user exits.
; *
; * \param p_instance the instance
; * \param name interface name, or NULL for default
; * \param p_exception an initialized exception pointer
; */
;  VLC_PUBLIC_API void libvlc_add_intf( libvlc_instance_t *p_instance, const char *name,libvlc_exception_t *p_exception );
  libvlc_add_intf( *instance.l, name.s,*exception.l ) As "libvlc_add_intf"

;/**
; * Waits until an interface causes the instance to exit.
; * You should start at least one interface first, using libvlc_add_intf().
; *
; * \param p_instance the instance
; */
;  VLC_PUBLIC_API void libvlc_wait( libvlc_instance_t *p_instance );
  libvlc_wait( *instance.l ) As "libvlc_wait"

;/**
; * Retrieve libvlc version.
; *
; * Example: "0.9.0-git Grishenko"
; *
; * \return a string containing the libvlc version
; */
;  VLC_PUBLIC_API const char * libvlc_get_version(void);
  libvlc_get_version() ;As "libvlc_get_version"

;/**
; * Retrieve libvlc compiler version.
; *
; * Example: "gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu6)"
; *
; * \return a string containing the libvlc compiler version
; */
;  VLC_PUBLIC_API const char * libvlc_get_compiler(void);
  libvlc_get_compiler() ;As "libvlc_get_compiler"

;/**
; * Retrieve libvlc changeset.
; *
; * Example: "aa9bce0bc4"
; *
; * \return a string containing the libvlc changeset
; */
;  VLC_PUBLIC_API const char * libvlc_get_changeset(void);
  libvlc_get_changeset() As "libvlc_get_changeset"

;/*****************************************************************************
; * media
; *****************************************************************************/

;/**
; * Create a media with the given MRL.
; *
; * \param p_instance the instance
; * \param psz_mrl the MRL to read
; * \param p_e an initialized exception pointer
; * \return the newly created media
; */
;  VLC_PUBLIC_API libvlc_media_t * libvlc_media_new(libvlc_instance_t *p_instance,const char * psz_mrl,libvlc_exception_t *p_e );
  libvlc_media_new(*instance.l,psz_mrl.s,*exception.l) ;As "libvlc_media_new" 

;/**
; * Create a media as an empty node with the passed name.
; *
; * \param p_instance the instance
; * \param psz_name the name of the node
; * \param p_e an initialized exception pointer
; * \return the new empty media
; */
;  VLC_PUBLIC_API libvlc_media_t * libvlc_media_new_as_node(libvlc_instance_t *p_instance,const char * psz_name,libvlc_exception_t *p_e );
  libvlc_media_new_as_node(*instance.l,name.s,*exception.l) As "libvlc_media_new_as_node"

;/**
; * Add an option to the media.
; *
; * This option will be used to determine how the media_player will
; * read the media. This allows to use VLC's advanced
; * reading/streaming options on a per-media basis.
; *
; * The options are detailed in vlc --long-help, for instance "--sout-all"
; *
; * \param p_instance the instance
; * \param ppsz_options the options (as a string)
; * \param p_e an initialized exception pointer
; */
;  VLC_PUBLIC_API void libvlc_media_add_option(libvlc_media_t * p_md,const char * ppsz_options,libvlc_exception_t * p_e );
  libvlc_media_add_option(*instance.l,options.s,*exception.l) As "libvlc_media_add_option"

;/**
; * Retain a reference to a media descriptor object (libvlc_media_t). Use
; * libvlc_media_release() to decrement the reference count of a 
; * media descriptor object.
; *
; * \param p_meta_desc a media descriptor object.
; */
;  VLC_PUBLIC_API void libvlc_media_retain(libvlc_media_t *p_meta_desc );
  libvlc_media_retain(*meta_desc.l) As "libvlc_media_retain"

;/**
; * Decrement the reference count of a media descriptor object. If the
; * reference count is 0, then libvlc_media_release() will release the
; * media descriptor object. It will send out an libvlc_MediaFreed event
; * to all listeners. If the media descriptor object has been released it
; * should not be used again.
; *
; * \param p_meta_desc a media descriptor object.
; */
;  VLC_PUBLIC_API void libvlc_media_release(libvlc_media_t *p_meta_desc );
  libvlc_media_release(*meta_desc.l) ;As "libvlc_media_release"


;/**
; * Get the media resource locator (mrl) from a media descriptor object
; *
; * \param p_md a media descriptor object
; * \param p_e an initialized exception object
; * \return string with mrl of media descriptor object
; */
;  VLC_PUBLIC_API char * libvlc_media_get_mrl( libvlc_media_t * p_md,libvlc_exception_t * p_e );
  libvlc_media_get_mrl( *media.l,*exception.l ) As "libvlc_media_get_mrl"

;/**
; * Duplicate a media descriptor object.
; *
; * \param p_meta_desc a media descriptor object.
; */
;  VLC_PUBLIC_API libvlc_media_t * libvlc_media_duplicate( libvlc_media_t * );
  libvlc_media_duplicate( *meta_desc.l ) As "libvlc_media_duplicate"

;/**
; * Read the meta of the media.
; *
; * \param p_meta_desc the media to read
; * \param e_meta_desc the meta to read
; * \param p_e an initialized exception pointer
; * \return the media's meta
; */
;  VLC_PUBLIC_API char * libvlc_media_get_meta(libvlc_media_t *p_meta_desc,libvlc_meta_t e_meta,libvlc_exception_t *p_e );
  libvlc_media_get_meta(*meta_desc.l,meta_desc.l,*exception.l ) As "libvlc_media_get_meta"

;/**
; * Get current state of media descriptor object. Possible media states
; * are defined in libvlc_structures.c ( libvlc_NothingSpecial=0,
; * libvlc_Opening, libvlc_Buffering, libvlc_Playing, libvlc_Paused,
; * libvlc_Stopped, libvlc_Forward, libvlc_Backward, libvlc_Ended,
; * libvlc_Error).
; *
; * @see libvlc_state_t
; * \param p_meta_desc a media descriptor object
; * \param p_e an initialized exception object
; * \return state of media descriptor object
; */
;  VLC_PUBLIC_API libvlc_state_t libvlc_media_get_state(libvlc_media_t *p_meta_desc,libvlc_exception_t *p_e );
  libvlc_media_get_state(*meta_desc.l,*exception.l ) As "libvlc_media_get_state"

;/**
; * Get subitems of media descriptor object. This will increment
; * the reference count of supplied media descriptor object. Use
; * libvlc_media_list_release() to decrement the reference counting.
; *
; * \param p_md media descriptor object
; * \param p_e initalized exception object
; * \return list of media descriptor subitems or NULL
; */
;  VLC_PUBLIC_API libvlc_media_list_t *libvlc_media_subitems( libvlc_media_t *p_md,libvlc_exception_t *p_e );
  libvlc_media_subitems( *media.l,*exception.l ) As "libvlc_media_subitems"

;/**
; * Get event manager from media descriptor object.
; * NOTE: this function doesn't increment reference counting.
; *
; * \param p_md a media descriptor object
; * \param p_e an initialized exception object
; * \return event manager object
; */
;  VLC_PUBLIC_API libvlc_event_manager_t *libvlc_media_event_manager( libvlc_media_t * p_md,libvlc_exception_t * p_e );
  libvlc_media_event_manager( *media.l,*exception.l ) As "libvlc_media_event_manager"

;/**
; * Get duration of media descriptor object item.
; *
; * \param p_md media descriptor object
; * \param p_e an initialized exception object
; * \return duration of media item
; */
;  VLC_PUBLIC_API libvlc_time_t libvlc_media_get_duration( libvlc_media_t * p_md,libvlc_exception_t * p_e );
  libvlc_media_get_duration( *media.l,*exception.l ) As "libvlc_media_get_duration"

;/**
; * Get preparsed status for media descriptor object.
; *
; * \param p_md media descriptor object
; * \param p_e an initialized exception object
; * \return true if media object has been preparsed otherwise it returns false
; */
;  VLC_PUBLIC_API int libvlc_media_is_preparsed( libvlc_media_t * p_md,libvlc_exception_t * p_e );
  libvlc_media_is_preparsed( *media.l,*exception.l ) As "libvlc_media_is_preparsed"

;/**
; * Sets media descriptor's user_data. user_data is specialized data 
; * accessed by the host application, VLC.framework uses it as a pointer to 
; * an native object that references a libvlc_media_t pointer
; *
; * \param p_md media descriptor object
; * \param p_new_user_data pointer to user data
; * \param p_e an initialized exception object
; */
;  VLC_PUBLIC_API void libvlc_media_set_user_data( libvlc_media_t * p_md,void * p_new_user_data,libvlc_exception_t * p_e);
  libvlc_media_set_user_data( *media.l, *new_user_data.l, *exception.l);

;/**
; * Get media descriptor's user_data. user_data is specialized data 
; * accessed by the host application, VLC.framework uses it as a pointer to 
; * an native object that references a libvlc_media_t pointer
; *
; * \param p_md media descriptor object
; * \param p_e an initialized exception object
; */
;  VLC_PUBLIC_API void *libvlc_media_get_user_data( libvlc_media_t * p_md,libvlc_exception_t * p_e);
  libvlc_media_get_user_data( *media.l,*exception.l);

;/*****************************************************************************
; * Media Player
; *****************************************************************************/
;/**
; * Create an empty Media Player object
; *
; * \param p_libvlc_instance the libvlc instance in which the Media Player
; *        should be created.
; * \param p_e an initialized exception pointer
; */
;  VLC_PUBLIC_API libvlc_media_player_t * libvlc_media_player_new( libvlc_instance_t *, libvlc_exception_t * );
  libvlc_media_player_new( *libvlc_instance.l, *exception.l ) As "libvlc_media_player_new"

;/**
; * Create a Media Player object from a Media
; *
; * \param p_md the media. Afterwards the p_md can be safely
; *        destroyed.
; * \param p_e an initialized exception pointer
; */
;  VLC_PUBLIC_API libvlc_media_player_t * libvlc_media_player_new_from_media( libvlc_media_t *, libvlc_exception_t * );
  libvlc_media_player_new_from_media(*media.l, *exception.l ) ;As "libvlc_media_player_new_from_media"

;/**
; * Release a media_player after use
; * Decrement the reference count of a media player object. If the
; * reference count is 0, then libvlc_media_player_release() will 
; * release the media player object. If the media player object 
; * has been released, then it should not be used again.
; *
; * \param p_mi the Media Player to free
; */
;  VLC_PUBLIC_API void libvlc_media_player_release( libvlc_media_player_t * );
  libvlc_media_player_release( *media.l ) ;As "libvlc_media_player_release"

;/**
; * Retain a reference to a media player object. Use
; * libvlc_media_player_release() to decrement reference count.
; *
; * \param p_mi media player object
; */
;  VLC_PUBLIC_API void libvlc_media_player_retain( libvlc_media_player_t * );
  libvlc_media_player_retain( *media.l ) As "libvlc_media_player_retain"

;/** 
; * Set the media that will be used by the media_player. If any,
; * previous md will be released.
; *
; * \param p_mi the Media Player
; * \param p_md the Media. Afterwards the p_md can be safely
; *        destroyed.
; * \param p_e an initialized exception pointer
; */
;  VLC_PUBLIC_API void libvlc_media_player_set_media( libvlc_media_player_t *, libvlc_media_t *, libvlc_exception_t * );
  libvlc_media_player_set_media(*mediai.l,*mediad.l,*exception.l) As "libvlc_media_player_set_media" 

; /**
;  * Get the media used by the media_player.
;  *
;  * \param p_mi the Media Player
;  * \param p_e an initialized exception pointer
;  * \return the media associated With p_mi, Or NULL If no
;  *         media is associated
;  */
;  VLC_PUBLIC_API libvlc_media_t * libvlc_media_player_get_media( libvlc_media_player_t *, libvlc_exception_t * );
  libvlc_media_player_get_media(*media.l,*exception.l) As "libvlc_media_player_get_media"

; /**
;  * Get the Event Manager from which the media player send event.
;  *
;  * \param p_mi the Media Player
;  * \param p_e an initialized exception pointer
;  * \return the event manager associated With p_mi
;  */
;  VLC_PUBLIC_API libvlc_event_manager_t * libvlc_media_player_event_manager ( libvlc_media_player_t *, libvlc_exception_t * );
  libvlc_media_player_event_manager ( *media.l,*exception.l ) As "libvlc_media_player_event_manager"

; /**
;  * Play
;  *
;  * \param p_mi the Media Player
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_media_player_play ( libvlc_media_player_t *, libvlc_exception_t * );
  libvlc_media_player_play ( *media.l,*exception.l ) ;As "libvlc_media_player_play"

; /**
;  * Pause
;  *
;  * \param p_mi the Media Player
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_media_player_pause ( libvlc_media_player_t *, libvlc_exception_t * );
  libvlc_media_player_pause ( *media.l,*exception.l ) ;As "libvlc_media_player_pause"

; /**
;  * Stop
;  *
;  * \param p_mi the Media Player
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_media_player_stop ( libvlc_media_player_t *, libvlc_exception_t * );
  libvlc_media_player_stop ( *media.l,*exception.l ) ;As "libvlc_media_player_stop"

; /**
;  * Set the drawable where the media player should render its video output
;  *
;  * \param p_mi the Media Player
;  * \param drawable the libvlc_drawable_t where the media player
;  *        should render its video
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_media_player_set_drawable ( libvlc_media_player_t *, libvlc_drawable_t, libvlc_exception_t * );
  libvlc_media_player_set_drawable (*media.l,*drawable.l,*exception.l ) ;As "libvlc_media_player_set_drawable"

; /**
;  * Get the drawable where the media player should render its video output
;  *
;  * \param p_mi the Media Player
;  * \param p_e an initialized exception pointer
;  * \return the libvlc_drawable_t where the media player
;  *         should render its video
;  */
;  VLC_PUBLIC_API libvlc_drawable_t libvlc_media_player_get_drawable ( libvlc_media_player_t *, libvlc_exception_t * );
  libvlc_media_player_get_drawable (*media.l, *exception.l) As "libvlc_media_player_get_drawable"

; /** \bug This might go away ... To be replaced by a broader system */
; 
; /**
;  * Get the current movie length (in ms).
;  *
;  * \param p_mi the Media Player
;  * \param p_e an initialized exception pointer
;  * \return the movie length (in ms).
;  */
;  VLC_PUBLIC_API libvlc_time_t libvlc_media_player_get_length( libvlc_media_player_t *, libvlc_exception_t *);
  libvlc_media_player_get_length(*media.l, *exception.l) ;As "libvlc_media_player_get_length"

; /**
;  * Get the current movie time (in ms).
;  *
;  * \param p_mi the Media Player
;  * \param p_e an initialized exception pointer
;  * \return the movie time (in ms).
;  */
;  VLC_PUBLIC_API libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *, libvlc_exception_t *);
  libvlc_media_player_get_time(*media.l, *exception.l) ;As "libvlc_media_player_get_time"

; /**
;  * Set the movie time (in ms).
;  *
;  * \param p_mi the Media Player
;  * \param the movie time (in ms).
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_media_player_set_time( libvlc_media_player_t *, libvlc_time_t, libvlc_exception_t *);
  libvlc_media_player_set_time( *media.l,time.l,*exception.l) ;As "libvlc_media_player_set_time"

; /**
;  * Get movie position.
;  *
;  * \param p_mi the Media Player
;  * \param p_e an initialized exception pointer
;  * \return movie position
;  */
;  VLC_PUBLIC_API float libvlc_media_player_get_position( libvlc_media_player_t *, libvlc_exception_t *);
  libvlc_media_player_get_position(*media.l,*exception.l) As "libvlc_media_player_get_position"

; /**
;  * Set movie position.
;  *
;  * \param p_mi the Media Player
;  * \param p_e an initialized exception pointer
;  * \return movie position
;  */
;  VLC_PUBLIC_API void libvlc_media_player_set_position( libvlc_media_player_t *, float, libvlc_exception_t *);
  libvlc_media_player_set_position(*media.l,float.f,*exception.l) As "libvlc_media_player_set_position"

; /**
;  * Set movie chapter
;  *
;  * \param p_mi the Media Player
;  * \param i_chapter chapter number To play
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_media_player_set_chapter( libvlc_media_player_t *, int, libvlc_exception_t *);
  libvlc_media_player_set_chapter(*media.l, chapter.l,*exception.l) As "libvlc_media_player_set_chapter"

; /**
;  * Get movie chapter
;  *
;  * \param p_mi the Media Player
;  * \param p_e an initialized exception pointer
;  * \return chapter number currently playing
;  */
;  VLC_PUBLIC_API int libvlc_media_player_get_chapter( libvlc_media_player_t *, libvlc_exception_t * );
  libvlc_media_player_get_chapter(*media.l, *exception.l) As "libvlc_media_player_get_chapter"

; /**
;  * Get movie chapter count
;  *
;  * \param p_mi the Media Player
;  * \param p_e an initialized exception pointer
;  * \return number of chapters in movie
;  */
;  VLC_PUBLIC_API int libvlc_media_player_get_chapter_count( libvlc_media_player_t *, libvlc_exception_t *);
  libvlc_media_player_get_chapter_count(*media.l, *exception.l) As "libvlc_media_player_get_chapter_count"
;  VLC_PUBLIC_API int libvlc_media_player_will_play        ( libvlc_media_player_t *, libvlc_exception_t *);
  libvlc_media_player_will_play (*media.l, *exception.l) As "libvlc_media_player_will_play"

; /**
;  * Get movie play rate
;  *
;  * \param p_mi the Media Player
;  * \param p_e an initialized exception pointer
;  * \return movie play rate
;  */
;  VLC_PUBLIC_API float libvlc_media_player_get_rate( libvlc_media_player_t *, libvlc_exception_t *);
  libvlc_media_player_get_rate(*media.l, *exception.l) As "libvlc_media_player_get_rate"

; /**
;  * Set movie play rate
;  *
;  * \param p_mi the Media Player
;  * \param movie play rate To set
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_media_player_set_rate( libvlc_media_player_t *, float, libvlc_exception_t *);
  libvlc_media_player_set_rate(*media.l,movie.f,*exception.l) As "libvlc_media_player_set_rate"

; /**
;  * Get current movie state
;  *
;  * \param p_mi the Media Player
;  * \param p_e an initialized exception pointer
;  * \return current movie state As libvlc_state_t
;  */
;  VLC_PUBLIC_API libvlc_state_t libvlc_media_player_get_state( libvlc_media_player_t *, libvlc_exception_t *);
  libvlc_media_player_get_state(*media.l, *exception.l) As "libvlc_media_player_get_state"

; /**
;  * Get movie fps rate
;  *
;  * \param p_mi the Media Player
;  * \param p_e an initialized exception pointer
;  * \return frames per Second (fps) For this playing movie
;  */
;  VLC_PUBLIC_API float libvlc_media_player_get_fps( libvlc_media_player_t *, libvlc_exception_t *);
  libvlc_media_player_get_fps(*media.l, *exception.l) As "libvlc_media_player_get_fps"

; /** End bug */

; /**
;  * Does this media player have a video output?
;  *
;  * \param p_md the media player
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API int  libvlc_media_player_has_vout( libvlc_media_player_t *, libvlc_exception_t *);
  libvlc_media_player_has_vout(*media.l, *exception.l) As "libvlc_media_player_has_vout"

; /**
;  * Is this media player seekable?
;  *
;  * \param p_input the input
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi, libvlc_exception_t *p_e );
  libvlc_media_player_is_seekable(*input.l, *exception.l) As "libvlc_media_player_is_seekable"

; /**
;  * Can this media player be paused?
;  *
;  * \param p_input the input
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi, libvlc_exception_t *p_e );
  libvlc_media_player_can_pause( *input.l, *exception.l ) As "libvlc_media_player_can_pause"
 
; /**
;  * Toggle fullscreen status on video output.
;  *
;  * \param p_mediaplayer the media player
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_toggle_fullscreen( libvlc_media_player_t *, libvlc_exception_t * );
  libvlc_toggle_fullscreen( *mediaplayer.l, *exception.l ) As "libvlc_toggle_fullscreen"

; /**
;  * Enable Or disable fullscreen on a video output.
;  *
;  * \param p_mediaplayer the media player
;  * \param b_fullscreen boolean For fullscreen status
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_set_fullscreen( libvlc_media_player_t *, int, libvlc_exception_t * );
  libvlc_set_fullscreen(*mediaplayer.l,fullscreen.b,*exception.l ) As "libvlc_set_fullscreen"

; /**
;  * Get current fullscreen status.
;  *
;  * \param p_mediaplayer the media player
;  * \param p_e an initialized exception pointer
;  * \return the fullscreen status (boolean)
;  */
;  VLC_PUBLIC_API int libvlc_get_fullscreen( libvlc_media_player_t *, libvlc_exception_t * );
  libvlc_get_fullscreen(*mediaplayer.l, *exception.l) As "libvlc_get_fullscreen"

; /**
;  * Get current video height.
;  *
;  * \param p_mediaplayer the media player
;  * \param p_e an initialized exception pointer
;  * \return the video height
;  */
;  VLC_PUBLIC_API int libvlc_video_get_height( libvlc_media_player_t *, libvlc_exception_t * );
  libvlc_video_get_height( *mediaplayer.l, *exception.l) ;As "libvlc_video_get_height"

; /**
;  * Get current video width.
;  *
;  * \param p_mediaplayer the media player
;  * \param p_e an initialized exception pointer
;  * \return the video width
;  */
;  VLC_PUBLIC_API int libvlc_video_get_width( libvlc_media_player_t *, libvlc_exception_t * );
  libvlc_video_get_width(*mediaplayer.l, *exception.l) ;As "libvlc_video_get_width"

; /**
;  * Get current video aspect ratio.
;  *
;  * \param p_mediaplayer the media player
;  * \param p_e an initialized exception pointer
;  * \return the video aspect ratio
;  */
;  VLC_PUBLIC_API char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *, libvlc_exception_t * );
  libvlc_video_get_aspect_ratio(*mediaplayer.l, *exception.l) As "libvlc_video_get_aspect_ratio"

; /**
;  * Set new video aspect ratio.
;  *
;  * \param p_mediaplayer the media player
;  * \param psz_aspect new video aspect-ratio
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_video_set_aspect_ratio( libvlc_media_player_t *, char *, libvlc_exception_t * );
  libvlc_video_set_aspect_ratio(*mediaplayer.l,aspect.s,*exception.l) As "libvlc_video_set_aspect_ratio"

; /**
;  * Get current video subtitle.
;  *
;  * \param p_mediaplayer the media player
;  * \param p_e an initialized exception pointer
;  * \return the video subtitle selected
;  */
;  VLC_PUBLIC_API int libvlc_video_get_spu( libvlc_media_player_t *, libvlc_exception_t * );
  libvlc_video_get_spu(*mediaplayer.l, *exception.l) As "libvlc_video_get_spu"

; /**
;  * Set new video subtitle.
;  *
;  * \param p_mediaplayer the media player
;  * \param i_spu new video subtitle To Select
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_video_set_spu( libvlc_media_player_t *, int , libvlc_exception_t * );
  libvlc_video_set_spu(*mediaplayer.l,spu.l,*exception.l) As "libvlc_video_set_spu"

; /**
;  * Set new video subtitle file.
;  *
;  * \param p_mediaplayer the media player
;  * \param psz_subtitle new video subtitle file
;  * \param p_e an initialized exception pointer
;  * \return the success status (boolean)
;  */
;  VLC_PUBLIC_API int libvlc_video_set_subtitle_file( libvlc_media_player_t *, char *, libvlc_exception_t * );
  libvlc_video_set_subtitle_file(*mediaplayer.l,psz_subtitle.s,*exception.l) As "libvlc_video_set_subtitle_file"

; /**
;  * Get current crop filter geometry.
;  *
;  * \param p_mediaplayer the media player
;  * \param p_e an initialized exception pointer
;  * \return the crop filter geometry
;  */
;  VLC_PUBLIC_API char *libvlc_video_get_crop_geometry( libvlc_media_player_t *, libvlc_exception_t * );
  libvlc_video_get_crop_geometry(*mediaplayer.l, *exception.l) As "libvlc_video_get_crop_geometry"

; /**
;  * Set new crop filter geometry.
;  *
;  * \param p_mediaplayer the media player
;  * \param psz_geometry new crop filter geometry
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_video_set_crop_geometry( libvlc_media_player_t *, char *, libvlc_exception_t * );
  libvlc_video_set_crop_geometry(*mediaplayer.l,geometry.s,*exception.l ) As "libvlc_video_set_crop_geometry"

; /**
;  * Toggle teletext transparent status on video output.
;  *
;  * \param p_mediaplayer the media player
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_toggle_teletext( libvlc_media_player_t *, libvlc_exception_t * );
  libvlc_toggle_teletext(*mediaplayer.l, *exception.l) As "libvlc_toggle_teletext"

; /**
;  * Get current teletext page requested.
;  *
;  * \param p_mediaplayer the media player
;  * \param p_e an initialized exception pointer
;  * \return the current teletext page requested.
;  */
;  VLC_PUBLIC_API int libvlc_video_get_teletext( libvlc_media_player_t *, libvlc_exception_t * );
  libvlc_video_get_teletext(*mediaplayer.l, *exception.l) As "libvlc_video_get_teletext"

; /**
;  * Set new teletext page To retrieve.
;  *
;  * \param p_mediaplayer the media player
;  * \param i_page teletex page number requested
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_video_set_teletext( libvlc_media_player_t *, int, libvlc_exception_t * );
  libvlc_video_set_teletext(*mediaplayer.l,page.l,*exception.l) As "libvlc_video_set_teletext"

; /**
;  * Take a snapshot of the current video window.
;  *
;  * If i_width And i_height is 0, original size is used.
;  * If i_width XOr i_height is 0, original aspect-ratio is preserved.
;  *
;  * \param p_mediaplayer the media player
;  * \param psz_filepath the path where To save the screenshot To
;  * \param i_width the snapshot's width
;  * \param i_height the snapshot's height
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_video_take_snapshot( libvlc_media_player_t *, char *,unsigned int, unsigned int, libvlc_exception_t * );
  libvlc_video_take_snapshot(*mediaplayer.l,filepath.s,width.l,height.l,*exception.l) As "libvlc_video_take_snapshot"

; /**
;  * Resize the current video output window.
;  *
;  * \param p_instance libvlc instance
;  * \param width new width For video output window
;  * \param height new height For video output window
;  * \param p_e an initialized exception pointer
;  * \return the success status (boolean)
;  */
;  VLC_PUBLIC_API void libvlc_video_resize( libvlc_media_player_t *, int, int, libvlc_exception_t *);
  libvlc_video_resize(*instance.l,width.l,height.l,*exception.l) As "libvlc_video_resize"

; /**
;  * Change the parent For the current the video output.
;  *
;  * \param p_instance libvlc instance
;  * \param drawable the new parent window (Drawable on X11, CGrafPort on MacOSX, HWND on Win32)
;  * \param p_e an initialized exception pointer
;  * \return the success status (boolean)
;  *
;  VLC_PUBLIC_API int libvlc_video_reparent( libvlc_media_player_t *, libvlc_drawable_t, libvlc_exception_t * );
  libvlc_video_reparent(*instance.l,drawable.l,*exception.l) As "libvlc_video_reparent"


; /**
;  * Tell windowless video output To redraw rectangular area (MacOS X only).
;  *
;  * \param p_instance libvlc instance
;  * \param area coordinates within video drawable
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_video_redraw_rectangle( libvlc_media_player_t *, const libvlc_rectangle_t *, libvlc_exception_t * );
  libvlc_video_redraw_rectangle(*instance.l,*rectangle.l,*exception.l ) As "libvlc_video_redraw_rectangle"

; /**
;  * Set the Default video output size.
;  *
;  * This setting will be used As Default For all video outputs.
;  *
;  * \param p_instance libvlc instance
;  * \param width new width For video drawable
;  * \param height new height For video drawable
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_video_set_size( libvlc_instance_t *, int, int, libvlc_exception_t * );
  libvlc_video_set_size(*instance.l,width.l,height.l,*exception.l ) As "libvlc_video_set_size"

; /**
;  * Set the Default video output viewport For a windowless video output
;  * (MacOS X only).
;  *
;  * This setting will be used As Default For all video outputs.
;  *
;  * \param p_instance libvlc instance
;  * \param view coordinates within video drawable
;  * \param clip coordinates within video drawable
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_video_set_viewport( libvlc_instance_t *, const libvlc_rectangle_t *, const libvlc_rectangle_t *, libvlc_exception_t * );
  libvlc_video_set_viewport(*instance.l,*rectangle_view.l,*rectangle_clip.l,*exception.l ) As "libvlc_video_set_viewport"

; /**
;  * Toggle mute status.
;  *
;  * \param p_instance libvlc instance
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_audio_toggle_mute( libvlc_instance_t *, libvlc_exception_t * );
  libvlc_audio_toggle_mute(*instance.l, *exception.l ) As "libvlc_audio_toggle_mute"

; /**
;  * Get current mute status.
;  *
;  * \param p_instance libvlc instance
;  * \param p_e an initialized exception pointer
;  * \return the mute status (boolean)
;  */
;  VLC_PUBLIC_API int libvlc_audio_get_mute( libvlc_instance_t *, libvlc_exception_t * );
  libvlc_audio_get_mute(*instance.l,*exception.l ) As "libvlc_audio_get_mute"

; /**
;  * Set mute status.
;  *
;  * \param p_instance libvlc instance
;  * \param status If status is true then mute, otherwise unmute
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_audio_set_mute( libvlc_instance_t *, int , libvlc_exception_t * );
  libvlc_audio_set_mute(*instance.l,status.l,*exception.l ) As "libvlc_audio_set_mute"

; /**
;  * Get current audio level.
;  *
;  * \param p_instance libvlc instance
;  * \param p_e an initialized exception pointer
;  * \return the audio level (int)
;  */
;  VLC_PUBLIC_API int libvlc_audio_get_volume( libvlc_instance_t *, libvlc_exception_t * );
  libvlc_audio_get_volume( *instance.l, *exception.l ) As "libvlc_audio_get_volume"

; /**
;  * Set current audio level.
;  *
;  * \param p_instance libvlc instance
;  * \param i_volume the volume (int)
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_audio_set_volume( libvlc_instance_t *, int, libvlc_exception_t *);
  libvlc_audio_set_volume( *instance.l, volume.l, *exception.l) As "libvlc_audio_set_volume"

; /**
;  * Get number of available audio tracks.
;  *
;  * \param p_mi media player
;  * \param p_e an initialized exception
;  * \return the number of available audio tracks (int)
;  */
;  VLC_PUBLIC_API int libvlc_audio_get_track_count( libvlc_media_player_t *,  libvlc_exception_t * );
  libvlc_audio_get_track_count( *media.l, *exception.l ) As "libvlc_audio_get_track_count"

; /**
;  * Get current audio track.
;  *
;  * \param p_mi media player
;  * \param p_e an initialized exception pointer
;  * \return the audio track (int)
;  */
;  VLC_PUBLIC_API int libvlc_audio_get_track( libvlc_media_player_t *, libvlc_exception_t * );
  libvlc_audio_get_track( *media.l, *exception.l ) As "libvlc_audio_get_track"

; /**
;  * Set current audio track.
;  *
;  * \param p_mi media player
;  * \param i_track the track (int)
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_audio_set_track( libvlc_media_player_t *, int, libvlc_exception_t * );
  libvlc_audio_set_track( *media.l,track.l, *exception.l ) As "libvlc_audio_set_track"

; /**
;  * Get current audio channel.
;  *
;  * \param p_instance vlc instance
;  * \param p_e an initialized exception pointer
;  * \return the audio channel (int)
;  */
;  VLC_PUBLIC_API int libvlc_audio_get_channel( libvlc_instance_t *, libvlc_exception_t * );
  libvlc_audio_get_channel( *instance.l, *exception.l ) As "libvlc_audio_get_channel"

; /**
;  * Set current audio channel.
;  *
;  * \param p_instance vlc instance
;  * \param i_channel the audio channel (int)
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_audio_set_channel( libvlc_instance_t *, int, libvlc_exception_t * );
  libvlc_audio_set_channel( *instance.l, channel.l, *exception.l ) As "libvlc_audio_set_channel"

;/*****************************************************************************
; * Event handling
; *****************************************************************************/
; /**
;  * Register For an event notification.
;  *
;  * \param p_event_manager the event manager To which you want To attach To.
;  *        Generally it is obtained by vlc_my_object_event_manager() where
;  *        my_object is the object you want To listen To.
;  * \param i_event_type the desired event To which we want To listen
;  * \param f_callback the function To call when i_event_type occurs
;  * \param user_data user provided Data To carry With the event
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_event_attach( libvlc_event_manager_t *p_event_manager,libvlc_event_type_t i_event_type,libvlc_callback_t f_callback,void *user_data,libvlc_exception_t *p_e );
  libvlc_event_attach( *event_manager.l,event_type.l,callback.l,*user_data.l,*exception.l ) As "libvlc_event_attach"

; /**
;  * Unregister an event notification.
;  *
;  * \param p_event_manager the event manager
;  * \param i_event_type the desired event To which we want To unregister
;  * \param f_callback the function To call when i_event_type occurs
;  * \param p_user_data user provided Data To carry With the event
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_event_detach( libvlc_event_manager_t *p_event_manager,libvlc_event_type_t i_event_type,libvlc_callback_t f_callback,void *p_user_data,libvlc_exception_t *p_e );
  libvlc_event_detach( *event_manager.l,event_type.l,callback.l,*user_data.l,*exception.l) As "libvlc_event_detach"

; /**
;  * Get an event's type name.
;  *
;  * \param i_event_type the desired event
;  */
;  VLC_PUBLIC_API const char * libvlc_event_type_name( libvlc_event_type_t event_type );
  libvlc_event_type_name( event_type.l ) As "libvlc_event_type_name"

;/*****************************************************************************
; * Media Library
; *****************************************************************************/

;  VLC_PUBLIC_API libvlc_media_library_t *libvlc_media_library_new( libvlc_instance_t * p_inst,libvlc_exception_t * p_e );
  libvlc_media_library_new( *instance.l,*exception.l) As "libvlc_media_library_new"

; /**
;  * Release media library object. This functions decrements the
;  * reference count of the media library object. If it reaches 0,
;  * then the object will be released.
;  *
;  * \param p_mlib media library object
;  */
;  VLC_PUBLIC_API void libvlc_media_library_release( libvlc_media_library_t * p_mlib );
  libvlc_media_library_release( *mlib.l ) As "libvlc_media_library_release"

; /**
;  * Retain a reference To a media library object. This function will
;  * increment the reference counting For this object. Use 
;  * libvlc_media_library_release() To decrement the reference count.
;  *
;  * \param p_mlib media library object
;  */
;  VLC_PUBLIC_API void libvlc_media_library_retain( libvlc_media_library_t * p_mlib );
  libvlc_media_library_retain( *mlib.l ) As "libvlc_media_library_retain"

; /**
;  * Load media library.
;  *
;  * \param p_mlib media library object
;  * \param p_e an initialized exception object.
;  */
;  VLC_PUBLIC_API void libvlc_media_library_load( libvlc_media_library_t * p_mlib,libvlc_exception_t * p_e );
  libvlc_media_library_load( *mlib.l ,*exception.l ) As "libvlc_media_library_load"

; /**
;  * Save media library.
;  *
;  * \param p_mlib media library object
;  * \param p_e an initialized exception object.
;  */
;  VLC_PUBLIC_API void libvlc_media_library_save( libvlc_media_library_t * p_mlib,libvlc_exception_t * p_e );
  libvlc_media_library_save( *mlib.l,*exception.l ) As "libvlc_media_library_save"

; /**
;  * Get media library subitems.
;  *
;  * \param p_mlib media library object
;  * \param p_e an initialized exception object.
;  * \return media List subitems
;  */
;  VLC_PUBLIC_API libvlc_media_list_t * libvlc_media_library_media_list( libvlc_media_library_t * p_mlib,libvlc_exception_t * p_e );
  libvlc_media_library_media_list( *mlib.l,*exception.l ) As "libvlc_media_library_media_list"

;/*****************************************************************************
; * Services/Media Discovery
; *****************************************************************************/
; /**
;  * Discover media service by name.
;  *
;  * \param p_inst libvlc instance
;  * \param psz_name service name
;  * \param p_e an initialized exception object
;  * \return media discover object
;  */
;  VLC_PUBLIC_API libvlc_media_discoverer_t *libvlc_media_discoverer_new_from_name( libvlc_instance_t * p_inst,const char * psz_name,libvlc_exception_t * p_e );
  libvlc_media_discoverer_new_from_name( *instance.l,name.s,*exception.l ) As "libvlc_media_discoverer_new_from_name"

; /**
;  * Release media discover object. If the reference count reaches 0, then
;  * the object will be released.
;  *
;  * \param p_mdis media service discover object
;  */
;  VLC_PUBLIC_API void   libvlc_media_discoverer_release( libvlc_media_discoverer_t * p_mdis );
  libvlc_media_discoverer_release( *mdis.l ) As "libvlc_media_discoverer_release"

; /**
;  * Get media service discover object its localized name.
;  *
;  * \param media discover object
;  * \return localized name
;  */
;  VLC_PUBLIC_API char * libvlc_media_discoverer_localized_name( libvlc_media_discoverer_t * p_mdis );
  libvlc_media_discoverer_localized_name( *mdis.l  ) As "libvlc_media_discoverer_localized_name"

; /**
;  * Get media service discover media List.
;  *
;  * \param p_mdis media service discover object
;  * \return List of media items
;  */
;  VLC_PUBLIC_API libvlc_media_list_t * libvlc_media_discoverer_media_list( libvlc_media_discoverer_t * p_mdis );
  libvlc_media_discoverer_media_list( *mdis.l ) As "libvlc_media_discoverer_media_list"

; /**
;  * Get event manager from media service discover object.
;  *
;  * \param p_mdis media service discover object
;  * \return event manager object.
;  */
;  VLC_PUBLIC_API libvlc_event_manager_t *libvlc_media_discoverer_event_manager( libvlc_media_discoverer_t * p_mdis );
  libvlc_media_discoverer_event_manager( *mdis.l ) As "libvlc_media_discoverer_event_manager"

; /**
;  * Query If media service discover object is running.
;  *
;  * \param p_mdis media service discover object
;  * \return true If running, false If Not
;  */
;  VLC_PUBLIC_API int libvlc_media_discoverer_is_running( libvlc_media_discoverer_t * p_mdis );
  libvlc_media_discoverer_is_running( *mdis.l ) As "libvlc_media_discoverer_is_running"

;/*****************************************************************************
; * Message log handling
; *****************************************************************************/

; /**
;  * Return the VLC messaging verbosity level.
;  *
;  * \param p_instance libvlc instance
;  * \param p_e an initialized exception pointer
;  * \return verbosity level For messages
;  */
;  VLC_PUBLIC_API unsigned libvlc_get_log_verbosity( const libvlc_instance_t *p_instance,libvlc_exception_t *p_e );
  libvlc_get_log_verbosity( *instance.l,*exception.l ) As "libvlc_get_log_verbosity"

; /**
;  * Set the VLC messaging verbosity level.
;  *
;  * \param p_instance libvlc log instance
;  * \param level log level
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_set_log_verbosity( libvlc_instance_t *p_instance, unsigned level,libvlc_exception_t *p_e );
  libvlc_set_log_verbosity( *instance.l, level.l,*exception.l ) As "libvlc_set_log_verbosity"

; /**
;  * Open a VLC message log instance.
;  *
;  * \param p_instance libvlc instance
;  * \param p_e an initialized exception pointer
;  * \return log message instance
;  */
;  VLC_PUBLIC_API libvlc_log_t *libvlc_log_open( libvlc_instance_t *, libvlc_exception_t *);
  libvlc_log_open( *instance.l, *exception.l ) As "libvlc_log_open"

; /**
;  * Close a VLC message log instance.
;  *
;  * \param p_log libvlc log instance
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_log_close( libvlc_log_t *, libvlc_exception_t *);
  libvlc_log_close( *log.l, *exception.l ) As "libvlc_log_close"

; /**
;  * Returns the number of messages in a log instance.
;  *
;  * \param p_log libvlc log instance
;  * \param p_e an initialized exception pointer
;  * \return number of log messages
;  */
;  VLC_PUBLIC_API unsigned libvlc_log_count( const libvlc_log_t *, libvlc_exception_t *);
  libvlc_log_count(*log.l,*exception.l) As "libvlc_log_count"

; /**
;  * Clear a log instance.
;  *
;  * All messages in the log are removed. The log should be cleared on a
;  * regular basis To avoid clogging.
;  *
;  * \param p_log libvlc log instance
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_log_clear( libvlc_log_t *, libvlc_exception_t *);
  libvlc_log_clear(*log.l, *exception.l ) As "libvlc_log_clear"

; /**
;  * Allocate And returns a new iterator To messages in log.
;  *
;  * \param p_log libvlc log instance
;  * \param p_e an initialized exception pointer
;  * \return log iterator object
;  */
;  VLC_PUBLIC_API libvlc_log_iterator_t *libvlc_log_get_iterator( const libvlc_log_t *, libvlc_exception_t *);
  libvlc_log_get_iterator(*log.l, *exception.l ) As "libvlc_log_get_iterator"

; /**
;  * Release a previoulsy allocated iterator.
;  *
;  * \param p_iter libvlc log iterator
;  * \param p_e an initialized exception pointer
;  */
;  VLC_PUBLIC_API void libvlc_log_iterator_free( libvlc_log_iterator_t *p_iter, libvlc_exception_t *p_e );
  libvlc_log_iterator_free(*iter.l, *exception.l ) As "libvlc_log_iterator_free"

; /**
;  * Return whether log iterator has more messages.
;  *
;  * \param p_iter libvlc log iterator
;  * \param p_e an initialized exception pointer
;  * \return true If iterator has more message objects, Else false
;  */
;  VLC_PUBLIC_API int libvlc_log_iterator_has_next( const libvlc_log_iterator_t *p_iter, libvlc_exception_t *p_e );
  libvlc_log_iterator_has_next(*iter.l, *exception.l ) As "libvlc_log_iterator_has_next"

; /**
;  * Return the Next log message.
;  *
;  * The message contents must Not be freed
;  *
;  * \param p_iter libvlc log iterator
;  * \param p_buffer log buffer
;  * \param p_e an initialized exception pointer
;  * \return log message object
;  */
;  VLC_PUBLIC_API libvlc_log_message_t *libvlc_log_iterator_next( libvlc_log_iterator_t *p_iter,libvlc_log_message_t *p_buffer,libvlc_exception_t *p_e );
  libvlc_log_iterator_next(*iter.l, *buffer.l ,*exception.l ) As "libvlc_log_iterator_next"
EndImport

Structure prog
   *inst
   *base
   *mp
   *m
   *state
   *item
   drawable.l
   wevent.l
   procent.l
   stukje.q
   reload.b
   sizex.l
   sizey.l
   osizex.l
   osizey.l
   length.q
   curpos.q
   curposo.q
   ex.l
   file$
   i.l
EndStructure

Global Dim vlc_args.s(8) 
Global Dim utf8args(8)
Global p.prog

CompilerIf #PB_Compiler_OS = #PB_OS_Linux
Procedure makeargs(Array Array.s(1), num, Array newarr(1))
      p\i = 0
      Repeat
         newarr(p\i) = AllocateMemory(StringByteLength(Array(p\i))+1)
         PokeS(newarr(p\i), Array(p\i), -1, #PB_UTF8)
         p\i+1
      Until p\i>=num
EndProcedure 
CompilerEndIf
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
Procedure makeargs(Array.s(1), num, newarr(1))
      p\i = 0
      Repeat
         newarr(p\i) = AllocateMemory(StringByteLength(Array(p\i))+1)
         PokeS(newarr(p\i), Array(p\i), -1, #PB_UTF8)
         p\i+1
      Until p\i>=num
EndProcedure 
CompilerEndIf


If  OpenWindow(1, 0, 0, 60, 20, "PureBasic VLC", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget)
    ScrollBarGadget(0, 0, 0, 0, 0, 0, 1000, 1)
    ButtonGadget(1, 0, 0, 0, 0, "F")
    ButtonGadget(2, 0, 0, 0, 0, ">")
    SetGadgetText(2, "||")
    ContainerGadget(3, 0, 0, 0, 0)
    vlc_args(0) = "-I"
    vlc_args(1) = "dummy"
    vlc_args(2) = "--ignore-config"
    CompilerIf #PB_Compiler_OS = #PB_OS_Linux
        vlc_args(3) = "--plugin-path=/usr/lib/vlc/codecs/"
    CompilerEndIf      
    CompilerIf #PB_Compiler_OS = #PB_OS_Windows
        vlc_args(3) = "--plugin-path=C:\\Program Files\\VideoLAN\\VLC\\plugins\"
    CompilerEndIf      
    vlc_args(4) = "--mms-caching"
    vlc_args(5) = "3200"
    vlc_args(6) = "--http-caching"
    vlc_args(7) = "3200"  
    makeargs(vlc_args(), 8, utf8args())
    Debug PeekS(libvlc_get_version())
    Debug PeekS(libvlc_get_compiler())
    exception.libvlc_exception
    libvlc_exception_init(@exception)
    Debug "exception\raised="+Str(exception\raised) 
    Debug "exception\code="+Str(exception\code) 
    Debug "exception\psz_message="+exception\message
    p\inst = libvlc_new(8, @utf8args(), @exeption) 
    p\file$ = "mms://85.119.217.29/TMFLive"  
    If p\inst
       p\m = libvlc_media_new(p\inst, p\file$, @exeption) ;CallFunction(0, "libvlc_media_new", p\inst, p\file$, @p\ex) 
       p\mp = libvlc_media_player_new_from_media(p\m, @exeption) ;CallFunction(0, "libvlc_media_player_new_from_media", p\m, @p\ex)
       libvlc_media_release(p\m) ;, @exeption) ;CallFunction(0, "libvlc_media_release", p\m, @p\ex) 
       p\drawable = GadgetID(3) 
       libvlc_media_player_set_drawable(p\mp, p\drawable, @exeption) ;CallFunction(0, "libvlc_media_player_set_drawable", p\mp, p\drawable, @p\ex)
       libvlc_media_player_play(p\mp, @exeption) ;CallFunction(0, "libvlc_media_player_play", p\mp, @p\ex) 
       p\reload=1
        While p\wevent<>#PB_Event_CloseWindow
            p\wevent = WindowEvent()
            If p\wevent = #PB_Event_Gadget
               Select EventGadget()
                  Case 0 ; slider
                     If p\mp
                        p\procent.l = GetGadgetState(0)      
                        libvlc_media_player_set_time(p\mp, p\stukje.q*p\procent, @exeption)
                     EndIf
                  Case 1 ; file
                  Case 2 ; play / pause
                     If GetGadgetText(2) = ">"
                        libvlc_media_player_play(p\mp, @exeption)
                        SetGadgetText(2, "||")                  
                     Else
                        libvlc_media_player_pause(p\mp, @exeption)
                        SetGadgetText(2, ">")
                     EndIf
               EndSelect
            EndIf
            If p\wevent=#PB_Event_SizeWindow
               If IsGadget(0)
                  ResizeGadget(0, 40, WindowHeight(1)-20, WindowWidth(1)-40, 20)
               EndIf
               If IsGadget(1)
                  ResizeGadget(1, 0, WindowHeight(1)-20, 20, 20)
               EndIf
               If IsGadget(2)
                  ResizeGadget(2, 20, WindowHeight(1)-20, 20, 20)
               EndIf
               If IsGadget(3)
                  ResizeGadget(3, 0, 0, WindowWidth(1), WindowHeight(1)-20)
               EndIf
            EndIf
            Delay(10)
            p\state = CallFunction(0, "libvlc_media_player_get_state", p\mp, @p\ex)
            Select p\state
               Case 0 ; libvlc_NothingSpecial 	
               Case 1 ; libvlc_Opening 	
               Case 2 ; libvlc_Buffering 	
               Case 3 ; libvlc_Playing 	
                  p\sizex = libvlc_video_get_width(p\mp, @exeption) ;CallFunction(0, "libvlc_video_get_width", p\mp, @p\ex)
                  p\sizey = libvlc_video_get_height(p\mp, @exeption) ;CallFunction(0, "libvlc_video_get_height", p\mp, @p\ex)
                  If p\sizex<>p\osizex And p\sizey<>p\osizey
                     p\osizex=p\sizex
                     p\osizey=p\sizey
                     ResizeWindow(1, #PB_Ignore, #PB_Ignore, p\sizex, p\sizey+20)
                     p\length.q = libvlc_media_player_get_length( p\mp, @exeption) ;CallFunction(0, "libvlc_media_player_get_length", p\mp, @p\ex)                 
                     p\stukje.q = p\length.q / 1000
                     If p\length=0
                        DisableGadget(0, 1)
                     Else
                        DisableGadget(0, 0)
                     EndIf
                     SetGadgetText(2, "||")                              
                  EndIf   
                  p\curpos.q = libvlc_media_player_get_time( p\mp, @exeption) ;CallFunction(0, "libvlc_media_player_get_time", p\mp, @p\ex)
                  If p\curpos.q<>p\curposo.q
                     p\curposo.q = p\curpos.q
                     p\stukje.q = p\length.q / 1000
                     If p\stukje>0 And p\curpos>0
                        SetGadgetState(0, p\curpos/p\stukje)
                     EndIf
                  EndIf
               Case 4 ; libvlc_Paused 	
               Case 5 ; libvlc_Stopped 	
               Case 6 ; libvlc_Forward 	
               Case 7 ; libvlc_Backward 	
               Case 8 ; libvlc_Ended 	
               Case 9 ; libvlc_Error
            EndSelect
        Wend
        If p\mp
           libvlc_media_player_stop(p\mp, @exeption) ;CallFunction(0, "libvlc_media_player_stop", p\mp, @p\ex)
           libvlc_media_player_release(p\mp) ;, @exeption) ;CallFunction(0, "libvlc_media_player_release", p\mp)
        EndIf
    EndIf 
    libvlc_release(p\inst)    
EndIf
User avatar
Inner
PureBasic Expert
PureBasic Expert
Posts: 714
Joined: Fri Apr 25, 2003 4:47 pm
Location: New Zealand

Re: LibVLC using ImportC

Post by Inner »

Philippe-felixer76-2 wrote:
Inner wrote:http://rainbowplayer.googlecode.com/files/pbVLC.zip

This is where I'm up to.
Wow Inner, nice work. I adjusted your code a bit so that
is't also usable under windows using a .lib file created with
polib.

Strange thing is, under windows it works more or less, i get
audio/video output. But i NEED to set the current directory
in the compiler options to the directory of VLC, otherwise
i get the same error as in Linux, quit unexpectedly.

Here's the libvlc.pb i adjusted, im out of options ATM:
When your using the the IDE to compile with PB looks in /compilers by default for the location of any .dll / .lib, linux is a different story :)

Added you code to ImportC handling.

I'll have a poke around a little bit more, when I last posted my vlc wasn't even capable of playing videos at all though the normal interface that comes with, I've sorted that out .. don't ask it's a gentoo thing.

Code: Select all

[????????] x11 video output error: X11 request 2.0 failed with error code 3:
 BadWindow (invalid Window parameter)
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  2 (X_ChangeWindowAttributes)
  Resource id in failed request:  0x80db108
  Serial number of failed request:  31
  Current serial number in output stream:  32
Wouldn't happen to be that error would it ?
Post Reply