Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion event/src/event.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use core::fmt;
use mem::{smpte::TimecodeInstant, str::StaticString};
use mem::{
smpte::{TimecodeInstant, TimecodeProperties},
str::StaticString,
};

/// Conditional VLT requirement to perform a [EventDescription::JumpEvent].
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
Expand Down Expand Up @@ -204,6 +207,8 @@ pub enum EventDescription {
TimecodeEvent {
/// Timecode Instant this LTC starts at
time: TimecodeInstant,
/// Timecode properties
properties: TimecodeProperties,
},

/// Marks the point where SMPTE LTC should stop running
Expand Down
1 change: 1 addition & 0 deletions event/src/eventcursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ mod tests {
f: 0,
frame_progress: 0,
},
properties: mem::smpte::TimecodeProperties::default(),
}),
},
);
Expand Down
2 changes: 2 additions & 0 deletions mem/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ pub mod time;
/// Low level data types for SMPTE Timecode
pub mod smpte {
pub use super::timecode::TimecodeInstant;
pub use super::timecode::TimecodeProperties;
pub use super::timecode::TimecodeUserBitFormat;
}
40 changes: 40 additions & 0 deletions mem/src/timecode.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
use core::fmt::{Display, Formatter, Result};

/// SMPTE timecode properties
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Default, Debug, Clone, Copy, Eq, PartialEq, PartialOrd, Ord)]
pub struct TimecodeProperties {
/// If set to true, frame numbers 0 and 1 are skipped during the first second of every minute, except multiples
/// of 10 minutes. This converts 30 frames/second time code to the 29.97 frames/second NTSC
/// standard. (from Wikipedia, "Linear timecode")
pub drop_frame: bool,
/// Set to true if the time code is synchronized to a color video signal. The frame number modulo
/// 2 (for NTSC and SECAM) or modulo 4 (for PAL) should be preserved across cuts in order to
/// avoid phase jumps in the chrominance subcarrier. (from Wikipedia, "Linear timecode")
pub color_framing: bool,
/// Binary group flag; user bit format
pub user_bit_format: TimecodeUserBitFormat,
/// Indicates that the time code is synchronized to an external clock. False indicates the time
/// origin is arbitrary. In practice, this means "ignore the timestamp in an LTC event, and run
/// LTC from device time instead".
pub use_wall_time: bool,
/// 32 user bits
pub user_bits: [u8; 4],
/// Frame number offset
pub frame_offset: u8,
}

/// SMPTE BFG, binary group flag.
/// Indicates the format of user bits
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Default, Debug, Clone, Copy, Eq, PartialEq, PartialOrd, Ord)]
pub enum TimecodeUserBitFormat {
/// No (or unspecified) format
#[default]
Unspecified = 0,
/// Date and timezone, according to SMPTE 309M
DateTimezone = 1,
/// Four 8-bit characters, transmitted little-endian
EightBitLittleEndian = 2,
/// Reserved and unused
Reserved11 = 3,
}

/// A SMPTE LTC timestamp, including frame rate.
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Default, Debug, Clone, Copy, Eq)]
Expand Down