summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
...
* avformat/mpegts: detect synchronous metadata KLV more reliablyMarton Balint2024-03-04
| | | | | | | | | | | | | | | | The mpegts code historically tries to strip (the first) metadata access unit header from synchronous KLV metadata, but the detection for such streams was unreliable causing strips of asynchronous metadata or ID3 as well. MISB ST 1402 specifies required stream type, stream id and registration descriptor (which eventually maps to the codec ID) so let's use all of these for reliable detection. Fixes a regression caused by 468615f2045da325e0f73e8e668d49cf456ccb37. Fixes ticket #10828, #10883. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/dvdvideodec: Reorder allocations to simplify freeingAndreas Rheinhardt2024-03-03
| | | | | Reviewed-by: Marth64 <marth64@proxyid.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/dvdvideodec: Only free allocated buffersAndreas Rheinhardt2024-03-03
| | | | | Reviewed-by: Marth64 <marth64@proxyid.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/dvdvideodec: Don't store AVInputFormat*Andreas Rheinhardt2024-03-03
| | | | | | | | | | | The inner AVInputFormat* of the inner mpegps-demuxer is only used once (in avformat_open_input()), so don't even store it. In fact, just use ff_mpegps_demuxer directly, as this demuxer has a configure dependency on it. Reviewed-by: Marth64 <marth64@proxyid.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/dvdvideodec: Explicitly return 0 on successAndreas Rheinhardt2024-03-03
| | | | | | | Don't "return ret" even when ret is zero on success. Reviewed-by: Marth64 <marth64@proxyid.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/iamf_writer: constify some function parametersJames Almer2024-03-02
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/wavdec: dynamically set max_size by defaultMarton Balint2024-03-02
| | | | | | | | | | | | | The wav demuxer by default tried to demux 4096-byte packets which caused packets with very few number of samples for files with high channel count. This caused a significant overhead especially since the latest ffmpeg.c threading changes. So let's use a similar approach for selecting audio frame size which is already used in the PCM demuxer, which is to read 25 times per second but at most 1024 samples. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mxfdec: track metadata sets by their typeMarton Balint2024-03-02
| | | | | | | | | We typically are only interesed in a single type of metadata set, so it is better to keep them separated instead of always filtering for them. Also use av_dynarray_add for increasing their array. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mxfdec: remove resolve_strong_ref usage with AnyTypeMarton Balint2024-03-02
| | | | | | | UUIDs do not have to be unique if their type sets them apart, so avoid using AnyType, since we are only interested in specific types. Signed-off-by: Marton Balint <cus@passwd.hu>
* 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.