moq_json/timed.rs
1use moq_net::Timestamp;
2
3/// A value read from a track, and its frame's timestamp.
4///
5/// Writes take the same pair as two arguments, `(value, at)`. On a timed track `at` is when the
6/// value was captured. A scale-less track has no time, so there it is [`Timestamp::unscaled`] at
7/// a group key: a write that opens a group starts it at that key, which must pass every group the
8/// track holds, as [`append_group`](moq_net::track::Producer::append_group) requires.
9#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10pub struct Timed<P> {
11 /// The value.
12 pub value: P,
13
14 /// The frame's timestamp: its capture time, or its group key on a scale-less track.
15 pub at: Timestamp,
16}
17
18impl<P> Timed<P> {
19 /// `value` at `at`.
20 pub fn new(value: P, at: Timestamp) -> Self {
21 Self { value, at }
22 }
23}