Module: Cohere::Transcribe::Audio::FFmpegNative
- Defined in:
- lib/cohere/transcribe/audio/ffmpeg_native.rb
Overview
Lazy binding for the gem's subprocess-free libav decoder adapter. The adapter itself dynamically selects a compatible FFmpeg 4-8 runtime; Ruby never launches ffmpeg and does not retain a Python codec runtime.
Defined Under Namespace
Classes: Library
Constant Summary collapse
- ERROR_CAPACITY =
1_024- CANCELLED_STATUS =
6
Class Method Summary collapse
- .available? ⇒ Boolean
-
.cancel_active! ⇒ Object
Pipeline cleanup must not load FFmpeg merely to discover that no native decode has ever started.
- .cancel_all! ⇒ Object
- .decode(path, sample_rate:, max_decoded_bytes:) ⇒ Object
- .diagnostic ⇒ Object
- .duration(path) ⇒ Object
- .library ⇒ Object
Class Method Details
.available? ⇒ Boolean
208 209 210 211 212 213 |
# File 'lib/cohere/transcribe/audio/ffmpeg_native.rb', line 208 def available? library true rescue TranscriptionRuntimeError false end |
.cancel_active! ⇒ Object
Pipeline cleanup must not load FFmpeg merely to discover that no native decode has ever started. If the adapter is already resident, this wakes every operation that captured an older cancellation generation while preserving later independent calls.
239 240 241 242 243 244 |
# File 'lib/cohere/transcribe/audio/ffmpeg_native.rb', line 239 def cancel_active! Library.loaded&.cancel_all! nil rescue Fiddle::DLError, TranscriptionRuntimeError nil end |
.cancel_all! ⇒ Object
229 230 231 232 233 |
# File 'lib/cohere/transcribe/audio/ffmpeg_native.rb', line 229 def cancel_all! library.cancel_all! rescue TranscriptionRuntimeError nil end |
.decode(path, sample_rate:, max_decoded_bytes:) ⇒ Object
221 222 223 |
# File 'lib/cohere/transcribe/audio/ffmpeg_native.rb', line 221 def decode(path, sample_rate:, max_decoded_bytes:) library.decode(path, sample_rate: sample_rate, max_decoded_bytes: max_decoded_bytes) end |
.diagnostic ⇒ Object
215 216 217 218 219 |
# File 'lib/cohere/transcribe/audio/ffmpeg_native.rb', line 215 def diagnostic library.diagnostic rescue TranscriptionRuntimeError => e e. end |
.duration(path) ⇒ Object
225 226 227 |
# File 'lib/cohere/transcribe/audio/ffmpeg_native.rb', line 225 def duration(path) library.duration(path) end |