summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
* libavformat/dvdvideo: add DVD-Video demuxer, powered by libdvdread and libdvdnavMarth642024-03-02
| | | | | Signed-off-by: Marth64 <marth64@proxyid.net> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avformat/avio: Make avio_print_string_array() accept const pointersAndreas Rheinhardt2024-03-02
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mov: Update bits_per_coded_sample after read pcmCZhao Zhili2024-03-01
| | | | Fix #10878
* avformat/iamf: remove duplicated functionJames Almer2024-02-29
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: Don't use entry[-1] in pointer arithmeticAndreas Rheinhardt2024-02-27
| | | | | | | | | | | | | It is undefined behaviour. Fixes many failed tests with UBSan and GCC 13 like "src/libavformat/mov.c:4229:44: runtime error: store to address 0x5572abe20f80 with insufficient space for an object of type 'struct MOVIndexRange'" (The line number does not refer to the line where &entry[-1] is assigned.) Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Revert "avformat/mov: zero initialize the index ranges buffer"Andreas Rheinhardt2024-02-27
| | | | | | | | | | | | This reverts commit eee3b7e2fb0664b889e58c03f76e19ef23e4d1d8. It has been made in an attempt to fix UBSan test failures with GCC 13 (see e.g. [1]), but it did not help at all. So revert it, but use av_malloc_array() instead of going back to av_malloc(). [1]: https://fate.ffmpeg.org/report.cgi?slot=x86_64-archlinux-gcc-ubsan&time=20240226182430 Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mov: add support for tile HEIF still imagesJames Almer2024-02-26
| | | | | | | | | | | | Export each tile as its own stream, and the grid information as a Stream Group of type TILE_GRID. This also enables exporting other stream items like thumbnails, which may be present in non tiled HEIF images too. For those, the primary stream will be tagged with the default disposition. Based on a patch by Swaraj Hota Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: add a Tile Grid stream group typeJames Almer2024-02-26
| | | | | | This will be used to support tiled image formats like HEIF. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/libsrt: use SRT_EPOLL_IN for waiting for an incoming connectionMarton Balint2024-02-25
| | | | | | | | | This is the proper poll mode for waiting for an incoming connection according to the SRT API docs. Fixes ticket #9142. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/libsrt: Remove manually free AV_OPT_TYPE_STRINGZhao Zhili2024-02-22
| | | | Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* Avoid OOM for invalid STCO / CO64 constructions.Dale Curtis2024-02-21
| | | | | | | | | | | The `entries` value is read directly from the stream and used to allocate memory. This change clamps `entries` to however many are possible in the remaining atom or file size (whichever is smallest). Fixes https://crbug.com/1429357 Signed-off-by: Dale Curtis <dalecurtis@chromium.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/movenc: Make check actually check what is intendedAndreas Rheinhardt2024-02-20
| | | | | | | | | Also fixes a Clang warning: "overlapping comparisons always evaluate to false [-Wtautological-overlap-compare]" Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* flvdec: Honor the "flv_metadata" option for the "datastream" metadata fieldMartin Storsjö2024-02-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By default the option "flv_metadata" (internally using the field name "trust_metadata") is set to 0, meaning that we don't allocate streams based on information in the metadata, only based on actual streams we encounter. However the "datastream" metadata field still would allocate a subtitle stream. When muxing, the "datastream" field is added if either a data stream or subtitle stream is present - but the same metadata field is used to preemtively create a subtitle stream only. Thus, if the field was added due to a data stream, not a subtitle stream, the demuxer would create a stream which won't get any actual packets. If there was such an extra, empty subtitle stream, running avformat_find_stream_info still used to terminate within reasonable time before 3749eede66c3774799766b1f246afae8a6ffc9bb. After that commit, it no longer would terminate until it reaches the max analyze duration, which is 90 seconds for flv streams (see e6a084641aada7a2e4672172f2ee26642800a361, 24fdf7334d2bb9aab0abdbc878b8ae51eb57c86b and f58e011a1f30332ba824c155078ca701e29aef63). Before that commit (which removed the deprecated AVStream.codec), the "st->codecpar->codec_id = AV_CODEC_ID_TEXT", set within the demuxer, would get propagated into st->codec->codec_id by numerous avcodec_parameters_to_context(st->codec, st->codecpar), then further into st->internal->avctx->codec_id by update_stream_avctx within read_frame_internal in libavformat/utils.c (demux.c these days). Signed-off-by: Martin Storsjö <martin@martin.st>
* avformat/movenc: add support for Immersive Audio Model and Formats in ISOBMFFJames Almer2024-02-20
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: add support for Immersive Audio Model and Formats in ISOBMFFJames Almer2024-02-20
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: make MOVStreamContext refcountedJames Almer2024-02-20
| | | | | | This will be useful in the next commit. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: factorize out setting the output packet propertiesJames Almer2024-02-20
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/demux: allow demuxers to output more than one packet per ↵James Almer2024-02-20
| | | | | | read_packet() call Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/iamfdec: set disposition flags to output streamsJames Almer2024-02-19
| | | | | | | if there's an audio layer with a single stream that can be rendered alone, mark it as default. Otherwise, mark every stream as dependent. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/iamfenc: further split into shareable modulesJames Almer2024-02-19
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/iamfdec: further split into shareable modulesJames Almer2024-02-19
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mxfdec: do not use AnyType when resolving Descriptors and ↵Marton Balint2024-02-20
| | | | | | | | | | | | | | | | | | MultipleDescriptors By using AnyType for resolving a strong reference we searched among all types, not just the ones which can be the target of the reference, which in some cases caused to find the wrong type, if the metadata set UUIDs were not unique. UUIDs do not have to be unique if their type sets them apart, SMPTE 377M says: > StrongRef: 'One to One’ relationship between sets and implemented in MXF > with UUIDs. Strong References are typed which means that the definition > identifies the kind of set which is the target of the reference. Fixes ticket #10865. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mxfdec: move resolving Descriptors to the multi descriptor resolve ↵Marton Balint2024-02-20
| | | | | | | | function Also remove unused descriptor member from MXFPackage. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/iamf_writer: Fix leaks on errorAndreas Rheinhardt2024-02-19
| | | | | | | Fixes Coverity issues #1559544 and #1559547. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/iamf_writer: Return proper error codesAndreas Rheinhardt2024-02-19
| | | | | | | | | | | | | Surprisingly the return value of add_param_definition() (a pointer) has only been used to check for success and not to actually access the pointee; nonsuccess was equated with ENOMEM, although there is a non-enomem error path in this function. Change this by returning an int. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/iamf: Don't mix ownership and non-ownership pointersAndreas Rheinhardt2024-02-19
| | | | | | | | | | | | | | | | | | | | | | | | | IAMFAudioElement and IAMFMixPresentation currently contain pointers to independently allocated objects that are sometimes owned by said structures and sometimes not. More precisely, upon success the demuxer transfers ownership of these other objects newly created AVStreamGroups, but it keeps its pointers. iamf_read_close() therefore always resets these pointers (because the cleanup code always treats them as ownership pointers). This leads to memory leaks in case iamf_read_header() without having attached all of these objects to stream groups. The muxer has a similar issue: It also clears these pointers (pointing to objects owned by stream groups created by the user) in its deinit function. This commit fixes this memleak by explicitly adding non-ownership pointers; this also allows to remove the code to reset the ownership pointers. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/iamf_writer: Don't memset twiceAndreas Rheinhardt2024-02-19
| | | | | | | This has been allocated via av_calloc() a few lines above. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/iamf_writer: Remove nonsense checkAndreas Rheinhardt2024-02-19
| | | | | | | | | | | | | Checking whether a pointer to an element of an array is NULL makes no sense, as the pointer addition involved in getting the address would be undefined behaviour already if the array were NULL. In this case the array allocation has already been checked a few lines before. Fixes Coverity issue #1559548. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/iamf_writer: Don't leak on error when adding ParamDefinitionAndreas Rheinhardt2024-02-19
| | | | | | | | Fix this by postponing the allocation. Fixes Coverity issue #1559545. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mpegts: remove decoding param from ts_packetsize optionJames Almer2024-02-19
| | | | | | | It's a read only exported option, and not meant to be set by the user. Also, move it to MPEGTS_OPTIONS while at it to avoid duplication. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mpegts: add a ts_id exported optionJames Almer2024-02-19
| | | | | | It will replace AVFormatContext.ts_id in the coming bump. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov_chan: rework ff_mov_read_chnlMarton Balint2024-02-18
| | | | | | | | | | | A lot of changes and fixes to channel layout parsing, notably - get rid of dynamic allocation of channel positions - signal unimplemented speaker positions as unknown instead of failure, but warn the user about it - native order, and that a single channel only appears once was always assumed for less than 64 channels, obviously this was incorrect Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mov: factorize reading the main part of the chnl atom to mov_chanMarton Balint2024-02-18
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/libsrt: Fix srt:// URL query string parsingIngo Oppermann2024-02-15
| | | | | | | | Add missing NULL check and use ff_urldecode for string query parameters. Signed-off-by: Ingo Oppermann <ingo@datarhei.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* all: use designated initializers for AVOption.unitAnton Khirnov2024-02-14
| | | | | | | | | | | | | | | | | | | | | | | | Makes it robust against adding fields before it, which will be useful in following commits. Majority of the patch generated by the following Coccinelle script: @@ typedef AVOption; identifier arr_name; initializer list il; initializer list[8] il1; expression tail; @@ AVOption arr_name[] = { il, { il1, - tail + .unit = tail }, ... }; with some manual changes, as the script: * has trouble with options defined inside macros * sometimes does not handle options under an #else branch * sometimes swallows whitespace
* avformat/avformat: Remove reference to removed setterAndreas Rheinhardt2024-02-14
| | | | | | Removed in 704017d91ec8fbade0de072d222018c1a6013b70. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroska: Add support for A_ATRAC/AT1asivery2024-02-13
| | | | | Signed-off-by: asivery <asivery@protonmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/dump: Fix use of undeclared variablesAndreas Rheinhardt2024-02-13
| | | | | | | Broken in ec2036454bcdc6c12382961d4ab539c2f9b70ec8. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: add a disposition field to AVStreamGroupJames Almer2024-02-13
| | | | | | | | | | The existing (and upcoming) available group types are meant to combine several streams for presentation, with the result being treated as if it was a stream itself. For example, a file could export two stream groups of the same type with one of them as the "default". Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov_chan: add support for reading custom channel layouts when ↵Marton Balint2024-02-12
| | | | | | layout_tag == 0 Signed-off-by: Marton Balint <cus@passwd.hu>
* lavf/assenc: normalize line endings to \nrcombs2024-02-11
| | | | | | | | | | | | Previously, we produced output with either \r\n or mixed line endings. This was undesirable unto itself, but also made working with patches affecting FATE output particularly challenging, especially via the mailing list. Everything that consumes the SSA/ASS format is line-ending-agnostic, so \n is selected to simplify git/ML usage in FATE. Extra \r characters at the end of a packet are dropped. These are always ignored by the renderer anyway.
* lavf/avio_internal: add ffio_write_lines for line ending normalizationrcombs2024-02-11
|
* avformat/mov_chan: never override number of channels based on chan atomMarton Balint2024-02-09
| | | | | | | | | | | The channel designation metadata should not override the number of channels. Let's warn the user if it is inconsistent, and keep the channel layout unspecified. Before the conversion to the channel layout API the code only set the mask, but never overridden the channel count, so this restores the old behaviour. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mov_chan: do not assume channels are in native orderMarton Balint2024-02-09
| | | | | | | | | | Existing code could have caused wrong channel order signalling or reduced channel count if a channel designation appeared multiple times. This is actually an old bug, but the conversion to the new channel layout API made it visible, because now the code overrides the proper channel count with the one calculated from the mask. Signed-off-by: Marton Balint <cus@passwd.hu>
* lavf/demux: stop calling avcodec_close()Anton Khirnov2024-02-09
| | | | | | Replace it with recreating the codec context. This is the last remaining blocker for deprecating avcodec_close().
* lavf/flacdec: stop accessing FFStream.avctxAnton Khirnov2024-02-09
| | | | | | | The demuxer opens an internal parser instance in read_timestamp(), which requires a codec context. There is no need for it to access the FFStream one which is used for other purposes, it can allocate its own internal one.
* lavf/mpegts: drop a cargo-culted checkAnton Khirnov2024-02-09
| | | | | | This check has survived the transition to AVCodecParameters, but is no longer relevant after it, since the codec context is no longer updated or accessed at all from the demuxer.
* avformat/rcwtenc: Pass RCWTContext directly in rcwt_init_cluster()Andreas Rheinhardt2024-02-09
| | | | | | | It does not use the AVFormatContext at all. Reviewed-by: Marth64 <marth64@proxyid.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/rcwtenc: Remove redundant zeroing of bufferAndreas Rheinhardt2024-02-09
| | | | | | | | Resetting the counter of used elements is enough as nothing is ever read from the currently unused elements. Reviewed-by: Marth64 <marth64@proxyid.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/rcwtenc: Fix potential out-of-bounds writeAndreas Rheinhardt2024-02-09
| | | | | | | | | | | | | | | | | | The rcwt muxer uses several counters for how much data it has already cached: One byte counter and one counter for how many complete blocks (of three bytes each). These counters can become inconsistent when the muxer is fed incomplete blocks as the muxer presumes that it is about to write a new block at the start of each write_packet call. E.g. sending 65535*3+1 1-byte packets (with data[0] e.g. 0x03) will trigger an out-of-bounds write. This patch fixes this by processing the data in complete blocks only. This also allows to simplify the code, e.g. to remove one of the counters. Reviewed-by: Marth64 <marth64@proxyid.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>