From 64834bb86a133400970d203656a30ae6a3d2832f Mon Sep 17 00:00:00 2001 From: Marton Balint Date: Tue, 30 Nov 2021 00:38:30 +0100 Subject: avformat: introduce AVFormatContext io_close2 which returns an int Otherwise there is no way to detect an error returned by avio_close() because ff_format_io_close cannot get the return value. Checking the return value of the close function is important in order to check if all data was successfully written and the underlying close() operation was successful. It can also be useful even for read mode because it can return any pending AVIOContext error, so the user don't have to manually check AVIOContext->error. In order to still support if the user overrides io_close, the generic code only uses io_close2 if io_close is either NULL or the default io_close callback. Signed-off-by: Marton Balint --- libavformat/segment.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libavformat/segment.c') diff --git a/libavformat/segment.c b/libavformat/segment.c index d531286c31..e9b0aa4fa8 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -158,6 +158,7 @@ static int segment_mux_init(AVFormatContext *s) av_dict_copy(&oc->metadata, s->metadata, 0); oc->opaque = s->opaque; oc->io_close = s->io_close; + oc->io_close2 = s->io_close2; oc->io_open = s->io_open; oc->flags = s->flags; -- cgit v1.2.3