bookclerk_mp4::edit
Editing a moov that is already in memory: find a box, replace a child, and
keep every enclosing size field consistent.
Rewriting a sample table means growing or shrinking a box that several
ancestors declare the size of, so a splice here is never a plain
Vec::splice: splice_replace walks back up the tree and patches each
ancestor's size by the same delta.
| Item | Kind | Summary |
|---|---|---|
find_box_range |
function | Find the first box of fourcc anywhere under the well-known containers. |
find_direct_child |
function | Find an immediate child of the box that starts at parent_start. |
find_child_in_range |
function | Find a box of fourcc among the siblings laid out in [start, end). |
splice_replace |
function | Replace buf[start..end] with replacement, fixing every ancestor's size. |
pub fn find_box_range(buf: &[u8], fourcc: &[u8; 4]) -> Result<Option<(usize, usize)>>
Find the first box of fourcc anywhere under the well-known containers.
Returns the byte range [start, end) of the whole box, header included.
buf- Destination buffer resized tosize.fourcc- Numericfourccvalue for this call.
The successful result value for this operation.
Returns an error when the underlying I/O, parse, network, or store operation fails.
Panics when an internal invariant does not hold.
pub fn find_direct_child(
buf: &[u8],
parent_start: usize,
parent_end: usize,
fourcc: &[u8; 4],
) -> Result<Option<(usize, usize)>>
Find an immediate child of the box that starts at parent_start.
buf- Destination buffer resized tosize.parent_start- Numericparent_startvalue for this call.parent_end- Numericparent_endvalue for this call.fourcc-fourccinput for this call.
The successful result value for this operation.
Returns an error when the underlying I/O, parse, network, or store operation fails.
pub fn find_child_in_range(
buf: &[u8],
start: usize,
end: usize,
fourcc: &[u8; 4],
) -> Result<Option<(usize, usize)>>
Find a box of fourcc among the siblings laid out in [start, end).
buf- Destination buffer resized tosize.start- Numericstartvalue for this call.end- Numericendvalue for this call.fourcc-fourccinput for this call.
The successful result value for this operation.
Returns an error when the underlying I/O, parse, network, or store operation fails.
Panics when an internal invariant does not hold.
pub fn splice_replace(
buf: &[u8],
start: usize,
end: usize,
replacement: &[u8],
) -> Result<Vec<u8>>
Replace buf[start..end] with replacement, fixing every ancestor's size.
buf- Destination buffer resized tosize.start- Numericstartvalue for this call.end- Numericendvalue for this call.replacement-replacementinput for this call.
On success, the inner Vec<u8> value.
Returns an error when the underlying I/O, parse, network, or store operation fails.
Generated from crates/bookclerk-mp4 at main · View as Markdown