Libva-rust(libva binding to rust) in development stage20 Mar 2017 | rust
Since Rust language appeared in the world, I felt strongly this is the language I should learn.
This is because:
- Rust guarantees to prevent from common bugs in C/C++ such as memory corruption and race condition, which are very painful to fix whenever you encounter in large project.
- Rust guarantees it doesn’t lose performance even supporting these features!
I don’t think that Rust aims at replacing C/C++, but it’s worth learning for C/C++ developers like me at least. So I’ve been searching and thinking of what I can do with this new language. In the end of last year, I decided to implement libva bindings to Rust.
Here are advantages of doing this project.
- I’m working on gstreamer-vaapi project, which means that I’m familiar with VA-API and middleware using this.
- This kind of binding the existing project to another language makes me understanding the project much more than the moment.
- Simultaneously, I could also learn new language in the level of practical development.
- H/W acceleration is a critical feature, especially for laptop or other embedded systems. So this project could be a good option for those trying to use H/W acceleration for playback on linux.
Finally, I did open this internal project on github, named as libva-rust.
There is one example, creating an VASurface and putting raw data to the surface and displaying it only on X11 window.
Let’s see the example code briefly.
Initalization for VA-API.
Draw raw data to VaapiImage in test_draw.rs and put it to the created surface.
Finally, display it by putting the surface to created X11 window.
It’s simple as you see, but the important first step.
My first goal is providing general and easy a set of “rusty” APIs so that this could be integrated into other rust-multimedia project like rust-media.
Another potential goal is implementation of vaapi plugins in gstreamer, written in Rust. Recently, Sebastian has been working on this(https://github.com/sdroege/rsplugin), I would really like to get involved in this project.
There are tons of things to do for the moment.
Here’s to-do list for now.
- Implement vp8 decoder first: Simply, it looks easier than h26x decoder. Is there any useful rust h26x parser out there, by the way?
- Manipulate raw data using Rust apis like Bit/Byte Reader/Writer.
- Implement general try-catch statement in Rust.
- Make test cases.
- Support wayland.
Yes. It has a long way to go still and I don’t have enough time to focus on this project. But I’ll be managing to keep working on this project.
So feel free to use and absolutely welcome contributions including issue report, bug fix, providing a patch, etc.