Page 1 of 1

how to change the screen layer (frame buffer) number for python

Posted: Tue Oct 22, 2019 3:10 pm
by citius-p
I have a python program that runs omxplayer in one thread and pygame surfaces manipulation in another.

Currently the omxplayer video size and position has been restricted to one area of the screen and the pygame surfaces sit around it. So both are visible.

I am wanting to run the video full screen and have the surfaces transparent on top of it.

I can set the omxplayer to use layer zero, but is there a way of forcing the pygame output to a higher layer number ?

Re: how to change the screen layer (frame buffer) number for python

Posted: Tue Oct 22, 2019 11:12 pm
by dividuum
You could place the video below the frame buffer layer instead of trying to move the frame buffer itself.

Re: how to change the screen layer (frame buffer) number for python

Posted: Wed Oct 23, 2019 8:28 am
by citius-p
Thanks for the suggestion.

I have tried that, but omxplayer will not accept a negative layer number

So, I have to try and move the pygame output into a positive layer number

Re: how to change the screen layer (frame buffer) number for python

Posted: Wed Oct 23, 2019 10:39 am
by dividuum
citius-p wrote:
Wed Oct 23, 2019 8:28 am
I have tried that, but omxplayer will not accept a negative layer number
It does, at least with the version I have here on my test Pi4:

Code: Select all

$ omxplayer --layer -128 demo1/optical.mp4 
You can confirm that by running vcgencmd dispmanx_list and check the layer numbers. The framebuffer is at -127 by default. Being XRGB8888, there's no transparency, so the video layer below it isn't visible through the framebuffer and you cannot see the video playing in this configuration:

Code: Select all

root@raspberrypi:~# vcgencmd dispmanx_list
display:2 format:YUV_UV transform:0 layer:-128 640x368 src:0,0,640,360 dst:0,0,1920,1080 cost:1216 lbm:10240 (ignore lower layers) 
display:2 format:XRGB8888 transform:0 layer:-127 1920x1080 src:0,0,1920,1080 dst:0,0,1920,1080 cost:1156 lbm:0 

Re: how to change the screen layer (frame buffer) number for python

Posted: Wed Oct 23, 2019 7:58 pm
by citius-p
For some reason I had it in my head that the 'layer parameter was '-l'. Using the full '--layer' now lets me go negative

However, on my my Pi 2 using -128 for omxplayer gives sound but no video. I have a Pi 3 which I will have to hook up to try.

I am still wondering if there is a way of wrestling the command line away from -127.

Re: how to change the screen layer (frame buffer) number for python

Posted: Thu Oct 24, 2019 7:44 pm
by dividuum
citius-p wrote:
Wed Oct 23, 2019 7:58 pm
However, on my my Pi 2 using -128 for omxplayer gives sound but no video.
That's expected and what I meant with my XRGB8888 note. If the layer above isn't transparent, a video behind it will not be visible.
I am still wondering if there is a way of wrestling the command line away from -127.
Probably, but pointless: Just use layers relative to -127. Only the relative layer position is relevant.

Re: how to change the screen layer (frame buffer) number for python

Posted: Sat Oct 26, 2019 3:54 pm
by citius-p
Thanks, for the update.

I will now move forward as you suggest.