[FFmpeg-devel] [PATCH v2 03/12] avutil/frame: add helper for clearing out side data sets
Anton Khirnov
anton at khirnov.net
Wed Apr 12 11:27:46 EEST 2023
Quoting Jan Ekström (2023-04-11 23:20:43)
> ---
> libavutil/frame.c | 5 +++++
> libavutil/frame.h | 7 +++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/libavutil/frame.c b/libavutil/frame.c
> index 019613e4d2..24038cc0fa 100644
> --- a/libavutil/frame.c
> +++ b/libavutil/frame.c
> @@ -90,6 +90,11 @@ static void wipe_side_data_from_frame(AVFrame *frame) {
> wipe_side_data(&frame->side_data, &frame->nb_side_data);
> }
>
> +void av_side_data_set_wipe(AVFrameSideDataSet *set)
> +{
> + wipe_side_data(&set->side_data, &set->nb_side_data);
> +}
> +
> AVFrame *av_frame_alloc(void)
> {
> AVFrame *frame = av_malloc(sizeof(*frame));
> diff --git a/libavutil/frame.h b/libavutil/frame.h
> index 45024c2a03..734ac3fe75 100644
> --- a/libavutil/frame.h
> +++ b/libavutil/frame.h
> @@ -991,6 +991,13 @@ int av_frame_apply_cropping(AVFrame *frame, int flags);
> */
> const char *av_frame_side_data_name(enum AVFrameSideDataType type);
>
> +/**
> + * Clear all side data from a side data set
> + *
> + * @param set the set which should be cleared
> + */
> +void av_side_data_set_wipe(AVFrameSideDataSet *set);
The function name is 'wipe', the doxy says 'clear'. The operation it
actually performs is usually called 'uninit' or 'free' in other APIs
(e.g. av_packet_free_side_data()).
I would prefer to avoid inventing new terminology, because that leads to
confusion. av_side_data_set_uninit() would be my preference (not 'free'
because the struct itself is not freed).
The doxy should say what exactly the function does - free all side data
items and their contents and zero the struct.
--
Anton Khirnov
More information about the ffmpeg-devel
mailing list