Skip to main content

PartitionPack

Struct PartitionPack 

Source
pub struct PartitionPack {
Show 15 fields pub kind: PartitionKind, pub status: PartitionStatus, pub major_version: u16, pub minor_version: u16, pub kag_size: u32, pub this_partition: u64, pub previous_partition: u64, pub footer_partition: u64, pub header_byte_count: u64, pub index_byte_count: u64, pub index_sid: u32, pub body_offset: u64, pub body_sid: u32, pub operational_pattern: UlBytes, pub essence_containers: Vec<UlBytes>,
}
Expand description

The Partition Pack — SMPTE ST 377-1:2019 §7.1, Table 4 (Key) + Table 5 (Value). Covers the Header/Body/Footer variants (§7.2-7.4); which one a given instance is lives in kind.

Fields§

§kind: PartitionKind

Which kind of Partition this is (Table 4 byte 14).

§status: PartitionStatus

Open/Closed × Complete/Incomplete (Table 4 byte 15).

§major_version: u16

Fixed 0x0001 for this revision.

§minor_version: u16

Fixed 0x0003 for this revision (0x0002 = ST 377M-2004).

§kag_size: u32

KLV Alignment Grid size in bytes: 0=undefined, 1=byte-aligned, 2..=1048576 a valid grid, >1048576 forbidden (§6.4.1).

§this_partition: u64

Byte offset of this Partition from the start of the Header Partition (always 0 for the Header Partition itself).

§previous_partition: u64

Byte offset of the previous Partition (0 for the first Partition after the Header).

§footer_partition: u64

Byte offset of the Footer Partition (0 if not yet known).

§header_byte_count: u64

Bytes used for Header Metadata + Primer Pack in this Partition (0 if none).

§index_byte_count: u64

Bytes used for Index Table Segments in this Partition (0 if none).

§index_sid: u32

Index Table Segment stream ID in this Partition (0 = none).

§body_offset: u64

Byte offset of the Essence Container segment in this Partition, relative to the start of its BodySID stream.

§body_sid: u32

Essence Container stream ID in this Partition (0 = none).

§operational_pattern: UlBytes

Operational Pattern UL (copy of the Preface’s own value).

§essence_containers: Vec<UlBytes>

Batch of Essence Container ULs used in/referenced by this file.

Implementations§

Source§

impl PartitionPack

Source

pub fn key(kind: PartitionKind, status: PartitionStatus) -> UlBytes

Build the 16-byte Key for kind/status (Table 4/6/7/8).

Byte numbering (1-indexed per the spec) -> 0-indexed array position: bytes 1-7 = the fixed prefix 06 0E 2B 34 02 05 01; byte 8 = registry version (wildcard on parse, written as 0x01); bytes 9-12 = the fixed mid section 0D 01 02 01; byte 13 = Structure Kind (0x01, part of the fixed prefix); byte 14 = Partition Kind (PartitionKind); byte 15 = Partition Status (PartitionStatus); byte 16 = reserved (0x00).

Source

pub fn is_partition_key(key: &UlBytes) -> bool

True if key matches the Partition Pack Key (Table 4): the fixed prefix bytes AND byte 14 one of the three valid PartitionKind values. Useful to recognize a Partition Pack while walking a file’s top-level KLV items, before committing to a full parse.

The fixed prefix alone is not sufficient to distinguish a Partition Pack from a crate::PrimerPack or crate::RandomIndexPack Key: all three share the same “Defined- Length Pack, Set/Pack Registry” family (bytes 1-13, Tables 4/13/29) and differ only in byte 14 (0x02/0x03/0x04 Partition vs. 0x05 Primer Pack vs. 0x11 Random Index Pack) — so byte 14 must be checked too, not just the shared prefix.

Trait Implementations§

Source§

impl Clone for PartitionPack

Source§

fn clone(&self) -> PartitionPack

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PartitionPack

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for PartitionPack

Source§

impl<'a> Parse<'a> for PartitionPack

Source§

type Error = Error

The error type this implementer returns. Typically the enclosing crate’s Error enum.
Source§

fn parse(bytes: &'a [u8]) -> Result<Self>

Parse bytes as Self. Returns Err(Self::Error) on any protocol violation or buffer underrun.
Source§

impl PartialEq for PartitionPack

Source§

fn eq(&self, other: &PartitionPack) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for PartitionPack

Source§

type Error = Error

The error type this implementer returns (usually the same as the corresponding Parse impl, but need not be).
Source§

fn serialized_len(&self) -> usize

Number of bytes serialize_into will write.
Source§

fn serialize_into(&self, buf: &mut [u8]) -> Result<usize>

Write the serialised form into buf. Returns the number of bytes written (always equal to serialized_len()).
Source§

fn to_bytes(&self) -> Vec<u8>
where Self::Error: Debug,

Convenience: allocate a Vec and serialise into it. Read more
Source§

impl StructuralPartialEq for PartitionPack

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.