[theora] Cleaning app

Ralph Giles giles at xiph.org
Fri May 25 10:54:29 PDT 2007


On Fri, May 25, 2007 at 11:39:19AM +0100, Kostas Kostiadis wrote:

> yuv_buffer yuv;
> theora_decode_YUVout(&td,&yuv);
> 
> I'm guessing a bunch of stuff gets newed/malloced for yuv.y, yuv.u, and
> yuv.u.

theora_decode_YUVout() fills out the yuv_buffer to point to internal 
storage inside td. So the pointers are only valid until the next call
to theora_decode_packetin(). Freeing the memory is the library's 
responsibility and happens when you call theora_clear().

If you're mantaining a decoded frame queue, you need to copy the 
referenced data, and then managing the copies is your responsibility.

theora_encode_YUVin() copies the data you pass in. In this cast it's
up to you to allocate/free the yuv.y, yuv.u and yuv.v buffers.

 -r


More information about the theora mailing list