mirror of
https://github.com/iluvcapra/bwavfile.git
synced 2025-12-31 17:00:44 +00:00
Added Default trait for Bext
This commit is contained in:
29
src/bext.rs
29
src/bext.rs
@@ -1,8 +1,10 @@
|
||||
pub type LU = f32;
|
||||
#[allow(clippy::upper_case_acronyms)]
|
||||
pub type LU = f32;
|
||||
pub type LUFS = f32;
|
||||
pub type Decibels = f32;
|
||||
|
||||
use chrono::{Local, DateTime};
|
||||
|
||||
/// Broadcast-WAV metadata record.
|
||||
///
|
||||
/// The `bext` record contains information about the original recording of the
|
||||
@@ -79,3 +81,28 @@ pub struct Bext {
|
||||
/// Coding History.
|
||||
pub coding_history: String,
|
||||
}
|
||||
|
||||
impl Default for Bext {
|
||||
/// Create a new version 0 `bext` with all description fields set to the empty string
|
||||
/// and the current local date and time filled in.
|
||||
fn default() -> Self {
|
||||
let now: DateTime<_> = Local::now();
|
||||
|
||||
Self {
|
||||
description: "".to_string(),
|
||||
originator: "".to_string(),
|
||||
originator_reference: "".to_string(),
|
||||
origination_date:now.date_naive().format("%Y-%m%-d").to_string(),
|
||||
origination_time: now.time().format("%H:%M:%S").to_string(),
|
||||
time_reference: 0,
|
||||
version: 0,
|
||||
umid: None,
|
||||
loudness_value: None,
|
||||
loudness_range: None,
|
||||
max_true_peak_level: None,
|
||||
max_momentary_loudness: None,
|
||||
max_short_term_loudness: None,
|
||||
coding_history: "".to_string(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user