Commit Graph

33 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
Andreas Rheinhardt a085cfa654 avformat/utils: Move ff_get_extradata to demux_utils.c
It is only used by demuxers (although it is hypothetically
possible that some day e.g. a protocol might need it, but
that is unlikely given that they don't deal with AVCodecParameters).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-05-10 07:45:58 +02:00
Andreas Rheinhardt 1dcd0adedd avformat: Remove unnecessary inclusions from libavcodec
Also improve the other headers a bit while at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-23 23:45:39 +01:00
Anton Khirnov 271a9b632c rsd: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:36 -03: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
Michael Niedermayer 7186ec88b9 uavformat/rsd: check for EOF in extradata
Fixes: OOM
Fixes: 26503/clusterfuzz-testcase-minimized-ffmpeg_dem_RSD_fuzzer-6530816735444992

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-01-11 23:15:04 +01:00
Michael Niedermayer c79d8a6851 avformat/rsd: Check size and start before computing duration
Fixes: signed integer overflow: 100794754 * 28 cannot be represented in type 'int'
Fixes: 26474/clusterfuzz-testcase-minimized-ffmpeg_dem_RSD_fuzzer-5181797606096896

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-10-30 17:49:51 +01:00
Andreas Rheinhardt c1e439d7e9 avformat: Forward errors where possible
It is not uncommon to find code where the caller thinks to know better
what the return value should be than the callee. E.g. something like
"if (av_new_packet(pkt, size) < 0) return AVERROR(ENOMEM);". This commit
changes several instances of this to instead forward the actual error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-12-12 19:25:33 +01: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
Clément Bœsch cd4d6cba12 lavf: fix usages of av_get_codec_tag_string() 2017-03-29 14:49:29 +02:00
James Almer 4de591e6fb Merge commit '83548fe894cdb455cc127f754d09905b6d23c173'
* commit '83548fe894cdb455cc127f754d09905b6d23c173':
  lavf: fix usage of AVIOContext.seekable

Merged-by: James Almer <jamrial@gmail.com>
2017-03-21 17:02:30 -03:00
Andreas Cadhalpun ee5f0f1d35 rsd: limit number of channels
Negative values don't make sense and too large values can cause
overflows. For AV_CODEC_ID_ADPCM_THP this leads to a too small extradata
buffer being allocated, causing out-of-bounds writes.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
2016-10-20 19:54:54 +02:00
Paul B Mahol 323b8c95e4 avformat: add AVFormatContext to ff_get_extradata()
Needed for av_log() inside that function.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2016-04-14 18:21:08 +02:00
Derek Buitenhuis 6f69f7a8bf Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* commit '9200514ad8717c63f82101dc394f4378854325bf':
  lavf: replace AVStream.codec with AVStream.codecpar

This has been a HUGE effort from:
    - Derek Buitenhuis <derek.buitenhuis@gmail.com>
    - Hendrik Leppkes <h.leppkes@gmail.com>
    - wm4 <nfxjfg@googlemail.com>
    - Clément Bœsch <clement@stupeflix.com>
    - James Almer <jamrial@gmail.com>
    - Michael Niedermayer <michael@niedermayer.cc>
    - Rostislav Pehlivanov <atomnuker@gmail.com>

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-10 20:59:55 +01:00
Paul B Mahol b885d9ced5 avformat/rsd: implement seeking
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-20 20:52:37 +01:00
James Almer 183827e689 avformat/rsd: reindent after the last commit
Signed-off-by: James Almer <jamrial@gmail.com>
2015-11-19 16:06:01 -03:00
James Almer 01c63e69f1 avformat/rsd: GADP files are adpcm_thp_le
Signed-off-by: James Almer <jamrial@gmail.com>
2015-11-19 16:00:16 -03:00
Paul B Mahol 2905c51204 avformat/rsd: XMA2 is actually stored, not XMA1
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-11 09:31:44 +01:00
Paul B Mahol 0cfd4a993f avformat/rsd: add XMA support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-09 10:41:38 +01:00
Paul B Mahol bb1d3f1078 avformat/rsd: add VAG support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-18 14:17:14 +02:00
Michael Niedermayer 92a26261d1 avformat/rsd: Check av_new_packet() return value
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-17 12:56:47 +02:00
James Almer 8297f560cc avformat/rsd: propagate return values of extradata helper functions
They can return errors other than ENOMEM

Signed-off-by: James Almer <jamrial@gmail.com>
2015-10-16 16:11:58 -03:00
Paul B Mahol 3a63890154 avformat/rsd: add WADP support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-16 16:37:41 +02:00
Paul B Mahol a99226133e avformat/rsd: support XADP tag
It appears that Xbox ADPCM is same as WAV adpcm.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-10-11 18:39:23 +02:00
Clément Bœsch edbbb11488 avformat/rsd: make tag_buf string larger
av_get_codec_tag_string() uses more that 1 char for unprintable characters.
2014-12-20 00:17:43 +01:00
James Almer d34ec64a22 replace calls to url_feof() with avio_feof()
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-08 00:48:38 +02:00
Michael Niedermayer 2e2cab6e4f avformat/rsd: use ff_get_extradata()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-25 17:38:30 +01:00
Michael Niedermayer eb96802355 avformat/rsd: increase the score for odd samplerate/channels to max/8
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-10 13:37:03 +01:00
Michael Niedermayer 7b7697646b avformat/rsd: increase probe score, as misdetections are fixed
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-06 11:57:57 +01:00
Michael Niedermayer 50a3c4c5d2 avformat/rsd: Check channels and sample_rate fields
Fixes probetest failure

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-06 11:57:57 +01:00
Paul B Mahol a807c68253 avformat: use ff_alloc_extradata()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-10-13 20:13:38 +00:00
James Almer 67fad0d221 ADPCM IMA Radical decoder
Signed-off-by: James Almer <jamrial@gmail.com>
2013-05-10 16:53:50 -03:00
James Almer d3710c51d9 RSD demuxer
Signed-off-by: James Almer <jamrial@gmail.com>
2013-05-10 16:52:10 -03:00