Skip to content

Commit f13932a

Browse files
authored
Merge pull request #133 from yhx-12243/20bits
fix: Add missing {S20,U20}{LE,BE} (20 bits for 4 bytes align)
2 parents 2219abb + 9272ae5 commit f13932a

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/pcm.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ alsa_enum!(
475475
alsa_enum!(
476476
#[non_exhaustive]
477477
/// [SND_PCM_FORMAT_xxx](http://www.alsa-project.org/alsa-doc/alsa-lib/group___p_c_m.html) constants
478-
Format, ALL_FORMATS[48],
478+
Format, ALL_FORMATS[52],
479479

480480
Unknown = SND_PCM_FORMAT_UNKNOWN,
481481
S8 = SND_PCM_FORMAT_S8,
@@ -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)