diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-11-11 14:31:10 +0100 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-11-11 14:36:53 +0100 |
commit | c03ffe1712e65b2f18d090d34db95ef18340bd0e (patch) | |
tree | 5b0feb39e0020d945d69b05c808620d781a15f8e | |
parent | 2905c512044807567fc93402f7b3d6dca3552ce6 (diff) | |
download | ffmpeg-c03ffe1712e65b2f18d090d34db95ef18340bd0e.tar.gz |
avformat/utils: re-factor freeing AVStreams
This matches the Libav signature and simplifies merging future changes.
-rw-r--r-- | libavformat/utils.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index e55b29479b..6b426e9492 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3651,13 +3651,16 @@ int av_read_pause(AVFormatContext *s) return AVERROR(ENOSYS); } -void ff_free_stream(AVFormatContext *s, AVStream *st) { - int j; - av_assert0(s->nb_streams>0); - av_assert0(s->streams[ s->nb_streams - 1 ] == st); +static void free_stream(AVStream **pst) +{ + AVStream *st = *pst; + int i; + + if (!st) + return; - for (j = 0; j < st->nb_side_data; j++) - av_freep(&st->side_data[j].data); + for (i = 0; i < st->nb_side_data; i++) + av_freep(&st->side_data[i].data); av_freep(&st->side_data); if (st->parser) @@ -3678,7 +3681,16 @@ void ff_free_stream(AVFormatContext *s, AVStream *st) { av_freep(&st->info); av_freep(&st->recommended_encoder_configuration); av_freep(&st->priv_pts); - av_freep(&s->streams[ --s->nb_streams ]); + + av_freep(pst); +} + +void ff_free_stream(AVFormatContext *s, AVStream *st) +{ + av_assert0(s->nb_streams>0); + av_assert0(s->streams[ s->nb_streams - 1 ] == st); + + free_stream(&s->streams[ --s->nb_streams ]); } void avformat_free_context(AVFormatContext *s) |