* Copyright (C) 2026 Xiaomi Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
int volc_asr_register(void);
int volc_asr_recognize(const unsigned char *pcm_data,
size_t pcm_len,
const char *app_id,
const char *token,
const char *cluster,
char *text_out,
size_t text_cap);
typedef struct volc_asr_stream volc_asr_stream_t;
* Returns NULL on failure. Caller must call volc_asr_stream_finish()
* or volc_asr_stream_abort() to release resources. */
volc_asr_stream_t *volc_asr_stream_open(void);
* Returns 0 on success, negative errno on error. */
int volc_asr_stream_send(volc_asr_stream_t *s,
const unsigned char *pcm, size_t len);
* text_out receives the recognized text (NUL-terminated).
* Returns 0 on success, negative errno on error. Always frees s. */
int volc_asr_stream_finish(volc_asr_stream_t *s,
char *text_out, size_t text_cap);
void volc_asr_stream_abort(volc_asr_stream_t *s);
#ifdef __cplusplus
}
#endif