summaryrefslogtreecommitdiff
path: root/libavformat/flacdec.c
Commit message (Collapse)AuthorAgeFilesLines
* avformat/internal: Don't include avcodec.hAndreas Rheinhardt2022-09-261-0/+1
| | | | | | | | | | | | | | | The general demuxing API uses parsers and decoders. Therefore FFStream contains pointers to AVCodecContexts and AVCodecParserContext and lavf/internal.h includes lavc/avcodec.h. Yet actually only a few files files really use these; and it is best when this number stays small. Therefore this commit uses opaque structs in lavf/internal.h for these contexts and stops including avcodec.h. This also avoids including lavc/codec_desc.h implicitly. All other headers are implicitly included as now (mostly through codec.h). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/flac: Don't use bytestream API unnecessarilyAndreas Rheinhardt2022-09-021-0/+1
| | | | | | | It makes no sense here, as flac_parse_block_header() is not even supposed to advance the caller's pointer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: Move avpriv_new_chapter to demux_utils.cAndreas Rheinhardt2022-05-101-1/+1
| | | | | | | It is demuxer-only: Muxers deal only with chapters given to them; they don't create any of their own. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* flac: convert to new channel layout APIVittorio Giovara2022-03-151-2/+1
| | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/flacdec: Also set channels when setting channel_layoutAndreas Rheinhardt2021-10-071-0/+2
| | | | | | | | | This brings the FLAC demuxer in line with all the other demuxers. Furthermore, if it is not done and the FLAC decoder is disabled, the FLAC parser will overwrite the channel layout with the standard channel layout for that number of channels. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: Avoid allocation for AVStreamInternalAndreas Rheinhardt2021-09-171-9/+10
| | | | | | | | | | Do this by allocating AVStream together with the data that is currently in AVStreamInternal; or rather: Put AVStream at the beginning of a new structure called FFStream (which encompasses more than just the internal fields and is a proper context in its own right, hence the name) and remove AVStreamInternal altogether. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: Avoid allocation for AVFormatInternalAndreas Rheinhardt2021-09-171-1/+2
| | | | | | | | | | | | | Do this by allocating AVFormatContext together with the data that is currently in AVFormatInternal; or rather: Put AVFormatContext at the beginning of a new structure called FFFormatContext (which encompasses more than just the internal fields and is a proper context in its own right, hence the name) and remove AVFormatInternal altogether. The biggest simplifications occured in avformat_alloc_context(), where one can now simply call avformat_free_context() in case of errors. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/flac_picture: Try to reuse buffer for attached pictureAndreas Rheinhardt2021-08-281-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/rawdec: Deduplicate AVClasses based upon ff_raw_optionsAndreas Rheinhardt2021-07-081-2/+1
| | | | | | | | The child_class_next API relied on different (de)muxers to use different AVClasses; yet this API has been replaced by child_class_iterate. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/flacdec, takdec: Use FFRawDemuxerContext directlyAndreas Rheinhardt2021-07-081-2/+1
| | | | | | | | | | | | | The beginning of the private contexts of both the FLAC and the TAK demuxer currently mimick FFRawDemuxerContext: A pointer to an AVClass followed by the AVOpt-enabled field raw_packet_size. Said field is only used by the demuxers' read_packet functions via ff_raw_read_partial_packet(), which treats the private context as an FFRaawDemuxerContext. Yet this is fragile, so better include a FFRawDemuxerContext struct at the beginning of said demuxers' private contexts. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: move AVStream.{parser,need_parsing} to AVStreamInternalJames Almer2021-05-071-1/+1
| | | | | | | Those are private fields, no reason to have them exposed in a public header. Signed-off-by: James Almer <jamrial@gmail.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>
* avformat/flacdec: use av_packet_alloc() to allocate packetsJames Almer2021-03-171-8/+7
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* lavf: move AVStream.*index_entries* to AVStreamInternalAnton Khirnov2020-10-281-4/+4
| | | | | | | Those are private fields, no reason to have them exposed in a public header. Since there are some (semi-)public fields located after these, even though this section is supposed to be private, keep some dummy padding there until the next major bump to preserve ABI compatibility.
* libavformat/flacdec: Workaround for truncated metadata picture sizeMattias Wadman2020-05-251-1/+1
| | | | | | | | | | | | | | | | | | | | | Some flac muxers write truncated metadata picture size if the picture data do not fit in 24 bits. Detect this by truncting the size found inside the picture block and if it matches the block size use it and read rest of picture data. This workaround is only for flac files and not ogg files with flac METADATA_BLOCK_PICTURE comments and it can be disabled with strict level above normal. Currently there is a 500MB limit on truncate size to protect from large memory allocations. The truncation bug in lavf flacenc was fixed in e447a4d112bcfee10126c54eb4481fa8712957c8 but based on existing broken files other unknown flac muxers seems to truncate also. Before the fix a broken flac file for reproduction could be generated with: ffmpeg -f lavfi -i sine -f lavfi -i color=red:size=2400x2400 -map 0:0 -map 1:0 -c:v:0 bmp -disposition:1 attached_pic -t 1 test.flac Fixes ticket 6333 Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avformat/flacdec: Remove useless packetAndreas Rheinhardt2019-11-171-5/+6
| | | | | | | | | | | flac_read_timestamp() applied av_init_packet() to a packet (which initializes all fields of the packet except for data and size) and then went on to use only the data and size fields. In other words: Said packet can be removed and replaced by an uint8_t * and an int. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/rawdec: Make the raw packet size configurableMichael Niedermayer2019-07-171-0/+4
| | | | | | | | This allows testing parsers with a wider range of input packet sizes. Which is important and usefull for regression testing, some of our parsers in fact to not work if the packet size is changed from 1024 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf: Constify the probe function argument.Carl Eugen Hoyos2019-03-211-2/+2
| | | | | Reviewed-by: Lauri Kasanen Reviewed-by: Tomas Härdin
* Merge commit 'ed1cd81076434b76f37576d4d806973476a8e96c'Clément Bœsch2017-03-151-9/+20
|\ | | | | | | | | | | | | | | | | | | | | * commit 'ed1cd81076434b76f37576d4d806973476a8e96c': flac demuxer: improve probing Suggested commit very closely matches our code, except with regards to AVPROBE_SCORE_EXTENSION. The code layout is mostly merged but preserves our behaviour. Merged-by: Clément Bœsch <u@pkh.me>
| * flac demuxer: improve probingAnton Khirnov2016-07-311-3/+18
| | | | | | | | | | Extend the probe function to validate the STREAMINFO block that must follow the fLaC ID tag.
* | lavf/flacdec: Return maximum score if the streaminfo header is valid.Carl Eugen Hoyos2017-03-021-1/+8
| |
* | avformat/flacdec: Check avio_read result when reading flac block header.Frank Liberato2017-01-251-1/+2
| | | | | | | | | | | | Return AVERROR_INVALIDDATA if all four bytes aren't present. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avformat/flacdec: Fix seeking close to EOFMichael Niedermayer2016-06-221-3/+6
| | | | | | | | | | | | Fixes Ticket5428 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | 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-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/flacdec: remove unused return code assignmentMichael Niedermayer2015-12-091-3/+3
| | | | | | | | | | | | Fixes CID1271811 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Replace remaining occurances of av_free_packet with av_packet_unrefHendrik Leppkes2015-10-271-1/+1
| |
* | avformat/flacdec: support fast-seekChing Yi, Chan2015-10-041-1/+59
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '059a934806d61f7af9ab3fd9f74994b838ea5eba'Michael Niedermayer2015-07-271-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit '059a934806d61f7af9ab3fd9f74994b838ea5eba': lavc: Consistently prefix input buffer defines Conflicts: doc/examples/decoding_encoding.c libavcodec/4xm.c libavcodec/aac_adtstoasc_bsf.c libavcodec/aacdec.c libavcodec/aacenc.c libavcodec/ac3dec.h libavcodec/asvenc.c libavcodec/avcodec.h libavcodec/avpacket.c libavcodec/dvdec.c libavcodec/ffv1enc.c libavcodec/g2meet.c libavcodec/gif.c libavcodec/h264.c libavcodec/h264_mp4toannexb_bsf.c libavcodec/huffyuvdec.c libavcodec/huffyuvenc.c libavcodec/jpeglsenc.c libavcodec/libxvid.c libavcodec/mdec.c libavcodec/motionpixels.c libavcodec/mpeg4videodec.c libavcodec/mpegvideo.c libavcodec/noise_bsf.c libavcodec/nuv.c libavcodec/nvenc.c libavcodec/options.c libavcodec/parser.c libavcodec/pngenc.c libavcodec/proresenc_kostya.c libavcodec/qsvdec.c libavcodec/svq1enc.c libavcodec/tiffenc.c libavcodec/truemotion2.c libavcodec/utils.c libavcodec/utvideoenc.c libavcodec/vc1dec.c libavcodec/wmalosslessdec.c libavformat/adxdec.c libavformat/aiffdec.c libavformat/apc.c libavformat/apetag.c libavformat/avidec.c libavformat/bink.c libavformat/cafdec.c libavformat/flvdec.c libavformat/id3v2.c libavformat/isom.c libavformat/matroskadec.c libavformat/mov.c libavformat/mpc.c libavformat/mpc8.c libavformat/mpegts.c libavformat/mvi.c libavformat/mxfdec.c libavformat/mxg.c libavformat/nutdec.c libavformat/oggdec.c libavformat/oggparsecelt.c libavformat/oggparseflac.c libavformat/oggparseopus.c libavformat/oggparsespeex.c libavformat/omadec.c libavformat/rawdec.c libavformat/riffdec.c libavformat/rl2.c libavformat/rmdec.c libavformat/rtpdec_latm.c libavformat/rtpdec_mpeg4.c libavformat/rtpdec_qdm2.c libavformat/rtpdec_svq3.c libavformat/sierravmd.c libavformat/smacker.c libavformat/smush.c libavformat/spdifenc.c libavformat/takdec.c libavformat/tta.c libavformat/utils.c libavformat/vqf.c libavformat/westwood_vqa.c libavformat/xmv.c libavformat/xwma.c libavformat/yop.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
| * lavc: Consistently prefix input buffer definesVittorio Giovara2015-07-271-1/+1
| | | | | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | lavf/flac: Autodetect raw flac files.Carl Eugen Hoyos2015-04-101-0/+18
| |
* | Merge commit '7784f47762d59e859b4d0f74b3e021ad9368ee2c'Michael Niedermayer2014-11-061-8/+11
|\ \ | |/ | | | | | | | | | | | | | | | | * commit '7784f47762d59e859b4d0f74b3e021ad9368ee2c': lavf: stop using avpriv_flac_parse_streaminfo() Conflicts: libavcodec/Makefile Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * lavf: stop using avpriv_flac_parse_streaminfo()Anton Khirnov2014-11-061-8/+11
| | | | | | | | | | | | The only parameters needed by the demuxers are the sample rate and sample count, which can be trivially extracted manually, without resorting to an avpriv function.
* | Merge commit 'db68ef898a3802e51b6f41fd600d0d46d058e3f8'Michael Niedermayer2014-08-141-1/+4
|\ \ | |/ | | | | | | | | | | | | | | | | * commit 'db68ef898a3802e51b6f41fd600d0d46d058e3f8': ogg: update event_flags with STREAM_/METADATA_UPDATED whenever metadata changes. Conflicts: libavformat/oggparsevorbis.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * ogg: update event_flags with STREAM_/METADATA_UPDATED whenever metadata changes.Andrew Stone2014-08-131-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Originally, AVFormatContext and a metadata dict were provided to ff_vorbis_comment(), but this presented issues if an AVStream was being updated or the metadata on AVFormatContext wasn't actually being updated. To remedy this, ff_vorbis_stream_comment() explicitly updates a stream's metadata and sets any necessary flags. ff_vorbis_comment() does not modify any flags, and any calls to it that update AVFormatContext's metadata (just a single call) must also update AVFormatContext.event_flags after detecting any metadata changes to the provided dictionary, as signaled by a positive return value. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* | replace calls to url_feof() with avio_feof()James Almer2014-08-081-1/+1
| | | | | | | | | | Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '23f741f79327e31be7b2a75ebb2e02111e06e52f'Michael Niedermayer2014-05-281-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | * commit '23f741f79327e31be7b2a75ebb2e02111e06e52f': matroskadec: parse the channel layout mask for FLAC Conflicts: libavformat/oggparsevorbis.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * matroskadec: parse the channel layout mask for FLACAnton Khirnov2014-05-281-1/+1
| | | | | | | | It is commonly stored in a vorbiscomment block in codec private data.
* | Merge commit '5fdaf312c5541b77b6364db8b49d6abb416a25c0'Michael Niedermayer2014-05-281-1/+1
|\ \ | |/ | | | | | | | | | | * commit '5fdaf312c5541b77b6364db8b49d6abb416a25c0': flac: make avpriv_flac_parse_block_header() inline Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * flac: make avpriv_flac_parse_block_header() inlineAnton Khirnov2014-05-281-1/+1
| | | | | | | | | | | | This avoids all the ABI troubles associated with avpriv_. Since this function is very small and does not depend on any tables, making it inline should have no adverse effects.
* | Merge commit 'd6b9ce99ea384fb676561461768b8316725a4ccd'Michael Niedermayer2014-05-281-0/+15
|\ \ | |/ | | | | | | | | | | * commit 'd6b9ce99ea384fb676561461768b8316725a4ccd': flac demuxer: parse the WAVEFORMATEXTENSIBLE_CHANNEL_MASK tag Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * flac demuxer: parse the WAVEFORMATEXTENSIBLE_CHANNEL_MASK tagAnton Khirnov2014-05-281-0/+15
| | | | | | | | It is used to store the channel mask for non-standard layouts.
* | avformat/flacdec/flac_read_timestamp: free the correct packetMichael Niedermayer2014-04-161-2/+2
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avformat/flacdec/flac_read_timestamp: dont modify AVStream stateMichael Niedermayer2014-04-151-8/+12
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | flac demuxer: improve seekingRainer Hochecker2014-04-141-0/+45
| |
* | Merge commit '1d55f8d5f6f2cd74fa27170e2be37a72441d9202'Michael Niedermayer2014-04-041-0/+5
|\ \ | |/ | | | | | | | | | | * commit '1d55f8d5f6f2cd74fa27170e2be37a72441d9202': flacdec: export replaygain tags from Vorbis comments Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * flacdec: export replaygain tags from Vorbis commentsAlessandro Ghedini2014-04-041-0/+5
| | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* | Merge commit '601d6228c4811d8971a2412a759e1a4ab775ebe8'Michael Niedermayer2013-10-131-1/+1
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | * commit '601d6228c4811d8971a2412a759e1a4ab775ebe8': flac: move picture parsing code in a separate file Conflicts: libavformat/Makefile libavformat/flacdec.c See: 1e5bbbfcf303ec3db0c7db30b85855e2e5358aec Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * flac: move picture parsing code in a separate fileJames Almer2013-10-121-130/+2
| | | | | | | | | | Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* | lavf/flacdec: Share the function to parse cover art blocksJames Almer2013-07-091-128/+2
| | | | | | | | | | Signed-off-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>