Skip to main content

cadmpeg_core/
container.rs

1// SPDX-License-Identifier: Apache-2.0
2//! Format-independent container inspection results.
3
4use std::collections::BTreeMap;
5
6#[cfg(feature = "schema")]
7use schemars::JsonSchema;
8use serde::{Deserialize, Serialize};
9
10/// One stream or segment in a container summary.
11///
12/// `role` and `attributes` are codec-defined. The ordered attribute map keeps
13/// the format-independent summary deterministic.
14#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
15#[cfg_attr(feature = "schema", derive(JsonSchema))]
16pub struct ContainerEntry {
17    /// Entry name/path within the container.
18    pub name: String,
19    /// Codec-defined role classification.
20    pub role: String,
21    /// Compression method label (for example, `"stored"` or `"deflate"`).
22    pub compression: String,
23    /// Compressed size in bytes.
24    pub compressed_size: u64,
25    /// Uncompressed size in bytes.
26    pub uncompressed_size: u64,
27    /// Extra codec-extracted attributes, sorted by key.
28    #[serde(default)]
29    pub attributes: BTreeMap<String, String>,
30}
31
32/// The result of inspecting a container without decoding its geometry.
33#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
34#[cfg_attr(feature = "schema", derive(JsonSchema))]
35pub struct ContainerSummary {
36    /// Source format id.
37    pub format: String,
38    /// Container kind, for example, `"zip"`.
39    pub container_kind: String,
40    /// Enumerated entries.
41    pub entries: Vec<ContainerEntry>,
42    /// Codec-defined informational notes.
43    pub notes: Vec<String>,
44}