Converts a Media Foundation GUID to a RustCV pixel format. This function maps Windows Media Foundation video format GUIDs to the cross-platform `PixelFormat` enum used by RustCV. # Arguments `guid` - The Media Foundation format GUID # Returns The corresponding `PixelFormat`. Returns `PixelFormat::Unknown(0)` if the format is not recognized, with a warning logged.
(guid: &GUID)
| 36 | /// The corresponding `PixelFormat`. Returns `PixelFormat::Unknown(0)` |
| 37 | /// if the format is not recognized, with a warning logged. |
| 38 | pub fn from_mf_guid(guid: &GUID) -> PixelFormat { |
| 39 | match *guid { |
| 40 | MFVideoFormat_YUY2 => PixelFormat::Known(FourCC::YUYV), |
| 41 | MFVideoFormat_UYVY => PixelFormat::Known(FourCC::UYVY), |
| 42 | MFVideoFormat_NV12 => PixelFormat::Known(FourCC::NV12), |
| 43 | MFVideoFormat_YV12 => PixelFormat::Known(FourCC::YV12), |
| 44 | MFVideoFormat_RGB24 => PixelFormat::Known(FourCC::RGB3), |
| 45 | MFVideoFormat_RGB32 => PixelFormat::Known(FourCC::RGBA), |
| 46 | MFVideoFormat_MJPG => PixelFormat::Known(FourCC::MJPEG), |
| 47 | MFVideoFormat_H264 => PixelFormat::Known(FourCC::H264), |
| 48 | _ => { |
| 49 | tracing::warn!(target: "rustcv::msmf", "Unknown MF pixel format: {:?}", guid); |
| 50 | PixelFormat::Unknown(0) |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | /// Converts a RustCV pixel format to a Media Foundation GUID. |
| 56 | /// |