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

Aurelien Jacobs aurel
Tue Sep 30 00:26:20 CEST 2008


Benjamin Larsson wrote:

> 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 ?

Very old thread now...
I've finally committed a slightly modified version of the patch.
It works fine without memcpy().

Aurel




More information about the ffmpeg-devel mailing list