summaryrefslogtreecommitdiffstats
path: root/libavformat
Commit message (Collapse)AuthorAgeFilesLines
...
* avformat/rso: Deduplicate codec tags listAndreas Rheinhardt2021-02-234-2/+5
| | | | | | Also saves a relocation. Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/voc: Deduplicate codec tags listAndreas Rheinhardt2021-02-234-2/+5
| | | | | | Also saves a relocation. Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/caf: Deduplicate codec tags listAndreas Rheinhardt2021-02-234-2/+4
| | | | | | Also saves a relocation. Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/asfenc: Deduplicate codec tags listsAndreas Rheinhardt2021-02-231-6/+6
| | | | | | Also saves relocations. Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/au: Deduplicate codec_tag listsAndreas Rheinhardt2021-02-231-2/+4
| | | | | | Also saves a relocation. Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/isom: Remove outcommented functionAndreas Rheinhardt2021-02-231-39/+0
| | | | | | There is another ff_mov_read_chan in mov_chan.c. Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/isom: Split movaudio/movvideo tags off into a separate fileAndreas Rheinhardt2021-02-233-325/+352
| | | | | | | | | The NUT and avi demuxers only need ff_codec_movvideo_tags and so this removes a dependency on the rest of isom.c as well as on mpeg4audio.c (which isom depends on); it is similar for the Matroska demuxer and muxers, except that the mpeg4audio.c dependency can't be avoided. Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/Makefile: Remove outdated AIFF demuxer dependency on iso_mediaAndreas Rheinhardt2021-02-232-3/+1
| | | | | | | | | | | | | | | | This is a result of the mov channel parsing stuff being factored out of mov.c twice: Once in 91b782720fd0df5571775b6591bc41797d6ecf78 to isom.c and later in 3bab7cd12802dc5abf2c5cc6dec49e9e249ce204. Also remove the isom.h header; and while just at it, remove an unused mathematics.h inclusion. (isom.c actually depends upon mpeg4audio from libavcodec for avpriv_mpeg4audio_get_config2 and avpriv_mpa_freq_tab; yet there is no configure dependency for iso_media which leads to failure of shared builds.) Signed-off-by: Andreas Rheinhardt <[email protected]>
* avcodec: remove pointless lowres deprecation wrappersJames Almer2021-02-221-2/+0
| | | | | | | | Neither the feature, public fields, or AVOptions were ever truly deprecated, nor will have been removed if this FF_API_ define was left in place, so get rid of it as it's misleading. Signed-off-by: James Almer <[email protected]>
* avformat/mov: fix timecode with counter mode flag setMark Reid2021-02-221-11/+0
| | | | | | | | | | | | | | | | | | | | | The current behaviour ends up squaring the avg_frame_rate if the conter mode flag is set. This messes up the timecode calculation, and looks to me as a regression that seems to have been introduced 428b4aac. Upon further testing is seems that no special case is need for having the counter flag set. av_timecode_init appears to handles the timecode correctly, at least in the sample files I have. Here is a sample mov file with the counter flag set https://www.dropbox.com/s/5l4fucb9lhq523s/timecode_counter_mode.mov before the patch ffmpeg will report the timecode as: 00:37:11:97 and warns that the timecode framerate is 576000000/1002001 after patch: 14:50:55:02 Signed-off-by: Anton Khirnov <[email protected]>
* avformat/matroskaenc: Add support for FlagTextDescriptionsAndreas Rheinhardt2021-02-221-0/+2
| | | | | | | | This is the Matroska equivalent of D_WEBVTT_DESCRIPTIONS and is therefore only enabled for subtitles. Reviewed-by: Ridley Combs <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/matroskadec: Add support for FlagTextDescriptionsAndreas Rheinhardt2021-02-222-1/+7
| | | | | | | | This is the equivalent of the WebM "D_WEBVTT/DESCRIPTIONS" and is therefore only exported for subtitles. Reviewed-by: Ridley Combs <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/matroskaenc: Add support for FlagHearing/VisualImpairedAndreas Rheinhardt2021-02-221-0/+5
| | | | | Reviewed-by: Ridley Combs <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/matroskadec: Add support for FlagHearing/VisualImpairedAndreas Rheinhardt2021-02-222-1/+11
| | | | | | | | | | Given that our disposition flags provide no way to distinguish the cases of "track is unsuitable for hearing impaired users" and "it is unknown whether the track is suitable for hearing impaired users" we do not need to use a CountedElement for these flags. Reviewed-by: Ridley Combs <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/matroskaenc: Add support for FlagCommentaryAndreas Rheinhardt2021-02-221-0/+2
| | | | | Reviewed-by: Ridley Combs <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/matroskadec: Add support for FlagCommentaryAndreas Rheinhardt2021-02-222-1/+6
| | | | | | | | | | Hint: Matroska actually provides a way to distinguish the cases of "track is no commentary track" and "it is unknown whether the track is a commentary track", but our disposition flags do not. Therefore we need not use a CountedElement. Reviewed-by: Ridley Combs <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/matroskadec: Beautify setting default valuesAndreas Rheinhardt2021-02-221-7/+8
| | | | | Reviewed-by: Ridley Combs <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/matroskadec: Reindent after the previous commitAndreas Rheinhardt2021-02-221-9/+9
| | | | | Reviewed-by: Ridley Combs <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/matroskadec: Make reading zero-length elements spec-compliantAndreas Rheinhardt2021-02-221-17/+33
| | | | | | | | | | | | For a very long time, the payload of integer and float elements had to have a length > 0. Our parser treated such invalid elements as having a value zero. But now it has been defined what an EBML element with length zero means: It is a shorthand for the default value. This has also been defined for strings (both ASCII and UTF-8). This commit modifies our parser to support this. Reviewed-by: Ridley Combs <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/matroskadec: Don't use fake default value for ReferenceBlockAndreas Rheinhardt2021-02-221-3/+3
| | | | | | | | | This has been done in order to find out whether this element is present at all; but this can now be done in a cleaner way by using a CountedElement for it. Reviewed-by: Ridley Combs <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/matroskaenc: Don't write empty languageAndreas Rheinhardt2021-02-221-1/+1
| | | | | | | | According to the new EBML specifications, a string element of length zero would be read as the default value by a compliant parser. Reviewed-by: Ridley Combs <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/matroskadec: Check min_luminance more thoroughlyAndreas Rheinhardt2021-02-221-4/+7
| | | | | | | | | | | | | | | | | | | | In the absence of an explicitly coded minimal luminance, the current code inferred it to be -1, an invalid value. Yet it did not check the value lateron at all, so that if a valid maximum luminance is encountered, but no minimal luminance, an invalid minimal luminance of -1 is exported. If an minimal luminance element with a negative value is present, it is exported, too. This can be simply fixed by adding a check for the value of the element. Yet given that a minimal luminance of zero Cd/m² is legal and can be coded with a length of zero, we must not use a fake default value to find out whether the element is present or not. Therefore this patch uses an explicit counter for it. While just at it, also check for max_luminance > min_luminance. Reviewed-by: Ridley Combs <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/matroskadec: Allow to count the number of element occurencesAndreas Rheinhardt2021-02-221-146/+163
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Up until now, the generic EBML reader used by the Matroska demuxer did not have the capability to record whether an element was actually present or not; instead, in cases where it mattered one typically added an invalid default value and checked whether the value is valid (in which case it is guaranteed to be present). This worked pretty well so far, yet the EBML specifications have evolved: It is now legal to use zero-length elements for floats, ints, uints and strings (both ASCII and UTF-8); the value of these elements is the default value of the element (if it has one) or zero for scalar types and an empty string for strings. Furthermore, having a default value does no longer imply that the element may be presumed to be present (with its default value) if it is absent; this is only true if the element is mandatory, too. These rules are designed to allow size savings as follows: Consider the newly added FlagOriginal: It being zero means the track is not in its original language, it being one means it is. For backward compatibility reasons, neither of the two values may be inferred automatically in the absence of the element. But one can still save a byte when one wants to write the element with a value of zero, as one can write the integer with a length of zero: 0x55AE 80 instead of 0x55AE 81 00. In the former case, a parser has to infer the value of the element to be zero (which is the element's default value). When encountering an element with length zero, our parser always infers a value of zero (or an empty string); this is wrong for values with a different default value. It needs to infer the default value (or zero in its absence) and this precludes using an invalid default value for elements like FlagOriginal. Ergo one needs to be able to record whether an element is present or not by other means. This patch allows to use a simple counter for this. While just at it, some invalid and unnecessary default values have been removed (mastering metadata elements used default values of -1.0, despite these elements only being used if they are > 0). Reviewed-by: Ridley Combs <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/microdvddec: use 64bit for durationsMichael Niedermayer2021-02-211-2/+2
| | | | | | | | Fixes: signed integer overflow: 7 - -2147483647 cannot be represented in type 'int' Fixes: 28036/clusterfuzz-testcase-minimized-ffmpeg_dem_MICRODVD_fuzzer-5171698751766528 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <[email protected]>
* avformat: add Simbiosis IMX demuxerPaul B Mahol2021-02-204-1/+163
|
* avformat/mpegenc: Forward error codeAndreas Rheinhardt2021-02-191-3/+4
| | | | Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/mpegenc: Avoid adding invalid packet to queueAndreas Rheinhardt2021-02-191-12/+12
| | | | | | Do this by moving the check before the allocation. Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/mpegenc: Fix leak in case trailer is never writtenAndreas Rheinhardt2021-02-191-0/+5
| | | | Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/mpegenc: Ensure packet queue stays validAndreas Rheinhardt2021-02-191-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The MPEG-PS muxer uses a custom queue of custom packets. To keep track of it, it has a pointer (named predecode_packet) to the head of the queue and a pointer to where the next packet is to be added (it points to the next-pointer of the last element of the queue); furthermore, there is also a pointer that points into the queue (called premux_packet). The exact behaviour was as follows: If premux_packet was NULL when a packet is received, it is taken to mean that the old queue is empty and a new queue is started. premux_packet will point to the head of said queue and the next_packet-pointer points to its next pointer. If predecode_packet is NULL, it will also made to point to the newly allocated element. But if premux_packet is NULL and predecode_packet is not, then there will be two queues with head elements premux_packet and predecode_packet. Yet only elements reachable from predecode_packet are ever freed, so the premux_packet queue leaks. Worse yet, when the predecode_packet queue will be eventually exhausted, predecode_packet will be made to point into the other queue and when predecode_packet will be freed, the next pointer of the preceding element of the queue will still point to the element just freed. This element might very well be still reachable from premux_packet which leads to use-after-frees lateron. This happened in the tickets mentioned below. Fix this by never creating two queues in the first place by checking for predecode_packet to know whether the queue is empty. If premux_packet is NULL, then it is set to the newly allocated element of the queue. Fixes tickets #6887, #8188 and #8266. Signed-off-by: Andreas Rheinhardt <[email protected]>
* avcodec: add initial exr image encoderPaul B Mahol2021-02-181-1/+1
|
* avformat/ircamdec: use lrintf() for roundingPaul B Mahol2021-02-161-2/+2
|
* avformat/mxfenc: Discard audio until valid video has been receivedAndreas Rheinhardt2021-02-161-0/+7
| | | | | | | | | | | | | Normally, video packets are muxed before audio packets for mxf (there is a dedicated interleave function for this); furthermore the first (video) packet triggers writing the actual header. Yet when the first video packet fails the checks performed on it, it will be an audio packet that leads to writing the header and codec_ul (a value set based upon properties of the bitstream which necessitates actually inspecting packets) may be wrong. Therefore this commit discards audio packets until a valid video packet has been received. Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/mxfenc: Fix typoAndreas Rheinhardt2021-02-161-2/+2
| | | | | Reviewed-by: Paul B Mahol <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/mxfenc: Use user-specified version even when bitexactAndreas Rheinhardt2021-02-161-4/+3
| | | | | | Doing so is still bitexact. Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/mxfenc: Never set codec_ul UID to NULLAndreas Rheinhardt2021-02-161-11/+14
| | | | | | | | | | | | | | | | | mxf distinguishes codec profiles by different UIDs and therefore needs to check that the input is actually compatible with mxf (i.e. if there is a defined UID for it). If not, then sometimes the UID would be set to NULL and writing the (video) packet would fail. Yet the following audio packet would trigger writing the header (which has been postponed because the UID is not known at the start) and if the UID is NULL, this can lead to segfaults. This commit therefore stops setting the UID to NULL if the input is incompatible with mxf (it has initially been set to a generic value in mxf_write_header()). Fixes #7993. Reviewed-by: Tomas Härdin <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/rmdec: Check codec_length without overflowMichael Niedermayer2021-02-161-1/+1
| | | | | | | | Fixes: signed integer overflow: 2147483647 + 64 cannot be represented in type 'int' Fixes: 30333/clusterfuzz-testcase-minimized-ffmpeg_dem_RM_fuzzer-5175286983426048 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <[email protected]>
* avformat/mov: Check element count in mov_metadata_hmmt()Michael Niedermayer2021-02-161-0/+2
| | | | | | | | Fixes: Timeout Fixes: 30325/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6048395703746560 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <[email protected]>
* avformat/utils: Add av_assert1 to preclude NULL + len, len != 0Andreas Rheinhardt2021-02-151-0/+1
| | | | | | | | | Such a scenario is undefined behaviour and would also indicate a bug in our code. Suggested-by: James Almer <[email protected]> Reviewed-by: James Almer <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* lavf/img2dec: Autodetect pfm images.Carl Eugen Hoyos2021-02-151-1/+1
|
* avformat/utils: Fix undefined NULL + 0Andreas Rheinhardt2021-02-141-1/+1
| | | | | | | | | | | This is undefined behaviour in C, so use data = len ? data + len : data instead of data += len. GCC optimizes the branch away in this case; Clang unfortunately doesn't. Fixes ticket #8592. Reviewed-by: Paul B Mahol <[email protected]> Signed-off-by: Andreas Rheinhardt <[email protected]>
* avdevice/avdevice: Deprecate AVDevice Capabilities APIAndreas Rheinhardt2021-02-141-0/+4
| | | | | | | | | | | | | | It has been added in 6db42a2b6b22e6f1928fafcf3faa67ed78201004, yet since then none of the necessary create/free_device_capabilities functions has been implemented, making this API completely useless. Because of this one can already simplify avdevice_capabilities_free/create and can already remove the function pointers at the next major bump; given that the documentation explicitly states that av_device_capabilities is not to be used by a user, it's options can already be removed (save for the sentinel). Signed-off-by: Andreas Rheinhardt <[email protected]>
* avformat/nutdec: Check timebase count against main header lengthMichael Niedermayer2021-02-141-4/+4
| | | | | | | | | Fixes: Timeout (long -> 3ms) Fixes: 28514/clusterfuzz-testcase-minimized-ffmpeg_dem_NUT_fuzzer-6078669009321984 Fixes: 30095/clusterfuzz-testcase-minimized-ffmpeg_dem_NUT_fuzzer-5074433016463360 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <[email protected]>
* avformat/mov: sanity check STSD entriesMichael Niedermayer2021-02-141-1/+1
| | | | | | | | | | | | The choosen value is arbitrary. I am not sure if this is a good idea but i dont immedeately see an alternative better way, it seems either an arbitrary limit or OOM Fixes: OOM Fixes: 27492/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6194970578649088 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <[email protected]>
* avformat/mux: return a pointer to the packet in ff_interleaved_peek()James Almer2021-02-133-30/+16
| | | | | | | And make it const, so the caller doesn't attempt to change it. ff_get_muxer_ts_offset() should be used to get the muxer timestamp offset. Signed-off-by: James Almer <[email protected]>
* avformat/mux: add ff_get_muxer_ts_offset()James Almer2021-02-132-0/+17
| | | | | | Will be useful in the next patch Signed-off-by: James Almer <[email protected]>
* avformat/utils: force lowres to 0 in avformat_find_stream_info()James Almer2021-02-131-9/+8
| | | | | | Instead of applying it and then restoring the original codecpar dimensions. Signed-off-by: James Almer <[email protected]>
* avformat/electronicarts: Clear partial_packet on errorMichael Niedermayer2021-02-121-0/+1
| | | | | | | | | Fixes: Infinite loop Fixes: 30165/clusterfuzz-testcase-minimized-ffmpeg_dem_EA_fuzzer-6224642371092480 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <[email protected]> Signed-off-by: Michael Niedermayer <[email protected]>
* avformat/r3d: Check samples before computing durationMichael Niedermayer2021-02-121-1/+2
| | | | | | | | | Fixes: signed integer overflow: -4611686024827895807 + -4611686016279904256 cannot be represented in type 'long' Fixes: 30161/clusterfuzz-testcase-minimized-ffmpeg_dem_R3D_fuzzer-5694406713802752 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <[email protected]> Signed-off-by: Michael Niedermayer <[email protected]>
* avformat/wavdec: Consider AV_INPUT_BUFFER_PADDING_SIZE in set_spdif()Michael Niedermayer2021-02-101-1/+1
| | | | | | | | | The buffer is read by using the bit reader Fixes: out of array read Fixes: 27539/clusterfuzz-testcase-minimized-ffmpeg_dem_WAV_fuzzer-5650565572591616 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <[email protected]>
* avformat/rmdec: Check remaining space in debug av_log() loopMichael Niedermayer2021-02-101-1/+4
| | | | | | | | | Fixes: Timeout (long -> 2 ms) Fixes: 26709/clusterfuzz-testcase-minimized-ffmpeg_dem_IVR_fuzzer-5665833403285504 Fixes: 27522/clusterfuzz-testcase-minimized-ffmpeg_dem_IVR_fuzzer-6321071221112832 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <[email protected]>