diff --git a/Cargo.toml b/Cargo.toml index 5f870e3..e92fefd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ exclude = ["examples/full_usage"] [package] name = "whisper-rs" -version = "0.10.0" +version = "0.10.1" edition = "2021" description = "Rust bindings for whisper.cpp" license = "Unlicense" diff --git a/src/standalone.rs b/src/standalone.rs index e945dfb..eb49751 100644 --- a/src/standalone.rs +++ b/src/standalone.rs @@ -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. /// /// # Safety diff --git a/sys/Cargo.toml b/sys/Cargo.toml index 1966542..a6ddf80 100644 --- a/sys/Cargo.toml +++ b/sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "whisper-rs-sys" -version = "0.8.0" +version = "0.8.1" edition = "2021" description = "Rust bindings for whisper.cpp (FFI bindings)" license = "Unlicense" diff --git a/sys/whisper.cpp b/sys/whisper.cpp index d38af15..0b9af32 160000 --- a/sys/whisper.cpp +++ b/sys/whisper.cpp @@ -1 +1 @@ -Subproject commit d38af151a1ed5378c5a9ae368e767ed22c8ab141 +Subproject commit 0b9af32a8b3fa7e2ae5f15a9a08f5b10394993f5