summaryrefslogtreecommitdiff
path: root/libavformat
Commit message (Collapse)AuthorAge
* avformat/mov: add AVFMT_SHOW_IDS flagGyan Doshi2021-08-22
| | | | | | The MOV muxer can store streamids as track ids but they aren't visible when probing the result via lavf/dump or ffprobe due to lack of this flag in the demuxer.
* lavf/concatdec: support per-file optionsNicolas George2021-08-22
|
* libavformat/concatdec: remove support for unsafe=-1Nicolas George2021-08-22
| | | | | It only makes sense as the default value, but it is not the default since 689211d5727231c3fe92762d224dbadebdbf4e30.
* avformat/hlsenc: minus subtitle streams count when subtitle stream between ↵Steven Liu2021-08-19
| | | | | | | | | | | | | | | | | | video and audio streams because subtitles streams will be written to webvtt m3u8 list so the stream index should minus subtitles streams count when subtitle between audio and video streams. testcase: before patch: ffmpeg -i input -map 0:a:0 -map 0:s:0 -map 0:v:0 -f hls aaaa.m3u8 will EXC_BAD_ACCESS after patch: ffmpeg -i input -map 0:a:0 -map 0:s:0 -map 0:v:0 -f hls aaaa.m3u8 will ok Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
* avformat/hlsenc: set http options before use delete http methodSteven Liu2021-08-19
| | | | | | | Fix ticket: 9338 Set options which set by user from parent options. Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
* movenc: Get rid of frag_startHu Weiwen2021-08-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "frag_start" is redundant, and every occurance can be replaced with cluster[0].dts - start_dts The proof of no behaviour changes: (All line number below is based on commit bff7d662d728) "frag_start" is read at 4 place (with all possible call stacks): mov_write_packet ... mov_flush_fragment mov_write_moof_tag mov_write_moof_tag_internal mov_write_traf_tag mov_write_tfxd_tag (#1) mov_write_tfdt_tag (#2) mov_add_tfra_entries (#3) mov_write_sidx_tags mov_write_sidx_tag (#4) mov_write_trailer mov_auto_flush_fragment mov_flush_fragment ... (#1 #2 #3 #4) mov_write_sidx_tags mov_write_sidx_tag (#4) shift_data compute_sidx_size get_sidx_size mov_write_sidx_tags mov_write_sidx_tag (#4) All read happens in "mov_write_trailer" and "mov_write_moof_tag". So we need to prove no behaviour change in these two functions. Condition 1: for every track that have "trk->entry == 0", trk->frag_start == trk->track_duration. Condition 2: for every track that have "trk->entry > 0", trk->frag_start == trk->cluster[0].dts - trk->start_dts. Definition 1: "Before flush" means just before the invocation of "mov_flush_fragment", except for the auto-flush case in "mov_write_single_packet", which means before L5934. Lemma 1: If Condition 1 & 2 is true before flush, Condition 1 & 2 is still true after "mov_flush_fragment" returns. Proof: No update to the tracks that have "trk->entry == 0" before flushing, so we only consider tracks that have "trk->entry > 0": Case 1: !moov_written and moov will be written in this iteration trk->entry = 0 L5366 trk->frag_start == trk->cluster[0].dts - trk->start_dts Lemma condition trk->frag_start += trk->start_dts + trk->track_duration - trk->cluster[0].dts; L5363 So trk->entry == 0 && trk->frag_start == trk->track_duration Case 2: !moov_written and moov will NOT be written in this iteration nothing changed Case 3: moov_written trk->entry = 0 L5445 trk->frag_start == trk->cluster[0].dts - trk->start_dts Lemma condition trk->frag_start += trk->start_dts + trk->track_duration - trk->cluster[0].dts; L5444 So trk->entry == 0 && trk->frag_start == trk->track_duration Note that trk->track_duration may be updated for the tracks that have "trk->entry > 0" (mov_write_moov_tag will update track_duration of "tmcd" track, but it must have 1 entry). But in all case, trk->frag_start is also updated to consider the new value. Lemma 2: If Condition 1 & 2 is true before "ff_mov_write_packet" invocation, Condition 1 & 2 is still true after it returns. Proof: Only the track corresponding to the pkt is updated, and no update to relevant variables if trk->entry > 0 before invocation. So we only need to prove "trk->frag_start == trk->cluster[0].dts - trk->start_dts" after trk->entry increase from 0 to 1. Case 1: trk->start_dts == AV_NOPTS_VALUE Case 1.1: trk->frag_discont && use_editlist trk->cluster[0].dts = pkt->dts at L5741 trk->frag_start = pkt->pts at L5785 trk->start_dts = pkt->dts - pkt->pts at L5786 So trk->frag_start == trk->cluster[0].dts - trk->start_dts Case 1.2: trk->frag_discont && !use_editlist trk->cluster[0].dts = pkt->dts at L5741 trk->frag_start = pkt->dts at L5790 trk->start_dts = 0 at L5791 So trk->frag_start == trk->cluster[0].dts - trk->start_dts Case 1.3: !trk->frag_discont trk->cluster[0].dts = pkt->dts at L5741 trk->frag_start = 0 init trk->start_dts = pkt->dts at L5779 So trk->frag_start == trk->cluster[0].dts - trk->start_dts Case 2: trk->start_dts != AV_NOPTS_VALUE Case 2.1: trk->frag_discont trk->cluster[0].dts = pkt->dts at L5741 trk->frag_start = pkt->dts - trk->start_dts at L5763 So trk->frag_start == trk->cluster[0].dts - trk->start_dts Case 2.2: !trk->frag_discont trk->cluster[0].dts = trk->start_dts + trk->track_duration at L5749 trk->track_duration == trk->frag_start Lemma condition So trk->frag_start == trk->cluster[0].dts - trk->start_dts Lemma 3: Condition 1 & 2 is true in all case before and after "ff_mov_write_packet" invocation, before flush and after "mov_flush_fragment" returns. Proof: All updates to relevant variable happen either in "ff_mov_write_packet", or during flush. And Condition 1 & 2 is true initially. So with lemma 1 & 2, we can prove this use induction. Noticed that all read of "frag_start" only happen in "trk->entry > 0" branch. Now we need to prove Condition 2 is true before each read. Because no update to variables relevant to Condition 2 between "before flush" and "mov_write_moof_tag" invocation, we can conclude Condition 2 is true before every invocation of "mov_write_moof_tag". No behaviour change in "mov_write_moof_tag" is proved. In "mov_write_trailer", No update to relevant variables after the last flush and before the invocation of "mov_write_sidx_tag". So no behaviour change to "mov_write_trailer" is proved. Q.E.D. Signed-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn> Signed-off-by: Martin Storsjö <martin@martin.st>
* movenc: Ensure no separate moof written for empty trackHu Weiwen2021-08-18
| | | | | | | | track->mdat_buf can be not NULL while the track is still empty if the last packet write failed. Signed-off-by: Hu Weiwen <sehuww@mail.scut.edu.cn> Signed-off-by: Martin Storsjö <martin@martin.st>
* avformat/isom_tags: prefer in24 for 24bit PCM in MOVJan Ekström2021-08-14
| | | | | | | | | | | | | In 1c42fd93236e7869ef4d9fe3650dd3e951387321 the ipcm identifier was added in order to demux additional raw audio from Sony MP4 files. Unfortunately, it was not noticed that this same list is utilized for muxing as well, thus causing ipcm to get preferred compared to the identifier officially specified in QTFF documentation. This fixes the order of preference for 24bit PCM, where ipcm is still allowed, but in24 is the first match - thus being preferred. Fixes fate-acodec-pcm-s24be.
* libavformat/isom_tags.c: add ipcm to list of tagsStephen Hutchinson2021-08-14
| | | | Fixes http://trac.ffmpeg.org/ticket/9219
* avformat/mxfdec: store parition score instead of partition pointer in metadataMarton Balint2021-08-14
| | | | | | | | | Partition struct may be reallocated, so let's store the score directly in order to avoid use-after-free. Also mxf->current_partition might be null when reading some local tags. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/oggdec: Use av_realloc_array()Andreas Rheinhardt2021-08-12
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* libavformat/file.c: 'file_delete()' and 'file_move()' require ↵Michael Witten2021-08-12
| | | | | | | | 'CONFIG_FILE_PROTOCOL' This quashes 2 warnings when the 'file' protocol is not enabled. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* movenc: Don't try to fix the fragment end duration if none will be writtenMartin Storsjö2021-08-10
| | | | | | | | | If autoflushing on a new packet (e.g. due to the frag_every_frame flag being set), there's no samples to be written in the new fragment, so we can't overwrite the track duration in order to make it line up with the next packet to be written. Signed-off-by: Martin Storsjö <martin@martin.st>
* avformat/paf: read frame rate from header @0x88Gregory Montoir2021-08-10
| | | | Signed-off-by: Gregory Montoir <cyx@users.sourceforge.net>
* avformat/mxfdec: make MXFMetadataSet part of all metadata setsMarton Balint2021-08-08
| | | | | | | The code expects every kind of metadata set to start with the generic metadata set attributes. Signed-off-by: Marton Balint <cus@passwd.hu>
* libavformat/mov: Change log line from debug to traceSoft Works2021-08-07
| | | | | | It's creating too much noise, even for debug Signed-off-by: softworkz <softworkz@hotmail.com>
* avformat/mxfenc: add a return at the end of non-void functionsJames Almer2021-08-06
| | | | | | Fixes compilation with GCC 11 when configured with --disable-optimizations Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/fifo: Free dict on av_dict_copy() failureAndreas Rheinhardt2021-08-06
| | | | | | | | av_dict_copy() puts the onus on the caller to clean up dst on failure; it can be nonempty if copying a later entry of src fails after having successfully copied an earlier entry. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/ilbc: Use av_get_packetAndreas Rheinhardt2021-08-06
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: Use ffio_read_size where appropriateAndreas Rheinhardt2021-08-06
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/yuv4mpegenc: Write data generically via AVPixFmtDescriptorAndreas Rheinhardt2021-08-06
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/adtsenc: return value check for init_get_bits in adts_decode_extradatamaryam ebrahimzadeh2021-08-06
| | | | | | | | As the second argument for init_get_bits (buf) can be crafted, a return value check for this function call is necessary. 'buf' is part of 'AVPacket pkt'. replace init_get_bits with init_get_bits8. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/wtvdec: Check for EOF before seeking back in parse_media_type()Michael Niedermayer2021-08-06
| | | | | | | | | Fixes: Infinite loop Fixes: 36311/clusterfuzz-testcase-minimized-ffmpeg_dem_WTV_fuzzer-4889181296918528 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mpc8: Check first keyframe position for overflowMichael Niedermayer2021-08-06
| | | | | | | | Fixes: signed integer overflow: 9223372036854775791 + 18 cannot be represented in type 'long' Fixes: 36307/clusterfuzz-testcase-minimized-ffmpeg_dem_MPC8_fuzzer-4917863877050368 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: prefer footer and complete partitions for metadataMarton Balint2021-08-01
| | | | | | Also do not store inferior metadata with the same UID. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/wavdec: Use 64bit in new_pos computationMichael Niedermayer2021-07-31
| | | | | | | | Fixes: signed integer overflow: 129 * 16711680 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-6742285317439488 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/sbgdec: Check for overflow in timestamp preparationMichael Niedermayer2021-07-31
| | | | | | | | Fixes: signed integer overflow: 9223372036854775807 + 86400000000 cannot be represented in type 'long' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-6731040263634944 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/dsicin: Check packet size for overflowMichael Niedermayer2021-07-31
| | | | | | | | Fixes: signed integer overflow: 24672 + 2147483424 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_DSICIN_fuzzer-6731325979623424 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/dsfdec: Change order of operations in bitrate computationMichael Niedermayer2021-07-31
| | | | | | | | Fixes: signed integer overflow: 538976288 * 67372036 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_DSF_fuzzer-6751696819716096 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/bfi: check nframesMichael Niedermayer2021-07-31
| | | | | | | | Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_BFI_fuzzer-6737028768202752 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/avidec: fix position overflow in avi_load_index()Michael Niedermayer2021-07-31
| | | | | | | | Fixes: signed integer overflow: 9223372033098784808 + 4294967072 cannot be represented in type 'long' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_AVI_fuzzer-6732488912273408 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/asfdec_f: Check sizeX against paddingMichael Niedermayer2021-07-31
| | | | | | | | Fixes: signed integer overflow: 2147483607 + 64 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_fuzzer-6753897878257664 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/aiffdec: Check for size overflow in header parsingMichael Niedermayer2021-07-31
| | | | | | | | Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int' Fixes: 29102/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-6723467048255488 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 frame wrapping detection for J2K essence containerPierre-Anthony Lemieux2021-07-29
| | | | | | | | | | | | | | | | | | | For JPEG 2000 essence, the MXF input format module currently uses the value of byte 14 of the essence container UL to determine whether the J2K essence is clip- (byte 14 is 0x02) or frame-wrapped (byte 14 is 0x01). Otherwise it assumes an unknown wrapping. Additional wrappings are documented in SMPTE ST422:2019: 0x03: Interlaced Frame, 1 field/KLV 0x04: Interlaced Frame, 2 fields/KLV 0x05: Field-wrapped Picture Element 0x06: Frame-wrapped Picture Element And these should also be handled as frame wrapped content. Signed-off-by: Pierre-Anthony Lemieux <pal@sandflow.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/internal: Move ff_read_line_to_bprint_overwrite to avio_internal.hAndreas Rheinhardt2021-07-29
| | | | | | | | | | | | | 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/aviobuf: Make ff_read_line_to_bprint() staticAndreas Rheinhardt2021-07-29
| | | | | | It is only used in ff_read_line_to_bprint_overwrite(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mov: Remove pointless EOF checksAndreas Rheinhardt2021-07-28
| | | | | | | | | | | 9888ffb1ce5e0a17f711b01933d504c72ea29d3b added checks for EOF in loops in the mov demuxer as a precaution against timeouts; yet there is no I/O in the loop when parsing the STSZ atom as the values are read from an already read buffer. So remove said checks. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mov: Fix crash with too big STSZ atomsAndreas Rheinhardt2021-07-28
| | | | | | | | | | | | | | mov_read_stsz() did not ensure that every bit of a buffer is addressable by an int as is required by the get_bits API, leading to a crash in ticket #9344. Fix this by restricting the size more thoroughly. The file from said ticket will then be considered invalid; in the future, we might read and process the data in chunks to actually support such files. Fixes ticket #9344. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mov: Fix incorrect overflow detection in mov_read_sidx()Michael Niedermayer2021-07-28
| | | | | | | | Fixes: signed integer overflow: 9223372036854775807 + 1442840321 cannot be represented in type 'long' Fixes: 33670/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6644379491106816 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/concat: check the terminating character returned by av_get_token()James Almer2021-07-27
| | | | | | | | | Don't attempt to increase the cursor pointer if it was \0. Fixes invalid reads. Reviewed-by: Marton Balint <cus@passwd.hu> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/yuv4mpegenc: add support for yuva444pPaul B Mahol2021-07-25
|
* avformat/yuv4mpegdec: Use table instead of repeated "else if"Andreas Rheinhardt2021-07-23
| | | | | | | | The code savings more than offset the size of the table (1936B vs 768B with GCC 10.3 at -O3). Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mov: Avoid undefined overflow in time_offset calculationMichael Niedermayer2021-07-22
| | | | | | | | Fixes: signed integer overflow: 8511838621821575200 - -3954125146725285889 cannot be represented in type 'long' Fixes: 33414/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6610119325515776 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Remove/replace some unnecessary avcodec.h inclusionsAndreas Rheinhardt2021-07-22
| | | | | | | Also remove other unnecessary headers and include headers directly while at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Remove unnecessary avassert.h inclusionsAndreas Rheinhardt2021-07-22
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Remove unnecessary mem.h inclusionsAndreas Rheinhardt2021-07-22
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Remove obsolete version.h inclusionsAndreas Rheinhardt2021-07-22
| | | | | | | These have mostly been added because of FF_API_*; yet when these were removed, removing the header has been forgotten. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Stop including channel_layout.h in avcodec.hAndreas Rheinhardt2021-07-22
| | | | | | Also include channel_layout.h directly wherever used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/avcodec: Stop including bsf.h in avcodec.hAndreas Rheinhardt2021-07-22
| | | | | | Also include bsf.h directly wherever it is used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/gifdec: log loop countGyan Doshi2021-07-20
|