Skip to content

Commit

Permalink
impl std::fmt::Debug for audio::Format
Browse files Browse the repository at this point in the history
  • Loading branch information
yury committed Oct 23, 2024
1 parent 161fe4d commit 3f28374
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions cidre/src/cat/audio/base_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::{
ptr::{slice_from_raw_parts, slice_from_raw_parts_mut},
};

use crate::{define_opts, os};
use crate::{define_opts, four_cc_to_str, os};

#[cfg(feature = "ns")]
use crate::ns;
Expand Down Expand Up @@ -164,10 +164,20 @@ impl<const N: usize> BufList<N> {

/// A four char code indicating the general kind of data in the stream.
#[doc(alias = "AudioFromatID")]
#[derive(Clone, Copy, PartialEq, Eq, Default, Debug)]
#[derive(Clone, Copy, PartialEq, Eq, Default)]
#[repr(transparent)]
pub struct Format(pub u32);

impl std::fmt::Debug for Format {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut be = self.0.to_be_bytes();
f.debug_struct("Format")
.field("raw", &self.0)
.field("fcc", &four_cc_to_str(&mut be))
.finish()
}
}

/// The AudioFormatIDs used to identify individual formats of audio data.
impl Format {
/// Linear PCM, uses the standard flags.
Expand Down

0 comments on commit 3f28374

Please # to comment.