[FFmpeg-devel] uint8_t *buf -> const uint8_t *buf

Benjamin Larsson banan
Tue Jun 3 20:39:34 CEST 2008

Aurelien Jacobs wrote:
> Aurelien Jacobs wrote:
>> Ronald S. Bultje wrote:
>>> Hi,
>>> On Feb 2, 2008 8:40 AM, Aurelien Jacobs <aurel at gnuage.org> wrote:
>>>> Hum... It obviously won't work with joint stereo scrambled
>>>> streams. You will need to allocate another buffer instead of
>>>> reusing decoded_bytes_buffer. But the idea behind my patch is
>>>> still valid.
>>> Sure it will. The current one also reads/writes in/from the same buf
>>> if the datastream is encrypted (ptr1/ptr2 are both
>>> decoded_bytes_buffer). You are only changing the case where the
>>> stream is unscrambled from reading/writing from/to the input buffer
>>> to reading from the input buffer and writing into
>>> decoded_bytes_buffer.
>>> Right?
>> No. In case the datastream is encrypted (ptr1/ptr2 are both
>> decoded_bytes_buffer), and that's why FFSWAP is used in current code.
>> My code will overwrite the beginning of decoded_bytes_buffer
>> when reading its end.
>> An alternative solution would be to use current FFSWAP code
>> for scrambled streams and use my new code for straight streams.
>> This would avoid allocating one more buffer.
> Something like the attached patch may work.
> Aurel

Old thread, but I finally looked at this and it didn't work. I can't
come up with a better solution then just memcopy the const buffer to a
nonconst buffer, would that be acceptable ?

Benjamin Larsson

More information about the ffmpeg-devel mailing list