Glad your also happy.. we need youCoolman wrote:Now ScrollBarGadget works
There is no need to copy pbVLC in the directory VLC
but the display window is altered if covered by another ...

Work in progress.. you can help ..
Gr,
Phil.
I found thisPhilippe-felixer76-2 wrote:Glad your also happy.. we need youCoolman wrote:Now ScrollBarGadget works
There is no need to copy pbVLC in the directory VLC
but the display window is altered if covered by another ...
Work in progress.. you can help ..
Gr,
Phil.
Yeah i know Inner, i call it the 0.9 + and the 0.9 - way.Inner wrote:just a quick word your doing something really bad in your code, not earth shattering but bad none the less;
Some of the API commands your using in libvlc are deprecated.
http://www.videolan.org/developers/vlc/ ... ylist.html
Don't know if that term is formilure to you at all, I've only noticed it myself around linux circles, basically deprecated means the functions are going to be gone soon, and there is no telling when they'll disappear, which is why I paid no effort in converting those for the Includes to LibVLC.
I couldn't figure out why you'd gone back to library() open calls, until I started making an example template to go with the (yet to be release new version of the includes), using your OpenLibrary() example as guide to get things done, and suddenly found missing commands, then I realized why they where deprecated.
It's not going to harm anything for now.. but it would be a good step to move away from them.
Using deprecated commands and then having to redo your whole code style to fit a new API it tiresome and time consuming.
Code: Select all
;; 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)
Code: Select all
;*****************************************************************************
; Example: pbvlc.pb
; By: T.J.Roughton
; Requires: libvlc.pb (includes)
;*****************************************************************************
IncludeFile "libvlc.pb"
Enumeration
#WINDOW_PLAYMEDIA
EndEnumeration
Enumeration
#GAD_TRACKBAR
#GAD_FILE
#GAD_PLAYPAUSE
#GAD_MEDIACONTAINER
EndEnumeration
Global Dim vlc_args.s(8)
Global Dim utf8args(8)
;*****************************************************************************
; VLC Exception
;*****************************************************************************
Procedure Debug_Exception(cmd.s,ex.l,result.l=-1)
*exception.libvlc_exception=ex
OpenConsole()
PrintN(cmd+" = "+Str(result))
PrintN("libvlc_exception\raised="+Str(*exception\raised))
PrintN("libvlc_exception\code="+Str(*exception\code))
PrintN("libvlc_exception\message="+*exception\message)
CloseConsole()
EndProcedure
;*****************************************************************************
; Choose URL/File
;*****************************************************************************
Procedure.s OpenWindow_ChooseURLFILE()
result.s=""
If OpenWindow(0, 0, 0, 300, 50, "Choose URL/File", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget|#PB_Window_ScreenCentered)
ButtonGadget(1,10,10,135,30,"URL")
ButtonGadget(2,155,10,135,30,"FILE")
While wevent<>#PB_Event_CloseWindow
wevent = WindowEvent()
If wevent = #PB_Event_Gadget
Select EventGadget()
Case 1 ; URL
result.s=InputRequester("URL","Enter URL","")
wevent=#PB_Event_CloseWindow
Case 2 ; FILE
result.s=OpenFileRequester("File","","",0)
wevent=#PB_Event_CloseWindow
EndSelect
EndIf
Wend
EndIf
CloseWindow(0)
ProcedureReturn result
EndProcedure
;*****************************************************************************
; Set Args
;*****************************************************************************
Procedure SetArguments(location.s)
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"
PBVLC_MakeArgs(vlc_args(), 8, utf8args())
EndProcedure
;*****************************************************************************
; Roll it!
;*****************************************************************************
Procedure OpenWindow_PlayMedia(location.s)
exception.libvlc_exception
If OpenWindow(#WINDOW_PLAYMEDIA, 0, 0, 60, 20, "PureBasic VLC", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MaximizeGadget)
ButtonGadget(#GAD_PLAYPAUSE, 0, 0, 0, 0, "F")
ButtonGadget(#GAD_FILE, 0, 0, 0, 0, ">")
ScrollBarGadget(#GAD_TRACKBAR, 0, 0, 0, 0, 0, 1000, 1)
ContainerGadget(#GAD_MEDIACONTAINER, 0, 0, 0, 0)
drawable=PBVLC_XDisplayFromWindowID(GadgetID(#GAD_MEDIACONTAINER))
; Set the arguments up for VLC
SetArguments(location)
; Init
libvlc_exception_init(@exception)
instants = libvlc_new (8,@utf8args(),@exception)
item = libvlc_playlist_add (instants,@location,#Null,@exception)
libvlc_playlist_play (instants,item,0,#Null,@exception)
mplayer = libvlc_playlist_get_media_player (instants,@exception)
; we must start playing so that libvlc_video_set_parent has some input first!
libvlc_video_set_parent (instants,drawable,@exception)
oldwsize.l=0
oldhsize.l=0
oldcurpos.q=0
While wevent<>#PB_Event_CloseWindow
wevent = WindowEvent()
If wevent = #PB_Event_Gadget
Select EventGadget()
Case #GAD_TRACKBAR
Case #GAD_FILE
Case #GAD_PLAYPAUSE
Case #GAD_MEDIACONTAINER
EndSelect
EndIf
If wevent=#PB_Event_SizeWindow
If IsGadget(#GAD_TRACKBAR)
ResizeGadget(#GAD_TRACKBAR, 40, WindowHeight(#WINDOW_PLAYMEDIA)-20, WindowWidth(#WINDOW_PLAYMEDIA)-40, 20)
EndIf
If IsGadget(#GAD_FILE)
ResizeGadget(#GAD_FILE, 0, WindowHeight(#WINDOW_PLAYMEDIA)-20, 20, 20)
EndIf
If IsGadget(#GAD_PLAYPAUSE)
ResizeGadget(#GAD_PLAYPAUSE, 20, WindowHeight(#WINDOW_PLAYMEDIA)-20, 20, 20)
EndIf
If IsGadget(#GAD_MEDIACONTAINER)
ResizeGadget(#GAD_MEDIACONTAINER, 0, 0, WindowWidth(#WINDOW_PLAYMEDIA), WindowHeight(#WINDOW_PLAYMEDIA)-20)
EndIf
EndIf
state = libvlc_media_player_get_state(mplayer, @exception)
Select state
Case 0 ; libvlc_NothingSpecial
Case 1 ; libvlc_Opening
Case 2 ; libvlc_Buffering
Case 3 ; libvlc_Playing
width=libvlc_video_get_width(mplayer,@exception)
height=libvlc_video_get_height(mplayer,@exception)
curpos.q=libvlc_media_player_get_time(mplayer,@exception)
If (width<>oldwsize And height<>oldhsize)
oldwsize=width
oldhsize=height
ResizeWindow(#WINDOW_PLAYMEDIA,#PB_Ignore,#PB_Ignore,width,height+20)
;
length.q=libvlc_media_player_get_length(mplayer,@exception)
stukje.q=length.q/1000
If length=0
DisableGadget(#GAD_TRACKBAR,1)
Else
DisableGadget(#GAD_TRACKBAR,0)
EndIf
SetGadgetText(#GAD_PLAYPAUSE, "||")
EndIf
If curpos<>oldcurpos
curposo=curpos
stukje.q = length / 1000
If (stukje>0 And curpos>0)
SetGadgetState(#GAD_TRACKBAR,curpos/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
Delay(1)
Wend
If mplayer
libvlc_media_player_stop(mplayer,@exception)
libvlc_media_player_release(mplayer)
EndIf
libvlc_release(instants)
CloseWindow(#WINDOW_PLAYMEDIA)
EndIf
EndProcedure
;-----------------------------------------------------------------------------
OpenWindow_PlayMedia(OpenWindow_ChooseURLFILE())
Wow nice work.. i needed to adjust some things to get it toInner wrote:Right then, here is a working example at least on linux using old deprecated functionshaven't gotten around to upgrading it yet, one thing at a time, I first needed to *cough* clean *cough* the code a bit so that I could understand what was going on, hope you can identify your finger prints
Code: Select all
.code.
that's due to where windows looks for dlls; copy libvlc.dll into the source's directory (as this is where it would be in a finalised project, i.e. the exe's directory), or into the system32 dir (in system32 is not advisable if you ask me)Philippe-felixer76-2 wrote:The most strange things is, on windows you need to set
the defaultdirectory in compiler options in PB to the directory
where the libvlc.dll is. Otherwise a you get a error not finding
the dll.
So it seems setcurrentdirectory() doesn't work with using ImportC on windows, it does work with using Openlibrary(). Strange..lexvictory wrote:that's due to where windows looks for dlls; copy libvlc.dll into the source's directory (as this is where it would be in a finalised project, i.e. the exe's directory), or into the system32 dir (in system32 is not advisable if you ask me)Philippe-felixer76-2 wrote:The most strange things is, on windows you need to set
the defaultdirectory in compiler options in PB to the directory
where the libvlc.dll is. Otherwise a you get a error not finding
the dll.
Fixed.Philippe-felixer76-2 wrote: The drawable needed a compilerif because on windows
it uses a plain gadgetid().
Uhmm there probably all like that you know, we're just using a small amount of the commands available so.. (ponders) I'll make a CompilerSelect on OS to select the right include of libvlc_linux.pb / libvlc_windows.pb / libvlc_macos.pb, where by you would just include as normal libvlc.pb and the compiler would choose the right one, appears the simplest way around this banana.Philippe-felixer76-2 wrote: A few defs (17+/-) from ImportC like for example
libvlc_exception_init( *exception.l ) As "libvlc_exception_init"
only works like this:
libvlc_exception_init( *exception.l )
You can redistribute the dlls/codecs for VLC it's open source as you likely know and GPL if I recall, just remember to include the verious legal bumbo jumbo, then it won't matter where it is as much.Philippe-felixer76-2 wrote: The most strange things is, on windows you need to set
the defaultdirectory in compiler options in PB to the directory
where the libvlc.dll is. Otherwise a you get a error not finding
the dll.
Philippe-felixer76-2 wrote: Apart from this its multiOS already
I have bad luck getting PB to run on OSX BTW..
not strange at all really... using openlibrary is like opening a file; it doesn't really matter where it is, but using Import/ImportC means that the exe is linked to the dll and cant function if windows cant find it.Philippe-felixer76-2 wrote:So it seems setcurrentdirectory() doesn't work with using ImportC on windows, it does work with using Openlibrary(). Strange..
And I don't really want to uhmm .. copy it .. although tempting I've wondered what that OS feels like to run.lexvictory wrote:Philippe-felixer76-2 wrote: hehe i use OSX 10.4.8 in vmware (10.5.2 doesn't seem to like it)
OSX doesnt support my wireless card, i dont like to run an ethernet cable thru the house and my graphics card is too new, so running it w/o virtualisation is a hassle
Wow thats fast..Inner wrote:http://rainbowplayer.googlecode.com/fil ... alpha3.zip
Alpha 3
Fixed: pbvlc_example.pb PBVLC_XDisplayFromWindowID() only required for linux
Changed: Split up the include files for each OS and made a central include to include only the include the source being compiled on.
Yeah but before i call ImportC is do a setcurrentdirectory() tolexvictory wrote:not strange at all really... using openlibrary is like opening a file; it doesn't really matter where it is, but using Import/ImportC means that the exe is linked to the dll and cant function if windows cant find it.Philippe-felixer76-2 wrote:So it seems setcurrentdirectory() doesn't work with using ImportC on windows, it does work with using Openlibrary(). Strange..
From memory Windows looks in the exe dir, the current dir, then the system dir (perhaps not in that order though)
if on linux you moved libvlc from /usr/lib, you would get the equivalent error message
hehe i use OSX 10.4.8 in vmware (10.5.2 doesn't seem to like it)
OSX doesnt support my wireless card, i dont like to run an ethernet cable thru the house and my graphics card is too new, so running it w/o virtualisation is a hassle