MCPcopy Create free account
hub / github.com/RustCV/RustCV / from_mf_guid

Function from_mf_guid

rustcv-backend-msmf/src/pixel_map.rs:38–53  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

36/// The corresponding `PixelFormat`. Returns `PixelFormat::Unknown(0)`
37/// if the format is not recognized, with a warning logged.
38pub 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///

Callers 1

parse_media_typeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected