| 612 | }; |
| 613 | |
| 614 | bool _encoder_begin_callback(struct whisper_context * ctx, struct whisper_state * state, void * user_data){ |
| 615 | (void) state; |
| 616 | struct whisper_context_wrapper ctx_w; |
| 617 | ctx_w.ptr = ctx; |
| 618 | auto * params = static_cast<WhisperFullParamsWrapper *>(user_data); |
| 619 | if (!params || !params->py_encoder_begin_callback) { |
| 620 | return false; |
| 621 | } |
| 622 | |
| 623 | py::gil_scoped_acquire gil; |
| 624 | py::function callback = params->py_encoder_begin_callback; |
| 625 | py::object result_py; |
| 626 | if (!has_python_user_data(params->py_encoder_begin_callback_user_data)) { |
| 627 | result_py = callback(ctx_w); |
| 628 | } else { |
| 629 | result_py = callback(ctx_w, params->py_encoder_begin_callback_user_data); |
| 630 | } |
| 631 | bool res = result_py.cast<bool>(); |
| 632 | return res; |
| 633 | } |
| 634 | |
| 635 | void assign_encoder_begin_callback(struct whisper_full_params *params_base, py::object callback){ |
| 636 | auto * params = static_cast<WhisperFullParamsWrapper *>(params_base); |
nothing calls this directly
no test coverage detected