aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mpegts.c
Commit message (Collapse)AuthorAgeFilesLines
* avformat/mpegts: update stream info when PMT ES stream_type changesPavel Koshevoy2025-05-181-1/+3
| | | | | | | | | I have several .ts captures where video and audio codec changes even though the PMT version does not change and the PIDs stay the same. This happens during transition to/from slate (mpeg2 video and audio) to network broadcast (hevc video and eac3 audio in private PES). I've updated fate ts-demux expected results.
* avformat/mpegenc, mpegts. mxfenc: Mark (de)muxers declarations as internalAndreas Rheinhardt2025-03-051-1/+2
| | | | | | | Otherwise compilers might emit code that presumes there to be a GOT which can't be fixed by the linker. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Revert "avformat/mpegts: Add standard extension so hls can check in ↵Michael Niedermayer2025-01-261-1/+0
| | | | | | | | extension_picky mode" The next commit implements the hls fix in a way that doesnt need this This reverts commit 54897da7ce8ae6e349cd56d0f11cb2404e264efa.
* avformat/mpegts: Add standard extension so hls can check in extension_picky modeMichael Niedermayer2025-01-211-0/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpegts: correctly skip TP_extra_header in m2tsllyyr2024-12-081-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | instead of just resyncing and skipping a bunch of TS packets, leading to a loss of frames. Before this, a stray byte with the value of 0x47 in TP_extra_header would throw off the detection of where TS packets start. A typical file that could cause issues would look like this: 00000300: 238f 4780 4750 1110 0000 01e0 0000 84c0 ^^ ^^ The first four bytes here are TP_extra_header and the actual TS packet starts at offset 0x304 FFmpeg would try to read a packet at 0x300 but since nothing skips the 4 byte TP_extra_header, find that the first byte is not 0x47 and immediately go into mpegts_resync, and incorrectly detect the stray 0x47 in the TP_extra_header at 0x302 as the new sync byte. Fix this by correctly skipping the first 4 bytes if the source packet is 192 bytes. Signed-off-by: llyyr <llyyr.public@gmail.com> Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
* avformat/mpegts: is_pes_stream() use switch caseScott Theisen2024-12-031-2/+12
| | | | | | | also add STREAM_TYPE_PRIVATE_SECTION since a private_section() is not a PES_packet(). Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegts*: reduce use of magic numbersScott Theisen2024-12-031-75/+75
| | | | | | | | | | | | Note ISO/IEC 13818-1 defines an Extension_descriptor with descriptor_tag value 0x3f (63), so I kept the DVB comment. I don't know what defines stream_type value 0x8a as DTS. I don't have any Blu-ray standards so I don't know where those stream_type values are defined. Signed-off-by: Marton Balint <cus@passwd.hu>
* 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>
* 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>
* lavf: replace FFFormatContext.prefer_codec_framerate with FF_INFMT_FLAGAnton Khirnov2024-10-161-2/+2
| | | | | There is no reason for this to be a dynamic property, as the only demuxer using this sets it unconditionally.
* lavc/opus*: move to opus/ subdirAnton Khirnov2024-09-021-1/+1
|
* avformat/mpegts: implement dv_md_compressionNiklas Haas2024-07-281-2/+6
|
* avformat/mpegts: Don't use uninitialized value in av_log()Andreas Rheinhardt2024-05-251-1/+1
| | | | | | | It is undefined behaviour in (at least) C11 (see C11 6.3.2.1 (2)). Fixes Coverity issue #1500314. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mpegts: Reset local nb_prg on add_program() failureMichael Niedermayer2024-04-011-1/+2
| | | | | | | | | | | add_program() will deallocate the whole array on failure so we must clear nb_prgs Fixes: null pointer dereference Fixes: crash-35a3b39ddcc5babeeb005b7399a3a1217c8781bc Found-by: Catena cyber Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-311-3/+1
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/avformat: remove AVFormatContext.ts_idJames Almer2024-03-071-1/+1
| | | | | | It's been replaced by a demuxer exported private option. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/avformat: Add FFInputFormat, hide internals of AVInputFormatAndreas Rheinhardt2024-03-071-12/+12
| | | | | | | | | | | | | | | | | | | | | This commit does for AVInputFormat what commit 59c9dc82f450638a3068deeb1db5c56f6d155752 did for AVOutputFormat: It adds a new type FFInputFormat, moves all the internals of AVInputFormat to it and adds a now reduced AVInputFormat as first member. This does not affect/improve extensibility of both public or private fields for demuxers (it is still a mess due to lavd). This is possible since 50f34172e0cca2cabc5836308ec66dbf93f5f2a3 (which removed the last usage of an internal field of AVInputFormat in fftools). (Hint: tools/probetest.c accesses the internals of FFInputFormat as well, but given that it is a testing tool this is not considered a problem.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mpegts: detect synchronous metadata KLV more reliablyMarton Balint2024-03-041-2/+5
| | | | | | | | | | | | | | | | 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/mpegts: remove decoding param from ts_packetsize optionJames Almer2024-02-191-6/+3
| | | | | | | 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-191-2/+9
| | | | | | It will replace AVFormatContext.ts_id in the coming bump. Signed-off-by: James Almer <jamrial@gmail.com>
* lavf/mpegts: drop a cargo-culted checkAnton Khirnov2024-02-091-5/+0
| | | | | | 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/mpegts: add ts stream types for H266/VVCThomas Siedel2024-01-311-0/+2
| | | | | | | | | | | | | | Add transport stream stream type 0x33 for vvc. Add STREAM_TYPE_VIDEO_VVC to MPEG-1/2 and MPEG-2 transport stream. Add basic transport stream support for TS mux/demux. Tested with: ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v libvvenc test.ts && ffmpeg -i test.ts -f null - ffmpeg -i NovosobornayaSquare_1920x1080.mp4 -c:v copy test.ts && ffmpeg -i test.ts -f md5 - Signed-off-by: Marton Balint <cus@passwd.hu> Signed-off-by: Thomas Siedel <thomas.ff@spin-digital.com> Co-Authored-By: Nuo Mi <nuomi2021@gmail.com>
* Revert "all: Don't set AVClass.item_name to its default value"Anton Khirnov2024-01-201-0/+2
| | | | | | | Some callers assume that item_name is always set, so this may be considered an API break. This reverts commit 0c6203c97a99f69dbaa6e4011d48c331e1111f5e.
* all: Don't set AVClass.item_name to its default valueAndreas Rheinhardt2023-12-221-2/+0
| | | | | | | | Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9; also avoids relocations. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/avformat: use the side data from AVStream.codecparJames Almer2023-10-061-5/+5
| | | | | | | | | | | | Deprecate AVStream.side_data and its helpers in favor of the AVStream's codecpar.coded_side_data. This will considerably simplify the propagation of global side data to decoders and from encoders. Instead of having to do it inside packets, it will be available during init(). Global and frame specific side data will therefore be distinct. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/aviobuf: Add ffio_init_(read|write)_context()Andreas Rheinhardt2023-09-071-11/+7
| | | | | | | | | | | | | | Most users of ffio_init_context() simply want to wrap a buffer into an AVIOContext; they do not provide function pointers at all. Therefore this commit adds shortcuts for these two common operations. This also allows to accept const data when reading (i.e. the const is now cast away at a central place in ffio_init_read_context() instead of at several callers). This also allows to constify the data in ff_text_init_buf(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/defs: Add AV_PROFILE_* defines, deprecate FF_PROFILE_* definesAndreas Rheinhardt2023-09-071-4/+5
| | | | | | | | | These defines are also used in other contexts than just AVCodecContext ones, e.g. in libavformat. Furthermore, given that these defines are public, the AV-prefix is the right one, so deprecate (and not just move) the FF-macros. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* libavformat/mpegts.c: fix hardcoded 5-bytes skip for metadata streams.Romain Beauxis2023-06-201-1/+1
| | | | | | | | | | | | | | | | | | | Before the introduction of AV_CODEC_ID_TIMED_ID3 for timed_id3 metadata streams in mpegts (commit 4a4437c0fbc8f7afe0c533070395a42e56b4ee75), AV_CODEC_ID_SMPTE_KLV was the only existing codec for metadata. It seems that this codec has a 5-bytes metadata header[1] that, for some reason, was always skipped when decoding data packets. However, when working with a AV_CODEC_ID_TIMED_ID3 streams, this results in the 5 first bytes of the payload being cut-off, which includes essential informations such as the ID3 tag version. This patch fixes the issue by keeping the 5-bytes skip only for AV_CODEC_ID_SMPTE_KLV streams. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mpegts: add AC-4Aman Karmani2023-06-201-0/+1
|
* lavf/mpegts.c: set some properties for ARIB captionTADANO Tokumei2023-03-281-1/+5
| | | | | | | | | | | Some additional properties are set for ARIB caption. * need_parsing = 0 ARIB caption doesn't require any parser. This avoids "parser not found" warning message. * need_context_update = 1 When any profiles are changed, set this flag to notify. Signed-off-by: rcombs <rcombs@rcombs.me>
* avformat/mpegts: add support for preserving SMPTE 2038 when transcoding ↵Devin Heitmueller2023-03-261-0/+1
| | | | | | | | | | | | | | | | | MPEG-TS streams Add the appropriate descriptors to the MPEG-TS demux and mux to ensure that SMPTE 2038 VANC streams are properly preserved when using codec copy (including adding the appropriate PMT descriptors). The focus of this patch is TS input to TS output. A separate patch adds support for output of 2038 VANC over decklink SDI. Thanks to Marton Balint for feedback to preserve ABI compatibility. Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* 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>
* avformat/mpegts: remove obsolate hacks for detecting streams with bad PMTsMarton Balint2022-06-201-10/+2
| | | | | | | | | Ffmpeg/ffprobe/ffplay sets scan_all_pmts to 1 when finding the streams, that should be enough to handle files for which some early PMTs miss some streams. Fixes ticket #9782. Signed-off-by: Marton Balint <cus@passwd.hu>
* 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>
* avformat/mpegts.c: ignore a section with next flagTADANO Tokumei2022-04-091-0/+8
| | | | | | | | | | | 'current_next_indicator' of 0 (next) on each section header indicates the service information is for immediate future one. ffmpeg doesn't need to parse it but current (1) one. ref: section 5.1.1 of DVB BlueBook A038 (EN 300 468) Signed-off-by: TADANO Tokumei <aimingoff@pc.nifty.jp> Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegts.c: fix to check end of each descriptor of SDTTADANO Tokumei2022-04-091-3/+3
| | | | | | | | Current code incorrectly check against end of section rather than end of descriptor. Signed-off-by: TADANO Tokumei <aimingoff@pc.nifty.jp> Signed-off-by: Marton Balint <cus@passwd.hu>
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-161-0/+2
| | | | | | | | This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. Signed-off-by: Martin Storsjö <martin@martin.st>
* avformat/mpegts: initialize max_packet_size when sub-demuxerGyan Doshi2022-02-101-0/+1
| | | | | | | | | | | bca30570d2 added a user option to set max_packet_size replacing a hardcoded value. This had a side-effect of leaving the field set to 0 when packet demuxing is carried out from another demuxer using avpriv functions, which could lead to demux failure. Hardcoded max_packet_size inside avpriv_mpegts_parse_open to 2048000 to avoid this. Value chosen to be 10x that of default value to accommodate large payloads.
* avformat/mpegts: add option max_packet_sizeGyan Doshi2022-01-161-5/+6
| | | | | | Makes maximum size of emitted packet user-tunable. Default is existing 204800 bytes.
* all: Use av_memdup() where appropriateAndreas Rheinhardt2021-12-031-2/+1
| | | | | Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mpegts: fix stream index in verbose log messageMarton Balint2021-11-251-3/+2
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegts: Fix for the DOVI video stream descriptorLimin Wang2021-10-281-2/+9
| | | | | | By <<Dolby Vision Streams Within the MPEG-2 Transport Stream Format v1.2>> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/mpegts: add support for stream_type 0xd4, which is AVS3Limin Wang2021-10-201-0/+1
| | | | | | | | GB/T 17975.1 Information technology-Generic coding of moving pictures and associated audio information-Part 1:Systems Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* libavformat/hls: add support for decryption of HLS media segments encrypted ↵Nachiket Tarate2021-10-131-0/+11
| | | | | | | | | | | using SAMPLE-AES encryption method Apple HTTP Live Streaming Sample Encryption: https://developer.apple.com/library/ios/documentation/AudioVideo/Conceptual/HLS_Sample_Encryption Signed-off-by: Nachiket Tarate <nachiket.programmer@gmail.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
* avformat/mpegts: fix max_packet_size in mpegts payload parsingMarton Balint2021-10-101-2/+2
| | | | | | | | | | | | | | | | | The maximum allowed useful PES payload data was set to PES_packet_length, but it is in fact smaller by the length of the PES header. This changes how corrupt streams are packetized: - If PES header length is bigger than PES_packet_length then the PES packet payload will be handled as an unbound packet - PES packets with payload across multiple MPEGTS packets will always be splitted if with the next chunk of data the payload should exceed PES_packet_length, previously a PES_header_length amount of excess was allowed. Fixes ticket #9355. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegts: rename PES total_size to PES_packet_lengthMarton Balint2021-10-101-18/+18
| | | | | | | | | This renames PESContext->total_size to PESContext->PES_packet_length and keeps it 0 for unbound packets, so its name and semantics will match the standard. There should be no change in functionality. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegts: delay allocation of PES bufferMarton Balint2021-10-101-10/+10
| | | | | | This allows us to allocate the buffer in a single code path. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegts: use named constants for stream_id typesMarton Balint2021-10-101-9/+10
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mpegts: use actually read packet size in mpegts_resync special caseMichael Niedermayer2021-10-071-2/+2
| | | | | | | | | Fixes: infinite loop Fixes: 37986/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGTSRAW_fuzzer-5292311517462528 - Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpegts: fixes overflow when parsing the PMTNicolas Jorge Dato2021-09-181-2/+3
| | | | | | | | | | When a possible overflow was detected, there was a break to exit the while loop. However, it should have already substracted 2 bytes from program_info_length (descriptor ID + length). Fixes ticket #9422. Signed-off-by: Marton Balint <cus@passwd.hu>