lavf: add avformat_close_input().
It sets the supplied AVFormatContext pointer to NULL after freeing it, which is safer and its name is consistent with other lavf functions. Also deprecate av_close_input_file().
This commit is contained in:
@@ -2684,14 +2684,23 @@ void avformat_free_context(AVFormatContext *s)
|
||||
av_free(s);
|
||||
}
|
||||
|
||||
#if FF_API_CLOSE_INPUT_FILE
|
||||
void av_close_input_file(AVFormatContext *s)
|
||||
{
|
||||
avformat_close_input(&s);
|
||||
}
|
||||
#endif
|
||||
|
||||
void avformat_close_input(AVFormatContext **ps)
|
||||
{
|
||||
AVFormatContext *s = *ps;
|
||||
AVIOContext *pb = (s->iformat->flags & AVFMT_NOFILE) || (s->flags & AVFMT_FLAG_CUSTOM_IO) ?
|
||||
NULL : s->pb;
|
||||
flush_packet_queue(s);
|
||||
if (s->iformat->read_close)
|
||||
s->iformat->read_close(s);
|
||||
avformat_free_context(s);
|
||||
*ps = NULL;
|
||||
if (pb)
|
||||
avio_close(pb);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user