[squeak-dev] Raspberry PI & omxplayer from Squeak

Jon Hylands jon at huv.com
Thu Nov 19 16:25:33 UTC 2015


David,

So I've installed CommandShell, and at first it appeared to work.

I could evaluate this:

CommandShell new processCommand: 'galculator'

and it would open the calculator, and the PID held inside the foreground
proxies corresponded directly to the running app's pid.

However, when I run omxplayer, using this command line:

CommandShell new processCommand: 'omxplayer -r --live --win ''54 58 400
447'' http://localhost:10088/?action=stream'

I end up with our old friend, the shell pid and another process for
omxplayer

I traced it in the debugger, all the way down to where the
UnixOSProcessAccessor is sending
#primForkExec:stdIn:stdOut:stdErr:argBuf:argOffsets:envBuf:envOffsets:workingDir:

The first argument to that message is '/usr/bin/omxplayer'

Yet I end up with this:

pi at raspberrypi ~ $ ps -ef | grep omx
pi        3182  3058  0 16:19 ?        00:00:00 /bin/bash
/usr/bin/omxplayer -r --live --win 54 58 400 447
http://localhost:10088/?action=stream
pi        3190  3182  9 16:19 ?        00:00:19 /usr/bin/omxplayer.bin -r
--live --win 54 58 400 447 http://localhost:10088/?action=stream

Why is this happening, and how can I fix it?

Thanks,
Jon



On Wed, Nov 18, 2015 at 10:56 PM, David T. Lewis <lewis at mail.msen.com>
wrote:

> 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
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20151119/75f63b91/attachment-0001.htm


More information about the Squeak-dev mailing list