#![warn(rust_2018_idioms)]
#![allow(dead_code)]
pub mod audio;
pub mod io;
pub mod video;
use bytes::Bytes;
use shared::time::SystemInstant;
use std::time::Duration;
#[derive(Debug)]
pub struct Sample {
pub data: Bytes,
pub timestamp: SystemInstant,
pub duration: Duration,
pub packet_timestamp: u32,
pub prev_dropped_packets: u16,
pub prev_padding_packets: u16,
}
impl Default for Sample {
fn default() -> Self {
Sample {
data: Bytes::new(),
timestamp: SystemInstant::now(),
duration: Duration::from_secs(0),
packet_timestamp: 0,
prev_dropped_packets: 0,
prev_padding_packets: 0,
}
}
}
impl PartialEq for Sample {
fn eq(&self, other: &Self) -> bool {
let mut equal: bool = true;
if self.data != other.data {
equal = false;
}
if self.timestamp.duration_since_unix_epoch().as_secs()
!= other.timestamp.duration_since_unix_epoch().as_secs()
{
equal = false;
}
if self.duration != other.duration {
equal = false;
}
if self.packet_timestamp != other.packet_timestamp {
equal = false;
}
if self.prev_dropped_packets != other.prev_dropped_packets {
equal = false;
}
if self.prev_padding_packets != other.prev_padding_packets {
equal = false;
}
equal
}
}