[FFmpeg-devel] [PATCH 4/8] avcodec: Constify some AVPackets

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Fri Mar 5 15:24:18 EET 2021


James Almer:
> On 3/4/2021 12:42 PM, Andreas Rheinhardt wrote:
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
>> ---
>> Of all the decoders using the simple decode API (i.e. with .decode set)
>> only imm5 seems to modify its input packet (which is fine given that it
>> is not the user-supplied reference);
> 
> Having that decoder make a writable copy using a different AVPacket
> struct, so the input one can be constified, sounds like a good idea in
> order to make the AVPacket parameter in AVCodec->decode() const (If
> that's what you're trying to achieve), and would be consistent with
> AVCodec->encode2().
> 

I was actually thinking about using const and casting it away in that
one decoder, but if you don't like this, I can modify it.

> For that matter, why is got_frame called "outdata_size" in codec.h? Did
> the purpose of that parameter change at some point?
> 
> libfdk_aac's API is not
>> const-correct, so as-is it is not compatible with constifiying the
>> AVPacket
>> in the .decode function, yet this is easily fixable.
>>


More information about the ffmpeg-devel mailing list