frame: add a function for removing side data from a frame
This commit is contained in:
@@ -526,3 +526,19 @@ int av_frame_copy(AVFrame *dst, const AVFrame *src)
|
||||
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < frame->nb_side_data; i++) {
|
||||
AVFrameSideData *sd = frame->side_data[i];
|
||||
if (sd->type == type) {
|
||||
av_freep(&sd->data);
|
||||
av_dict_free(&sd->metadata);
|
||||
av_freep(&frame->side_data[i]);
|
||||
frame->side_data[i] = frame->side_data[frame->nb_side_data - 1];
|
||||
frame->nb_side_data--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user