add changes from whisper.cpp update

This commit is contained in:
Zero 2023-04-17 17:57:00 -06:00
parent 7c78c128a1
commit 13d44e5881
No known key found for this signature in database
GPG key ID: 3861E636EA1E0E2B
9 changed files with 536 additions and 140 deletions

26
src/whisper_state.rs Normal file
View 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
}
}