From: Michel L. <wa...@zo...> - 2008-11-20 08:10:37
|
On Wed, Nov 19, 2008 at 09:29:07AM +0100, Martin Hering wrote: > I am currently experimenting with libmpeg2 for use in a video player > project. I am currently using it straight out of the box and it works > fine. When the decoder is finished and gives me back a display picture I > just copy the display_fbuf to another buffer which can be queued for > later playback. However this method is not very efficient since copying > a block of memory as huge as a picture always imposes the burden of a > big system load. I was wondering if I could simply switch the buffer > pointers, say I give display_fbuf->buf[...] the pointers to the memory > region that I would normaly queue up and queue up the display_fbuf->buf > instead. However this is currently not possible due to being > display_fbuf defined as const. I removed the const for testing only, but > it seems that this is not a valid method, since my app crashes at some > point. My question now is, is there a legal method of switching buffers > or does anybody have a better solution? Look at doc/sample5.c and doc/sample6.c, they do what you want, with the app picking a new buffer at every STATE_PICTURE state and passing it to the decoder. -- Michel "Walken" Lespinasse A program is never fully debugged until the last user dies. |