Page 1 of 1

Editing OMXPlayer

Posted: Wed Apr 09, 2014 8:05 pm
by JizzaDaMan
There are two things I want to change about omxplayer:
I want to stop it displaying a message on screen whenever you pause/play it.
Also when you quit, it waits for input before you can enter further commands on the command line. I want it to continue back to the command line without waiting for input.

I'd imagine that to change these I'd need to edit the source code and recompile it on my pi. I've found the source code, but how can I find/where is the right place(s) to edit?

Also, how do I recompile the code from scratch?

Thanks for any help

Re: Editing OMXPlayer

Posted: Wed Apr 09, 2014 9:46 pm
by redhawk
That's odd usually when I press "q" it instantly returns control to the console and sometimes the occasional error message.
As for the on screen "play/pause" message you can suppress this by adding --no-osd to your command line argument.

If you still insist on hacking up omxplayer the source code is available via the ol' github - :)

Richard S.

Re: Editing OMXPlayer

Posted: Thu Apr 10, 2014 6:52 pm
by JizzaDaMan
I expect it does. I'm controlling it using sockets in python from another computer over a network. That means I need omxplayer to be able to receive input not from a keyboard, so I'm using pipes. I have a python script running on the pi which listens for the signal to run command line arguments. It works thus:

mkfifo arbitrary_pipe

omxplayer video.avi < arbitrary_pipe &
echo . > arbitrary_pipe &
echo -n q > arbitrary_pipe &

when the last command is executed, I have to press enter on the pi before I can continue.

Re: Editing OMXPlayer

Posted: Thu Apr 10, 2014 8:25 pm
by gkreidl
Perhaps using the dbus interface will work better. There is a script in the omxplayer repository on github. Download it, make it executable and copy it to /usr/local/bin.

Then add something like that to your python script:

Code: Select all

def send_dbus(args):
    res = ''
        db = subprocess.Popen(['']+args,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
        (res,err) = db.communicate()
        res = ''
    if err:
        res = ''
    return res
where args is an array, containing the command and possibly arguments.