Tobias,
I liked your ideas of:
Dim aExec As String[]
Dim sRes As String
aExec = ["cat", "/proc/meminfo"]
' Use aExec.Add() to add more arguments
Exec aExec To sRes

and (thread 'Stopping a CLI program):
Print #hFfmpeg, "q"
if you opened it For Output...

Currently I have:
Private hffmpeg as Process
Private sOutput As String
...
Dim aExec As String
...
aExec = ["ffmpeg"]
aExec.Add("-f x11grab")
aExec.Add("-s " & iScreenWidth & "x" & iScreenHeight)
aExec.Add("-i :0.0+" & iScreenLeft & "," & iScreenTop & "+nomouse")
aExec.Add("-f pulse")
aExec.Add("-i " & "$(pactl list | grep -A2 '^Source #' | grep 'Name: 
.*\\.monitor$' | awk '{print $NF}' | tail -n1)")
aExec.Add("-f " & sFileFormat)
aExec.Add("-vcodec" & svcodec)
aExec.Add("-r 25")
aExec.Add("-vb 1024k")
aExec.Add("-acodec" & sacodec)
aExec.Add("-ac 2")
aExec.Add("-ab 128k")
aExec.Add("-async 1")
aExec.Add("-threads " & bThreads)
aExec.Add("-y")
aExec.Add(sVideoPath)
hffmpeg = Exec aExec Wait For Read As "Messages"
...
Public Sub Messages_Read()
   Dim sLine As String
   Read #Last, sLine, -256
   sOutput &= sLine
End
Public Sub Messages_Kill()
   Print sOutput
End
...

Ideally, I'd like to add "Write" to the Exec line (as it seems to me that it 
won't go wrong if ffmpeg 'corrupts' the output file in comparison to 
using"hffmpeg.Kill()") , so that I can use (in a Stop button's click event):
Print #hffmpeg, "q"

However, I can't get the syntax right. I've tried 'Write' after 'For', 'Write' 
after 'Messages', 'For Write' between 'aExec' & 'For'. Is it possible to do 
this?

I don't understand the explanation of using Input instead of Read & 
Output instead of Write (i.e. "If you use the *INPUT* and *OUTPUT* 
keywords instead of *READ* and *WRITE*, then the process is executed 
inside a virtual terminal. The process will think running inside a true 
terminal.virtual terminal."). What are the implications of this, e.g. 
for my app?

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to