libVLC in pb (Windows Only)
libVLC in pb (Windows Only)
hola
libVLC is the core engine and the interface to the multimedia framework on which VLC media player is based.
libVLC is modularized into hundreds of plugins, which may be loaded at runtime. This architecture provides great flexibility to developers (both VLC devs and devs consuming the library). It allows developers to create a wide range of multimedia applications using the VLC features.....
more ...https://www.videolan.org/vlc/libvlc.html
API Documentation https://videolan.videolan.me/vlc/group__libvlc.html
Requirements
vlc media player https://www.videolan.org/vlc/
vlc.pb
https://www.mediafire.com/file/jkqzr8sf ... b.zip/file
libVLC is the core engine and the interface to the multimedia framework on which VLC media player is based.
libVLC is modularized into hundreds of plugins, which may be loaded at runtime. This architecture provides great flexibility to developers (both VLC devs and devs consuming the library). It allows developers to create a wide range of multimedia applications using the VLC features.....
more ...https://www.videolan.org/vlc/libvlc.html
API Documentation https://videolan.videolan.me/vlc/group__libvlc.html
Requirements
vlc media player https://www.videolan.org/vlc/
vlc.pb
https://www.mediafire.com/file/jkqzr8sf ... b.zip/file
interested in Cybersecurity..
Re: libVLC in pb
Thank you CELTIC88, thats pretty cool im sure it will help me coding a subbing tool
Re: libVLC in pb
Very interesting.
I've dreamed several times to use the VLC API instead of Fmodex for my little webradio program (function: network stream in VLC), but I gave up because of the amount of documentation.
I've dreamed several times to use the VLC API instead of Fmodex for my little webradio program (function: network stream in VLC), but I gave up because of the amount of documentation.
Re: libVLC in pb
A lot of work.
Thank you very much!
At the first try of the example, I saw nothing.
Then I noticed, that vlc_loadlibvlc() returns nothing.
So I modified it a bit:
And modified the example:
So I was able to see that the dll was not loaded, but the path was correct.
Then I remebered that I used PB x86. So the dll was not usable.
I started it with PB x64 and ...
it worked.
Btw.: the CompilerIf should be placed in vlc.pb, which should be a vlc.pbi
Oh and you should use
In your files, else you 'force' a user to use EnableExplicit.
Thank you very much!
At the first try of the example, I saw nothing.
Then I noticed, that vlc_loadlibvlc() returns nothing.
So I modified it a bit:
Code: Select all
Procedure.i vlc_loadlibvlc(libvlcpath.s)
Protected cd.s = GetCurrentDirectory()
SetCurrentDirectory(GetPathPart(libvlcpath))
vlc_libisloaded = libvlc_loadapi(OpenLibrary(#PB_Any, GetFilePart(libvlcpath)))
SetCurrentDirectory(cd)
ProcedureReturn vlc_libisloaded
EndProcedure
Code: Select all
IncludeFile "vlc.pb"
CompilerIf Not #PB_Compiler_Thread
CompilerError "You have to enable thread save!"
CompilerEndIf
If vlc_loadlibvlc("C:\Program Files\VideoLAN\VLC\libvlc.dll") ; select vlc dll
OpenWindow(0, 0, 0, 800, 700, "")
CanvasGadget(1, 0, 0, 800, 700)
vlc = vlc_createplayer(GadgetID(1), #True)
vlc_setvolume(vlc, 80)
; vlc_play(vlc,"https://www.youtube.com/watch?v=sOlP10fDclE&ab_channel=ClassicMrBean") ; not work for youtube video
vlc_addplaylist(vlc,"https://www.youtube.com/watch?v=sOlP10fDclE&ab_channel=ClassicMrBean")
vlc_playplaylist(vlc)
While WaitWindowEvent() <> #PB_Event_CloseWindow
Wend
vlc_freeplayer(vlc)
Else
Debug "Was not able to load libvlc.dll"
EndIf
Then I remebered that I used PB x86. So the dll was not usable.
I started it with PB x64 and ...
it worked.
Btw.: the CompilerIf should be placed in vlc.pb, which should be a vlc.pbi
Oh and you should use
Code: Select all
CompilerIf #PB_Compiler_IsMainFile
EnableExplicit
CompilerEndIf
Re: libVLC in pb
I get a "Invalid memory access" on
Procedure.s vlc_stringformat(fmt,va_list)
Protected sret.s
Protected c = snprintf(0,0,fmt,va_list)
Procedure.s vlc_stringformat(fmt,va_list)
Protected sret.s
Protected c = snprintf(0,0,fmt,va_list)
WARNING: I dont know what I am doing! I just put stuff here and there and sometimes like magic it works. So please improve on my code and post your changes so I can learn more. TIA
-
- Addict
- Posts: 1309
- Joined: Fri Aug 28, 2015 6:10 pm
- Location: Portugal
Re: libVLC in pb
Hi
How do I get this to work on the MAC?
How do I get this to work on the MAC?
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Re: libVLC in pb
Maybe this helps: viewtopic.php?f=13&t=70862
I am to provide the public with beneficial shocks.
Alfred Hitshock
- Kwai chang caine
- Always Here
- Posts: 5357
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Re: libVLC in pb
Works perfectly here
Thanks a lot my friend for sharing this great job
Thanks a lot my friend for sharing this great job
The happiness is a road...
Not a destination
Not a destination
-
- Addict
- Posts: 1309
- Joined: Fri Aug 28, 2015 6:10 pm
- Location: Portugal
Re: libVLC in pb
Finally got it to work on macOS Big Sur!
Used vlc 2.2.8 and changed a few bits.
Now I just need to sort out Play, Pause, Stop.
I am only using this to play my audio files which are right old mix.
I think the sequence I need is to:-
1. Create Player
2. Play the song
3. When stopping
Stop the player
Free the player
Then wind back to step 1 to play the next song.
If I have some success I will post back here.
Hopefully I can wait for InitSound() on Big Sur to be fixed.
Used vlc 2.2.8 and changed a few bits.
Now I just need to sort out Play, Pause, Stop.
I am only using this to play my audio files which are right old mix.
I think the sequence I need is to:-
1. Create Player
2. Play the song
3. When stopping
Stop the player
Free the player
Then wind back to step 1 to play the next song.
If I have some success I will post back here.
Hopefully I can wait for InitSound() on Big Sur to be fixed.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
-
- Addict
- Posts: 1309
- Joined: Fri Aug 28, 2015 6:10 pm
- Location: Portugal
Re: libVLC in pb
Got it working playing my .ogg and .mp3 and added to my audio player.
Just want to read Artist and title from the meta data if possible.
Tried:-
The song plays straight away no bother but I get no meta data.
What am I missing?
PS if I change the line to
Debug vlc_getmeta(Myvlc,#libvlc_meta_Title)
It returns the Filename
Just want to read Artist and title from the meta data if possible.
Tried:-
Code: Select all
vlc_play(Myvlc,"File:///" + FileName)
Debug "Meta Data"
Debug vlc_getmeta(Myvlc,#libvlc_meta_Artist)
Debug "End Meta"
What am I missing?
PS if I change the line to
Debug vlc_getmeta(Myvlc,#libvlc_meta_Title)
It returns the Filename
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
-
- Addict
- Posts: 1309
- Joined: Fri Aug 28, 2015 6:10 pm
- Location: Portugal
Re: libVLC in pb
Lovely.
Spurred on by InitSound() not working on Big Sur
Tried this and got it working for playing MP3, .ogg and FLAC.
Downloaded VLC 2.2.8 then pulled out the libs and plugins etc.
Had to change one bit in the libvlc.pb
I now have the player start,Stop, Pause etc and volume control and a status line to display time played.
Very scrappy GUI as just trying it out.
Code still has my debug statements in as well.
Works on MAC Big Sur.
I think you will need to change the CreatePlayer() procedure to get it to work on windows and or linux.
The whole thing can be downloaded here:-https://www.mediafire.com/file/zsi4cxg4 ... t.zip/file
This includes the libs etc
In the download there is a TI Media.db file this can be deleted just me trying to get other things working.
Spurred on by InitSound() not working on Big Sur
Tried this and got it working for playing MP3, .ogg and FLAC.
Downloaded VLC 2.2.8 then pulled out the libs and plugins etc.
Had to change one bit in the libvlc.pb
I now have the player start,Stop, Pause etc and volume control and a status line to display time played.
Very scrappy GUI as just trying it out.
Code still has my debug statements in as well.
Works on MAC Big Sur.
I think you will need to change the CreatePlayer() procedure to get it to work on windows and or linux.
The whole thing can be downloaded here:-https://www.mediafire.com/file/zsi4cxg4 ... t.zip/file
This includes the libs etc
In the download there is a TI Media.db file this can be deleted just me trying to get other things working.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Re: libVLC in pb
I'm guessing this is for MacOS?
https://paste.pics/157d4a2e48de397a37963f8d9972a8ce
Judging from the error above, or should I download from somewhere the Windows .libs and replace them.
https://paste.pics/157d4a2e48de397a37963f8d9972a8ce
Judging from the error above, or should I download from somewhere the Windows .libs and replace them.
-
- Addict
- Posts: 1309
- Joined: Fri Aug 28, 2015 6:10 pm
- Location: Portugal
Re: libVLC in pb
"Works on MAC Big Sur."
I have not done the same for windows .
I downloaded VLC 2.2.8. and extracted the libs and plugins.
Replace these with the ones for the version of windows/vlc you are using and modify the createplayer routine.
I have not done the same for windows .
I downloaded VLC 2.2.8. and extracted the libs and plugins.
Replace these with the ones for the version of windows/vlc you are using and modify the createplayer routine.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Re: libVLC in pb
This example is excellent! Thank you for providing it.
I've got it working for a basic video player, but I need to get the video and audio data so I can output to a SDI video card. The libvlc api makes that possible with a set callbacks routine. However I'm getting crashes in the first callback. I'm sure that I don't properly know how to define the call back.
The C (c++?) call back looks like this:
static void *lock(void *data, void **p_pixels)
{
struct ctx *ctx = data;
SDL_LockMutex(ctx->mutex);
SDL_LockSurface(ctx->surf);
*p_pixels = ctx->surf->pixels;
return NULL; /* picture identifier, not needed here */
}
I may or may not use SDL for this project. Most importantly I need the pixel data. Anyone know how to translate this to Purebasic?
Thanks,
Russ
I've got it working for a basic video player, but I need to get the video and audio data so I can output to a SDI video card. The libvlc api makes that possible with a set callbacks routine. However I'm getting crashes in the first callback. I'm sure that I don't properly know how to define the call back.
The C (c++?) call back looks like this:
static void *lock(void *data, void **p_pixels)
{
struct ctx *ctx = data;
SDL_LockMutex(ctx->mutex);
SDL_LockSurface(ctx->surf);
*p_pixels = ctx->surf->pixels;
return NULL; /* picture identifier, not needed here */
}
I may or may not use SDL for this project. Most importantly I need the pixel data. Anyone know how to translate this to Purebasic?
Thanks,
Russ
Re: libVLC in pb
Don't know anything about the SDL stuff, but my general solution would look like this:
Code: Select all
ProcedureC.i lock(*Data, *p_pixels)
Protected *ctx.ctx
*ctx = *Data
SDL_LockMutex(*ctx\mutex)
SDL_LockSurface(*ctx\surf)
PokeI(*p_pixels, *ctx\surf\pixels)
ProcedureReturn #Null
EndProcedure
Last edited by infratec on Fri Apr 29, 2022 10:04 pm, edited 1 time in total.