add changes from whisper.cpp update
This commit is contained in:
parent
7c78c128a1
commit
13d44e5881
9 changed files with 536 additions and 140 deletions
26
src/whisper_state.rs
Normal file
26
src/whisper_state.rs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
/// Rustified pointer to a Whisper state.
|
||||
#[derive(Debug)]
|
||||
pub struct WhisperState {
|
||||
ptr: *mut whisper_rs_sys::whisper_state,
|
||||
}
|
||||
|
||||
unsafe impl Send for WhisperState {}
|
||||
unsafe impl Sync for WhisperState {}
|
||||
|
||||
impl Drop for WhisperState {
|
||||
fn drop(&mut self) {
|
||||
unsafe {
|
||||
whisper_rs_sys::whisper_free_state(self.ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl WhisperState {
|
||||
pub(crate) unsafe fn new(ptr: *mut whisper_rs_sys::whisper_state) -> Self {
|
||||
Self { ptr }
|
||||
}
|
||||
|
||||
pub(crate) fn as_ptr(&self) -> *mut whisper_rs_sys::whisper_state {
|
||||
self.ptr
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue