Add whisper_lang_str_full function to whisper-rs
This commit is contained in:
parent
22bf23a168
commit
e195c885a1
3 changed files with 1584 additions and 1091 deletions
|
|
@ -4,7 +4,7 @@ exclude = ["examples/full_usage"]
|
||||||
|
|
||||||
[package]
|
[package]
|
||||||
name = "whisper-rs"
|
name = "whisper-rs"
|
||||||
version = "0.10.0"
|
version = "0.10.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "Rust bindings for whisper.cpp"
|
description = "Rust bindings for whisper.cpp"
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,23 @@ pub fn get_lang_str(id: i32) -> Option<&'static str> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the full string of the specified language name (e.g. 2 -> "german").
|
||||||
|
///
|
||||||
|
/// # Returns
|
||||||
|
/// The full string of the language, None if not found.
|
||||||
|
///
|
||||||
|
/// # C++ equivalent
|
||||||
|
/// `const char * whisper_lang_str_full(int id)`
|
||||||
|
pub fn get_lang_str_full(id: i32) -> Option<&'static str> {
|
||||||
|
let c_buf = unsafe { whisper_rs_sys::whisper_lang_str_full(id) };
|
||||||
|
if c_buf.is_null() {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
let c_str = unsafe { CStr::from_ptr(c_buf) };
|
||||||
|
Some(c_str.to_str().unwrap())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Callback to control logging output: default behaviour is to print to stderr.
|
/// Callback to control logging output: default behaviour is to print to stderr.
|
||||||
///
|
///
|
||||||
/// # Safety
|
/// # Safety
|
||||||
|
|
|
||||||
1034
sys/src/bindings.rs
1034
sys/src/bindings.rs
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue