Commit Graph

32 Commits

Author SHA1 Message Date
Tobias Rapp c941e99b7f avformat/wavenc: replace literal numbers with enum constants
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2017-10-05 09:49:22 +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
Anton Khirnov 83548fe894 lavf: fix usage of AVIOContext.seekable
It is supposed to be a flag. The only currently defined value is
AVIO_SEEKABLE_NORMAL, but other ones may be added in the future.
However all the current lavf code treats this field as a bool (mainly
for historical reasons).
Change all those cases to properly check for AVIO_SEEKABLE_NORMAL.
2016-09-30 16:54:33 +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
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
Paul B Mahol 2506244155 avformat/wavenc: use AV_OPT_TYPE_BOOL for write_bext option
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2015-09-11 15:34:17 +00:00
Carl Eugen Hoyos 2608f11863 lavf/wav: Print an error if files >4G are written.
Additionally, don't write an incorrect shorter size for such files.

Fixes part of ticket #4543.
2015-05-17 02:08:58 +02:00
Michael Niedermayer 004564c930 avformat/wavenc: Check umid length
Fixes potential out of array read

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-10 20:03:36 +02:00
Michael Niedermayer ecb4ae7879 avformat/wavenc: fix string length variable types
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-10 19:52:30 +02:00
Michael Niedermayer f45758d3ee avformat/wavenc: Change enum to int, which is accessed via AVOption as int
This fixes depending on implementation defined behavior

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-30 00:08:57 +02:00
Michael Niedermayer 308429e124 avformat/wavenc: check return value of strftime()
Fixes CID1257006

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-09 16:15:40 +01:00
Michael Niedermayer 76886589ee avformat/wavenc: Use localtime_r() for thread saftey
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-02 20:08:12 +01:00
Paul B Mahol 6779bf3f0f avformat/wavenc: use av_mallocz_array()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2014-07-11 10:38:45 +00:00
Michael Niedermayer 501158c682 avformat/wavenc: simplify malloc failure checking
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-24 13:51:40 +02:00
Michael Niedermayer 3bd0221bc1 avformat/wavenc: more specific error return for "Writing 16 bit peak for 8 bit audio"
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-24 13:50:38 +02:00
Michael Niedermayer d34d3304a8 avformat/wavenc: do not hardcode array size in memset and other functions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-24 13:38:47 +02:00
Michael Niedermayer 2e1e10a6bb avformat/wavenc: use the bitexact flag from avformat instead of the one from avcodec
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-24 13:32:27 +02:00
Georg Lippitsch fd504f7c6f Peak Envelope Chunk encoder: Indent
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-24 04:37:02 +02:00
Georg Lippitsch e3b03da772 EBU Tech 3285 - Supplement 3 - Peak Envelope Chunk encoder
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-24 04:30:29 +02:00
Michael Niedermayer c01bcce495 Merge commit 'd246231e4714119faac6c7acd881d3b687bb8b11'
* commit 'd246231e4714119faac6c7acd881d3b687bb8b11':
  wavenc: use codec descriptors to get the codec name

Conflicts:
	libavformat/wavenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-18 21:05:46 +02:00
Anton Khirnov d246231e47 wavenc: use codec descriptors to get the codec name
Also, return a proper error code.
2014-05-18 20:33:38 +02:00
Carl Eugen Hoyos c2b0ce70ad Initialize riff and wav size fields to -1 instead of 0.
WMP doess not play the output files if the fields are
set to 0 and not overwritten (using pipe output).

Fixes ticket #3346.
2014-05-03 22:21:00 +02:00
Daniel Verkamp 5e7d21c7ad ff_put_wav_header: add flag to force WAVEFORMATEX
Partially undoes commit 2c4e08d89327595f7f4be57dda4b3775e1198d5e:

    riff: always generate a proper WAVEFORMATEX structure in
    ff_put_wav_header

A new flag, FF_PUT_WAV_HEADER_FORCE_WAVEFORMATEX, is added to force the
use of WAVEFORMATEX rather than PCMWAVEFORMAT even for PCM codecs.

This flag is used in the Matroska muxer (the cause of the original
change) and in the ASF muxer, because the specifications for
these formats indicate explicitly that WAVEFORMATEX should be used.

Muxers for other formats will return to the original behavior of writing
PCMWAVEFORMAT when writing a header for raw PCM.

In particular, this causes raw PCM in WAV to generate the canonical
44-byte header expected by some tools.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-30 16:41:35 +02:00
Nicolas George eeb975f5cd lavf/wavenc: check for a single stream.
Fix trac ticket #3110.
2013-11-03 10:29:27 +01:00
Daniel Verkamp 5dd78ef34e WAV muxer: reindent 2013-02-13 17:36:55 +00:00
Daniel Verkamp 1ecce266fa WAV muxer: add RF64 support 2013-02-12 14:50:27 +00:00
Paul B Mahol 3174137d41 w64: fact guid support
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-01-07 10:08:38 +00:00
Paul B Mahol 9a74282644 Sony Wave64 muxer
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2012-12-31 07:10:57 +00:00
Michael Niedermayer 2fe0094e0b wavenc: write fact chunk sample count at the correct file position
Fixes curruption of metadata in the INFO chunk.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-11-26 19:11:10 -05:00
Michael Niedermayer f7a9a99661 wavenc: fix curruption of metadata
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-30 21:48:39 +01:00
Michael Niedermayer df5e089da9 Merge commit '31c54711cc3f1484af101d629bbb805820d37ad1'
* commit '31c54711cc3f1484af101d629bbb805820d37ad1':
  lavf: split wav muxer and demuxer into separate files.

Conflicts:
	libavformat/wavdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-17 15:46:08 +02:00
Anton Khirnov 31c54711cc lavf: split wav muxer and demuxer into separate files. 2012-10-16 18:52:07 +02:00