[FFmpeg-devel] [PATCH 1/3] avutil/frame: add av_frame_replace
James Almer
jamrial at gmail.com
Fri Aug 13 18:31:26 EEST 2021
On 8/13/2021 12:27 PM, Andreas Rheinhardt wrote:
> James Almer:
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>> Not going to bother with implementing replace for side data, since it's IMO not
>> worth it, but patches are welcome of course.
>>
>> Missing version bump and APIchanges entry.
>>
>> libavutil/frame.c | 98 +++++++++++++++++++++++++++++++++++++++++++++++
>> libavutil/frame.h | 18 +++++++++
>> 2 files changed, 116 insertions(+)
>>
>> diff --git a/libavutil/frame.h b/libavutil/frame.h
>> index ff2540a20f..36ed128886 100644
>> --- a/libavutil/frame.h
>> +++ b/libavutil/frame.h
>> @@ -695,6 +695,24 @@ void av_frame_free(AVFrame **frame);
>> */
>> int av_frame_ref(AVFrame *dst, const AVFrame *src);
>>
>> +/**
>> + * Ensure the destination frame refers to the same data described by the source
>> + * frame.
>> + *
>> + * Copy frame properties from src to dst and create a new reference for each
>> + * AVBufferRef from src if they differ from those in dst.
>> + *
>> + * src must be reference counted.
>> + *
>> + * @param src The source frame. If there's data described in it, it must be
>> + * reference counted.
>> + * @param dst The destination frame.
>> + *
>> + * @return 0 on success, a negative AVERROR on error. On error, dst is
>> + * unreferenced.
>> + */
>> +int av_frame_replace(AVFrame *dst, const AVFrame *src);
>> +
>> /**
>> * Create a new frame that references the same data as src.
>> *
>>
> av_buffer_replace() is a no-op if src == dst (and documented to be so);
> this is not true for this function where you instantly wipe side data.
Like i said above, I'm not going to try and implement replace for side
data. It's just not worth the extra complexity.
>
> - Andreas
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
>
More information about the ffmpeg-devel
mailing list