[FFmpeg-devel] [PATCH 2/2] avformat/mxfenc: support XAVC long gop

Baptiste Coudurier baptiste.coudurier at gmail.com
Wed Apr 10 02:25:14 EEST 2019

> On Apr 9, 2019, at 4:05 PM, Hendrik Leppkes <h.leppkes at gmail.com> wrote:
> On Wed, Apr 10, 2019 at 12:21 AM Baptiste Coudurier
> <baptiste.coudurier at gmail.com> wrote:
>> +                return 0;
>> +            }
>> +            init_get_bits(&gb, tmp, tmp_size*8);
>> +            ret = avpriv_h264_decode_seq_parameter_set(&gb, (AVCodecContext*)s, &ps, 0);
> The AVCodecContext cast looks like a recipe for disaster. The function
> is internal to the H264 decoder, so if it at some point decides to
> actually access the AVCodecContext it receives, or even worse, the
> priv_data element in it, expecting a H264Context, then everything goes
> to hell.
> Just another sign why exporting functions internal from a decoder is
> just an overall bad idea…

Calm down. AVCodecContext can be allocated in any case, for AV_CODEC_ID_H264.
The reason that function needs it in the first place is small.

Re-using code is _good_


More information about the ffmpeg-devel mailing list