Commit Graph

20 Commits

Author SHA1 Message Date
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
Zane van Iperen 981d49e373
avformat/argo_brp: use bits_per_coded_sample instead of bits_per_raw_sample
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2021-07-19 14:14:39 +10: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
Zane van Iperen 769ab6b864
avformat/argo_brp: remove block_align check for audio
Causes a divide-by-zero in the rare case where:
- the file has an audio stream,
- the first audio frame isn't within the first BRP_BASF_LOOKAHEAD frames,
- an audio frame is encountered later, and
- its chunk header (except num_blocks) contains all zeros
   (matching the uninitialised structure in the context)

The decoder will discard any garbage data, so the check isn't really needed.

Fixes: division by 0
Fixes: 26667/clusterfuzz-testcase-minimized-ffmpeg_dem_ARGO_BRP_fuzzer-5645146928185344.fuzz

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-11-05 07:58:06 +10:00
Zane van Iperen 5fb628521f
avformat/argo_brp: bail if no video frames
Fixes: Assertion failure
Fixes: 26572/clusterfuzz-testcase-minimized-ffmpeg_dem_ARGO_BRP_fuzzer-5166735591997440

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-11-03 10:47:37 +10:00
Paul B Mahol a3a6b56200 avcodec: add Argonaut Games Video decoder 2020-09-27 09:56:13 +02:00
Zane van Iperen ce30c3d5b9
avformat/argo_brp: use header frame counts
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-27 09:11:36 +10:00
Zane van Iperen 3ffb15a105
avformat/argo_brp: allow v1.1 ASF streams to have a non-22050 sample rate in certain circumstances
It seems that in files where the BASF block isn't first, v1.1 ASF streams are
allowed to be non-22050. Either this format is really inconsistent, or
FX Fighter and Croc just ignored the sample rate field, requiring the v1.1
restriction in the first place.

This bumps the version to 1.2 in these streams so they're not "corrected".

Found in Alien Odyssey games files in:
./GRAPHICS/COMMBUNK/{{COMADD1,COMM2_{1,2,3E},COMM3_{2,3,4,5,6}},FADE{1,2}}.BRP

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-27 09:11:36 +10:00
Zane van Iperen 97efac3ac1
avformat/argo_brp: cosmetics
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-27 09:11:35 +10:00
Zane van Iperen da5ab5a0b6
avformat/argo_brp: handle the case where the BASF block isn't the first
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-27 09:11:35 +10:00
Zane van Iperen 2e7752afff
avformat/argo_brp: support MASK streams
We can't actually use them though.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-27 09:11:34 +10:00
Zane van Iperen ebfed56858
avformat/argo_{asf,brp}: fix potential segfault in ff_argo_asf_fill_stream()
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-27 09:11:29 +10:00
Zane van Iperen b0dee629da
avformat/argo_brp: don't pass AVStream into avpriv_request_sample()
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-20 19:27:12 +10:00
Zane van Iperen 9ab54eb501
avformat/argo_brp: set BVID packet duration
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-20 19:27:12 +10:00
Zane van Iperen 52c5c97740
avformat/argo_brp: handle multiple BASF blocks
Turns out that there are files with multiple (reasonably-sized) BASF
blocks. Some of the files just have particularly large frames (~10s).

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-20 19:21:01 +10:00
Zane van Iperen a68c91f6bc
avformat/argo_brp: make sure stream ids match
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-20 19:21:01 +10:00
Zane van Iperen e76102a2d8
avformat/argo_brp: cleanup 'goto fail's
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-20 19:21:01 +10:00
Zane van Iperen 3cf650bda9
avformat/argo_brp: remove an allocation
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-20 19:21:00 +10:00
Zane van Iperen 52d362c6e0
avformat/argo_{asf,brp}: use variable frame sizes when (de)muxing adpcm_argo
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-19 15:55:00 +10:00
Zane van Iperen 119efa275e
avformat: add Argonaut Games BRP demuxer
Used in FMVs for FX Fighter and Croc. Supports BVID and BASF streams,
requests samples for anything else.

Due to the way BASF streams are contained in the file, only one is
supported. I have yet to see a BRP file with multiple.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2020-09-14 14:38:45 +10:00