Returns a human-readable FourCC string (e.g., "MJPG"). 返回人类可读的 FourCC 字符串(如 "MJPG")。
(self)
| 124 | /// Returns a human-readable FourCC string (e.g., "MJPG"). |
| 125 | /// 返回人类可读的 FourCC 字符串(如 "MJPG")。 |
| 126 | pub fn fourcc_str(self) -> String { |
| 127 | let v = self.to_fourcc(); |
| 128 | let bytes = [ |
| 129 | (v & 0xFF) as u8, |
| 130 | ((v >> 8) & 0xFF) as u8, |
| 131 | ((v >> 16) & 0xFF) as u8, |
| 132 | ((v >> 24) & 0xFF) as u8, |
| 133 | ]; |
| 134 | String::from_utf8_lossy(&bytes).into_owned() |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | impl std::fmt::Display for PixelFormat { |