Commit Graph

47 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 a94a6617a3 avformat/riffdec: Pass logctx as void* instead of AVFormatContext*
Also stop second-guessing error codes from ff_get_extradata().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2023-08-30 20:00:55 +02:00
Will Cassella e601ec3c19 libavformat/riffec: Zero-initialize channels in ff_get_wav_header
Clang's static analyzer complains that leaving the  variable
uninitialized could lead to a code path where the uninitialized value is
written to  at the end of this function.
This patch simply zero-initializes that variable to avoid that.

Signed-off-by: Will Cassella <cassew@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-09-20 18:58:23 -03:00
James Almer 60d8c2019f avformat/riffdec: don't unconditionally overwrite WAVEFORMATEXTENSIBLE layout
Do it only if the value conflicts with the previous channels value.

Fixes ticket #9912

Signed-off-by: James Almer <jamrial@gmail.com>
2022-09-11 09:52:02 -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
Vittorio Giovara c3bf53fab2 riff: convert to new channel layout API
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:36 -03:00
Andreas Rheinhardt d1ac645636 avformat: Use ffio_read_size where appropriate
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-08-06 22:47:22 +02:00
Andreas Rheinhardt 25c8507818 Remove/replace some unnecessary avcodec.h inclusions
Also remove other unnecessary headers and include headers directly while
at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 15:29:46 +02:00
Paul B Mahol dfb0b9370d avcodec: fix pcm zork decoder
Fixes #1939
2020-02-16 12:54:57 +01:00
Andreas Rheinhardt 82d61a9ce3 avformat: Don't free old extradata before ff_alloc/get_extradata
These functions already free it themselves before they allocate the new
extradata.

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
Paul B Mahol 3a2adeedaf avformat/riffdec: pass correct pointer to av_log 2019-04-07 21:09:56 +02:00
James Almer 42f27d1b8e Merge commit '0539d84d985e811e5989ef27c13f7e2dda0f9b89'
* commit '0539d84d985e811e5989ef27c13f7e2dda0f9b89':
  asfdec: Account for different Format Data sizes

See 76853a3e0c

Merged-by: James Almer <jamrial@gmail.com>
2017-09-28 00:28:38 -03:00
Thierry Foucu 4bc7268f2b lavf/riff: Support decoding files with broken mediasubtype base guid.
Fixes ticket #6100.
2017-02-17 14:24:53 +01:00
Alexandra Hájková 0539d84d98 asfdec: Account for different Format Data sizes
Some muxers may use the BMP_HEADER Format Data size instead
of the ASF-specific one.

Bug-Id: 1020
CC: libav-stable@libav.org

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-02-15 11:21:11 +01:00
Clément Bœsch f475405237 Merge commit '7f549b8338ed3775fec4bf10421ff5744e5866dd'
* commit '7f549b8338ed3775fec4bf10421ff5744e5866dd':
  riff: don't overwrite bps from WAVEFORMATEX if EXTENSIBLE doesn't contain that data.

Only cosmetics, the change was already present.

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-02-02 11:36:34 +01:00
Hendrik Leppkes 7f549b8338 riff: don't overwrite bps from WAVEFORMATEX if EXTENSIBLE doesn't contain that data.
According to the specification on the MSDN [1], 0 is valid for that
particular field, and it should be ignored in that case.

[1]: http://msdn.microsoft.com/en-us/library/windows/desktop/dd757714(v=vs.85).aspx

Bug-Id: 950

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2016-07-22 19:08:12 +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
Carl Eugen Hoyos aebfbe5c13 lavf/riffdec: Remove \n from avpriv_report_missing_feature().
Found-by: Clément Bœsch
2016-03-06 21:39:57 +01:00
Anton Khirnov 9200514ad8 lavf: replace AVStream.codec with AVStream.codecpar
Currently, AVStream contains an embedded AVCodecContext instance, which
is used by demuxers to export stream parameters to the caller and by
muxers to receive stream parameters from the caller. It is also used
internally as the codec context that is passed to parsers.

In addition, it is also widely used by the callers as the decoding (when
demuxer) or encoding (when muxing) context, though this has been
officially discouraged since Libav 11.

There are multiple important problems with this approach:
    - the fields in AVCodecContext are in general one of
        * stream parameters
        * codec options
        * codec state
      However, it's not clear which ones are which. It is consequently
      unclear which fields are a demuxer allowed to set or a muxer allowed to
      read. This leads to erratic behaviour depending on whether decoding or
      encoding is being performed or not (and whether it uses the AVStream
      embedded codec context).
    - various synchronization issues arising from the fact that the same
      context is used by several different APIs (muxers/demuxers,
      parsers, bitstream filters and encoders/decoders) simultaneously, with
      there being no clear rules for who can modify what and the different
      processes being typically delayed with respect to each other.
    - avformat_find_stream_info() making it necessary to support opening
      and closing a single codec context multiple times, thus
      complicating the semantics of freeing various allocated objects in the
      codec context.

