[FFmpeg-devel] [PATCH v2 02/12] avutil/frame: split side data list wiping out to non-AVFrame function

Anton Khirnov anton at khirnov.net
Wed Apr 12 11:21:02 EEST 2023


Quoting Jan Ekström (2023-04-11 23:20:42)
> ---
>  libavutil/frame.c | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/libavutil/frame.c b/libavutil/frame.c
> index c905e8d611..019613e4d2 100644
> --- a/libavutil/frame.c
> +++ b/libavutil/frame.c
> @@ -76,14 +76,18 @@ static void free_side_data(AVFrameSideData **ptr_sd)
>      av_freep(ptr_sd);
>  }
>  
> -static void wipe_side_data(AVFrame *frame)
> +static void wipe_side_data(AVFrameSideData ***sd, int *nb_side_data)
>  {
> -    for (int i = 0; i < frame->nb_side_data; i++) {
> -        free_side_data(&frame->side_data[i]);
> +    for (int i = 0; i < *nb_side_data; i++) {
> +        free_side_data(&((*sd)[i]));
>      }
> -    frame->nb_side_data = 0;
> +    *nb_side_data = 0;
> +
> +    av_freep(sd);
> +}
>  
> -    av_freep(&frame->side_data);
> +static void wipe_side_data_from_frame(AVFrame *frame) {

Wrong brace placement.

Also, I _much_ prefer consistent big-endian naming - in this case
something like frame_side_data_wipe()

The commit message should also mention it will be useful in future
commits, as this change by itself is not an improvement.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list