help with video code?

BlitzMax Forums/BlitzMax Beginners Area/help with video code?

Caton(Posted 2016) [#1]
Is there a way to build blitzmax for windows x64?


xlsior(Posted 2016) [#2]
Yes, using Brucey's BMX NG.


Caton(Posted 2016) [#3]
I meant build blitz max from source to windows x64 platform V14 run time so it will run fast.


Brucey(Posted 2016) [#4]
If you think your BlitzMax app is running slowly, you are probably doing something wrong.


Caton(Posted 2016) [#5]
it's not slow I just to know how to build my blitzmax for windows x64
so I can use vlc 64x lib.

see post here http://www.blitzbasic.com/codearcs/codearcs.php?code=3230


xlsior(Posted 2016) [#6]
Using BMX NG with the custom MaxIDE you can compile 64 bit windows executables, which can communicate with 64 bit DLLs as well.


Caton(Posted 2016) [#7]
I'm having errors with bmx ng x64 compiling, please help?

Import maxgui.drivers

' LibVLC functions...

Global libvlc_new:Byte Ptr							(argc:Int, argv:Byte Ptr)			"win32"
Global libvlc_release:Byte Ptr						(instance:Byte Ptr)					"win32"	' Void return

Global libvlc_media_new_path:Byte Ptr				(instance:Byte Ptr, path:Byte Ptr)	"win32"
Global libvlc_media_new_location:Byte Ptr			(instance:Byte Ptr, path:Byte Ptr)	"win32"
Global libvlc_media_release:Int						(media:Byte Ptr)					"win32"	' Void return

Global libvlc_media_player_new_from_media:Byte Ptr	(media:Byte Ptr)					"win32"
Global libvlc_media_player_set_hwnd:Int				(player:Byte Ptr, hwnd:Int)			"win32"	' Void return
Global libvlc_media_player_play:Int					(player:Byte Ptr)					"win32"
Global libvlc_media_player_stop:Int					(player:Byte Ptr)					"win32"	' Void return
Global libvlc_media_player_release:Int				(player:Byte Ptr)					"win32"	' Void return

'Local file:String = RequestFile ("Select a media file...")
'If Not file Then End

Local file:String = "http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4"

' Assign functions from DLL...

Global libvlc:Int = LoadLibraryA ("libvlc.dll")

If libvlc

	libvlc_new							= GetProcAddress (libvlc, "libvlc_new")
	libvlc_release						= GetProcAddress (libvlc, "libvlc_release")
	
	libvlc_media_new_path				= GetProcAddress (libvlc, "libvlc_media_new_path")
	libvlc_media_new_location			= GetProcAddress (libvlc, "libvlc_media_new_location")
	libvlc_media_player_new_from_media	= GetProcAddress (libvlc, "libvlc_media_player_new_from_media")
	libvlc_media_release				= GetProcAddress (libvlc, "libvlc_media_release")
	
	libvlc_media_player_set_hwnd		= GetProcAddress (libvlc, "libvlc_media_player_set_hwnd")
	libvlc_media_player_play			= GetProcAddress (libvlc, "libvlc_media_player_play")
	libvlc_media_player_stop			= GetProcAddress (libvlc, "libvlc_media_player_stop")
	libvlc_media_player_release			= GetProcAddress (libvlc, "libvlc_media_player_release")
	
	Local instance:Byte Ptr
	Local media:Byte Ptr
	Local player:Byte Ptr
	
	' Create VLC instance...
	
	instance = libvlc_new (0, Null)
	
	If instance
	
		' Load media from filename...
		
'		media = libvlc_media_new_path (instance, file.ToCString ())
		media = libvlc_media_new_location (instance, file.ToCString ())
		
		If media
		
			' Create VLC player...
			
			player = libvlc_media_player_new_from_media (media)
			
			If player
			
				' Blitz window...
			
				Local window:TGadget = CreateWindow ("Media player", 320, 200, 640, 480)
				
				If window
				
					' Inner client area of window...
					
					Local hwnd:Int = QueryGadget (window, QUERY_HWND_CLIENT)
					
					' Tell VLC to render into client area...
					
					libvlc_media_player_set_hwnd player, hwnd
					
					' Play!
					
					libvlc_media_player_play player
	
					Repeat
						
						Select WaitEvent ()
							
							Case EVENT_WINDOWCLOSE
								Exit

						End Select
						
					Forever
					
					' Stop and release VLC player...
					
					If player
						libvlc_media_player_stop	player
						libvlc_media_player_release	player
					EndIf
					
				EndIf
			
			EndIf
		
			' Release media...
			
			libvlc_media_release media

		EndIf
		
		' Release VLC instance...
		
		libvlc_release instance
		
	EndIf
	
EndIf



col(Posted 2016) [#8]
You need to be VERY specific...
What errors do you have? What you have done so far? and what are the errors?


Caton(Posted 2016) [#9]
In the orginal blitzmax no errors in code, but when using bmx ng I get have you tested to code? it will show the error.


Brucey(Posted 2016) [#10]
For example, LoadLibraryA returns a Byte Ptr on NG.

This is where most of your issues will be - BlitzMax using Int for storing pointers. An issue in 64-bit where pointers are 8-bytes instead of 4-bytes.


Caton(Posted 2016) [#11]
Please help me fix the code.


col(Posted 2016) [#12]
The fixes are exactly as Brucey said... The main differences are some Int should be Byte Ptr.

Here you go... for you to compare and learn.
You need to be connected to the internet as it streams the video from the web. Don't forget that you need either the 32bit or the 64bit version of the dlls depending on the architecture that you have selected to build for in the 'program menu -> architecture' option. Also don't forget to copy the dlls as explained in the original post that you copied the example code from...




Caton(Posted 2016) [#13]
Thanks for code fix! :)


Caton(Posted 2016) [#14]
Also Is it possible to get the video in full screen so all I see is the video on my whole computer screen? and need help on adding code when vlc is done playing video end the program


col(Posted 2016) [#15]
Hiya,

What code have you tried to get full screen video and get detection of the video stream stopped playing? For me to work know how to do this I would need to look through the api manual and apply it the code above... have you tried that just yet?


Caton(Posted 2016) [#16]
post removed.