aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
Commit message (Collapse)AuthorAgeFilesLines
...
* avformat/smoothstreamingenc: check return value of avcodec_parameters_copy()Marth642024-11-201-1/+3
| | | | | | | Written in the dominant style of the surrounding code block. Reviewed-by: ePirat <epirat07@gmail.com> Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/mpegts: add support for ATSC E-AC-3 streamsScott Theisen2024-11-211-0/+1
| | | | | | | ATSC A/52:2018 Digital Audio Compression (AC-3, E-AC-3), Annex G defines stream_type 0x87 for E-AC-3 bit streams. Signed-off-by: Marton Balint <cus@passwd.hu>
* libaformat/mp3dec: Register the MIME type "audio/mpeg" to the mp3 decoder.Richard Mitic2024-11-201-0/+1
| | | | | | | Some mp3 files look surprisingly like mpeg PS streams. In order for us to hint to ffmpeg that the file really is mp3, we can deliver it with a mime type. The mp3 probe therefore needs to have a mime type registered, (which is previously did not).
* avformat/dvdvideodec: don't allow seeking beyond dvdnav reported durationMarth642024-11-161-1/+1
| | | | | | | There is no reason to accept timestamp values beyond what dvdnav reported as the duration of the title. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/dvdvideodec: discard duplicate or partial AC3 samplesMarth642024-11-161-1/+35
| | | | | | | | | | | | | | | Some DVD muxers signal segments to start with duplicate audio samples when starting extraction from a chapter marker or terminate seamless PGs on partial audio samples (causing corrupt AC3 frames). Clean up after these muxers by tracking frames with duplicate PTS and eliminating partial AC3 frames. This results in smoother chapter extraction and overall seeking experience, with linear PTS and AC3 delay within 32ms (1 frame) away from the video. The issue was not apparent until the flushing pattern was replaced with a full subdemux reset, as the flushing dropped the frames prematurely, along side others, as such they were never present to begin with.
* avformat/dvdvideodec: drop packets with unset PTS or DTSMarth642024-11-161-17/+12
| | | | | | | | | The packets effectively serve no purpose and we are already dropping packets with PTS less than 0. This also creates for a smoother seeking experience after the subdemuxer reset fix. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/dvdvideodec: remove unnecessary need_parsing argumentMarth642024-11-161-13/+9
| | | | | | The value is always AVSTREAM_PARSE_HEADERS. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/dvdvideodec: open subdemuxer after initializing IFO headersMarth642024-11-161-10/+8
| | | | | | | It is wasteful to open the subdemuxer if an error occurs while initializing streams or reading IFO headers. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/dvdvideodec: remove auto value for menu_lu optionMarth642024-11-161-8/+1
| | | | | | | | The "auto" mode serves no functional purpose except for logging a message and setting the value to 1. The documentation clearly explains what the option is for. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/dvdvideodec: default menu_vts option to 1 and clarify descriptionMarth642024-11-161-1/+1
| | | | | | | Menu 0 is the VIDEO_TS root menu, which does not appear to be used commonly for menu segments. Instead, default to the menu of VTS 1. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/dvdvideodec: check the length of a NAV packet when reading titlesMarth642024-11-161-0/+7
| | | | | | | | Some discs present titles with bogus NAV packets. We apply this check for menus and for title MPEG blocks, but we should also apply it for NAV packets during title demuxing. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/dvdvideodec: reset the subdemuxer on discontinuity instead of flushingMarth642024-11-161-64/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DVDs naturally consist of segmented MPEG-PS blobs within a VOB (i.e. VOBs are not linear). NAV packs set the segment boundaries. When switching between segments, discontinuities occur and thus the subdemuxer needs to be reset. The current approach to manage this is by invoking ff_read_frame_flush() on the subdemuxer context, via a callback function which is invoked during the menu or dvdnav block functions. The same subdemuxer context is used throughout the demux, with a stretched PTS wrap bits value (64) + disabled overflow correction, and then flushed on each segment. Eventually, a play_end context variable is set to declare EOF. However, this approach causes frame drops. The block read flushes the demuxer before the frame read is complete, causing frames to drop on discontinuity. The play_end signal likewise ends playback before the frame read is complete, causing frames to drop at end of the title. To compound the issue, the PTS wrap bits value of 64 is wrong; the VOBU limit is actually 32 and the overflow correction should work. Instead, EOF the MPEG-PS subdemuxer organically when each VOB segment ends, and re-open it if needed with the offset after the full frame read is complete. In doing so, correct the PTS wrap behavior to 32 bits and remove the play_end/segment_started signals and callback pattern. Note that the timestamps as reported by the NAV packets are known as "PTMs", so the fields storing the time prior to adjustment are renamed accordingly. This makes it more clear when we are offsetting the NAV packet reported timestamps versus what we present as a demuxer. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/dvdvideodec: simplify dvdvideo_read_packet()Marth642024-11-161-23/+21
| | | | | | | | | The function has a few branches where it discards frames via FFERROR_REDO; consolidate is via a goto block to simplify the function and improve readability. Logging still maintains all the relevant details for the reason of the discard. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/dvdvideodec: enable chapter calculation for menusMarth642024-11-161-18/+35
| | | | | | | Menus are generally segmented by cell, so use them as the marker delimiters. Requires preindex option to be enabled. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/dvdvideodec: standardize the NAV packet event signalMarth642024-11-161-14/+17
| | | | | | | | | This consolidates the FFERROR_REDO handling of NAV packets to dvdvideo_subdemux_read_data(), is a pre-requisite to calculating chapter markers for menus, and a pre-requisite to fixing the frame desync issue when the subdemuxer is flushed. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/dvdvideodec: move memcpy below missed NAV packet warningMarth642024-11-161-2/+2
| | | | | | | | Readability improvement; the warning can be bundled beneath the preceding validations rather than awkwardly between the memcpy and return. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/dvdvideodec: remove "auto" value for -pg option, default to 1Marth642024-11-161-22/+9
| | | | | | | | | | | | | | The default "auto" mode is effectively useless; the reasonable default use case is to use the first PG (segment) of the selected PGC for both menus and standard titles. Just default the value to 1, since the option is irrelevant unless -pgc is also set. Note that this should not break users using this advanced option. The "auto" mode errored and asked for a PG number regardless for non-menus, and for menus the mode simply defaulted to 1. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/dvdvideodec: measure duration of the current menu VOBU in stateMarth642024-11-161-0/+1
| | | | | | | This will be a pre-requisite to calculating chapter markers for menus. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/dvdvideodec: fix menu PGC number off-by-one in stateMarth642024-11-161-1/+1
| | | | Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/dvdvideodec: remove unused headersMarth642024-11-161-2/+0
| | | | Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/movenc: Fix ffv1 supportMichael Niedermayer2024-11-161-0/+1
| | | | | | Fixes: Ticket9975 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/sapdec: check return value of avcodec_parameters_copy()Marth642024-11-151-1/+3
| | | | | | Written in the dominant style of the surrounding code block. Signed-off-by: Marth64 <marth64@proxyid.net>
* avformat/iamf: use the new Binaural channel layoutJames Almer2024-11-134-5/+9
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: check that items are allocated before accessing themJames Almer2024-11-121-6/+9
| | | | | | | | | | | Fixes NULL pointer dereferences introduced in 2e338152a274a5f10670cee3cd16097076216d72 Fixes: clusterfuzz-testcase-fuzzer_loadfile-4753810267897856 Fixes: clusterfuzz-testcase-minimized-fuzzer_loadfile-6042587212873728 Fixes: clusterfuzz-testcase-minimized-fuzzer_loadfile-6536211629408256 Reported-by: kasper93 Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/vividas: Check avio_read() for failureMichael Niedermayer2024-11-111-1/+2
| | | | | | | | | Fixes: use of uninitialized value (untested) Fixes: 42537627/clusterfuzz-testcase-minimized-fuzzer_loadfile_direct-5505802505355264 Found-by: ossfuzz Reported-by: Kacper Michajlow Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/ilbc: Check avio_read() for failureMichael Niedermayer2024-11-111-1/+2
| | | | | | | | | Fixes: use of uninitialized value Fixes: 42537627/clusterfuzz-testcase-minimized-fuzzer_protocol_memory-6656646223298560-cut Found-by: ossfuzz Reported-by: Kacper Michajlow Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/nistspheredec: Clear bufferMichael Niedermayer2024-11-111-1/+1
| | | | | | | | | Fixes: use-of-uninitialized-value Fixes: 42537627/clusterfuzz-testcase-minimized-fuzzer_protocol_memory-6515855798632448-cut Found-by: ossfuzz Reported-by: Kacper Michajlow Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mccdec: Initialize and check rate.denMichael Niedermayer2024-11-111-2/+2
| | | | | | | | | | Fixes: Assertion c > 0 failed at libavutil/mathematics.c:61 Fixes: use-of-uninitialized-value Fixes: 42537627/clusterfuzz-testcase-minimized-fuzzer_protocol_memory-5939605805793280 Found-by: ossfuzz Reported-by: Kacper Michajlow Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/rpl: check channelsMichael Niedermayer2024-11-111-0/+2
| | | | | | | | | Fixes: 42537199/clusterfuzz-testcase-minimized-fuzzer_loadfile_direct-5447162658357248 Fixes: runtime error: signed integer overflow: -3330498059201358222 * 4 cannot be represented in type 'int64_t' (aka 'long') Found-by: ossfuzz Reported-by: Kacper Michajlow Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: reindent after previous commitJames Almer2024-11-101-11/+11
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: use an array of pointers for heif_itemJames Almer2024-11-102-29/+50
| | | | | | | | | | Pointers to specific entries in the array are stored in other structs, so in the scenario where heif_item was reallocated when parsing an iloc box after and iinf one, the pointers may end up referencing freed memory. Fixes use-after-free with such samples. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/hls: improve commentvectronic2024-11-101-1/+1
| | | | Signed-off-by: vectronic <hello.vectronic@gmail.com>
* avformat/mov: if pos has been reset, clear fragments and indexes and search ↵vectronic2024-11-101-3/+36
| | | | | | | | for next root fixes https://trac.ffmpeg.org/ticket/7359 Signed-off-by: vectronic <hello.vectronic@gmail.com>
* lavf/mxfenc: Use nb_components, not av_pix_fmt_count_planes()Tomas Härdin2024-11-081-7/+17
| | | | | | Also check that pix_desc != NULL, thanks James Almer This fixes https://trac.ffmpeg.org/ticket/11267
* avcodec/rv60: RealVideo 6.0 decoderPeter Ross2024-11-032-0/+2
| | | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: Peter Ross <pross@xvid.org>
* avformat/rmdec: support RMHD file formatPeter Ross2024-11-031-13/+30
| | | | Signed-off-by: Peter Ross <pross@xvid.org>
* avformat/riff: map Y416 fourcc to RAWVIDEO decoderJames Almer2024-10-261-0/+1
| | | | | | As defined in https://learn.microsoft.com/en-us/windows/win32/medfound/10-bit-and-16-bit-yuv-video-formats#422-formats Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/riff: map Y210 and Y216 fourcc to RAWVIDEO decoderJames Almer2024-10-251-0/+2
| | | | | | As defined in https://learn.microsoft.com/en-us/windows/win32/medfound/10-bit-and-16-bit-yuv-video-formats#422-formats Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mpegts: Initialize predefined_SLConfigDescriptor_seenMichael Niedermayer2024-10-251-0/+2
| | | | | | | | Fixes: use of uninitialized variable Fixes: 368729566/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGTS_fuzzer-6044501804646400 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mxfdec: Fix overflow in midpoint computationMichael Niedermayer2024-10-251-1/+1
| | | | | | | | Fixes: signed integer overflow: 4611686016549392399 + 9223372033098784800 cannot be represented in type 'long long' Fixes: 368503277/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5928227458056192 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf/mxfdec: Set a scan direction explicitlyTomas Härdin2024-10-211-8/+10
| | | | This prevents a theoretical case where seeks to a gap in an index can cause an infinite loop
* avformat/movenc: explicitly support V30XLE and not the host native endian ↵James Almer2024-10-171-1/+1
| | | | | | | | version Should fix fate-vsynth*-v410 on BE targets. Signed-off-by: James Almer <jamrial@gmail.com>
* lavf/flvdec: replace a private option with a field in FFFormatContextAnton Khirnov2024-10-163-18/+18
| | | | | | | | | | | The demuxer's 'missing_streams' private option is used to communicate information from the demuxer to avformat_find_stream_info(). However, that is not only unnecessarily complicated, it also leaks internal information to users, e.g. this option appears in the results of the fate-flv-demux test. Use a new field in FFFormatContext to communicate this information instead.
* lavf: replace FFFormatContext.prefer_codec_framerate with FF_INFMT_FLAGAnton Khirnov2024-10-164-8/+9
| | | | | There is no reason for this to be a dynamic property, as the only demuxer using this sets it unconditionally.
* lavf: deprecate av_format_inject_global_side_data()Anton Khirnov2024-10-162-0/+10
| | | | | | | | This function would otherwise fail to build on the next major bump, as inject_global_side_data is marked for removal. It should also never be needed, as there is now a mechanism for supplying global side data to decoders directly.
* lavf: move demuxing-specific fields from FFFormatContext to ↵Anton Khirnov2024-10-165-68/+85
| | | | FormatContextInternal
* lavf: move muxing-specific fields from FFFormatContext to FormatContextInternalAnton Khirnov2024-10-165-68/+78
|
* lavf: add new struct for data private to generic layerAnton Khirnov2024-10-162-2/+15
| | | | | | Trivial for now, will become more useful in future commits, as many fields from FFFormatContext should not be visible to individual (de)muxers.
* lavf: add a header for generic-layer interfacesAnton Khirnov2024-10-169-61/+99
| | | | Analogous to what was previously done in avcodec and avfilter.
* lavf/internal: remove a prototype for non-existent functionAnton Khirnov2024-10-161-9/+0
| | | | | ff_stream_side_data_copy() has been gone since 5432d2aacad5fa7420fe2d9369ed061d521e92d6