summaryrefslogtreecommitdiff
path: root/libavformat/aadec.c
Commit message (Collapse)AuthorAgeFilesLines
* avformat/demux: Add new demux.h headerAndreas Rheinhardt2022-05-101-0/+1
| | | | | | And move those stuff already in demuxer-only files to it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* aa: convert to new channel layout APIAnton Khirnov2022-03-151-2/+2
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/aadec: Use smaller scope for variablesAndreas Rheinhardt2021-12-081-7/+6
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/aadec: Simplify data->hex conversionAndreas Rheinhardt2021-12-081-8/+5
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/aadec: Simplify deriving file keyAndreas Rheinhardt2021-12-081-15/+7
| | | | | | | | Don't use different src and dst in av_tea_crypt(); use in-place modifications instead. Also let av_tea_crypt() encrypt all three blocks in one call. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/aadec: Don't unnecessarily reinitialize AVTEA contextAndreas Rheinhardt2021-12-081-11/+4
| | | | | | | | We use ECB, not CBC mode here, so one does not need to reinitialize the context; for the same reason, one can also just let av_tea_crypt() loop over the blocks, avoiding a loop here. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/aadec: Avoid copying data aroundAndreas Rheinhardt2021-12-081-29/+13
| | | | | | | | | | | | | Up until now, the packets have been read in blocks of at most eight bytes at a time; then these blocks have been decrypted and copied into a buffer on the stack (that was double the size needed...). From there they have been copied to the dst packet. This commit changes this: The data is read in one go; and the decryption avoids temporary buffers, too, by making use of the fact that src and dst of av_tea_crypt() can coincide. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/aadec: Don't use the same loop counter in inner and outer loopAndreas Rheinhardt2021-12-081-2/+2
| | | | | | | Due to this bush.aa (from the FATE suite) exported garbage metadata with key "_040930". Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: Avoid allocation for AVStreamInternalAndreas Rheinhardt2021-09-171-3/+5
| | | | | | | | | | 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/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/aadec: Simplify cleanup after read_header failureAndreas Rheinhardt2021-07-071-6/+3
| | | | | | by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/utils: make ff_update_cur_dts() sharedJames Almer2021-06-091-2/+2
| | | | | | libavdevice needs it. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: move AVStream.{parser,need_parsing} to AVStreamInternalJames Almer2021-05-071-3/+3
| | | | | | | 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/aadec: Fix leak on errorAndreas Rheinhardt2021-03-261-2/+5
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat: Make AVChapter.id an int64_t on next major bumpAndreas Rheinhardt2021-03-191-1/+1
| | | | | | | | | 64 bits are needed in order to retain the uid values of Matroska chapters; the type is kept signed because the semantics of NUT chapters depend upon whether the id is > 0 or < 0. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/aadec: Replace strncpy by av_strlcpyAndreas Rheinhardt2021-03-051-1/+1
| | | | | | | | | | | While this usage of strncpy is correct, said function nevertheless has the disadvantage of not automatically ensuring that the destination string is zero-terminated. So av_strlcpy should be preferred. This also removes a -Wstringop-truncation warning from GCC (it doesn't matter whether the buffer is truncated, as long as it can fit all the names of the supported codecs). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/aadec: Use smaller scope for variables, remove initializationsAndreas Rheinhardt2021-03-051-4/+5
| | | | | | avio_get_str always zero terminates the strings it reads. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/aadec: Check for EOF while reading chaptersMichael Niedermayer2021-03-011-1/+2
| | | | | | | | Fixes: timeout Fixes: 28199/clusterfuzz-testcase-minimized-ffmpeg_dem_AA_fuzzer-4896162657861632 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/aadec: Check toc_size to contain the minimum to demuxer usesMichael Niedermayer2020-05-211-1/+1
| | | | | | | | Fixes: out of array access Fixes: stack-buffer-overflow-READ-0x0831fff1 Found-by: GalyCannon <galycannon@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/aadec: Check for scanf() failureMichael Niedermayer2019-04-241-1/+6
| | | | | | | | Fixes: use of uninitialized variables Fixes: blank.aa Found-by: Chamal De Silva <chamal.desilva@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf: Constify the probe function argument.Carl Eugen Hoyos2019-03-211-1/+1
| | | | | Reviewed-by: Lauri Kasanen Reviewed-by: Tomas Härdin
* aadec: improve seeking in mp3 contentKarsten Otto2018-07-141-3/+16
| | | | | | | | | | | | MP3 frames may not be aligned to aa chunk boundaries. When seeking, calculate the expected frame offset in the target chunk. Adjust the timestamp and truncate the next packet accordingly. This solution works for the majority of tested audio material. For some rare encodings with mp3 padding or embedded id3 tags, it will mispredict the correct offset, and at worst skip an extra frame. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* aadec: add chapters and seekingKarsten Otto2018-07-091-4/+81
| | | | | | | | | | | | | | | read_packet reads content in chunks. Thus seek must be clamped to valid chunk positions in the file, which in turn are relative to chapter start positions. So in read_header, scan for chapter headers once by skipping through the content. Set stream time_base based on bitrate in bytes/s, for easy timestamp to position conversion. Then in read_seek, find the chapter containing the seek position, calculate the nearest chunk position, and reinit the read_seek state accordingly. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* aadec: improve eof detectionKarsten Otto2018-07-081-2/+13
| | | | | | | | | Remember the end position of audio content in the file and check it during read_packet. There always seems to be other data beyond it, which could be misinterpreted as more audio. Also add some extra avio_read error checks, to bail early in case of a broken/truncated file. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Fix all -Wformat warnings raised by DJGPPClément Bœsch2017-03-291-1/+2
|
* avformat/aadec: use avio_get_str()Paul B Mahol2017-01-161-10/+2
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avformat/aadec: stop ignoring file metadataPaul B Mahol2017-01-161-4/+5
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec: add SIPR parserPaul B Mahol2017-01-161-0/+2
| | | | | | Fixes #2056. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* Merge commit '9200514ad8717c63f82101dc394f4378854325bf'Derek Buitenhuis2016-04-101-11/+11
| | | | | | | | | | | | | | | | * 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>
* avformat/aa: initialize "header_seed" and "header_key"Vesselin Bontchev2015-09-101-2/+2
| | | | | | Fixes CID 1322364, CID 1322363 Signed-off-by: Vesselin Bontchev <vesselin.bontchev@yandex.com>
* avformat/aa: use correct format specifier in sscanfVesselin Bontchev2015-08-251-2/+13
| | | | | | This demuxer was broken on a large number of platforms due to usage of wrong format specifier in sscanf. This patch fixes the problem, and also adds some debug logging to reduce future debugging pain.
* Add support for Audible AA filesVesselin Bontchev2015-08-211-0/+303
https://en.wikipedia.org/wiki/Audible.com#Quality