Add metadata.rs
This commit is contained in:
74
src/metadata.rs
Normal file
74
src/metadata.rs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use chrono::{DateTime, Utc};
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
pub struct VideoMetadata {
|
||||||
|
pub video_path: String,
|
||||||
|
pub probed_at: DateTime<Utc>,
|
||||||
|
pub format: FormatInfo,
|
||||||
|
pub video_stream: Option<VideoStream>,
|
||||||
|
pub audio_streams: Vec<AudioStream>,
|
||||||
|
pub subtitle_streams: Vec<SubtitleStream>,
|
||||||
|
pub other_streams: Vec<OtherStream>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Default)]
|
||||||
|
pub struct FormatInfo {
|
||||||
|
pub filename: Option<String>,
|
||||||
|
pub format_name: Option<String>,
|
||||||
|
pub format_long_name: Option<String>,
|
||||||
|
pub duration: f64,
|
||||||
|
pub size: u64,
|
||||||
|
pub bit_rate: u64,
|
||||||
|
pub probe_score: Option<i32>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub tags: Option<serde_json::Value>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
pub struct VideoStream {
|
||||||
|
pub index: i32,
|
||||||
|
pub codec_name: Option<String>,
|
||||||
|
pub codec_long_name: Option<String>,
|
||||||
|
pub profile: Option<String>,
|
||||||
|
pub width: i32,
|
||||||
|
pub height: i32,
|
||||||
|
pub pix_fmt: Option<String>,
|
||||||
|
pub r_frame_rate: Option<String>,
|
||||||
|
pub avg_frame_rate: Option<String>,
|
||||||
|
pub bit_rate: Option<u64>,
|
||||||
|
pub duration: Option<f64>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub tags: Option<serde_json::Value>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
pub struct AudioStream {
|
||||||
|
pub index: i32,
|
||||||
|
pub codec_name: Option<String>,
|
||||||
|
pub channels: i32,
|
||||||
|
pub sample_rate: Option<String>,
|
||||||
|
pub bit_rate: Option<u64>,
|
||||||
|
pub duration: Option<f64>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub tags: Option<serde_json::Value>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
pub struct SubtitleStream {
|
||||||
|
pub index: i32,
|
||||||
|
pub codec_name: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub language: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub tags: Option<serde_json::Value>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
pub struct OtherStream {
|
||||||
|
pub index: i32,
|
||||||
|
pub codec_type: String,
|
||||||
|
pub codec_name: Option<String>,
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub tags: Option<serde_json::Value>,
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user