easy_ffprobe/
subtitle_stream.rs

1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5use crate::streams::{option_string_to_int, StreamTags};
6
7#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
8/// Tags specific for subtitles
9
10pub struct SubtititleTags {
11    #[serde(flatten)]
12    pub tags: StreamTags,
13    pub filename: Option<String>,
14    pub mimetype: Option<String>,
15    pub width: Option<i64>,
16    pub height: Option<i64>,
17    #[serde(deserialize_with = "option_string_to_int", default)]
18    pub bit_rate: Option<i64>,
19    #[serde(rename = "SOURCE_ID")]
20    pub source_id: Option<String>,
21    #[serde(flatten)]
22    pub extra: HashMap<String, serde_json::Value>,
23}
24#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
25#[cfg_attr(feature = "__internal_deny_unknown_fields", serde(deny_unknown_fields))]
26/// Stream of type subtitle
27pub struct SubtitleStream {
28    /// Bit rate of the video stream.
29    /// The bit_rate represents the number of bits that are processed per unit of time in the video stream. It is a measure of the video stream's data rate, indicating how much data is encoded for each second of video.
30    #[serde(deserialize_with = "option_string_to_int", default)]
31    pub bit_rate: Option<i64>,
32    /// width of video
33    pub width: Option<i64>,
34    /// height of video
35    pub height: Option<i64>,
36    /// Long name of the codec used for the video stream.
37    pub codec_long_name: String,
38    /// Short name of the codec used for the video stream.
39    /// Example: h264
40    pub codec_name: String,
41    /// Duration of the video stream in timestamp units.
42    pub duration_ts: Option<u64>,
43    /// Metadata tags associated with the video stream.
44    pub tags: Option<SubtititleTags>,
45    #[cfg(feature = "__internal_deny_unknown_fields")]
46    codec_type: Option<serde_json::Value>,
47    #[cfg(feature = "__internal_deny_unknown_fields")]
48    start_time: Option<serde_json::Value>,
49    #[cfg(feature = "__internal_deny_unknown_fields")]
50    duration: Option<serde_json::Value>,
51}