aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
Commit message (Collapse)AuthorAgeFilesLines
* avformat/avio: Schedule AVIODirContext to become an opaque typeAndreas Rheinhardt2022-10-034-1/+12
| | | | | | | Users can't make anything with its content. Making it opaque might allow us to avoid one level of indirection. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mpeg4audio: Move ff_copy_pce_data() to a header of its ownAndreas Rheinhardt2022-10-022-0/+2
| | | | | | | | | It is only used by three of the thirty files that (potentially indirectly) include mpeg4audio.h. Twenty of these files won't have a put_bits.h inclusion any more after this patch. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: add Media 100i decoderPaul B Mahol2022-09-301-0/+7
|
* format/imfdec: improve error handling when selecting tracks for playbackPierre-Anthony Lemieux2022-09-281-3/+12
| | | | Reviewed-by: Zane van Iperen <zane@zanevaniperen.com>
* avformat/internal: Don't include avcodec.hAndreas Rheinhardt2022-09-2619-9/+23
| | | | | | | | | | | | | | | 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/matroska*: Use av_chroma_location_(pos_to_enum|enum_to_pos)Andreas Rheinhardt2022-09-262-3/+5
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/nutdec: Don't shrink packet size manuallyAndreas Rheinhardt2022-09-251-1/+0
| | | | | | | | | It is unnecessary because an av_shrink_packet() a few lines below will set the size; furthermore, it is actually harmful, because av_shrink_packet() does nothing in case the size already matches, so that the packet's padding is not correctly zeroed. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/matroskadec: Error out if a timestamp is beyond durationMichael Niedermayer2022-09-241-1/+4
| | | | | | | | | | Maybe timestamp / duration validity should be checked earlier Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-6586894739177472 Fixes: signed integer overflow: 0 - -9223372036854775808 cannot be represented in type 'long' Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/spdifdec: Use 64bit to compute bit rateMichael Niedermayer2022-09-241-1/+1
| | | | | | | | Fixes: signed integer overflow: 32 * 553590816 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-6564974517944320 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/rpl: Use 64bit for duration computationMichael Niedermayer2022-09-241-1/+1
| | | | | | | | Fixes: signed integer overflow: 24709512 * 88 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6737973728641024 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/xwma: Use av_rescale() for duration computationMichael Niedermayer2022-09-241-1/+1
| | | | | | | | Fixes: signed integer overflow: 34242363648 * 538976288 cannot be represented in type 'long' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6577923913547776 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/sdsdec: Use av_rescale() to avoid intermediate overflow in duration ↵Michael Niedermayer2022-09-241-1/+1
| | | | | | | | | | calculation Fixes: signed integer overflow: 72128794995445727 * 240 cannot be represented in type 'long' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_SDS_fuzzer-6628185583779840 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 ts_int in genrate_intervalsMichael Niedermayer2022-09-241-0/+2
| | | | | | | | | | | There is probably a better place to check for this, but better here than nowhere Fixes: signed integer overflow: -9223372036824775808 - 86400000000 cannot be represented in type 'long' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-6601162580688896 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: clamp end_tsMichael Niedermayer2022-09-241-1/+1
| | | | | | | | Fixes: signed integer overflow: 9223372036851135042 + 15666854 cannot be represented in type 'long' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-6573717339111424 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/rmdec: check tag_sizeMichael Niedermayer2022-09-241-0/+2
| | | | | | | | Fixes: signed integer overflow: -2147483648 - 8 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_RM_fuzzer-6598073725353984 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/nutdec: Check fieldsMichael Niedermayer2022-09-241-0/+5
| | | | | | | | Fixes: signed integer overflow: -2147483648 - 1 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_NUT_fuzzer-6566001610719232 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/flvdec: Use 64bit for sum_flv_tag_sizeMichael Niedermayer2022-09-241-3/+3
| | | | | | | | Fixes: signed integer overflow: 2138820085 + 16130322 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_LIVE_FLV_fuzzer-6704728165187584 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/jacosubdec: Fix overflow in get_shift()Michael Niedermayer2022-09-241-1/+1
| | | | | | | | Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_JACOSUB_fuzzer-6722544461283328 Fixes: signed integer overflow: 48214448 * 60 cannot be represented in type 'int' Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/genh: Check nb_channels for IMA ADPCMMichael Niedermayer2022-09-241-0/+2
| | | | | | | | | | The check could be made more strict Fixes: signed integer overflow: 36 * 538976288 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_GENH_fuzzer-6539389873815552 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/dxa: avoid bpc overflowsMichael Niedermayer2022-09-241-2/+5
| | | | | | | | Fixes: signed integer overflow: 2147483647 + 32 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_DXA_fuzzer-6639823726706688 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/dhav: Use 64bit seek_backMichael Niedermayer2022-09-241-1/+1
| | | | | | | | Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_DHAV_fuzzer-6604736532447232 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/cafdec: Check that nb_frasmes fits within 64bitMichael Niedermayer2022-09-241-1/+1
| | | | | | | | Fixes: signed integer overflow: 1099511693312 * 538976288 cannot be represented in type 'long' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-6565048815845376 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_o: Limit packet offsetMichael Niedermayer2022-09-241-0/+2
| | | | | | | | | | | avoids overflows with it Fixes: signed integer overflow: 9223372036846866010 + 4294967047 cannot be represented in type 'long' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_O_fuzzer-6538296768987136 Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_ASF_O_fuzzer-657169555665715 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/apm: Use 64bit for bit_rate computationMichael Niedermayer2022-09-241-1/+1
| | | | | | | | Fixes: signed integer overflow: -1155522528 * 4 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_APM_fuzzer-6580670570299392 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/ape: Check frames sizeMichael Niedermayer2022-09-241-0/+2
| | | | | | | | Fixes: signed integer overflow: 9223372036854775806 + 3 cannot be represented in type 'long' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_APE_fuzzer-6389264140599296 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/cafenc: derive Opus frame size from the relevant stream parametersJames Almer2022-09-241-5/+14
| | | | | | | | | | | | Use the stream duration as last resort, as an off-by-one result of the "st->duration / (caf->packets - 1)" calculation can break playback on some devices. Also, don't write the sample_rate value propagated by encoders like libopus. The sample rate of the audio fed to it is irrelevant after being encoded. Fixes ticket #9930. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: add FTR audio decoder and parserPaul B Mahol2022-09-242-0/+4
|
* avformat: add APAC demuxerPaul B Mahol2022-09-234-2/+90
|
* avformat/movenc: Write auxi box for animated AVIF with alphaVignesh Venkatasubramanian2022-09-222-13/+16
| | | | | | | | | | | | | According to the HEIF specification (ISO/IEC 23008-12) Section 7.5.3.1, tracks with handler_type 'auxv' must contain a 'auxi' box in its SampleEntry to notify the nature of the auxiliary track to the decoder. The content is the same as the 'auxC' box. So parameterize and re-use the existing function. Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com> Signed-off-by: James Zern <jzern@google.com>
* avformat/icodec: Check nb_palMichael Niedermayer2022-09-221-0/+3
| | | | | | | | | Fixes: signed integer overflow: 538976288 * 4 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_ICO_fuzzer-6690068904935424 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/aiffdec: Use 64bit for block_duration useMichael Niedermayer2022-09-221-1/+1
| | | | | | | | | Fixes: signed integer overflow: 3 * -2147483648 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-6668935979728896 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/aiffdec: Check block_durationMichael Niedermayer2022-09-221-0/+2
| | | | | | | | | Fixes: signed integer overflow: 3 * -2147483648 cannot be represented in type 'int' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-6668935979728896 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mxfdec: Avoid some redundant writing to tables in ↵Michael Niedermayer2022-09-221-3/+3
| | | | | | | mxf_compute_ptses_fake_index() offsets suggested by Tomas Härdin Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mxfdec: only probe max run inMichael Niedermayer2022-09-221-1/+1
| | | | | Suggested-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mxfdec: Check run_in is within 65536Michael Niedermayer2022-09-221-1/+6
| | | | | | | | Fixes: signed integer overflow: 9223372036854775807 - -2146905566 cannot be represented in type 'long' Fixes: 50993/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-6570996594769920 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/dashdec: Reindent after the previous commitAndreas Rheinhardt2022-09-221-7/+7
| | | | | Reviewed-by: Steven Liu <lingjiujianke@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/dashdec: Fix crash on invalid input/ENOMEM, fix leakAndreas Rheinhardt2022-09-221-1/+6
| | | | | | | | | | | | | | | | | | | | | | In case a SupplementalProperty node exists in an adaptationset, it is searched for a "schemeIdUri" property via xmlGetProp(). Whatever xmlGetProp() returns is then compared via av_strcasecmp() to a string literal. xmlGetProp() can return NULL, namely in case no "schemeIdUri" exists and (given that this string is allocated) presumably also on allocation failure. No check for NULL is done, so this may crash. Furthermore, the string returned by xmlGetProp() needs to be freed with xmlFree(), but this is not done either. This commit fixes both of these issues; they existed since this code has been added in 10d008f0fd9e713e290f626300d66382ad786c49. This has been found while investigating ticket #9697. The continuous leaks might very well be the reason behind the observed slowdown. Reviewed-by: Steven Liu <lingjiujianke@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mov: get the correct fragment stsd_id when decrypting the sampleWang Yaqiang2022-09-212-3/+5
| | | | | | | | When determining whether a packet should be decrypted, should use the stsd_id of the fragment where the current packet is located. Reviewed-by: Zhao Zhili <zhilizhao@tencent.com> Signed-off-by: Wang Yaqiang <wangyaqiang03@kuaishou.com>
* libavformat/riffec: Zero-initialize channels in ff_get_wav_headerWill Cassella2022-09-201-1/+1
| | | | | | | | | | Clang's static analyzer complains that leaving the variable uninitialized could lead to a code path where the uninitialized value is written to at the end of this function. This patch simply zero-initializes that variable to avoid that. Signed-off-by: Will Cassella <cassew@google.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/spdifenc: Reorder struct members to make it smallerAndreas Rheinhardt2022-09-201-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mxf: set stream frame rates for ST 422 essence containersPierre-Anthony Lemieux2022-09-201-0/+25
| | | | | | | | The MXF demuxer does not currently set AVStream::avg_frame_rate and ::r_frame_rate when J2K essence is wrapped according to SMPTE ST 422. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/aptxdec: Don't set AV_PKT_FLAG_CORRUPT mistakenlyAndreas Rheinhardt2022-09-191-2/+8
| | | | | | | | | | Just because we try to put multiple units of block_align bytes (the atomic units for APTX and APTX HD) into one packet does not mean that packets with fewer units than the one we wanted are corrupt; only those packets that are not a multiple of block_align are. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/aptxdec: Don't set AVCodecParameters.frame_sizeAndreas Rheinhardt2022-09-191-2/+0
| | | | | | | This field was misunderstood: It gives the number of samples in a packet, not the number of bytes. Its usage was wrong for APTX HD. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/ape: fix overflow in total_blocksPaul B Mahol2022-09-161-2/+2
|
* avformat/ape: set packet durationPaul B Mahol2022-09-161-0/+1
|
* avformat/bonk: Don't set data_offset to what it would be set to anywayAndreas Rheinhardt2022-09-161-1/+0
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: add LAF demuxerPaul B Mahol2022-09-164-1/+274
|
* avcodec: add MI-SC4 audio decoderPaul B Mahol2022-09-161-0/+1
|
* avformat/dump: Avoid unnecessary implicit calculation of strlenAndreas Rheinhardt2022-09-141-3/+1
| | | | | | | | | | | | | | | | | | | | | | av_strlcpy() returns the length of the src string to enable the caller to check for truncation. It is currently used in the following way in dump_metadata(): Every metadata value is searched for \b, \n, \v, \f, \r and then the data up to the first of these characters found is copied to a small temporary buffer via av_strlcpy() (but of course not more than fits into said buffer) and then printed; all characters up to the character found earlier are then treated as consumed. But this is bad performance-wise if the while string is big and contains many of these characters, because av_strlcpy() will unnecessarily calculate the length of the whole remaining string. (dump_metadata() actually ignored the return value of av_strlcpy().) Fix this by not copying the data to a temporary buffer at all. Instead just use %.*s to bound the number of characters output. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: add bonk demuxerPaul B Mahol2022-09-124-2/+102
|