Skip to content

Conversation

rolleifx
Copy link
Contributor

@rolleifx rolleifx commented Aug 8, 2022

use 'wide' atom as a place holder to solve "mdat size too large" issue in writer.rs.

"Extended Size
If the size field of an atom is set to 1, the type field is followed by a 64-bit extended size field, which contains the actual size of the atom as a 64-bit unsigned integer. This is used when the size of a media data atom exceeds 2^32 bytes.

When the size field contains the actual size of the atom, the extended size field is not present. This means that when a QuickTime atom is modified by adding data, and its size crosses the 2^32 byte limit, there is no extended size field in which to record the new atom size. Consequently, it is not always possible to enlarge an atom beyond 2^32 bytes without copying its contents to a new atom.

To prevent this inconvenience, media data atoms are typically created with a 64-bit placeholder atom immediately preceding them in the movie file. The placeholder atom has a type of kWideAtomPlaceholderType ('wide').

Much like a 'free' or 'skip' atom, the 'wide' atom is reserved space, but in this case the space is reserved for a specific purpose. If a 'wide' atom immediately precedes a second atom, the second atom can be extended from a 32-bit size to a 64-bit size simply by starting the atom header 8 bytes earlier (overwriting the 'wide' atom), setting the size field to 1, and adding an extended size field. This way the offsets for sample data do not need to be recalculated.

The 'wide' atom is exactly 8 bytes in size, and consists solely of its size and type fields. It contains no other data."

---- https://developer.apple.com/library/archive/documentation/QuickTime/QTFF/QTFFChap1/qtff1.html#//apple_ref/doc/uid/TP40000939-CH203-BBCGDDDF

@rolleifx
Copy link
Contributor Author

I can't reproduce the cargo clippy error under rustc 1.62.1 :

~/dev/rust/mp4-rust$ cargo clippy --no-deps -- -D warnings
Finished dev [unoptimized + debuginfo] target(s) in 0.03s

but failed under rustc 1.63.0:
error: you are deriving PartialEq and can implement Eq
--> src/types.rs:12:30
|
12 | #[derive(Debug, Clone, Copy, PartialEq, Serialize)]
| ^^^^^^^^^ help: consider deriving Eq as well: PartialEq, Eq
|
= note: -D clippy::derive-partial-eq-without-eq implied by -D warnings
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving PartialEq and can implement Eq
--> src/types.rs:33:30
|
33 | #[derive(Debug, Clone, Copy, PartialEq, Serialize)]
| ^^^^^^^^^ help: consider deriving Eq as well: PartialEq, Eq
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving PartialEq and can implement Eq
--> src/types.rs:54:30
|
54 | #[derive(Debug, Clone, Copy, PartialEq, Serialize)]
| ^^^^^^^^^ help: consider deriving Eq as well: PartialEq, Eq
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving PartialEq and can implement Eq
--> src/types.rs:89:19
|
89 | #[derive(Default, PartialEq, Clone, Copy, Serialize)]
| ^^^^^^^^^ help: consider deriving Eq as well: PartialEq, Eq
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving PartialEq and can implement Eq
--> src/types.rs:168:30
|
168 | #[derive(Debug, Clone, Copy, PartialEq)]
| ^^^^^^^^^ help: consider deriving Eq as well: PartialEq, Eq
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving PartialEq and can implement Eq
--> src/types.rs:226:30
|
226 | #[derive(Debug, Clone, Copy, PartialEq)]
| ^^^^^^^^^ help: consider deriving Eq as well: PartialEq, Eq
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving PartialEq and can implement Eq
--> src/types.rs:280:17
|
280 | #[derive(Debug, PartialEq, Clone, Copy)]
| ^^^^^^^^^ help: consider deriving Eq as well: PartialEq, Eq
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving PartialEq and can implement Eq
--> src/types.rs:319:17
|
319 | #[derive(Debug, PartialEq, Clone, Copy)]
| ^^^^^^^^^ help: consider deriving Eq as well: PartialEq, Eq
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving PartialEq and can implement Eq
--> src/types.rs:466:17
|
466 | #[derive(Debug, PartialEq, Clone, Copy)]
| ^^^^^^^^^ help: consider deriving Eq as well: PartialEq, Eq
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving PartialEq and can implement Eq
--> src/types.rs:525:17
|
525 | #[derive(Debug, PartialEq, Clone, Copy)]
| ^^^^^^^^^ help: consider deriving Eq as well: PartialEq, Eq
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving PartialEq and can implement Eq
--> src/types.rs:567:17
|
567 | #[derive(Debug, PartialEq, Clone, Default)]
| ^^^^^^^^^ help: consider deriving Eq as well: PartialEq, Eq
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving PartialEq and can implement Eq
--> src/types.rs:575:17
|
575 | #[derive(Debug, PartialEq, Clone, Default)]
| ^^^^^^^^^ help: consider deriving Eq as well: PartialEq, Eq
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving PartialEq and can implement Eq
--> src/types.rs:581:17
|
581 | #[derive(Debug, PartialEq, Clone, Default)]
| ^^^^^^^^^ help: consider deriving Eq as well: PartialEq, Eq
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving PartialEq and can implement Eq
--> src/types.rs:606:17
|
606 | #[derive(Debug, PartialEq, Clone, Default)]
| ^^^^^^^^^ help: consider deriving Eq as well: PartialEq, Eq
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving PartialEq and can implement Eq
--> src/mp4box/avc1.rs:265:24
|
265 | #[derive(Debug, Clone, PartialEq, Default, Serialize)]
| ^^^^^^^^^ help: consider deriving Eq as well: PartialEq, Eq
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving PartialEq and can implement Eq
--> src/mp4box/co64.rs:7:24
|
7 | #[derive(Debug, Clone, PartialEq, Default, Serialize)]
| ^^^^^^^^^ help: consider deriving Eq as well: PartialEq, Eq
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving PartialEq and can implement Eq
--> src/mp4box/ctts.rs:26:24
|
26 | #[derive(Debug, Clone, PartialEq, Default, Serialize)]
| ^^^^^^^^^ help: consider deriving Eq as well: PartialEq, Eq
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

error: you are deriving PartialEq and can implement Eq

@alfg alfg merged commit c26bdca into alfg:master Jan 6, 2023
@alfg
Copy link
Owner

alfg commented Jan 6, 2023

Thanks! Sorry for the late response!

jprochazk pushed a commit to jprochazk/mp4 that referenced this pull request Sep 18, 2024
* fix "mdat size too large"

* fix clippy

* Fix clippy::derive-partial-eq-without-eq
CandleCandle pushed a commit to CandleCandle/mp4-rust that referenced this pull request May 7, 2025
* fix "mdat size too large"

* fix clippy

* Fix clippy::derive-partial-eq-without-eq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants