[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Double Buffered display vs Overlays
On Friday 16 September 2005 16:24, Pete Shinners wrote:
> On Thu, 2005-09-15 at 20:28 +0100, Michael Sparks wrote:
> > I'm currently decoding and displaying video in a pygame overlay. I also
> > have a bunch of surfaces I regularly blit into the display surface.
>
> A common technique is to set the Movie object to display to an offscreen
> Surface. Then, every time you are drawing a frame you blit the offscreen
> onto the display Surface. As long as your screen framerate is keeping up
> with the movie you won't be missing any frames.
Indeed.
Out of interest can a movie object take raw YUV frames in the same sort of way
the Overlay buffer can?
FWIW, our most basic decode & display chain looks like this:
pipeline(
ReadFileAdaptor(file, readmode="bitrate",
bitrate = 300000*8/5),
DiracDecoder(),
RateLimit(framerate),
VideoOverlay(),
).run()
(the above probably works as you expect BTW)
Or for playback of raw data we do:
pipeline( ReadFileAdaptor("/data/dirac-video/snowboard-jum-352x288x75.yuv",
readmode="bitrate",
bitrate = 2280960*8),
RawYUVFramer(size=(352,288), pixformat = pygame.IYUV_OVERLAY),
VideoOverlay(),
).run()
Hence the interest in whether we can simply take the data that a video overlay
takes and "just" dump it to a movie. If we can't, we can't, no big deal.
> This technique does take a bit more processing than just playing to the
> Overlays. I'd do a bunch of speed testing for anything larger like DVD
> resolution.
I suspect it'd be fine - largely because the system I'm using isn't hardware
accelerated due to using the linux framebuffer device.
> The bonus for the offscreen Movie Surface is that you can draw things on
> top of the movie. It gets blitted to the screen like any other Surface.
Indeed. We had a pre-university trainee pick up python & pygame very quickly
and he used the "off screen playback" feature to pick out frames for sending
to mobiles, which is pretty cool, but I wasn't aware that it could handle raw
YUV data... I'll have another look :-)
This is attractive at the moment we've effectively got some code that acts
as a simple window manager for generator based things. (I'm intending on
documenting our pygame components at some point soon seperately BTW)
Thanks for the comments - I'll assume I'm hitting limitations of the video
overlay subsystem :-)
Michael.