Skip to content

Commit

Permalink
Misc doc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmarc committed Jan 24, 2024
1 parent 1ed50f5 commit b2c2ed1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ pub const MIN_VERSION: u16 = 13;
/// any higher version, but features added by versions higher than this are not supported.
pub const MAX_VERSION: u16 = 32;

const DESCRIPTOR_SIZE: usize = 5 * 4;
/// The size of a message header.
pub const DESCRIPTOR_SIZE: usize = 5 * 4;

bitflags! {
/// Special message types.
Expand Down
2 changes: 2 additions & 0 deletions src/protocol/command/sink_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ impl TagStructWrite for GetSinkInfo {
}
}

impl CommandReply for SinkInfo {}

impl TagStructRead for SinkInfo {
fn read(
ts: &mut TagStructReader<'_>,
Expand Down
6 changes: 0 additions & 6 deletions src/protocol/serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,6 @@ pub trait TagStructWrite {
/// Implemented by types that can be deserialized from a tagstruct stream.
pub trait TagStructRead: Sized {
/// Read an instance of `Self` from a tagstruct.
///
/// # Parameters
///
/// * `ts`: The tagstruct to read from.
/// * `protocol_version`: PulseAudio protocol version, used to decide on the precise data
/// format. For old versions, default values might be used for parts of `Self`.
fn read(ts: &mut TagStructReader<'_>, protocol_version: u16) -> Result<Self, ProtocolError>;
}

Expand Down
6 changes: 5 additions & 1 deletion src/protocol/serde/sample_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,18 @@ pub const CHANNELS_MAX: u8 = 32;

/// Describes how individual samples are encoded.
#[derive(Debug, Copy, Clone, Primitive, PartialEq, Eq, Default)]
#[repr(u8)]
pub enum SampleFormat {
/// Invalid or unspecified.
#[default]
Invalid = u8::MAX,
/// Unsigned 8 Bit PCM
U8 = 0,
/// 8 Bit a-Law
Alaw = 1,
/// 8 Bit mu-Law
Ulaw = 2,
/// Signed 16 Bit PCM, little endian (PC)
#[default]
S16Le = 3,
/// Signed 16 Bit PCM, big endian
S16Be = 4,
Expand All @@ -44,6 +47,7 @@ impl SampleFormat {
/// Returns the number of bytes used to store a single sample.
pub fn bytes_per_sample(&self) -> usize {
match self {
SampleFormat::Invalid => 0,
SampleFormat::U8 => 1,
SampleFormat::Alaw => 1,
SampleFormat::Ulaw => 1,
Expand Down

0 comments on commit b2c2ed1

Please sign in to comment.