@ -0,0 +1,463 @@ /* * Copyright (c) 2025 Vittorio Palmisano * * This file is part of FFmpeg. * * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with FFmpeg; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <whisper.h> #include "libavutil/avutil.h" #include "libavutil/opt.h" #include "libavutil/channel_layout.h" #include "libavutil/samplefmt.h" #include "libavfilter/avfilter.h" #include "libavfilter/audio.h" #include "libavutil/mem.h" #include "libavutil/avstring.h" #include "libavutil/internal.h" #include "libavformat/avio.h" #include "libavutil/thread.h" #include "formats.h" typedef struct WhisperContext { const AVClass *class; char *model_path; char *language; bool use_gpu; int gpu_device; char *vad_model_path; float vad_threshold; int64_t vad_min_speech_duration; int64_t vad_min_silence_duration; int64_t queue; char *destination; char *format; struct whisper_context *ctx_wsp; struct whisper_vad_context *ctx_vad; struct whisper_vad_params vad_params; float *audio_buffer; int audio_buffer_queue_size; int audio_buffer_fill_size; int audio_buffer_vad_size; int64_t audio_buffer_start_ms; int eof; int64_t next_pts; AVIOContext *avio_context; int index; } WhisperContext; static void cb_log(enum ggml_log_level level, const char *text, void *user_data) { AVFilterContext *ctx = user_data; int av_log_level = AV_LOG_DEBU...
First seen: 2025-08-13 10:58
Last seen: 2025-08-14 01:09