| 13 | #include <algorithm> |
| 14 | #include <numeric> |
| 15 | audio_data_t Gemma4e::load_audio_base64(const std::string &base64_str, int resample_rate, MonoDownmixMode downmix) { |
| 16 | audio_data_t empty_result; |
| 17 | audio_data_t result; |
| 18 | // Decode base64 to raw bytes |
| 19 | std::string audio_bytes = base64::from_base64(base64_str); |
| 20 | if (!audio_reader_.load_audio_from_memory(reinterpret_cast<const uint8_t*>(audio_bytes.data()), audio_bytes.size(), result, resample_rate, downmix)) { |
| 21 | std::cerr << "Failed to load audio from base64 string" << std::endl; |
| 22 | exit(-1); |
| 23 | //return empty_result; |
| 24 | } |
| 25 | return result; |
| 26 | } |
| 27 | |
| 28 | |
| 29 |
no test coverage detected