summaryrefslogtreecommitdiff
path: root/libavformat/mxfdec.c
Commit message (Collapse)AuthorAge
* avformat/mxfdec: Offload allocating string to av_dict_set()Andreas Rheinhardt2022-06-16
| | | | | Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mxfdec: Use ff_data_to_hex() for data->hex conversionAndreas Rheinhardt2022-06-16
| | | | | | | | | | In this case it also stops pretending that the length of the output string is somehow checked (which is currently being done by using snprintf that is called with the amount of space needed instead of the amount of space actually available). Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mxfdec: Don't duplicate av_uuid_unparseAndreas Rheinhardt2022-06-16
| | | | | | | | Also don't allocate the string ourselves, let av_dict_set() do it. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/demux: Add new demux.h headerAndreas Rheinhardt2022-05-10
| | | | | | And move those stuff already in demuxer-only files to it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mxfdec: Do not clear array in mxf_read_strong_ref_array() before ↵Michael Niedermayer2022-03-21
| | | | | | writing Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mxfdec: Check for avio_read() failure in mxf_read_strong_ref_array()Michael Niedermayer2022-03-21
| | | | | | | Fixes: 42827/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4900528511909888 Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mxfdec: Check count in mxf_read_strong_ref_array()Michael Niedermayer2022-03-21
| | | | | Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* mxf: convert to new channel layout APIVittorio Giovara2022-03-15
| | | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mxfdec: support MCA audio informationMarc-Antoine Arnaud2022-01-09
| | | | | | | Channel reordering is removed from this patch because the new channel layout API will support it properly. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mxfdec: Check for duplicate mxf_read_index_entry_array()Michael Niedermayer2021-12-09
| | | | | | | | | Fixes: memleak Fixes: 41596/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-6439060204290048 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mxfdec: Check component_depth in mxf_get_color_range()Michael Niedermayer2021-12-09
| | | | | | | | | Fixes: shift exponent 4294967163 is too large for 32-bit type 'int' Fixes: 41449/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6183636217495552 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mxfdec: rename sub_descriptors as file_descriptorsMarc-Antoine Arnaud2021-09-22
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* Replace all occurences of av_mallocz_array() by av_calloc()Andreas Rheinhardt2021-09-20
| | | | | | | They do the same. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat: Avoid allocation for AVStreamInternalAndreas Rheinhardt2021-09-17
| | | | | | | | | | Do this by allocating AVStream together with the data that is currently in AVStreamInternal; or rather: Put AVStream at the beginning of a new structure called FFStream (which encompasses more than just the internal fields and is a proper context in its own right, hence the name) and remove AVStreamInternal altogether. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mxfdec: check channel number in mxf_get_d10_aes3_packet()Michael Niedermayer2021-09-13
| | | | | | | | | Fixes: Out of array access Fixes: 37030/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5387719147651072 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* 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/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>
* 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/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>
* Remove unnecessary avassert.h inclusionsAndreas Rheinhardt2021-07-22
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mxfdec: Check size for shrinkingMichael Niedermayer2021-07-17
| | | | | | | | | av_shrink_packet() takes int size, so size must fit in int Fixes: out of array access Fixes: 35607/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4875541323841536 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: Simplify cleanup after read_header failureAndreas Rheinhardt2021-07-08
| | | | | | by setting the FF_FMT_INIT_CLEANUP flag. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mxfdec: fixed jp2k_rsiz and 170M matrixValerii Zapodovnikov2021-06-13
| | | | | | | Again. 240M matrix is different from BT.601! And 170M is the same as BT.601. It is primaries that are the same in 240M and 170M, as for jp2k_rsiz see page 17 of ST 422:2019. IT WAS THERE since 2006. This wrong jp2k_rsiz is a copy-paste of header_open_partition_key.
* avformat: move AVStream.{first,cur}_dts to AVStreamInternalJames Almer2021-06-09
| | | | | | They are private fields, no reason to have them exposed in a public header. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/utils: make ff_update_cur_dts() sharedJames Almer2021-06-09
| | | | | | libavdevice needs it. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: move AVStream.{parser,need_parsing} to AVStreamInternalJames Almer2021-05-07
| | | | | | | Those are private fields, no reason to have them exposed in a public header. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: Constify all muxer/demuxersAndreas Rheinhardt2021-04-27
| | | | | | | This is possible now that the next-API is gone. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mxfdec: Fix file position additionMichael Niedermayer2021-04-22
| | | | | | | | Fixes: signed integer overflow: 9223372036854775805 + 4 cannot be represented in type 'long' Fixes: 29927/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-5579985228267520 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 leak on errorAndreas Rheinhardt2021-03-19
| | | | | | | | It was introduced in d3d9b1fc8e2dfc8b4d66c9916ab7221062ff4660; Fixes Coverity issue #733800. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/mxfdec: Don't use wrong type of pointerAndreas Rheinhardt2021-03-19
| | | | | | | | | | | If one of the two results of a ternary conditional is a pointer to void, the type of the whole conditional operator is a pointer to void, even when the other possible result is not a pointer to void. This loophole in the type system has allowed mxf_read_local_tags to have a pointer of type pointer to MXFMetadataSet that actually points to an MXFContext. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/mxfdec: add support for getting product version number metadataMarton Balint2021-03-04
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mxfdec: change toolkit_version metadata field to toolkit_version_numMarton Balint2021-03-04
| | | | | | | It only got added recently, and the new name makes it consistent with product_version_num in the next patch. Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mxfdec: set toolkit version metadataLimin Wang2021-02-05
| | | | | | | | | | | Please check the string of toolkit version with below command: ./ffmpeg -i ../fate-suite/mxf/Sony-00001.mxf -c:v copy -c:a copy out.mxf ./ffmpeg -i out.mxf .... toolkit_version : 58.65.101.0.0 Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avformat/mxfdec: Add missing const to mxf_mastering_display*Tomas Härdin2021-02-03
|
* avformat/mxf: Establish register of local tagsTomas Härdin2021-02-01
| | | | | | Tags can be marked "not used" upfront, saving some space in the primer. av_asserts0() is used to enforce that only tags that are in the primer can actually be written. Sharing of MasteringDisplay ULs is now done via macros.
* avformat/mxfdec: Fix integer overflow in next position in mxf_read_local_tags()Michael Niedermayer2021-01-23
| | | | | | | | Fixes: signed integer overflow: 9223372036854775723 + 8192 cannot be represented in type 'long' Fixes: 29072/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4812604904177664 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: Free all types for both DescriptorsMichael Niedermayer2021-01-11
| | | | | | | | | Fixes: memleak Fixes: 26352/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5201158714687488 Suggested-by: Tomas Härdin <tjoppen@acc.umu.se> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mxf: Deduplicate random_index_pack_keyAndreas Rheinhardt2021-01-08
| | | | | Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/mxfdec: Do not clear arrays in mxf_read_index_entry_array()Michael Niedermayer2020-12-28
| | | | | | They are written too immediately, so it should not be needed. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavf: move AVStream.{inject_global_side_data,display_aspect_ratio} to ↵Anton Khirnov2020-10-28
| | | | | | | AVStreamInternal Those are private fields, no reason to have them exposed in a public header.
* avformat/mxfdec: Read Apple private Content Light Level from MXFHarry Mallon2020-09-17
| | | | | | * As embedded by Apple Compressor Signed-off-by: Harry Mallon <harry.mallon@codex.online>
* avformat/mxfdec: Read Mastering Display Colour Volume from MXFHarry Mallon2020-09-17
| | | | | | Described in Annex B SMPTE ST 2067-21:2020 Signed-off-by: Harry Mallon <harry.mallon@codex.online>
* avformat/mxfdec: Read video range from CDCIEssenceDescriptorHarry Mallon2020-08-29
| | | | | | | * Capture black_ref, white_ref and color_range and recognise full and narrow range. Signed-off-by: Harry Mallon <harry.mallon@codex.online>
* lavf/mxfdec: Limit score for files with run-in.Carl Eugen Hoyos2020-08-25
| | | | | | | | Only return AVPROBE_SCORE_MAX if the header partition pack key is at the start of the file. Fixes ticket #8846. Reviewed-by: Tomas Härdin
* avformat/mxfdec: Read color metadata from MXFHarry Mallon2020-08-06
| | | | | | | Reads color_primaries, color_trc and color_space from mxf headers. ULs are from https://registry.smpte-ra.org/ site. Signed-off-by: Harry Mallon <harry.mallon@codex.online>
* avformat/mxfdec: Fix memleak upon repeating tagsAndreas Rheinhardt2020-07-24
| | | | | | | | | | | When parsing MXF encountering some tags leads to allocations. And when these tags were encountered repeatedly, this could lead to memleaks, because the pointer to the old data got simply overwritten with a pointer to the new data (or to NULL on allocation failure). This has been fixed. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/mxfdec: Fix memleak when parsing tag failsAndreas Rheinhardt2020-07-24
| | | | | | | | | | | | | | The MXF demuxer uses an array of pointers to different structures of metadata (all containing a common initial sequence containing a type field to distinguish them) and some of these structures contain pointers to separately allocated subelements. If an error happens while reading and creating the tags, the semi-finished new tag is freed using the function to free these tags. But this function doesn't free the already allocated subelements, because the type has not been set yet. This commit changes this. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/mxfdec: Fix memleak when adding element to array failsAndreas Rheinhardt2020-07-24
| | | | | | | | | Said array contains pointers to other structs and both the designated new element as well as other stuff contained in it (e.g. strings) leak if the new element can't be added to the array. Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avformat/mxfdec: free duplicated utf16 stringsMichael Niedermayer2020-06-14
| | | | | | | | | Fixes: memleak Fixes: 23415/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5124814510751744 Suggested-by: Marton Balint <cus@passwd.hu> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>