| 221 | } |
| 222 | |
| 223 | AVFrameSideData *av_frame_side_data_add(AVFrameSideData ***sd, int *nb_sd, |
| 224 | enum AVFrameSideDataType type, |
| 225 | AVBufferRef **pbuf, unsigned int flags) |
| 226 | { |
| 227 | const AVSideDataDescriptor *desc = av_frame_side_data_desc(type); |
| 228 | AVFrameSideData *sd_dst = NULL; |
| 229 | AVBufferRef *buf = *pbuf; |
| 230 | |
| 231 | if ((flags & AV_FRAME_SIDE_DATA_FLAG_NEW_REF) && !(buf = av_buffer_ref(*pbuf))) |
| 232 | return NULL; |
| 233 | if (flags & AV_FRAME_SIDE_DATA_FLAG_UNIQUE) |
| 234 | av_frame_side_data_remove(sd, nb_sd, type); |
| 235 | if ((!desc || !(desc->props & AV_SIDE_DATA_PROP_MULTI)) && |
| 236 | (sd_dst = (AVFrameSideData *)av_frame_side_data_get(*sd, *nb_sd, type))) { |
| 237 | sd_dst = replace_side_data_from_buf(sd_dst, buf, flags); |
| 238 | } else |
| 239 | sd_dst = ff_frame_side_data_add_from_buf(sd, nb_sd, type, buf); |
| 240 | |
| 241 | if (sd_dst && !(flags & AV_FRAME_SIDE_DATA_FLAG_NEW_REF)) |
| 242 | *pbuf = NULL; |
| 243 | else if (!sd_dst && (flags & AV_FRAME_SIDE_DATA_FLAG_NEW_REF)) |
| 244 | av_buffer_unref(&buf); |
| 245 | return sd_dst; |
| 246 | } |
| 247 | |
| 248 | int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd, |
| 249 | const AVFrameSideData *src, unsigned int flags) |
no test coverage detected