B5: ec-probe reads PcmS24Be/PcmS32Be
Browse files at this commitc776375d41664d3cb766e87d4956f77247111baaParent: 74c238b1 changed file +10 -0
crates/ec-probe/src/decoder.rsmodified+10 -0
| @@ -373,7 +373,9 @@ fn is_pcm(codec: CodecId) -> bool { | |||
| 373 | | CodecId::PcmS16Le | 373 | | CodecId::PcmS16Le |
| 374 | | CodecId::PcmS16Be | 374 | | CodecId::PcmS16Be |
| 375 | | CodecId::PcmS24Le | 375 | | CodecId::PcmS24Le |
| 376 | + | CodecId::PcmS24Be | ||
| 376 | | CodecId::PcmS32Le | 377 | | CodecId::PcmS32Le |
| 378 | + | CodecId::PcmS32Be | ||
| 377 | | CodecId::PcmF32Le | 379 | | CodecId::PcmF32Le |
| 378 | ) | 380 | ) |
| 379 | } | 381 | } |
| @@ -462,10 +464,18 @@ fn pcm(codec: CodecId, data: &[u8], out: &mut Vec<f32>) { | |||
| 462 | let v = i32::from_le_bytes([0, c[0], c[1], c[2]]); | 464 | let v = i32::from_le_bytes([0, c[0], c[1], c[2]]); |
| 463 | v as f32 / 2147483648.0 | 465 | v as f32 / 2147483648.0 |
| 464 | })), | 466 | })), |
| 467 | + CodecId::PcmS24Be => out.extend(data.as_chunks::<3>().0.iter().map(|c| { | ||
| 468 | + let v = i32::from_be_bytes([c[0], c[1], c[2], 0]); | ||
| 469 | + v as f32 / 2147483648.0 | ||
| 470 | + })), | ||
| 465 | CodecId::PcmS32Le => out.extend( | 471 | CodecId::PcmS32Le => out.extend( |
| 466 | data.as_chunks::<4>().0.iter() | 472 | data.as_chunks::<4>().0.iter() |
| 467 | .map(|c| i32::from_le_bytes([c[0], c[1], c[2], c[3]]) as f32 / 2147483648.0), | 473 | .map(|c| i32::from_le_bytes([c[0], c[1], c[2], c[3]]) as f32 / 2147483648.0), |
| 468 | ), | 474 | ), |
| 475 | + CodecId::PcmS32Be => out.extend( | ||
| 476 | + data.as_chunks::<4>().0.iter() | ||
| 477 | + .map(|c| i32::from_be_bytes([c[0], c[1], c[2], c[3]]) as f32 / 2147483648.0), | ||
| 478 | + ), | ||
| 469 | CodecId::PcmF32Le => out.extend( | 479 | CodecId::PcmF32Le => out.extend( |
| 470 | data.as_chunks::<4>().0.iter() | 480 | data.as_chunks::<4>().0.iter() |
| 471 | .map(|c| f32::from_le_bytes([c[0], c[1], c[2], c[3]])), | 481 | .map(|c| f32::from_le_bytes([c[0], c[1], c[2], c[3]])), |