|
|
|
@ -868,21 +868,20 @@ AVFrameSideData *av_frame_side_data_add(AVFrameSideData ***sd, int *nb_sd, |
|
|
|
|
AVFrameSideData *sd_dst = NULL; |
|
|
|
|
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) |
|
|
|
|
remove_side_data(sd, nb_sd, type); |
|
|
|
|
if ((!desc || !(desc->props & AV_SIDE_DATA_PROP_MULTI)) && |
|
|
|
|
(sd_dst = (AVFrameSideData *)av_frame_side_data_get(*sd, *nb_sd, type))) { |
|
|
|
|
sd_dst = replace_side_data_from_buf(sd_dst, buf, flags); |
|
|
|
|
if (sd_dst) |
|
|
|
|
*pbuf = NULL; |
|
|
|
|
return sd_dst; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
sd_dst = add_side_data_from_buf(sd, nb_sd, type, buf); |
|
|
|
|
if (!sd_dst) |
|
|
|
|
return NULL; |
|
|
|
|
} else |
|
|
|
|
sd_dst = add_side_data_from_buf(sd, nb_sd, type, buf); |
|
|
|
|
|
|
|
|
|
*pbuf = NULL; |
|
|
|
|
if (sd_dst && !(flags & AV_FRAME_SIDE_DATA_FLAG_NEW_REF)) |
|
|
|
|
*pbuf = NULL; |
|
|
|
|
else if (!sd_dst && (flags & AV_FRAME_SIDE_DATA_FLAG_NEW_REF)) |
|
|
|
|
av_buffer_unref(&buf); |
|
|
|
|
return sd_dst; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|