[vlc-devel] stream_Peek memory management...
fenrir at elivagar.org
Tue Sep 20 22:09:18 CEST 2011
On Mon, Sep 19, 2011 at 05:32:43PM -0700, Peter Tap wrote:
> Thank you for your help. Things now make more sense.
> I had written a stream filter for decoding an encrypted media file. Currently,
> the encryption is a simple XOR mechanism. In my "Peek" implementation, I was
> simply calling the underlying stream_Peek method and XORing the read buffer
> before returning. The problem I am running into is that the underlying stream
> may used cached data (src/input/stream.c). As a result, I end up XORing data
> that is already XORed.
The data pointer returned by stream_Peek() is const uint8_t* and as such
you must not modify the pointed data.
> Looks like the only way to get around this problem is to add my own layer of
> cached data.
If you modify, the data, then yes you need to do it in your own buffer.
More information about the vlc-devel