Skip to content

Commit 708c499

Browse files
committed
fix: Add missing {S20,U20}{LE,BE} (20 bits for 4 bytes align)
1 parent 2219abb commit 708c499

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/pcm.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,10 @@ alsa_enum!(
503503
ImaAdPCM = SND_PCM_FORMAT_IMA_ADPCM,
504504
MPEG = SND_PCM_FORMAT_MPEG,
505505
GSM = SND_PCM_FORMAT_GSM,
506+
S20LE = SND_PCM_FORMAT_S20_LE,
507+
S20BE = SND_PCM_FORMAT_S20_BE,
508+
U20LE = SND_PCM_FORMAT_U20_LE,
509+
U20BE = SND_PCM_FORMAT_U20_BE,
506510
Special = SND_PCM_FORMAT_SPECIAL,
507511
S243LE = SND_PCM_FORMAT_S24_3LE,
508512
S243BE = SND_PCM_FORMAT_S24_3BE,
@@ -556,6 +560,10 @@ impl fmt::Display for Format {
556560
ImaAdPCM => write!(f, "IMA_ADPCM"),
557561
MPEG => write!(f, "MPEG"),
558562
GSM => write!(f, "GSM"),
563+
S20LE => write!(f, "S20_LE"),
564+
S20BE => write!(f, "S20_BE"),
565+
U20LE => write!(f, "U20_LE"),
566+
U20BE => write!(f, "U20_BE"),
559567
Special => write!(f, "SPECIAL"),
560568
S243LE => write!(f, "S24_3LE"),
561569
S243BE => write!(f, "S24_3BE"),
@@ -614,6 +622,10 @@ impl FromStr for Format {
614622
"IMA_ADPCM" => ImaAdPCM,
615623
"MPEG" => MPEG,
616624
"GSM" => GSM,
625+
"S20_LE" => S20LE,
626+
"S20_BE" => S20BE,
627+
"U20_LE" => U20LE,
628+
"U20_BE" => U20BE,
617629
"SPECIAL" => Special,
618630
"S24_3LE" => S243LE,
619631
"S24_3BE" => S243BE,
@@ -661,9 +673,15 @@ impl Format {
661673
#[cfg(target_endian = "little")] pub const fn u24_3() -> Format { Format::U243LE }
662674
#[cfg(target_endian = "big")] pub const fn u24_3() -> Format { Format::U243BE }
663675

676+
#[cfg(target_endian = "little")] pub const fn s20() -> Format { Format::S20LE }
677+
#[cfg(target_endian = "big")] pub const fn s20() -> Format { Format::S20BE }
678+
664679
#[cfg(target_endian = "little")] pub const fn s20_3() -> Format { Format::S203LE }
665680
#[cfg(target_endian = "big")] pub const fn s20_3() -> Format { Format::S203BE }
666681

682+
#[cfg(target_endian = "little")] pub const fn u20() -> Format { Format::U20LE }
683+
#[cfg(target_endian = "big")] pub const fn u20() -> Format { Format::U20BE }
684+
667685
#[cfg(target_endian = "little")] pub const fn u20_3() -> Format { Format::U203LE }
668686
#[cfg(target_endian = "big")] pub const fn u20_3() -> Format { Format::U203BE }
669687

0 commit comments

Comments
 (0)