<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>Laurent,</span></div><div><br><span></span></div><div><span>Thank you for your help. Things now make more sense.</span></div><div><br><span></span></div><div><span>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.</span></div><div><br><span></span></div><div><span>Looks like the only way to get around this problem is to add my own layer of cached data.<br></span></div><div><br></div><div>I would appreciate your any suggestions/ideas you may
 have.</div><div><br></div><div>Thank you once again for your help.</div><div><br></div><div>Regards,</div><div>Peter<br></div><div><br><span></span></div><div><br></div><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><font size="2" face="Arial"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> Laurent Aimar <fenrir@elivagar.org><br><b><span style="font-weight: bold;">To:</span></b> Mailing list for VLC media player developers <vlc-devel@videolan.org><br><b><span style="font-weight: bold;">Sent:</span></b> Monday, September 19, 2011 1:30 AM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [vlc-devel] stream_Peek memory management...<br></font><br>On Sun, Sep 18, 2011 at 04:35:08PM -0700, Peter Tap wrote:<br>> In vlc code, I noticed that the memory allocated from stream_Peek is not<br>>
 released in the code. A typical usage pattern is:<br>> <br>> const uint8_t* p_Peek;<br>> stream_Peek(s, &p_Peek, num);<br>> <br>> So, when stream_Peek succeeds, it creates memory for p_Peek and fills it with<br>> required data.<br> Not always. It can return a pointer into cached data when possible, and if not<br>then allocate a buffer and copy the data in it.<br>> <br>> What is confusing is that no one ever releases this memory.<br> stream_t keeps the ownership of the memory and will release it itself when<br>it is disposed of, or until the next stream_Peek() call.<br><br>-- <br>fenrir<br>_______________________________________________<br>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="http://mailman.videolan.org/listinfo/vlc-devel" target="_blank">http://mailman.videolan.org/listinfo/vlc-devel</a><br><br><br></div></div></div></body></html>