Struct TimeCode
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] }
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: u8Hours 0 - 23 are valid.
minutes: u8Minutes 0 - 59 are valid.
seconds: u8Seconds 0 - 59 are valid.
frame: u8Frame Indices 0 - 29 are valid.
drop_frame: boolWhether this is a drop frame.
color_frame: boolWhether this is a color frame.
field_phase: boolField 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
impl TimeCode
const BYTE_SIZE: usize = _;Number of bytes this would consume in an exr file.
fn validate(&self, strict: bool) -> UnitResultReturns an error if this time code is considered invalid.
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.
fn from_tv60_time(tv60_time: u32, user_data: u32) -> SelfUnpack 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.
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_frameflag, it will be lost.fn from_tv50_time(tv50_time: u32, user_data: u32) -> SelfUnpack a time code from one TV50 encoded u32 value and the encoded user data. This encoding does not support the
drop_frameflag, it will always be false.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_frameandcolor_frameflags, they will be lost.fn from_film24_time(film24_time: u32, user_data: u32) -> SelfUnpack a time code from one TV60 encoded u32 value and the encoded user data. This encoding does not support the
drop_frameandcolor_frameflags, they will always befalse.fn pack_user_data_as_u32(&self) -> u32Pack the user data
u8array into one u32. User data values are clamped to the valid range (maximum value is 4).fn write<W: Write>(&self, write: &mut W) -> UnitResultWrite this time code to the byte stream, encoded as TV60 integers. Returns an
Error::Invalidif the fields are out of the allowed range.fn read<R: Read>(read: &mut R) -> Result<Self>Read the time code, without validating, extracting from TV60 integers.
Trait Implementations
impl Clone for TimeCode
fn clone(&self) -> Self
impl Copy for TimeCode
impl Debug for TimeCode
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for TimeCode
fn default() -> Self
impl Eq for TimeCode
impl Hash for TimeCode
fn hash<__H: Hasher>(&self, state: &mut __H)
impl PartialEq for TimeCode
fn eq(&self, other: &Self) -> bool
impl StructuralPartialEq for TimeCode
Auto Trait Implementations
impl Freeze for TimeCode
impl RefUnwindSafe for TimeCode
impl Send for TimeCode
impl Sync for TimeCode
impl Unpin for TimeCode
impl UnsafeUnpin for TimeCode
impl UnwindSafe for TimeCode
Blanket Implementations
impl<R, P> ReadPrimitive<R> for TimeCode
where
R: Read + ReadEndian<P>,
P: Default,
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for TimeCode
where
ST: ?Sized,
DT: ?Sized,
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for TimeCode
where
ST: ?Sized,
DT: ?Sized,
impl<T> Any for TimeCode
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for TimeCode
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for TimeCode
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for TimeCode
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for TimeCode
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Pointable for TimeCode
const ALIGN: usize = _;type Init = T;unsafe fn init(init: <T as Pointable>::Init) -> usizeunsafe fn deref<'a>(ptr: usize) -> &'a Tunsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Tunsafe fn drop(ptr: usize)
impl<T> Read<Exclusive, BecauseExclusive> for TimeCode
where
T: ?Sized,
impl<T> ToOwned for TimeCode
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for TimeCode
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for TimeCode
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for TimeCode
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>