On 03/22/2014 03:23 PM, Anton Khirnov wrote: > > On Sat, 22 Mar 2014 15:11:52 -0400, Justin Ruggles <[email protected]> > wrote: >> On 03/18/2014 01:26 PM, Anton Khirnov wrote: >>> --- >>> doc/APIchanges | 4 ++++ >>> libavutil/frame.c | 16 ++++++++++++++++ >>> libavutil/frame.h | 6 ++++++ >>> 3 files changed, 26 insertions(+) >>> >>> diff --git a/doc/APIchanges b/doc/APIchanges >>> index e2da101..b5307de 100644 >>> --- a/doc/APIchanges >>> +++ b/doc/APIchanges >>> @@ -13,6 +13,10 @@ libavutil: 2013-12-xx >>> >>> API changes, most recent first: >>> >>> +2014-02-xx - xxxxxxx - lavu 53.05.0 - frame.h >>> + Add av_frame_remove_side_data() for removing a single side data >>> + instance from a frame. >>> + >>> 2014-02-xx - xxxxxxx - lavu 53.04.0 - frame.h, replaygain.h >>> Add AV_FRAME_DATA_REPLAYGAIN for exporting replaygain tags. >>> Add a new header replaygain.h with the AVReplayGain struct. >>> diff --git a/libavutil/frame.c b/libavutil/frame.c >>> index f81bbbd..cc4bfcd 100644 >>> --- a/libavutil/frame.c >>> +++ b/libavutil/frame.c >>> @@ -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--; >>> + } >>> + } >> >> I think you need to decrement 'i' after swapping the last element so >> that it will get checked in the next iteration. >> > > Well, we do not support/allow multiple instances of the same side data, so I > actually intended to return there, but forgot. > > Though i guess we could check for duplicates here as well.
Ok, just return. -Justin _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
