microsoft / microsoft/win32metadata
Possible misbinding
- Dominant language
- C++
- Stars
- 1.5k
- Forks
- 149
- Avg merge
- 5d 16h
- Merged PRs (30d)
- 4
Description
### Summary
I belive I have found a misbinding in the Win32_Media_MediaFoundation feature.
The IMFSourceReader::SetCurrentMediaType(arg , . . .) expects arg to be of type u32. The documentation provided my microsoft says there are 3 variants of arg:
0–0xFFFFFFFB | The zero-based index of a stream.
MF_SOURCE_READER_FIRST_VIDEO_STREAM 0xFFFFFFFC | The first video stream.
MF_SOURCE_READER_FIRST_AUDIO_STREAM 0xFFFFFFFD | The first audio stream.
But in the create all of them have an i32 type. Which can still be casted to a u32, but it was confusing for me at first and I dont think this is intended behavior.
### Crate manifest
```TOML
[dependencies]
anyhow = "1.0.86"
[dependencies.windows]
version = "0.58.0"
features = [
"Data_Xml_Dom",
"Win32_Foundation",
"Win32_Security",
"Win32_System_Threading",
"Win32_UI_WindowsAndMessaging",
"Win32_Media_MediaFoundation",
]
```
### Crate code
```Rust
use windows::{core::w, Win32::Media::MediaFoundation::{MFCreateMediaType, MFCreateSourceReaderFromURL, MFMediaType_Video, MFStartup, MFVideoFormat_RGB32, MFSTARTUP_FULL, MF_MT_MAJOR_TYPE, MF_MT_SUBTYPE, MF_SOURCE_READER_FIRST_VIDEO_STREAM, MF_VERSION}};
pub unsafe fn mf_startup() -> anyhow::Result<()> {
Ok(MFStartup(MF_VERSION, MFSTARTUP_FULL)?)
}
fn main() -> anyhow::Result<()> {
unsafe {
mf_startup()?;
let source_reader = MFCreateSourceReaderFromURL(w!("video://0"), None)?;
let media_type = MFCreateMediaType()?;
media_type.SetGUID(&MF_MT_MAJOR_TYPE, &MFMediaType_Video)?;
media_type.SetGUID(&MF_MT_SUBTYPE, &MFVideoFormat_RGB32)?;
source_reader.SetCurrentMediaType(MF_SOURCE_READER_FIRST_VIDEO_STREAM, None, &media_type)?; //Compiler error
}
Ok(())
}
```
Contributor guide
Assessment
This issue has not been assessed yet.