[FFmpeg-devel] [PATCH 4/5] avformat: make AVFormatContext io_close return an int

Anton Khirnov anton at khirnov.net
Wed Dec 1 13:35:54 EET 2021


Quoting Marton Balint (2021-11-30 10:07:21)
> 
> 
> On Tue, 30 Nov 2021, Andreas Rheinhardt wrote:
> 
> > Marton Balint:
> >> Otherwise there is no way to detect any error during avio_close().
> >>
> >> Signed-off-by: Marton Balint <cus at passwd.hu>
> >> ---
> >>  doc/APIchanges         | 3 +++
> >>  libavformat/avformat.h | 6 +++++-
> >>  libavformat/internal.h | 6 +++++-
> >>  libavformat/options.c  | 4 ++--
> >>  libavformat/utils.c    | 6 ++++--
> >>  libavformat/version.h  | 4 ++--
> >>  6 files changed, 21 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/doc/APIchanges b/doc/APIchanges
> >> index bc9f4e38da..090263aedf 100644
> >> --- a/doc/APIchanges
> >> +++ b/doc/APIchanges
> >> @@ -14,6 +14,9 @@ libavutil:     2021-04-27
> >>
> >>  API changes, most recent first:
> >>
> >> +2021-12-xx - xxxxxxxxxx - lavf 59.10.100 - avformat.h
> >> +  AVFormatContext io_open now returns an int.
> >> +
> >>  2021-11-22 - xxxxxxxxxx - lavu 57.9.100 - pixfmt.h
> >>    Add AV_PIX_FMT_P210, AV_PIX_FMT_P410, AV_PIX_FMT_P216, and AV_PIX_FMT_P416.
> >>
> >> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> >> index 75699f3a32..eec1f6b20c 100644
> >> --- a/libavformat/avformat.h
> >> +++ b/libavformat/avformat.h
> >> @@ -1756,8 +1756,12 @@ typedef struct AVFormatContext {
> >>
> >>      /**
> >>       * A callback for closing the streams opened with AVFormatContext.io_open().
> >> +     *
> >> +     * @param s the format context
> >> +     * @param pb IO context to be closed and freed
> >> +     * @return 0 on success, a negative AVERROR code on failure
> >>       */
> >> -    void (*io_close)(struct AVFormatContext *s, AVIOContext *pb);
> >> +    int (*io_close)(struct AVFormatContext *s, AVIOContext *pb);
> >>
> >>      /**
> >>       * ',' separated list of disallowed protocols.
> >
> > This is an API break.
> 
> To be honest I wanted to avoid the io_close2() dance. This change has 
> limited impact and we still did not have a release since the bump.
> 
> I can rework if somebody feels that introducing io_close2() is the better 
> way. Please let me know.

I do. I also feel very uncomfortable with arguments along the lines of
"breaking things outside of releases is ok". We've always considered git
master to be stable (except for a _short_ period after a major bump).

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list