[vlc-devel] [PATCH] avcodec: encoder: fix warning on losing const attribute
Steve Lhomme
robux4 at ycbcr.xyz
Wed Jul 10 08:19:04 CEST 2019
On 2019-07-09 20:03, Rémi Denis-Courmont wrote:
> Le tiistaina 9. heinäkuuta 2019, 15.31.37 EEST Steve Lhomme a écrit :
>> ---
>> modules/codec/avcodec/encoder.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/modules/codec/avcodec/encoder.c
>> b/modules/codec/avcodec/encoder.c index cbac0d33948..5410ac7dc99 100644
>> --- a/modules/codec/avcodec/encoder.c
>> +++ b/modules/codec/avcodec/encoder.c
>> @@ -580,8 +580,8 @@ int InitVideoEnc( vlc_object_t *p_this )
>>
>> if ( p_sys->b_mpeg4_matrix )
>> {
>> - p_context->intra_matrix = mpeg4_default_intra_matrix;
>> - p_context->inter_matrix = mpeg4_default_non_intra_matrix;
>> + p_context->intra_matrix = (uint16_t*)
>> mpeg4_default_intra_matrix;
>> + p_context->inter_matrix =
>> (uint16_t*) mpeg4_default_non_intra_matrix; }
>>
>> if ( p_sys->b_pre_me )
>
> This looks fishy. Either libavcodec should be fixed to use const, or the
> matrices may be written to, and the assignment is wrong (a fortiori the cast).
Indeed, the cast is wrong. Looking at avcodec_free_context(), it free's
the memory set on intra_matrix. So we should make a copy that lavc will
free.
More information about the vlc-devel
mailing list