Commit Graph

25 Commits

Author SHA1 Message Date
Andreas Rheinhardt 790f793844 avutil/common: Don't auto-include mem.h
There are lots of files that don't need it: The number of object
files that actually need it went down from 2011 to 884 here.

Keep it for external users in order to not cause breakages.

Also improve the other headers a bit while just at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-31 00:08:43 +01:00
Andreas Rheinhardt 4a4dcde339 avformat/internal: Move FF_FMT_INIT_CLEANUP to demux.h
and rename it to FF_INFMT_INIT_CLEANUP. This flag is demuxer-only,
so this is the more appropriate place for it.
This does not preclude adding internal flags common to both
demuxer and muxer in the future.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-26 06:36:43 +01:00
Andreas Rheinhardt b800327f4c avformat/avformat: Add FFInputFormat, hide internals of AVInputFormat
This commit does for AVInputFormat what commit
59c9dc82f4 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 50f34172e0
(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>
2024-03-07 08:53:31 -03:00
Anton Khirnov 1e7d2007c3 all: use designated initializers for AVOption.unit
Makes it robust against adding fields before it, which will be useful in
following commits.

Majority of the patch generated by the following Coccinelle script:

@@
typedef AVOption;
identifier arr_name;
initializer list il;
initializer list[8] il1;
expression tail;
@@
AVOption arr_name[] = { il, { il1,
- tail
+ .unit = tail
}, ...  };

with some manual changes, as the script:
* has trouble with options defined inside macros
* sometimes does not handle options under an #else branch
* sometimes swallows whitespace
2024-02-14 14:53:41 +01:00
Anton Khirnov 08bebeb1be Revert "all: Don't set AVClass.item_name to its default value"
Some callers assume that item_name is always set, so this may be
considered an API break.

This reverts commit 0c6203c97a.
2024-01-20 10:34:48 +01:00
Andreas Rheinhardt 0c6203c97a all: Don't set AVClass.item_name to its default value
Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9;
also avoids relocations.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-12-22 15:12:33 +01:00
James Almer 51c2c6ff59 libopenmpt: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:34 -03:00
Andreas Rheinhardt 1be3d8a0cb avcodec/avcodec: Stop including channel_layout.h in avcodec.h
Also include channel_layout.h directly wherever used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 11:14:31 +02:00
Andreas Rheinhardt 37a0fa55df avformat/libopenmpt: Simplify cleanup after read_header failure
by setting the FF_FMT_INIT_CLEANUP flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-07 22:32:55 +02:00
Andreas Rheinhardt bc70684e74 avformat: Constify all muxer/demuxers
This is possible now that the next-API is gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 11:48:06 -03:00
Andreas Rheinhardt 39ab256125 avformat/libopenmpt: Don't discard const
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-10-08 22:56:31 +02:00
Carl Eugen Hoyos 4d8875ec23 lavf: Constify the probe function argument.
Reviewed-by: Lauri Kasanen
Reviewed-by: Tomas Härdin
2019-03-21 11:42:17 +01:00
Michael Niedermayer 571af98a59 avformat/libopenmpt: Fix successfull typo
Reviewed-by: Lou Logan <lou@lrcd.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-12-31 02:37:08 +01:00
Jörn Heusipp f6ea397d0a avformat/libopenmpt: Probe file format from file data if possible
When building with libopenmpt 0.3, use the libopenmpt file header
probing functions for probing. libopenmpt probing functions are
allocation-free and designed to be as fast as possible.

For libopenmpt 0.2, or when libopenmpt 0.3 file header probing cannot
probe successfully due to too small probe buffer, test the filename
against the file extensions supported by the libopenmpt library that
is actually linked, instead of relying on a hard-coded file extension
list. File extension testing is also allocation-free and designed to
be fast in libopenmpt. Avoiding a hard-coded file extension list is
useful because later libopenmpt versions will likely add support for
more module file formats.

libopenmpt file header probing is tested regularly against the FATE
suite and other diverse file collections by libopenmpt upstream in
order to avoid false positives.

FATE passes with './configure --enable-libopenmpt' as well as with
'./configure --enable-libopenmpt --enable-libmodplug'.

libopenmpt probing adds about 5%..10% cpu time (depending on precise
usage pattern and host CPU and compiler version used for libopenmpt)
compared to all current internal FFmpeg probing functions combined in
tools/probetest for all of its module formats combined (currently 41
modules formats in libopenmpt 0.3.4 and 234 file formats in FFmpeg).

Signed-off-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Reviewed-by: Josh de Kock <josh@itanimul.li>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-20 22:59:40 +01:00
Jörn Heusipp 81b0d591d6 avformat/libopenmpt: Update file extensions list for libopenmpt 0.3
Signed-off-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Reviewed-by: Josh de Kock <josh@itanimul.li>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-20 22:59:40 +01:00
Jörn Heusipp 8b1b25a86f avformat/libopenmpt: Update to libopenmpt 0.3 API
libopenmpt 0.3 deprecates openmpt_module_create_from_memory() and
provides a replacement function openmpt_module_create_from_memory2().

Detecting libopenmpt 0.3 can be done at build time via the API
version macros provided by libopenmpt. libopenmpt 0.2 did not provide
all required macros, however libopenmpt documents the required #define
shims that can be safely added for libopenmpt 0.2.

Using openmpt_module_create_from_memory2() instead of
openmpt_module_create_from_memory() avoids the deprecation warning
when building ffmpeg with libopenmpt 0.3.

openmpt_module_create_from_memory2() provides more fine-grained error
reporting and in particular allows distinguishing out-of-memory from
input file parsing errors. Return appropriate ffmpeg errors
accordingly.

libopenmpt 0.3 is ABI and API compatible with applications built
against libopenmpt 0.2. Building ffmpeg with libopenmpt 0.2 is still
supported.

Signed-off-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-01-12 12:31:55 +01:00
Jörn Heusipp a571a2a65a avformat/libopenmpt: Fix mixed code and declarations
Signed-off-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-01-12 12:31:55 +01:00
Jörn Heusipp 3d2da6d585
avformat/libopenmpt: Query duration and metadata after selecting subsong
Duration depends on the selected subsong and thus must be queried after
selecting the subsong. There is no compelling reason to query other
metadata earlier either.

Tested with libopenmpt version: 0.2.8760-beta27
Libopenmpt configure options: --without-ogg --without-vorbis
--without-vorbisfile --without-portaudio --without-portaudiocpp
--without-mpg123 --without-pulseaudio --without-sndfile --without-flac

Signed-off-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Signed-off-by: Josh de Kock <josh@itanimul.li>
2017-09-24 15:54:38 +01:00
Michael Niedermayer bd8201566d avformat/libopenmpt: Check for avio_size() failure
Fixes CID1396850

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-30 23:35:18 +02:00
Andreas Cadhalpun 367cac7827 libopenmpt: add missing avio_read return value check
This fixes heap-buffer-overflows in libopenmpt caused by interpreting
the negative size value as unsigned size_t.

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Reviewed-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-01-16 02:54:04 +01:00
Jörn Heusipp 64131b87d6 libopenmpt: Add "date" to metadata.
Signed-off-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Signed-off-by: Josh de Kock <josh@itanimul.li>
2016-07-21 02:47:35 +01:00
Jörn Heusipp 840df1f193 libopenmpt: set stream duration and fix time base
Fix the confusion around the used time base.

Check size returned from avio_size()

Signed-off-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Signed-off-by: Josh de Kock <josh@itanimul.li>
2016-07-21 02:47:35 +01:00
Josh de Kock 9134d2df5b libopenmpt: add subsong support
Signed-off-by: Josh de Kock <josh@itanimul.li>
2016-07-21 02:47:35 +01:00
Jörn Heusipp f1eb6ddcb3 libavformat/libopenmpt: Fix memory leak in error path in read_header_openmpt().
Signed-off-by: Jörn Heusipp <osmanx@problemloesungsmaschine.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-17 16:20:46 +02:00
Josh de Kock d52dd768a3 lavf: add libopenmpt demuxer
Fixes ticket #5623

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-15 20:59:25 +02:00