Fix print_system_info return value
This commit is contained in:
parent
520ea9d4d8
commit
d3825debff
@ -1,7 +1,7 @@
|
||||
//! Standalone functions that have no associated type.
|
||||
|
||||
use crate::WhisperToken;
|
||||
use std::ffi::{c_int, CString};
|
||||
use std::ffi::{c_int, CStr, CString};
|
||||
|
||||
/// Return the id of the specified language, returns -1 if not found
|
||||
///
|
||||
@ -47,6 +47,8 @@ pub fn token_transcribe() -> WhisperToken {
|
||||
///
|
||||
/// # C++ equivalent
|
||||
/// `const char * whisper_print_system_info()`
|
||||
pub fn print_system_info() {
|
||||
unsafe { whisper_rs_sys::whisper_print_system_info() };
|
||||
pub fn print_system_info() -> &'static str {
|
||||
let c_buf = unsafe { whisper_rs_sys::whisper_print_system_info() };
|
||||
let c_str = unsafe { CStr::from_ptr(c_buf) };
|
||||
c_str.to_str().unwrap()
|
||||
}
|
@ -111,6 +111,7 @@ pub fn convert_stereo_to_mono_audio_simd(samples: &[f32]) -> Vec<f32> {
|
||||
mono
|
||||
}
|
||||
|
||||
#[cfg(feature = "simd")]
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
@ -363,7 +363,7 @@ impl WhisperContext {
|
||||
unsafe { whisper_rs_sys::whisper_token_beg(self.ctx) }
|
||||
}
|
||||
|
||||
/// Print performance statistics to stdout.
|
||||
/// Print performance statistics to stderr.
|
||||
///
|
||||
/// # C++ equivalent
|
||||
/// `void whisper_print_timings(struct whisper_context * ctx)`
|
||||
|
@ -12,7 +12,8 @@ fn main() {
|
||||
let _: u64 = std::fs::copy(
|
||||
"src/bindings.rs",
|
||||
env::var("OUT_DIR").unwrap() + "/bindings.rs",
|
||||
).expect("Failed to copy bindings.rs");
|
||||
)
|
||||
.expect("Failed to copy bindings.rs");
|
||||
} else {
|
||||
let bindings = bindgen::Builder::default()
|
||||
.header("wrapper.h")
|
||||
|
Loading…
Reference in New Issue
Block a user