External Shell Program

BlitzMax Forums/BlitzMax Programming/External Shell Program

MacSven(Posted 2007) [#1]
Hi,

I wan't to use a external Program Application (MPlayer) with my Blitzmax Application. It is a Shell program under MacOS X. I used the program from Blitzmax forum to start a External program. This works great, but i think there is a different between Shell Appication and GUI Application. The MPlayer is a nice idea to build a HTPC Interface like iTheater or Centerstage.
Does anyone know how i can start it?


Dreamora(Posted 2007) [#2]
CreateProcess

There is no difference if you use shell application or gui, beside the fact that the gui application NEEDS gui mode where the shell application can use the gui mode but does not depend on it.


grable(Posted 2007) [#3]
And for ALL platforms.

system_


TeaVirus(Posted 2007) [#4]
Here's something I threw together a while ago:

http://www.blitzmax.com/Community/posts.php?topic=55043

It works under Win32 and should for Linux without too much trouble. I'd like to get it up and running under OSX but wasn't able to find a proper command line version of MPLayer. They all seemed to have a GUI tacked on.


MacSven(Posted 2007) [#5]
I see you have the same problem TeaVirus. This version of mplayer have no gui.
Tested it, but nothing works. MPlayer Start and after a few seconds of playing , it freez. In the Shell typing this, and it plays the movie till the end, also m4a and mp3
Is it a problem while mplayer returns this:


./mplayer s02e52-2.avi

MPlayer dev-SVN-r21482-4.0.1 (C) 2000-2006 MPlayer Team
AltiVec found
CPU: PowerPC

Playing s02e52-2.avi.
AVI file format detected.
VIDEO: [DX50] 384x288 24bpp 25.000 fps 437.2 kbps (53.4 kbyte/s)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffodivx] vfm: ffmpeg (FFmpeg MPEG-4)
==========================================================================
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
mpg123: Can't rewind stream by 239 bits!
AUDIO: 48000 Hz, 2 ch, s16be, 128.0 kbit/8.33% (ratio: 16000->192000)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
AO: [macosx] 48000Hz 2ch s16be (2 bytes per sample)
Starting playback...
VDec: vo config request - 384 x 288 (preferred colorspace: Planar YV12)
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
SwScaler: using unscaled yuv420p -> yuyv422 special converter
VO: [macosx] 384x288 => 384x288 Packed YUY2
New_Face failed. Maybe the font path is wrong. 1 ??% ??% ??,?% 0 0
Please supply the text font file (~/.mplayer/subfont.ttf).
subtitle font: load_sub_face failed.
A: 201.3 V: 201.3 A-V: -0.003 ct: 0.067 5033/5033 8% 7% 4.2% 12 0


MacSven(Posted 2007) [#6]
Find out Something:

If i use CreateProcess MPlayer Crash after a few seconds.

If i use this:

system_ "open ./mplayer file.mp3"
it open a shell and iTunes is loading and plays the musik

If i use this:

system_ "./mplayer file.mp3" it play the musik to end

If i use this:

system_ "./mplayer >logfile.txt file.mp3" the shelloutput is written to logfile.txt and it play the musik to end


but i can't use my BlitzMax program. I have to wait for mplayer is finish the playback. The same on Video files.


Dreamora(Posted 2007) [#7]
CreateProcess is the only way to have your app running further while the other one is running. (ok, in some cases openurl works as well)

There is theoretically no reason that it should crash unless you did not assign the process to a variable which is saved in your app and kept alive (otherwise the process is killed by the garbage collector naturally)

EDIT
Just to add something to your crash problem: Did you change the directory before executing MPlayer and the like?
Because if you didn't, the player might try to look for its needed files in the directory of your application, which logically will fail. (thats what I assume due to the missing font error)