Open WallyOxen opened 1 day ago
Also facing this issue...
EDIT: it seems like a breaking change was made since commit: 24fae7d24c2ec2d31d63b127a0aa3cfa4261187a If you use this commit directly it should work, in your Cargo.toml:
windows-capture = { git = "https://github.com/NiiightmareXD/windows-capture", rev = "24fae7d24c2ec2d31d63b127a0aa3cfa4261187a"}
@BenedictWilkins Out of curiosity what version and build of windows are you using?
@WallyOxen OS Name Microsoft Windows 11 Home Version 10.0.22631 Build 22631
did reverting to that commit not work for you?
@BenedictWilkins I was just now able to test it out. After messing with the missing capture::Context
I was indeed able to get it to output screenshots
It seems that this commit changed frame.rs:205 and removed the D3D11_CPU_ACCESS_WRITE.0 as u32
flag. If I add that back in things work as well
Describe the bug 🐛 I'm not sure if your library is to blame or some wonkiness with the Windows crates/ my version of Windows. I was following the example in the README, added windows-capture v1.4.0 to my project and copied the example into my main.rs file. It runs as expected and saves a 6 second clip. If I uncomment the line
frame.save_as_image("frame.png", ImageFormat::Png)?;
and import the required Type. I get an error: Screen Capture Failed: FrameHandlerError(WindowsError(Error { code: HRESULT(0x80070057), message: "The parameter is incorrect." }))I tried to dig into it a bit, but I'm fairly new to Rust and don't understand Windows APIs much at all. It seems to be coming from the frame.buffer function during the
texture_desc
declaration. I was able to get past the error then if I hard coded theFormat
fromDXGI_FORMAT(self.color_format as u32)
to just beDXGI_FORMAT(28)
(Rgba8 default). I also was able to change the underlying DXGI_FORMAT struct to handlei32
instead ofu32
and changed all of the formats to align as well and that also resolved this issue.However, even after I hardcode that value it makes it to the
self.context.Map
function to "Map the texture to enable CPU access" with the same error as above and seems to be something with theD3D11_MAPPED_SUBRESOURCE::default()
, but that's where it gets into the Windows API and I'm really not sure of anything there. So this also makes me think it might not be an issue with your crate.Expected behavior 📝 I expect to get an image saved and overwritten with each frame that's captured during the 6 second recording
OS 🤖