diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-02-10 15:50:43 +0100 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2024-03-07 08:53:31 -0300 |
commit | b800327f4c7233d09baca958121722a04c2035ff (patch) | |
tree | df7ca79d0050cbbe27eda932d7047e3f53f281ae /libavformat/demux.c | |
parent | bb81c60927d8ff53286ffe1b5d9607757180b8ae (diff) | |
download | ffmpeg-b800327f4c7233d09baca958121722a04c2035ff.tar.gz |
avformat/avformat: Add FFInputFormat, hide internals of AVInputFormat
This commit does for AVInputFormat what commit
59c9dc82f450638a3068deeb1db5c56f6d155752 did for AVOutputFormat:
It adds a new type FFInputFormat, moves all the internals
of AVInputFormat to it and adds a now reduced AVInputFormat
as first member.
This does not affect/improve extensibility of both public
or private fields for demuxers (it is still a mess due to lavd).
This is possible since 50f34172e0cca2cabc5836308ec66dbf93f5f2a3
(which removed the last usage of an internal field of AVInputFormat
in fftools).
(Hint: tools/probetest.c accesses the internals of FFInputFormat
as well, but given that it is a testing tool this is not considered
a problem.)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavformat/demux.c')
-rw-r--r-- | libavformat/demux.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/libavformat/demux.c b/libavformat/demux.c index a0028bfeec..4c50eb5568 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -283,8 +283,8 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, s->duration = s->start_time = AV_NOPTS_VALUE; /* Allocate private data. */ - if (s->iformat->priv_data_size > 0) { - if (!(s->priv_data = av_mallocz(s->iformat->priv_data_size))) { + if (ffifmt(s->iformat)->priv_data_size > 0) { + if (!(s->priv_data = av_mallocz(ffifmt(s->iformat)->priv_data_size))) { ret = AVERROR(ENOMEM); goto fail; } @@ -300,9 +300,9 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, if (s->pb) ff_id3v2_read_dict(s->pb, &si->id3v2_meta, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta); - if (s->iformat->read_header) - if ((ret = s->iformat->read_header(s)) < 0) { - if (s->iformat->flags_internal & FF_FMT_INIT_CLEANUP) + if (ffifmt(s->iformat)->read_header) + if ((ret = ffifmt(s->iformat)->read_header(s)) < 0) { + if (ffifmt(s->iformat)->flags_internal & FF_FMT_INIT_CLEANUP) goto close; goto fail; } @@ -347,8 +347,8 @@ int avformat_open_input(AVFormatContext **ps, const char *filename, return 0; close: - if (s->iformat->read_close) - s->iformat->read_close(s); + if (ffifmt(s->iformat)->read_close) + ffifmt(s->iformat)->read_close(s); fail: ff_id3v2_free_extra_meta(&id3v2_extra_meta); av_dict_free(&tmp); @@ -375,8 +375,8 @@ void avformat_close_input(AVFormatContext **ps) pb = NULL; if (s->iformat) - if (s->iformat->read_close) - s->iformat->read_close(s); + if (ffifmt(s->iformat)->read_close) + ffifmt(s->iformat)->read_close(s); avformat_free_context(s); @@ -628,7 +628,7 @@ FF_ENABLE_DEPRECATION_WARNINGS } } - err = s->iformat->read_packet(s, pkt); + err = ffifmt(s->iformat)->read_packet(s, pkt); if (err < 0) { av_packet_unref(pkt); |