summaryrefslogtreecommitdiff
path: root/libavformat/wavenc.c
Commit message (Collapse)AuthorAgeFilesLines
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-161-0/+2
| | | | | | | | This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. Signed-off-by: Martin Storsjö <martin@martin.st>
* wav: convert to new channel layout APIVittorio Giovara2022-03-151-7/+7
| | | | | | 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>
* Replace all occurences of av_mallocz_array() by av_calloc()Andreas Rheinhardt2021-09-201-2/+2
| | | | | | | They do the same. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: Constify all muxer/demuxersAndreas Rheinhardt2021-04-271-2/+2
| | | | | | | 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>
* avformat/wavenc: Fix leak and segfault on reallocation errorAndreas Rheinhardt2021-02-271-24/+29
| | | | | | | | | | | | | | | | | | | | | Up until now, the wav muxer used a reallocation of the form ptr = av_realloc(ptr, size); that leaks upon error. Furthermore, if a failed reallocation happened when writing the trailer, a segfault would occur due to avio_write(NULL, size) because the muxer only prints an error message upon allocation error, but does not return the error. Moreover setting the pointer to the buffer to NULL on error seems to be done on purpose in order to record that an error has occured so that outputting the peak values is no longer attempted. This behaviour has been retained by simply disabling whether peak data should be written if an error occurs. Finally, the reallocation is now done once per peak block and not once per peak block per channel; it is also done with av_fast_realloc and not with a linear size increase. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/wavenc: Improve unsupported codec error messagesAndreas Rheinhardt2021-02-251-9/+6
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/wav: Deduplicate codec tags listsAndreas Rheinhardt2021-02-231-2/+2
| | | | | | Also saves relocations. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/wavenc: simplify, use av_rescale_q() insteadLimin Wang2020-05-101-4/+3
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat: remove more unneeded avio_flush() callsMarton Balint2020-01-071-7/+0
| | | | | | | | | | | | These instances are simply redundant or present because avio_flush() used to be required before doing a seekback. That is no longer the case, aviobuf code does the flush automatically on seek. This only affects code which is either disabled for streaming IO contexts or does no seekbacks after the flush, so this change should have no adverse effect on streaming. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat: remove unneeded avio_flush() calls from the end of write_trailer ↵Marton Balint2020-01-071-2/+0
| | | | | | | functions The IO context is always flushed by libavformat/mux.c after write_trailer is called, so this change should have no effect at all.
* avformat: remove avio_flush() calls from the end of write_header functionsMarton Balint2020-01-071-2/+0
| | | | | | | | | | | | | | To make it consistent with other muxers. The user can still control the generic flushing behaviour after write_header (same way as after packets) using the -flush_packets option, the default typically means to flush unless a non-streamed file output is used. Therefore this change should have no adverse effect on streaming, even if it is assumed that the first packet has a clean buffer, so small seekbacks within the output buffer work even when the IO context is not seekable. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/wavenc: Add deinit functionAndreas Rheinhardt2019-12-261-5/+2
| | | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/wavenc: skip writing incorrect peak-of-peaks position valueTobias Rapp2017-10-261-10/+1
| | | | | | | | | | | | | | According to EBU tech 3285 supplement 3 the dwPosPeakOfPeaks field should contain the absolute position to the maximum audio sample value, but the current implementation writes the relative peak frame index instead. Fix the issue by writing the "unknown" value (-1) for now until the feature is implemented correctly. Previous version reviewed-by: Peter Bubestinger <p.bubestinger@av-rd.com> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
* avformat/wavenc: replace literal numbers with enum constantsTobias Rapp2017-10-051-4/+4
| | | | Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
* Merge commit '83548fe894cdb455cc127f754d09905b6d23c173'James Almer2017-03-211-4/+4
|\ | | | | | | | | | | | | * commit '83548fe894cdb455cc127f754d09905b6d23c173': lavf: fix usage of AVIOContext.seekable Merged-by: James Almer <jamrial@gmail.com>
| * lavf: fix usage of AVIOContext.seekableAnton Khirnov2016-09-301-2/+2
| | | | | | | | | | | | | | | | 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.
* | Merge commit '9200514ad8717c63f82101dc394f4378854325bf'Derek Buitenhuis2016-04-101-25/+27
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
| * lavf: replace AVStream.codec with AVStream.codecparAnton Khirnov2016-02-231-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | avformat/wavenc: use AV_OPT_TYPE_BOOL for write_bext optionPaul B Mahol2015-09-111-1/+1
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | lavf/wav: Print an error if files >4G are written.Carl Eugen Hoyos2015-05-171-2/+6
| | | | | | | | | | | | Additionally, don't write an incorrect shorter size for such files. Fixes part of ticket #4543.
* | avformat/wavenc: Check umid lengthMichael Niedermayer2015-05-101-1/+1
| | | | | | | | | | | | Fixes potential out of array read Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/wavenc: fix string length variable typesMichael Niedermayer2015-05-101-3/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/wavenc: Change enum to int, which is accessed via AVOption as intMichael Niedermayer2015-03-301-1/+1
| | | | | | | | | | | | This fixes depending on implementation defined behavior Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/wavenc: check return value of strftime()Michael Niedermayer2014-12-091-5/+12
| | | | | | | | | | | | Fixes CID1257006 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/wavenc: Use localtime_r() for thread safteyMichael Niedermayer2014-11-021-1/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/wavenc: use av_mallocz_array()Paul B Mahol2014-07-111-2/+2
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | avformat/wavenc: simplify malloc failure checkingMichael Niedermayer2014-06-241-6/+1
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/wavenc: more specific error return for "Writing 16 bit peak for 8 ↵Michael Niedermayer2014-06-241-1/+1
| | | | | | | | | | | | bit audio" Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/wavenc: do not hardcode array size in memset and other functionsMichael Niedermayer2014-06-241-3/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/wavenc: use the bitexact flag from avformat instead of the one from ↵Michael Niedermayer2014-06-241-1/+1
| | | | | | | | | | | | avcodec Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Peak Envelope Chunk encoder: IndentGeorg Lippitsch2014-06-241-14/+14
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | EBU Tech 3285 - Supplement 3 - Peak Envelope Chunk encoderGeorg Lippitsch2014-06-241-1/+243
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'd246231e4714119faac6c7acd881d3b687bb8b11'Michael Niedermayer2014-05-181-2/+3
|\ \ | |/ | | | | | | | | | | | | | | | | * commit 'd246231e4714119faac6c7acd881d3b687bb8b11': wavenc: use codec descriptors to get the codec name Conflicts: libavformat/wavenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * wavenc: use codec descriptors to get the codec nameAnton Khirnov2014-05-181-2/+3
| | | | | | | | Also, return a proper error code.
| * wavenc: write fact chunk sample count at the correct file positionMichael Niedermayer2012-11-261-4/+5
| | | | | | | | | | | | | | 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>
* | Initialize riff and wav size fields to -1 instead of 0.Carl Eugen Hoyos2014-05-031-1/+1
| | | | | | | | | | | | | | WMP doess not play the output files if the fields are set to 0 and not overwritten (using pipe output). Fixes ticket #3346.
* | ff_put_wav_header: add flag to force WAVEFORMATEXDaniel Verkamp2014-04-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | lavf/wavenc: check for a single stream.Nicolas George2013-11-031-0/+5
| | | | | | | | Fix trac ticket #3110.
* | WAV muxer: reindentDaniel Verkamp2013-02-131-13/+13
| |
* | WAV muxer: add RF64 supportDaniel Verkamp2013-02-121-6/+67
| |
* | w64: fact guid supportPaul B Mahol2013-01-071-1/+19
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | Sony Wave64 muxerPaul B Mahol2012-12-311-0/+84
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | wavenc: fix curruption of metadataMichael Niedermayer2012-10-301-4/+5
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '31c54711cc3f1484af101d629bbb805820d37ad1'Michael Niedermayer2012-10-171-4/+4
|/ | | | | | | | | | * commit '31c54711cc3f1484af101d629bbb805820d37ad1': lavf: split wav muxer and demuxer into separate files. Conflicts: libavformat/wavdec.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
* lavf: split wav muxer and demuxer into separate files.Anton Khirnov2012-10-161-0/+219