Skip to content

Commit 97538d1

Browse files
committed
Add version APIs to capi.rs.
Fixes #1801
1 parent 6722d75 commit 97538d1

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

src/capi.rs

+30
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,36 @@ pub struct Packet {
251251
pub frame_type: FrameType,
252252
}
253253

254+
/// Version information as presented in `[package]` `version`.
255+
///
256+
/// e.g. `0.1.0``
257+
///
258+
/// Can be parsed by [semver](https://crates.io/crates/semver).
259+
/// This returns the version of the loaded library, regardless
260+
/// of which version the library user was built against.
261+
#[no_mangle]
262+
pub unsafe extern fn rav1e_version_short() -> *const c_char {
263+
concat!(env!("CARGO_PKG_VERSION"), "\0").as_ptr() as *const c_char
264+
}
265+
266+
/// Version information with the information
267+
/// provided by `git describe --tags`.
268+
///
269+
/// e.g. `0.1.0 (v0.1.0-1-g743d464)`
270+
///
271+
/// This returns the version of the loaded library, regardless
272+
/// of which version the library user was built against.
273+
#[no_mangle]
274+
pub unsafe extern fn rav1e_version_full() -> *const c_char {
275+
concat!(
276+
env!("CARGO_PKG_VERSION"),
277+
" (",
278+
env!("VERGEN_SEMVER_LIGHTWEIGHT"),
279+
")\0"
280+
)
281+
.as_ptr() as *const c_char
282+
}
283+
254284
/// Simple Data
255285
///
256286
///

0 commit comments

Comments
 (0)