| 1 |
//! Video and audio definitions. |
| 2 |
|
| 3 |
use crate::audiosample::{ChannelMap, Soniton}; |
| 4 |
use crate::pixel::Formaton; |
| 5 |
use std::sync::Arc; |
| 6 |
|
| 7 |
/// Video stream information. |
| 8 |
#[derive(Clone, Debug, PartialEq, Eq)] |
| 9 |
pub struct VideoInfo { |
| 10 |
/// Picture width. |
| 11 |
pub width: usize, |
| 12 |
/// Picture height. |
| 13 |
pub height: usize, |
| 14 |
/// Picture pixel format. |
| 15 |
pub format: Option<Arc<Formaton>>, |
| 16 |
} |
| 17 |
|
| 18 |
/// Audio stream information. |
| 19 |
#[derive(Clone, Debug, PartialEq, Eq)] |
| 20 |
pub struct AudioInfo { |
| 21 |
/// Audio sample rate. |
| 22 |
pub rate: usize, |
| 23 |
/// Audio sequence of channels. |
| 24 |
pub map: Option<ChannelMap>, |
| 25 |
/// Audio sample format. |
| 26 |
pub format: Option<Arc<Soniton>>, |
| 27 |
} |
| 28 |
|
| 29 |
/// Possible stream information types. |
| 30 |
#[derive(Clone, Debug, PartialEq, Eq)] |
| 31 |
pub enum MediaKind { |
| 32 |
/// Video codec information. |
| 33 |
Video(VideoInfo), |
| 34 |
/// Audio codec information. |
| 35 |
Audio(AudioInfo), |
| 36 |
} |
| 37 |
|
| 38 |
/// Possible codec parameters. |
| 39 |
#[derive(Clone, Debug, PartialEq, Eq)] |
| 40 |
pub struct CodecParams { |
| 41 |
/// Stream information type. |
| 42 |
pub kind: Option<MediaKind>, |
| 43 |
/// Codec id. |
| 44 |
pub codec_id: Option<String>, |
| 45 |
/// Codec additional data. |
| 46 |
pub extradata: Option<Vec<u8>>, |
| 47 |
/// Codec bit-rate. |
| 48 |
pub bit_rate: usize, |
| 49 |
/// Number of samples the decoder must process |
| 50 |
/// before outputting valid data. |
| 51 |
pub convergence_window: usize, |
| 52 |
/// Number of samples the codec needs to process |
| 53 |
/// before returning data. |
| 54 |
pub delay: usize, |
| 55 |
} |