[squeak-dev] Raspberry PI & omxplayer from Squeak

David T. Lewis lewis at mail.msen.com
Thu Nov 19 03:56:01 UTC 2015


On Wed, Nov 18, 2015 at 09:12:51PM -0500, Jon Hylands wrote:
> Hi,
> 
> I've been playing around with Squeak 5.0 on a pi 2 (with the 7" LCD
> touchscreen), and one of the things I'd like to be able to do is run (and
> control) omxplayer from within Squeak.
> 
> I did the same thing with Python, using this library:
> https://github.com/willprice/python-omxplayer-wrapper/tree/develop/omxplayer
> 
> However, I don't really need all the fancy controls - what I really want is
> a way to launch it, and then a way to kill it. I'll be streaming live MJPEG
> video from a webcam, so there is no concept of pause/stop/etc. I need to
> kill it because I want the ability to choose one of a couple different
> video streams.
> 
> I tried using OSProcess, but it gives me the pid of the shell script that
> launches the application, and not the application itself. I could certainly
> hack something using ps and grep, but I would prefer if there were a better
> way to do it.
> 
> Any ideas?

Hi Jon,

If you are trying to interact with an external process, you probably want
CommandShell, which is a companion package meant to be used with OSProcess.
The base OSProcess package has various utility methods (quite ill-advised
with the benefit of hindsight) that run external programs under a unix
shell. I originally intended that as a convenience, but it turns out to
be more confusing than it is helpful.

What you probably really want to do is run a program and interact with
it directly by talking to its standard input stream and listening to its
standard output and standard error streams. In most cases, the class
PipeableOSProcess will do what you want. At a slightly higher level, if
you need the very loose equivalent of unix shell parsing, ProxyPipeline
may be a better fit. Slightly higher level, the class CommandShell
provides all of the above with the option of opening a view on the command
processing (much like a unix terminal window).

So, if you want to interact directly with an external program, do not
use OSProcess by itself. Load CommandShell and use one of the higher
level classes that does not try to "help" you by running your program
under /bin/sh.

Dave



More information about the Squeak-dev mailing list