start work on nihed-cros-libva
[nihav-player.git] / nihed-cros-libva / README.md
CommitLineData
68362724
KS
1# Libva Rust Wrapper
2
3This crate provides lightweight and (hopefully) safe libva abstractions for use
4within Rust code with minimal dependencies. It is developed for use in
5ChromeOS, but has no ChromeOS specifics or dependencies and should thus be
6usable anywhere.
7
8The first version was written by Daniel Almeida and hosted in the [crosvm
9repository](https://chromium.googlesource.com/crosvm/crosvm/) before being
10split out here.
11
12## Dependencies
13
14The native [libva](https://github.com/intel/libva) library is required at link
15time, so make sure to have the `libva-dev` or equivalent package for your
16distribution installed. The VA-API driver corresponding to your hardware is
17also required: for Intel hardware it will be
18[intel-media-driver](https://github.com/intel/media-driver), whereas AMD
19hardware relies on [Mesa](https://gitlab.freedesktop.org/mesa/mesa).
20
21An easy way to see whether everything is in order is to run the `vainfo`
22utility packaged with `libva-utils` or as a standalone package in some
23distributions. `vainfo` will print the VA-API version, driver string, and a
24list of supported profiles and endpoints, i.e.:
25
26```
27vainfo: VA-API version: 1.13 (libva 2.13.0)
28vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 22.2.2 ()
29vainfo: Supported profile and entrypoints
30 VAProfileNone : VAEntrypointVideoProc
31 VAProfileNone : VAEntrypointStats
32 VAProfileMPEG2Simple : VAEntrypointVLD
33 VAProfileMPEG2Simple : VAEntrypointEncSlice
34 VAProfileMPEG2Main : VAEntrypointVLD
35 VAProfileMPEG2Main : VAEntrypointEncSlice
36 VAProfileH264Main : VAEntrypointVLD
37 etc
38```
39
40For decoding, the desired profile must be supported under `VAEntrypointVLD`.
41For example, in order to decode VP8 media, this line must be present in the
42output of `vainfo`:
43
44```
45 VAProfileVP8Version0_3 : VAEntrypointVLD
46```
47
48Whereas to decode H264 Main profile media, this line must be present:
49
50```
51 VAProfileH264Main : VAEntrypointVLD
52```
53
54For more information on VA-API and its usage within ChromeOS, see [this
55guide](https://chromium.googlesource.com/chromium/src/+/master/docs/gpu/vaapi.md).
56
57## Using
58
59The name of this crate is `cros-libva` to highlight the fact that it originates
60from ChromeOS and it not an official bindings. For ease of use, it is
61recommended to rename it to just `libva` in your project by using the following
62line in your `Cargo.toml`:
63
64```
65libva = { package = "cros-libva", version = "0.0.1" }
66```
67
68## Testing
69
70For a brief introduction on how to use this crate, see the
71`libva_utils_mpeg2vldemo` test under `src/lib.rs`. You can also quickly test
72MPEG2 decoding by running it:
73
74```
75cargo test -- --ignored libva_utils_mpeg2vldemo
76```