return;
for (i = 0; i < s->nb_streams; i++) {
OutputStream *os = &c->streams[i];
- if (os->out)
- avio_close(os->out);
- os->out = NULL;
+ avio_closep(&os->out);
if (os->ctx && os->ctx_inited)
av_write_trailer(os->ctx);
- if (os->ctx && os->ctx->pb)
+ if (os->ctx)
av_freep(&os->ctx->pb);
if (os->ctx)
avformat_free_context(os->ctx);
avio_seek(os->out, 0, SEEK_SET);
avio_wb32(os->out, pos);
avio_flush(os->out);
- avio_close(os->out);
- os->out = NULL;
+ avio_closep(&os->out);
}
static int hds_write_header(AVFormatContext *s)