forked from FFmpeg/FFmpeg
avutil/frame: add AV_FRAME_SIDE_DATA_FLAG_NEW_REF
The flag is documented but did not exist. So introduce it as it can be useful. Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
7f9c7f9849
commit
42e72d5c8b
4 changed files with 18 additions and 11 deletions
|
@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
|
||||||
|
|
||||||
API changes, most recent first:
|
API changes, most recent first:
|
||||||
|
|
||||||
|
2025-01-05 - xxxxxxxxxx - lavc 59.55.100 - frame.h
|
||||||
|
Add AV_FRAME_SIDE_DATA_FLAG_NEW_REF.
|
||||||
|
|
||||||
2025-01-05 - xxxxxxxxxx - lavc 61.31.100 - avcodec.h
|
2025-01-05 - xxxxxxxxxx - lavc 61.31.100 - avcodec.h
|
||||||
Deprecate AVCodecContext->properties.
|
Deprecate AVCodecContext->properties.
|
||||||
|
|
||||||
|
|
|
@ -868,21 +868,20 @@ AVFrameSideData *av_frame_side_data_add(AVFrameSideData ***sd, int *nb_sd,
|
||||||
AVFrameSideData *sd_dst = NULL;
|
AVFrameSideData *sd_dst = NULL;
|
||||||
AVBufferRef *buf = *pbuf;
|
AVBufferRef *buf = *pbuf;
|
||||||
|
|
||||||
|
if ((flags & AV_FRAME_SIDE_DATA_FLAG_NEW_REF) && !(buf = av_buffer_ref(*pbuf)))
|
||||||
|
return NULL;
|
||||||
if (flags & AV_FRAME_SIDE_DATA_FLAG_UNIQUE)
|
if (flags & AV_FRAME_SIDE_DATA_FLAG_UNIQUE)
|
||||||
remove_side_data(sd, nb_sd, type);
|
remove_side_data(sd, nb_sd, type);
|
||||||
if ((!desc || !(desc->props & AV_SIDE_DATA_PROP_MULTI)) &&
|
if ((!desc || !(desc->props & AV_SIDE_DATA_PROP_MULTI)) &&
|
||||||
(sd_dst = (AVFrameSideData *)av_frame_side_data_get(*sd, *nb_sd, type))) {
|
(sd_dst = (AVFrameSideData *)av_frame_side_data_get(*sd, *nb_sd, type))) {
|
||||||
sd_dst = replace_side_data_from_buf(sd_dst, buf, flags);
|
sd_dst = replace_side_data_from_buf(sd_dst, buf, flags);
|
||||||
if (sd_dst)
|
} else
|
||||||
*pbuf = NULL;
|
sd_dst = add_side_data_from_buf(sd, nb_sd, type, buf);
|
||||||
return sd_dst;
|
|
||||||
}
|
|
||||||
|
|
||||||
sd_dst = add_side_data_from_buf(sd, nb_sd, type, buf);
|
if (sd_dst && !(flags & AV_FRAME_SIDE_DATA_FLAG_NEW_REF))
|
||||||
if (!sd_dst)
|
*pbuf = NULL;
|
||||||
return NULL;
|
else if (!sd_dst && (flags & AV_FRAME_SIDE_DATA_FLAG_NEW_REF))
|
||||||
|
av_buffer_unref(&buf);
|
||||||
*pbuf = NULL;
|
|
||||||
return sd_dst;
|
return sd_dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1082,6 +1082,11 @@ void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd);
|
||||||
* Applies only for side data types without the AV_SIDE_DATA_PROP_MULTI prop.
|
* Applies only for side data types without the AV_SIDE_DATA_PROP_MULTI prop.
|
||||||
*/
|
*/
|
||||||
#define AV_FRAME_SIDE_DATA_FLAG_REPLACE (1 << 1)
|
#define AV_FRAME_SIDE_DATA_FLAG_REPLACE (1 << 1)
|
||||||
|
/**
|
||||||
|
* Create a new reference to the passed in buffer instead of taking ownership
|
||||||
|
* of it.
|
||||||
|
*/
|
||||||
|
#define AV_FRAME_SIDE_DATA_FLAG_NEW_REF (1 << 2)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add new side data entry to an array.
|
* Add new side data entry to an array.
|
||||||
|
|
|
@ -79,8 +79,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LIBAVUTIL_VERSION_MAJOR 59
|
#define LIBAVUTIL_VERSION_MAJOR 59
|
||||||
#define LIBAVUTIL_VERSION_MINOR 54
|
#define LIBAVUTIL_VERSION_MINOR 55
|
||||||
#define LIBAVUTIL_VERSION_MICRO 101
|
#define LIBAVUTIL_VERSION_MICRO 100
|
||||||
|
|
||||||
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||||
LIBAVUTIL_VERSION_MINOR, \
|
LIBAVUTIL_VERSION_MINOR, \
|
||||||
|
|
Loading…
Add table
Reference in a new issue