Skip to main content

nominal_api/conjure/objects/scout/video/api/
segment.rs

1#[derive(
2    Debug,
3    Clone,
4    conjure_object::serde::Serialize,
5    conjure_object::serde::Deserialize,
6    conjure_object::private::DeriveWith
7)]
8#[serde(crate = "conjure_object::serde")]
9#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[conjure_object::private::staged_builder::staged_builder]
11#[builder(crate = conjure_object::private::staged_builder, update, inline)]
12pub struct Segment {
13    #[serde(rename = "rid")]
14    rid: super::super::super::super::api::rids::SegmentRid,
15    #[serde(rename = "videoRid")]
16    video_rid: super::super::super::super::api::rids::VideoRid,
17    #[builder(
18        custom(type = super::super::super::super::api::Handle, convert = Box::new)
19    )]
20    #[serde(rename = "dataHandle")]
21    data_handle: Box<super::super::super::super::api::Handle>,
22    #[serde(rename = "frameRate")]
23    #[derive_with(with = conjure_object::private::DoubleWrapper)]
24    frame_rate: f64,
25    #[serde(rename = "durationSeconds")]
26    #[derive_with(with = conjure_object::private::DoubleWrapper)]
27    duration_seconds: f64,
28    #[builder(custom(type = super::SegmentTimestamps, convert = Box::new))]
29    #[serde(rename = "timestamps")]
30    timestamps: Box<super::SegmentTimestamps>,
31}
32impl Segment {
33    #[inline]
34    pub fn rid(&self) -> &super::super::super::super::api::rids::SegmentRid {
35        &self.rid
36    }
37    #[inline]
38    pub fn video_rid(&self) -> &super::super::super::super::api::rids::VideoRid {
39        &self.video_rid
40    }
41    #[inline]
42    pub fn data_handle(&self) -> &super::super::super::super::api::Handle {
43        &*self.data_handle
44    }
45    /// The average frame rate (FPS) of the segment calculated as total frames / duration in seconds.
46    #[inline]
47    pub fn frame_rate(&self) -> f64 {
48        self.frame_rate
49    }
50    /// The duration of a segment in media time.
51    #[inline]
52    pub fn duration_seconds(&self) -> f64 {
53        self.duration_seconds
54    }
55    /// for videos with frame-level timestamps, we provide mappings, otherwise we just include a single list
56    /// of timestamps.
57    #[inline]
58    pub fn timestamps(&self) -> &super::SegmentTimestamps {
59        &*self.timestamps
60    }
61}