Those problems are resolved by replacing the AVStream embedded codec
context with a newly added AVCodecParameters instance, which stores only
the stream parameters exported by the demuxers or read by the muxers.
2016-02-23 17:01:58 +01:00
Bruce Dawson 09b3a42495 riffdec: Explicitly null-terminate array to work around VC++ bug
Due to this bug in VC++ 2015 Update 1:
https://connect.microsoft.com/VisualStudio/feedback/details/2291638

the 'key' array in ff_read_riff_info() ends up being not null
terminated which led to failures in a Chromium unit tests. Update 2
should have a fix, but until then it is important to avoid problems.
2016-02-01 10:41:56 +01:00
Michael Niedermayer 4e31176e14 avformat/riffdec: remove special case for bitrate > 32bit
AVCodecContext.bitrate is 64bit

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-03 20:20:09 +01:00
Michael Niedermayer 32bf6550cb avformat/riffdec: Initialize bitrate
Fixes CID1338334

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-03 20:20:09 +01:00
Paul B Mahol b456ece557 XMA1 and XMA2 stereo decoders
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-11-06 13:45:50 +01:00
Carl Eugen Hoyos f17ca46009 lavf/riff: Support decoding Ambisonic wav files.
Reported and tested by Andy Furniss, adf d lists at gmail
2015-09-16 14:03:13 +02:00
Vittorio Giovara 059a934806 lavc: Consistently prefix input buffer defines
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-27 15:24:59 +01:00
Michael Niedermayer 839d6bc192 avformat/riffde: Fix integer overflow in bitrate
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-12 16:24:20 +02:00
Michael Niedermayer cd32637741 Merge commit 'f1bdc234370401c032cd85184e93c7c155eb6d62'
* commit 'f1bdc234370401c032cd85184e93c7c155eb6d62':
  riff: Validate bitrate

Conflicts:
	libavformat/riffdec.c

See: 189420cb56
Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-12 16:23:42 +02:00
Andreas Cadhalpun 189420cb56 riffdec: prevent negative bit rate
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-12 16:12:36 +02:00
Michael Niedermayer ba77fb61f7 Merge commit 'd80811c94e068085aab797f9ba35790529126f85'
* commit 'd80811c94e068085aab797f9ba35790529126f85':
  riff: Use the correct logging context

Conflicts:
	libavformat/asfdec_o.c
	libavformat/avidec.c
	libavformat/dxa.c
	libavformat/matroskadec.c
	libavformat/mov.c
	libavformat/riff.h
	libavformat/riffdec.c
	libavformat/wavdec.c
	libavformat/wtvdec.c
	libavformat/xwma.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-12 15:22:37 +02:00
Andreas Cadhalpun f1bdc23437 riff: Validate bitrate 2015-07-11 18:45:45 +02:00
Luca Barbato d80811c94e riff: Use the correct logging context 2015-07-11 18:45:44 +02:00
Michael Niedermayer 6d9dfb1267 Merge commit '1b4c468477f3b8d372da8ef4e5405539ad9c1501'
* commit '1b4c468477f3b8d372da8ef4e5405539ad9c1501':
  riff: Validate the wav header size before trying to parse it

Conflicts:
	libavformat/riffdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-30 12:59:16 +02:00
Luca Barbato 1b4c468477 riff: Validate the wav header size before trying to parse it 2015-06-28 17:32:40 +02:00
Michael Niedermayer da06169850 avformat/riffdec: Forward error code from avio_read() in ff_get_guid()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-28 13:04:47 +02:00
Michael Niedermayer fd3e7447c8 avformat/riffdec: Use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-22 12:03:35 +01:00
Thomas Volkert 00d7555f34 wavdec: RIFX file format support
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-18 00:10:35 +01:00
Michael Niedermayer e74f2be1ed avformat/riffdec: ask for samples with wav header size < 14
Based on commit by Hendrik Leppkes <h.leppkes@gmail.com>

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-30 01:55:36 +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 d32926db7f avformat/riff: return error code from ff_get_guid()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-12 15:59:15 +01:00
Carl Eugen Hoyos 862174ec83 Move GUID-related objects to riffenc.c and riff.c.
This simplifies the following eac3-in-wav patch.
2014-01-29 00:44:59 +01:00
Michael Niedermayer 0b9ca70243 avformat/riffdec: use ff_get_extradata()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-25 17:38:29 +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
Michael Niedermayer 5badcfe220 Merge commit 'd07aa3f02b73ab1371c13ac7898338380ca0932b'
* commit 'd07aa3f02b73ab1371c13ac7898338380ca0932b':
  riffdec: Add sanity checks for the sample rate

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-29 23:41:16 +02:00
Martin Storsjö d07aa3f02b riffdec: Add sanity checks for the sample rate
This avoids a division by zero for G726.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-29 19:58:18 +03:00
Michael Niedermayer 0a8f5eb23a Merge commit '255d9c570e117f0fcb8e51fa2c5996f3c4b2052b'
* commit '255d9c570e117f0fcb8e51fa2c5996f3c4b2052b':
  riff: Move demuxing code to a separate file.

Conflicts:
	configure
	libavformat/riff.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-06 18:30:47 +02:00
Diego Biurrun 255d9c570e riff: Move demuxing code to a separate file. 2013-08-06 11:02:36 +02:00