moq_karp/video/
mod.rs

1mod av1;
2mod codec;
3mod dimensions;
4mod h264;
5mod h265;
6mod vp9;
7
8pub use av1::*;
9pub use codec::*;
10pub use dimensions::*;
11pub use h264::*;
12pub use h265::*;
13pub use vp9::*;
14
15use bytes::Bytes;
16use serde::{Deserialize, Serialize};
17use serde_with::{hex::Hex, DisplayFromStr};
18
19use crate::Track;
20
21#[serde_with::serde_as]
22#[serde_with::skip_serializing_none]
23#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
24pub struct Video {
25	// Generic information about the track
26	pub track: Track,
27
28	// The codec mimetype encoded as a string
29	// ex. avc1.42c01e
30	#[serde_as(as = "DisplayFromStr")]
31	pub codec: VideoCodec,
32
33	// Some codecs unfortunately aren't self-describing
34	// One of the best examples is H264, which needs the sps/pps out of band to function.
35	#[serde(default)]
36	#[serde_as(as = "Option<Hex>")]
37	pub description: Option<Bytes>,
38
39	// The encoded width/height of the media
40	pub resolution: Dimensions,
41
42	#[serde(default)]
43	pub bitrate: Option<u64>,
44}