Commit fb6fa48f authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/oggdec: Factor free_stream out

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 3250d4b3
...@@ -63,6 +63,21 @@ static int64_t ogg_calc_pts(AVFormatContext *s, int idx, int64_t *dts); ...@@ -63,6 +63,21 @@ static int64_t ogg_calc_pts(AVFormatContext *s, int idx, int64_t *dts);
static int ogg_new_stream(AVFormatContext *s, uint32_t serial); static int ogg_new_stream(AVFormatContext *s, uint32_t serial);
static int ogg_restore(AVFormatContext *s); static int ogg_restore(AVFormatContext *s);
static void free_stream(AVFormatContext *s, int i)
{
struct ogg *ogg = s->priv_data;
struct ogg_stream *stream = &ogg->streams[i];
av_freep(&stream->buf);
if (stream->codec &&
stream->codec->cleanup) {
stream->codec->cleanup(s, i);
}
av_freep(&stream->private);
av_freep(&stream->new_metadata);
}
//FIXME We could avoid some structure duplication //FIXME We could avoid some structure duplication
static int ogg_save(AVFormatContext *s) static int ogg_save(AVFormatContext *s)
{ {
...@@ -662,13 +677,7 @@ static int ogg_read_close(AVFormatContext *s) ...@@ -662,13 +677,7 @@ static int ogg_read_close(AVFormatContext *s)
int i; int i;
for (i = 0; i < ogg->nstreams; i++) { for (i = 0; i < ogg->nstreams; i++) {
av_freep(&ogg->streams[i].buf); free_stream(s, i);
if (ogg->streams[i].codec &&
ogg->streams[i].codec->cleanup) {
ogg->streams[i].codec->cleanup(s, i);
}
av_freep(&ogg->streams[i].private);
av_freep(&ogg->streams[i].new_metadata);
} }
ogg->nstreams = 0; ogg->nstreams = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment