Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it a library #61

Closed
axelkar opened this issue Feb 12, 2024 · 10 comments
Closed

Make it a library #61

axelkar opened this issue Feb 12, 2024 · 10 comments

Comments

@axelkar
Copy link

axelkar commented Feb 12, 2024

I'd really like to use it as a library in a project I'm working on. XCap doesn't seem like it's good for streams and I can't find any other recently updated Rust libraries, which work for any kind of Wayland. I can try making a nice documentated API for you to publish onto crates.io.

@russelltg
Copy link
Owner

Which part exactly do you want as a library? This tool is pretty much just glue between wayland-protocols[-wlr], ffmpeg-next crates.

@axelkar
Copy link
Author

axelkar commented Feb 14, 2024

I'd be happy with shared glue code, especially if it gets support for GNOME and KDE.

@russelltg
Copy link
Owner

So the API would take in a region spec and output....what? Encoded video?

@axelkar
Copy link
Author

axelkar commented Feb 22, 2024

So the API would take in a region spec and output....what? Encoded video?

What do you mean by region spec? Regarding the output, I'll be using raw RGBA frames for my project but it could be configurable.

@russelltg
Copy link
Owner

I see. Region spec being what part of the screen to capture.

The primary reason that wl-screenrec is efficient is it never actually touches the raw textures, it uses dmabuf to just pass around handles to GPU memory.

If you want CPU surfaces then there is little overlap in what wl-screenrec does and what you want it seems?

@axelkar
Copy link
Author

axelkar commented Feb 24, 2024

.. pass around handles to GPU memory.

I'll be using the GPU for rendering, is there an easy way to get Vulkan or wgpu texture handles for frames?

@russelltg
Copy link
Owner

For sure, but that decreases overlap with this project even more.

To get it into wgpu/vulkan memory, all you have to do is allocate a surface with the right format (the Linux dmabuf Wayland protocol gives you the format), then export it as an EGLImage, get the fd, then pass it to the the screencopy protocol.

Happy to help you out with this, altho don't think there is any code we can share ....

@russelltg
Copy link
Owner

Going to go ahead and close the issue--best of luck and I hope this is at least useful example code!

@axelkar
Copy link
Author

axelkar commented Apr 11, 2024

Libwayshot looks great but doesn't seem to implement anything related to DMA-BUF.

I guess wgpu is a blocker too for doing direct GPU texture passing: gfx-rs/wgpu#2320

Could I manually do Vulkan magic with say ash or vulkano to get the DMA-BUF imported and use this?
gfx-rs/wgpu#3355

Thanks!

@russelltg
Copy link
Owner

Yes, you should be able to to manually do this per-wgpu backend you want to support

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants