From 66f8aaeb86c88bf811f83c200bee9b2465351a8d Mon Sep 17 00:00:00 2001 From: Zero Date: Mon, 28 Aug 2023 15:58:28 -0600 Subject: [PATCH] Update whisper.cpp to 8e46ba80d3c1dcf532a0029f9bcdf99ce9ce7d40 --- src/standalone.rs | 18 ------------------ src/whisper_ctx.rs | 17 +++++++++++++++++ sys/whisper.cpp | 2 +- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/src/standalone.rs b/src/standalone.rs index 318e99f..ef7373a 100644 --- a/src/standalone.rs +++ b/src/standalone.rs @@ -1,6 +1,5 @@ //! Standalone functions that have no associated type. -use crate::WhisperToken; use std::ffi::{c_int, CStr, CString}; /// Return the id of the specified language, returns -1 if not found @@ -54,23 +53,6 @@ pub fn get_lang_str(id: i32) -> Option<&'static str> { } } -// task tokens -/// Get the ID of the translate task token. -/// -/// # C++ equivalent -/// `whisper_token whisper_token_translate ()` -pub fn token_translate() -> WhisperToken { - unsafe { whisper_rs_sys::whisper_token_translate() } -} - -/// Get the ID of the transcribe task token. -/// -/// # C++ equivalent -/// `whisper_token whisper_token_transcribe()` -pub fn token_transcribe() -> WhisperToken { - unsafe { whisper_rs_sys::whisper_token_transcribe() } -} - /// Print system information. /// /// # C++ equivalent diff --git a/src/whisper_ctx.rs b/src/whisper_ctx.rs index c8c906c..e035c07 100644 --- a/src/whisper_ctx.rs +++ b/src/whisper_ctx.rs @@ -432,6 +432,23 @@ impl WhisperContext { pub fn reset_timings(&self) { unsafe { whisper_rs_sys::whisper_reset_timings(self.ctx) } } + + // task tokens + /// Get the ID of the translate task token. + /// + /// # C++ equivalent + /// `whisper_token whisper_token_translate ()` + pub fn token_translate(&self) -> WhisperToken { + unsafe { whisper_rs_sys::whisper_token_translate(self.ctx) } + } + + /// Get the ID of the transcribe task token. + /// + /// # C++ equivalent + /// `whisper_token whisper_token_transcribe()` + pub fn token_transcribe(&self) -> WhisperToken { + unsafe { whisper_rs_sys::whisper_token_transcribe(self.ctx) } + } } impl Drop for WhisperContext { diff --git a/sys/whisper.cpp b/sys/whisper.cpp index a5defbc..8e46ba8 160000 --- a/sys/whisper.cpp +++ b/sys/whisper.cpp @@ -1 +1 @@ -Subproject commit a5defbc1b98bea0f070331ce1e8b62d947b0443d +Subproject commit 8e46ba80d3c1dcf532a0029f9bcdf99ce9ce7d40