summaryrefslogtreecommitdiff
path: root/libavformat/flacenc.c
Commit message (Collapse)AuthorAgeFilesLines
* avformat/avformat: Move AVOutputFormat internals out of public headerAndreas Rheinhardt2023-02-091-9/+10
| | | | | | | | | | | | | | This commit does for AVOutputFormat what commit 20f972701806be20a77f808db332d9489343bb78 did for AVCodec: It adds a new type FFOutputFormat, moves all the internals of AVOutputFormat to it and adds a now reduced AVOutputFormat as first member. This does not affect/improve extensibility of both public or private fields for muxers (it is still a mess due to lavd). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* libavformat: Split version.hMartin Storsjö2022-03-161-0/+1
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* flac: convert to new channel layout APIVittorio Giovara2022-03-151-4/+4
| | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/packet_internal: Add proper PacketList structAndreas Rheinhardt2022-01-041-5/+5
| | | | | | | | | | | | | | | Up until now, we had a PacketList structure which is actually a PacketListEntry; a proper PacketList did not exist and all the related functions just passed pointers to pointers to the head and tail elements around. All these pointers were actually consecutive elements of their containing structs, i.e. the users already treated them as if they were a struct. So add a proper PacketList struct and rename the current PacketList to PacketListEntry; also make the functions use this structure instead of the pair of pointers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/(aiff|flac|mov|mp3|tta)enc: Don't create unnecessary referencesAndreas Rheinhardt2022-01-041-1/+1
| | | | | | | | | The packet given to muxers is not used afterwards; it is always unreferenced by libavformat. Ergo muxers are allowed to keep the references in the packets and e.g. move the ownership to a packet list. This is what this commit does. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/flacenc: Avoid stack packetAndreas Rheinhardt2021-10-031-4/+4
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/internal: Move ff_read_line_to_bprint_overwrite to avio_internal.hAndreas Rheinhardt2021-07-291-0/+1
| | | | | | | | | | | | | It only uses an AVIOContext and an AVBPrint. When doing so, it turned out that several non-users of ff_read_line_to_bprint_overwrite() and ff_bprint_to_codecpar_extradata() relied on libavformat/internal.h to include bprint.h or avstring.h for them. In order to avoid a repeat of this and in order to reduce unnecessary dependencies, a forward declaration of struct AVBPrint is used instead of including bprint.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: Constify all muxer/demuxersAndreas Rheinhardt2021-04-271-1/+1
| | | | | | | 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>
* avutil/buffer: Switch AVBuffer API to size_tAndreas Rheinhardt2021-04-271-1/+1
| | | | | | | Announced in 14040a1d913794d9a3fd6406a6d8c2f0e37e0062. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/packet_internal: make avpriv_packet_list_* functions use an internal ↵James Almer2021-03-171-1/+1
| | | | | | | | | struct The next pointer is kept at the end for backwards compatability until the major bump, when it should ideally be moved at the front. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: use the buffer_size_t typedef where requiredJames Almer2021-03-101-1/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/flacenc: Fix memleak when writing attached pictures failsAndreas Rheinhardt2020-11-261-0/+2
| | | | | | | | | | | | | | | | | The FLAC muxer currently stores an attached picture corresponding to an AVStream in AVStream.priv_data. The AVPacket contained therein is unreferenced after it has been written. The AVPacket structure itself is then freed generically as AVStream.priv_data. And this can lead to memleaks if an attached picture is not written: It might be because the trailer is never written or because writing a previous attached picture failed in case error_recognition is set to explode. Therefore free the packets properly (i.e. with av_packet_free()) in the muxer's deinit function. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/packet: move AVPacketList definition and function helpers over from ↵James Almer2020-09-151-3/+4
| | | | | | | | | libavformat And replace the flags parameter with a function callback that can be used to copy the contents of the packet (e.g, av_packet_ref and av_packet_copy_props). Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/vorbiscomment: Switch to AVIOContext from bytestream APIAndreas Rheinhardt2020-05-031-14/+4
| | | | | | | | | | | | | | | | Up until now ff_vorbiscomment_write() used the bytestream API to write VorbisComments. Therefore the caller had to provide a sufficiently large buffer to write the output. Yet two of the three callers (namely the FLAC and the Matroska muxer) actually want the output to be written via an AVIOContext; therefore they allocated buffers of the right size just for this purpose (i.e. they get freed immediately afterwards). Only the Ogg muxer actually wants a buffer. But given that it is easy to wrap a buffer into an AVIOContext this commit changes ff_vorbiscomment_write() to use an AVIOContext for its output. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/vorbiscomment: Replace AVDictionary ** by const AVDictionary *Andreas Rheinhardt2020-05-031-1/+1
| | | | | | | | | | | ff_vorbiscomment_write() used an AVDictionary ** parameter for a dictionary whose contents ought to be written; yet this can be replaced by AVDictionary * since commit 042ca05f0fdc5f4d56a3e9b94bc9cd67bca9a4bc; and this in turn can be replaced by const AVDictionary * to indicate that the dictionary isn't modified; the latter also applies to ff_vorbiscomment_length(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/flacenc: Don't allocate updated streaminfo separatelyAndreas Rheinhardt2020-04-181-8/+4
| | | | | | | It is a small buffer of a known, fixed size and so it should simply be put into the muxer's context. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/flacenc: Only update streaminfo if it has changedAndreas Rheinhardt2020-04-181-4/+2
| | | | | | | | | | | | | | | | | | | An AVStream's codecpar is supposed to be filled by the caller before avformat_write_header(); if the CodecParameters change, the caller should signal this via packet side data, but not touch the AVStream's codecpar. The FLAC muxer checks for packet side data containing updated extradata, yet if nothing has arrived by the time the trailer is written, the already written extradata is overwritten by the very same extradata again, unless the output is unseekable, in which case a warning that the FLAC header can't be rewritten is emitted. This commit changes this by only trying to rewrite the extradata if a new streaminfo arrived via packet side data. Only then is a warning emitted in case the output is unseekable. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat: remove unneeded avio_flush() calls from the end of write_trailer ↵Marton Balint2020-01-071-1/+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.
* libavformat/flacenc: reject too big picture blocksMattias Wadman2019-11-011-2/+8
| | | | | | | | | | | | | | | | A too big picture will case the muxer to write a truncated block size (uint24) causing the output file to be corrupt. How to reproduce: Write a file with truncated block size: ffmpeg -y -f lavfi -i sine -f lavfi -i color=red:size=2400x2400 -map 0:a:0 -map 1:v:0 -c:v:0 bmp -disposition:1 attached_pic -t 1 test.flac Try to decode: ffmpeg -i test.flac test.wav Signed-off-by: Mattias Wadman <mattias.wadman@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/flacenc: add a deinit functionJames Almer2019-10-211-2/+9
| | | | | Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/vorbiscomment: add support for writing chaptersPaul B Mahol2018-12-181-2/+2
| | | | Fixes #7532.
* avformat/flacenc: add flac_init()James Almer2018-04-161-10/+20
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/flacenc: support writing attached picturesRodger Combs2018-04-161-36/+242
| | | | | | Usage of packet queueing API and some cleaning done by the committer. Signed-off-by: James Almer <jamrial@gmail.com>
* Merge commit '83548fe894cdb455cc127f754d09905b6d23c173'James Almer2017-03-211-1/+1
|\ | | | | | | | | | | | | * commit '83548fe894cdb455cc127f754d09905b6d23c173': lavf: fix usage of AVIOContext.seekable Merged-by: James Almer <jamrial@gmail.com>
| * lavf: fix usage of AVIOContext.seekableAnton Khirnov2016-09-301-1/+1
| | | | | | | | | | | | | | | | 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-9/+9
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: use AV_OPT_TYPE_BOOL in a bunch of placesClément Bœsch2015-12-041-1/+1
| |
* | avformat/flacenc: Check length in flac_write_block_comment()Michael Niedermayer2015-05-111-1/+3
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/flacenc: Use av_clip_uintp2()Michael Niedermayer2015-02-211-1/+1
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/flacenc: use av_clip() instead of av_clip_c()Clément Bœsch2014-09-161-1/+1
| |
* | Merge commit 'e19d48dfce52f1417f7f06143b96fed00cbcdc52'Michael Niedermayer2014-06-011-8/+29
|\ \ | |/ | | | | | | | | | | | | | | | | * commit 'e19d48dfce52f1417f7f06143b96fed00cbcdc52': flac muxer: support reading updated extradata from side data Conflicts: libavformat/flacenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * flac muxer: support reading updated extradata from side dataAnton Khirnov2014-06-011-8/+29
| |
* | Merge commit 'efcde917af407a6031ecff68edd51fce7b83d104'Michael Niedermayer2014-05-281-3/+3
|\ \ | |/ | | | | | | | | | | | | | | | | * commit 'efcde917af407a6031ecff68edd51fce7b83d104': vorbiscomment: simplify API by using av_dict_count() Conflicts: libavformat/flacenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * vorbiscomment: simplify API by using av_dict_count()Anton Khirnov2014-05-281-3/+3
| |
* | Merge commit '54ed488b1af583df6c9d2a73b4a44f16b7e4f82c'Michael Niedermayer2014-05-281-0/+18
|\ \ | |/ | | | | | | | | | | | | | | | | * commit '54ed488b1af583df6c9d2a73b4a44f16b7e4f82c': flac muxer: write WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag for multichannel files Conflicts: libavformat/flacenc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * flac muxer: write WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag for multichannel filesAnton Khirnov2014-05-281-0/+18
| |
* | Merge commit '0c1959b056f6ccaa2eee2c824352ba93c8e36d52'Michael Niedermayer2014-05-151-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '0c1959b056f6ccaa2eee2c824352ba93c8e36d52': lavf: add AVFMT_FLAG_BITEXACT. Conflicts: doc/APIchanges libavformat/avformat.h libavformat/flacenc.c libavformat/movenc.c libavformat/oggenc.c libavformat/options_table.h libavformat/version.h tests/fate/video.mak Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavf: add AVFMT_FLAG_BITEXACT.Anton Khirnov2014-05-151-1/+1
| | | | | | | | | | | | | | | | Use it instead of checking CODEC_FLAG_BITEXACT in the first stream's codec context. Using codec options inside lavf is fragile and can easily break when the muxing codec context is not the encoding context.
* | lavf/flacenc: fix comment after previous changeJames Darnley2014-01-241-1/+1
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | lavf/flacenc: use metadata_header_paddingJames Darnley2014-01-241-2/+10
| | | | | | | | | | | | | | | | | | Allows a user to control the amount, if any, of padding they want added to the file. If set to zero the block will not be written at all. If set to some positive number four more bytes will be added to the file due to the small header required for the block. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit 'aa69cbc9e08281db6ecb98a2c8b4f60e8b12e558'Michael Niedermayer2014-01-101-0/+28
|\ \ | |/ | | | | | | | | | | | | | | | | * commit 'aa69cbc9e08281db6ecb98a2c8b4f60e8b12e558': flac muxer: add option to disable writing the global header Conflicts: libavformat/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * flac muxer: add option to disable writing the global headerJustin Ruggles2014-01-091-0/+28
| | | | | | | | | | The global header is not explicitly required for playback, and omitting it allows for simple concatenation.
| * lavf: Don't explicitly flush after each written packet in muxersClément Bœsch2013-09-161-1/+0
| | | | | | | | | | | | | | | | Since 596e5d4783, this is not necessary anymore. It also allows to actually disable the flushing, improving write performance (but possibly giving worse latency in real-time streaming). Signed-off-by: Martin Storsjö <martin@martin.st>
* | lavf/flacenc: use ffio_fill()Paul B Mahol2013-05-291-4/+2
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | lavf: remove some flushing in write_packet muxers callbacks.Clément Bœsch2013-04-141-1/+0
| | | | | | | | | | Since 4f112a8e3, this is not necessary anymore. Also, it allows to actually disable the flushing.
* | lavf/flacenc: disallow creation of invalid files with -c copyPaul B Mahol2012-10-221-0/+9
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | Merge commit '36ef5369ee9b336febc2c270f8718cec4476cb85'Michael Niedermayer2012-08-071-2/+2
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '36ef5369ee9b336febc2c270f8718cec4476cb85': Replace all CODEC_ID_* with AV_CODEC_ID_* lavc: add AV prefix to codec ids. Conflicts: doc/APIchanges doc/examples/decoding_encoding.c doc/examples/muxing.c ffmpeg.c ffprobe.c ffserver.c libavcodec/8svx.c libavcodec/avcodec.h libavcodec/dnxhd_parser.c libavcodec/dvdsubdec.c libavcodec/error_resilience.c libavcodec/h263dec.c libavcodec/libvorbisenc.c libavcodec/mjpeg_parser.c libavcodec/mjpegenc.c libavcodec/mpeg12.c libavcodec/mpeg4videodec.c libavcodec/mpegvideo.c libavcodec/mpegvideo_enc.c libavcodec/pcm.c libavcodec/r210dec.c libavcodec/utils.c libavcodec/v210dec.c libavcodec/version.h libavdevice/alsa-audio-dec.c libavdevice/bktr.c libavdevice/v4l2.c libavformat/asfdec.c libavformat/asfenc.c libavformat/avformat.h libavformat/avidec.c libavformat/caf.c libavformat/electronicarts.c libavformat/flacdec.c libavformat/flvdec.c libavformat/flvenc.c libavformat/framecrcenc.c libavformat/img2.c libavformat/img2dec.c libavformat/img2enc.c libavformat/ipmovie.c libavformat/isom.c libavformat/matroska.c libavformat/matroskadec.c libavformat/matroskaenc.c libavformat/mov.c libavformat/movenc.c libavformat/mp3dec.c libavformat/mpeg.c libavformat/mpegts.c libavformat/mxf.c libavformat/mxfdec.c libavformat/mxfenc.c libavformat/nsvdec.c libavformat/nut.c libavformat/oggenc.c libavformat/pmpdec.c libavformat/rawdec.c libavformat/rawenc.c libavformat/riff.c libavformat/sdp.c libavformat/utils.c libavformat/vocenc.c libavformat/wtv.c libavformat/xmv.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * Replace all CODEC_ID_* with AV_CODEC_ID_*Anton Khirnov2012-08-071-2/+2
| |
* | Merge remote-tracking branch 'qatar/master'Michael Niedermayer2012-04-061-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * qatar/master: cosmetics: Align muxer/demuxer declarations mpeg12: Do not change frame_pred_frame_dct flag and demote error into a warning avcodec: remove avcodec_guess_channel_layout() avutil: Add av_get_default_channel_layout() Conflicts: doc/APIchanges libavcodec/mpeg12.c libavformat/cdg.c libavformat/matroskaenc.c libavformat/mpegts.c libavformat/nuv.c libavformat/wav.c libavutil/audioconvert.c libavutil/audioconvert.h libavutil/avutil.h Merged-by: Michael Niedermayer <michaelni@gmx.at>