play Videos?

BlitzMax Forums/BlitzMax Programming/play Videos?

Kernle 32DLL_2(Posted 2005) [#1]
hi

i remember some good functions of BlitzBasic to play some videoclips. But how can i realize something in BlitzMax?


Dreamora(Posted 2005) [#2]
you can't

you would have to write your own module to play movies somehow ...


GW(Posted 2005) [#3]
You can, In windows.
Someone posted code to play movies through the windows api. works really well. Not sure where the link is though


Will(Posted 2005) [#4]
Will there be a cross platform built in solution for this? Quicktime support or something?


Robert(Posted 2005) [#5]
The people who created the free Ogg Vorbis format have also created an open video format called Theora (http://www.theora.org)

Perhaps this would be a good solution. The downside is that videos would have to be converted first.


DannyD(Posted 2006) [#6]
Wondering if there is any update regarding playing quicktime or any movie format whether through a public mod or official mod?


DannyD(Posted 2006) [#7]
Anyone?


ziggy(Posted 2006) [#8]
Hi, here's a small piece of code that enables playing AVI files, fullscreen, on windows. This code is working for Cinepak codec files, and some Indeo and Microsoft ones, but It didn't worked with DivX (don't know why).

Here you've got it:

Extern "Win32"
	Function mciSendString:Int(pstrCommand$z, lpstrReturnStr$z, wReturnLen:Int, CallBack:Int) = "mciSendStringA@16"
End Extern


Function PlayAVI:Int(FileName:String)
    Local cmdStr:String = ""
    Local ReturnCode:Int
    ReturnCode = mciSendString("close AVI_Device","",0,0)
    ReturnCode = mciSendString("open " + Chr(34) + filename + Chr(34) + " type avivideo alias AVI_Device","",0,0)
    If returncode<>0 Then 
    	Print "Error opening AVI device. Error code:" + returncode
    	Return False
    EndIf
    CmdStr = "play AVI_Device fullscreen wait"
    returncode =  mciSendString(cmdstr ,cmdstr , 0, 0)
    If returncode<>0 Then 
    	Print "Error playing AVI file. Error code:" + returncode
    	Return False
    Else
	Return True	 
	EndIf
End Function

PlayAVI("e:\graphicalism\people.avi")  
PlayAVI("e:\graphicalism\shell.AVI")
PlayAVI("e:\graphicalism\larocca.AVI")


I know it's not a real solution... but it can be helpful while nobody makes a real video playing module.


DannyD(Posted 2006) [#9]
Thanks Ziggy, anyone got similar for Mac Os ?


ziggy(Posted 2006) [#10]
There must be a way to call the system api for MacOsX, and access to QuickTime from there. but no idea how to interact with MacOsX API


Chris C(Posted 2006) [#11]
theres some rough mpeg replay stuff that should be x-platform and works with max2d, its on my site, let me know how you get on.


DannyD(Posted 2006) [#12]
I get this
Building play
Compiling:frame_wrap.cpp
Compiling:play.bmx
Linking:play.debug
ld: archive: /Users/danny/Desktop/mpeg/mpeg2dec-0.4.0/libmpeg2/.libs/libmpeg2.a has no table of contents, add one with ranlib(1) (can't load from it)
ld: archive: /Users/danny/Desktop/mpeg/mpeg2dec-0.4.0/libmpeg2/convert/.libs/libmpeg2convert.a has no table of contents, add one with ranlib(1) (can't load from it)
Build Error: Failed to link /Users/danny/Desktop/mpeg/play.debug.app/Contents/MacOS/play.debug
Process complete

Hmm, perhaps something is wrong with my Apple Developer Tools installation, must investigate...


Chris C(Posted 2006) [#13]
hehe, I'm guessing you'll have to recompile libmpeg2.a for use on the mac, I'm away from home, but could possibly do a version that imports just the C code not a precompiled archive.

libmpeg2 is on sourceforge, you might wanna have a go at compiling its C samples.

Email me if you would like to get this working on Mac, I dont have a Mac, but I'm sure together we could provide a solution for Mac users.


Chris C(Posted 2006) [#14]
Just got it working in win32 and Linux by importing C files instead of using an archive file (.a)

Just waiting for someone to get home, so they can test it on the mac for me, odds on this will now work on all 3 platforms... :D


DannyD(Posted 2006) [#15]
Hi chris,
I tried again and got the same error as above. It compiles the c code but stops during the linking. I understand this is a known issue with BM and Mac Os X at the moment and will investigate some more over the next week.