Struct exr::meta::attribute::TimeCode

source ·
pub struct TimeCode {
    pub hours: u8,
    pub minutes: u8,
    pub seconds: u8,
    pub frame: u8,
    pub drop_frame: bool,
    pub color_frame: bool,
    pub field_phase: bool,
    pub binary_group_flags: [bool; 3],
    pub binary_groups: [u8; 8],
}
Expand description

Contains time information for this frame within a sequence. Also defined methods to compile this information into a TV60, TV50 or Film24 bit sequence, packed into u32.

Satisfies the SMPTE standard 12M-1999. For more in-depth information, see philrees.co.uk/timecode.

Fields§

§hours: u8

Hours 0 - 23 are valid.

§minutes: u8

Minutes 0 - 59 are valid.

§seconds: u8

Seconds 0 - 59 are valid.

§frame: u8

Frame Indices 0 - 29 are valid.

§drop_frame: bool

Whether this is a drop frame.

§color_frame: bool

Whether this is a color frame.

§field_phase: bool

Field Phase.

§binary_group_flags: [bool; 3]

Flags for TimeCode.binary_groups.

§binary_groups: [u8; 8]

The user-defined control codes. Every entry in this array can use at most 3 bits. This results in a maximum value of 15, including 0, for each u8.

Implementations§

source§

impl TimeCode

source

pub const BYTE_SIZE: usize = 8usize

Number of bytes this would consume in an exr file.

source

pub fn validate(&self, strict: bool) -> UnitResult

Returns an error if this time code is considered invalid.

source

pub fn pack_time_as_tv60_u32(&self) -> Result<u32>

Pack the SMPTE time code into a u32 value, according to TV60 packing. This is the encoding which is used within a binary exr file.

source

pub fn from_tv60_time(tv60_time: u32, user_data: u32) -> Self

Unpack a time code from one TV60 encoded u32 value and the encoded user data. This is the encoding which is used within a binary exr file.

source

pub fn pack_time_as_tv50_u32(&self) -> Result<u32>

Pack the SMPTE time code into a u32 value, according to TV50 packing. This encoding does not support the drop_frame flag, it will be lost.

source

pub fn from_tv50_time(tv50_time: u32, user_data: u32) -> Self

Unpack a time code from one TV50 encoded u32 value and the encoded user data. This encoding does not support the drop_frame flag, it will always be false.

source

pub fn pack_time_as_film24_u32(&self) -> Result<u32>

Pack the SMPTE time code into a u32 value, according to FILM24 packing. This encoding does not support the drop_frame and color_frame flags, they will be lost.

source

pub fn from_film24_time(film24_time: u32, user_data: u32) -> Self

Unpack a time code from one TV60 encoded u32 value and the encoded user data. This encoding does not support the drop_frame and color_frame flags, they will always be false.

source

fn user_data_bit_indices(group_index: usize) -> Range<usize>

source

pub fn pack_user_data_as_u32(&self) -> u32

Pack the user data u8 array into one u32. User data values are clamped to the valid range (maximum value is 4).

source

fn unpack_user_data_from_u32(user_data: u32) -> [u8; 8]

source

pub fn write<W: Write>(&self, write: &mut W) -> UnitResult

Write this time code to the byte stream, encoded as TV60 integers. Returns an Error::Invalid if the fields are out of the allowed range.

source

pub fn read<R: Read>(read: &mut R) -> Result<Self>

Read the time code, without validating, extracting from TV60 integers.

Trait Implementations§

source§

impl Clone for TimeCode

source§

fn clone(&self) -> TimeCode

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for TimeCode

source§

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

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

impl Default for TimeCode

source§

fn default() -> TimeCode

Returns the “default value” for a type. Read more
source§

impl Hash for TimeCode

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for TimeCode

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for TimeCode

source§

impl Eq for TimeCode

source§

impl StructuralPartialEq for TimeCode

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> 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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
source§

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

§

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>,

§

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>,

§

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.