Skip to main content

nominal_api/conjure/objects/datasource/
video_file_metadata.rs

1/// Metadata specific to video files.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    conjure_object::private::DeriveWith
8)]
9#[serde(crate = "conjure_object::serde")]
10#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
11#[conjure_object::private::staged_builder::staged_builder]
12#[builder(crate = conjure_object::private::staged_builder, update, inline)]
13pub struct VideoFileMetadata {
14    #[builder(
15        custom(
16            type = super::super::scout::video::api::VideoFileTimestampManifest,
17            convert = Box::new
18        )
19    )]
20    #[serde(rename = "timestampManifest")]
21    timestamp_manifest: Box<super::super::scout::video::api::VideoFileTimestampManifest>,
22    #[builder(
23        default,
24        custom(
25            type = impl
26            Into<Option<super::VideoSegmentsMetadata>>,
27            convert = |v|v.into().map(Box::new)
28        )
29    )]
30    #[serde(
31        rename = "segmentMetadata",
32        skip_serializing_if = "Option::is_none",
33        default
34    )]
35    segment_metadata: Option<Box<super::VideoSegmentsMetadata>>,
36}
37impl VideoFileMetadata {
38    /// Constructs a new instance of the type.
39    #[inline]
40    pub fn new(
41        timestamp_manifest: super::super::scout::video::api::VideoFileTimestampManifest,
42    ) -> Self {
43        Self::builder().timestamp_manifest(timestamp_manifest).build()
44    }
45    /// Specifies how to determine absolute timestamps for each frame in the video.
46    /// Can be an embedded MCAP manifest, an external sidecar file, or calculated
47    /// from a starting offset applied to presentation timestamps.
48    #[inline]
49    pub fn timestamp_manifest(
50        &self,
51    ) -> &super::super::scout::video::api::VideoFileTimestampManifest {
52        &*self.timestamp_manifest
53    }
54    /// Cached aggregate metadata about the segments comprising this video file
55    /// after segmentation has completed. Includes frame counts, duration, and
56    /// frame rate. Empty until segmentation is complete.
57    /// Note: Min/max timestamps are stored in DatasetFile.bounds field.
58    /// Raw file size is stored in DatasetFile.fileSizeBytes.
59    #[inline]
60    pub fn segment_metadata(&self) -> Option<&super::VideoSegmentsMetadata> {
61        self.segment_metadata.as_ref().map(|o| &**o)
62    }
63}