1
2
3
/* automatically generated by rust-bindgen */

# [ repr ( C ) ] # [ repr ( align ( 16 ) ) ] # [ derive ( Debug , Copy , Clone ) ] pub struct max_align_t { pub __clang_max_align_nonce1 : :: std :: os :: raw :: c_longlong , pub __bindgen_padding_0 : u64 , pub __clang_max_align_nonce2 : u128 , } # [ test ] fn bindgen_test_layout_max_align_t ( ) { assert_eq ! ( :: std :: mem :: size_of :: < max_align_t > ( ) , 32usize , concat ! ( "Size of: " , stringify ! ( max_align_t ) ) ) ; assert_eq ! ( :: std :: mem :: align_of :: < max_align_t > ( ) , 16usize , concat ! ( "Alignment of " , stringify ! ( max_align_t ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < max_align_t > ( ) ) ) . __clang_max_align_nonce1 as * const _ as usize } , 0usize , concat ! ( "Offset of field: " , stringify ! ( max_align_t ) , "::" , stringify ! ( __clang_max_align_nonce1 ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < max_align_t > ( ) ) ) . __clang_max_align_nonce2 as * const _ as usize } , 16usize , concat ! ( "Offset of field: " , stringify ! ( max_align_t ) , "::" , stringify ! ( __clang_max_align_nonce2 ) ) ) ; } # [ repr ( C ) ] # [ derive ( Debug , Copy , Clone ) ] pub struct ModelState { _unused : [ u8 ; 0 ] , } # [ repr ( C ) ] # [ derive ( Debug , Copy , Clone ) ] pub struct StreamingState { _unused : [ u8 ; 0 ] , } # [ repr ( C ) ] # [ derive ( Debug , Copy , Clone ) ] pub struct MetadataItem { pub character : * mut :: std :: os :: raw :: c_char , pub timestep : :: std :: os :: raw :: c_int , pub start_time : f32 , } # [ test ] fn bindgen_test_layout_MetadataItem ( ) { assert_eq ! ( :: std :: mem :: size_of :: < MetadataItem > ( ) , 16usize , concat ! ( "Size of: " , stringify ! ( MetadataItem ) ) ) ; assert_eq ! ( :: std :: mem :: align_of :: < MetadataItem > ( ) , 8usize , concat ! ( "Alignment of " , stringify ! ( MetadataItem ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < MetadataItem > ( ) ) ) . character as * const _ as usize } , 0usize , concat ! ( "Offset of field: " , stringify ! ( MetadataItem ) , "::" , stringify ! ( character ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < MetadataItem > ( ) ) ) . timestep as * const _ as usize } , 8usize , concat ! ( "Offset of field: " , stringify ! ( MetadataItem ) , "::" , stringify ! ( timestep ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < MetadataItem > ( ) ) ) . start_time as * const _ as usize } , 12usize , concat ! ( "Offset of field: " , stringify ! ( MetadataItem ) , "::" , stringify ! ( start_time ) ) ) ; } # [ repr ( C ) ] # [ derive ( Debug , Copy , Clone ) ] pub struct Metadata { pub items : * mut MetadataItem , pub num_items : :: std :: os :: raw :: c_int , pub probability : f64 , } # [ test ] fn bindgen_test_layout_Metadata ( ) { assert_eq ! ( :: std :: mem :: size_of :: < Metadata > ( ) , 24usize , concat ! ( "Size of: " , stringify ! ( Metadata ) ) ) ; assert_eq ! ( :: std :: mem :: align_of :: < Metadata > ( ) , 8usize , concat ! ( "Alignment of " , stringify ! ( Metadata ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < Metadata > ( ) ) ) . items as * const _ as usize } , 0usize , concat ! ( "Offset of field: " , stringify ! ( Metadata ) , "::" , stringify ! ( items ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < Metadata > ( ) ) ) . num_items as * const _ as usize } , 8usize , concat ! ( "Offset of field: " , stringify ! ( Metadata ) , "::" , stringify ! ( num_items ) ) ) ; assert_eq ! ( unsafe { & ( * ( :: std :: ptr :: null :: < Metadata > ( ) ) ) . probability as * const _ as usize } , 16usize , concat ! ( "Offset of field: " , stringify ! ( Metadata ) , "::" , stringify ! ( probability ) ) ) ; } pub const DeepSpeech_Error_Codes_DS_ERR_OK : DeepSpeech_Error_Codes = 0 ; pub const DeepSpeech_Error_Codes_DS_ERR_NO_MODEL : DeepSpeech_Error_Codes = 4096 ; pub const DeepSpeech_Error_Codes_DS_ERR_INVALID_ALPHABET : DeepSpeech_Error_Codes = 8192 ; pub const DeepSpeech_Error_Codes_DS_ERR_INVALID_SHAPE : DeepSpeech_Error_Codes = 8193 ; pub const DeepSpeech_Error_Codes_DS_ERR_INVALID_LM : DeepSpeech_Error_Codes = 8194 ; pub const DeepSpeech_Error_Codes_DS_ERR_MODEL_INCOMPATIBLE : DeepSpeech_Error_Codes = 8195 ; pub const DeepSpeech_Error_Codes_DS_ERR_FAIL_INIT_MMAP : DeepSpeech_Error_Codes = 12288 ; pub const DeepSpeech_Error_Codes_DS_ERR_FAIL_INIT_SESS : DeepSpeech_Error_Codes = 12289 ; pub const DeepSpeech_Error_Codes_DS_ERR_FAIL_INTERPRETER : DeepSpeech_Error_Codes = 12290 ; pub const DeepSpeech_Error_Codes_DS_ERR_FAIL_RUN_SESS : DeepSpeech_Error_Codes = 12291 ; pub const DeepSpeech_Error_Codes_DS_ERR_FAIL_CREATE_STREAM : DeepSpeech_Error_Codes = 12292 ; pub const DeepSpeech_Error_Codes_DS_ERR_FAIL_READ_PROTOBUF : DeepSpeech_Error_Codes = 12293 ; pub const DeepSpeech_Error_Codes_DS_ERR_FAIL_CREATE_SESS : DeepSpeech_Error_Codes = 12294 ; pub type DeepSpeech_Error_Codes = u32 ; extern "C" { # [ doc = " @brief An object providing an interface to a trained DeepSpeech model." ] # [ doc = "" ] # [ doc = " @param aModelPath The path to the frozen model graph." ] # [ doc = " @param aNCep The number of cepstrum the model was trained with." ] # [ doc = " @param aNContext The context window the model was trained with." ] # [ doc = " @param aAlphabetConfigPath The path to the configuration file specifying" ] # [ doc = "                            the alphabet used by the network. See alphabet.h." ] # [ doc = " @param aBeamWidth The beam width used by the decoder. A larger beam" ] # [ doc = "                   width generates better results at the cost of decoding" ] # [ doc = "                   time." ] # [ doc = " @param[out] retval a ModelState pointer" ] # [ doc = "" ] # [ doc = " @return Zero on success, non-zero on failure." ] pub fn DS_CreateModel ( aModelPath : * const :: std :: os :: raw :: c_char , aNCep : :: std :: os :: raw :: c_uint , aNContext : :: std :: os :: raw :: c_uint , aAlphabetConfigPath : * const :: std :: os :: raw :: c_char , aBeamWidth : :: std :: os :: raw :: c_uint , retval : * mut * mut ModelState ) -> :: std :: os :: raw :: c_int ; } extern "C" { # [ doc = " @brief Frees associated resources and destroys model object." ] pub fn DS_DestroyModel ( ctx : * mut ModelState ) ; } extern "C" { # [ doc = " @brief Enable decoding using beam scoring with a KenLM language model." ] # [ doc = "" ] # [ doc = " @param aCtx The ModelState pointer for the model being changed." ] # [ doc = " @param aAlphabetConfigPath The path to the configuration file specifying" ] # [ doc = "                            the alphabet used by the network. See alphabet.h." ] # [ doc = " @param aLMPath The path to the language model binary file." ] # [ doc = " @param aTriePath The path to the trie file build from the same vocabu-" ] # [ doc = "                  lary as the language model binary." ] # [ doc = " @param aLMAlpha The alpha hyperparameter of the CTC decoder. Language Model" ] # [ doc = "weight." ] # [ doc = " @param aLMBeta The beta hyperparameter of the CTC decoder. Word insertion" ] # [ doc = "weight." ] # [ doc = "" ] # [ doc = " @return Zero on success, non-zero on failure (invalid arguments)." ] pub fn DS_EnableDecoderWithLM ( aCtx : * mut ModelState , aAlphabetConfigPath : * const :: std :: os :: raw :: c_char , aLMPath : * const :: std :: os :: raw :: c_char , aTriePath : * const :: std :: os :: raw :: c_char , aLMAlpha : f32 , aLMBeta : f32 ) -> :: std :: os :: raw :: c_int ; } extern "C" { # [ doc = " @brief Use the DeepSpeech model to perform Speech-To-Text." ] # [ doc = "" ] # [ doc = " @param aCtx The ModelState pointer for the model to use." ] # [ doc = " @param aBuffer A 16-bit, mono raw audio signal at the appropriate" ] # [ doc = "                sample rate." ] # [ doc = " @param aBufferSize The number of samples in the audio signal." ] # [ doc = " @param aSampleRate The sample-rate of the audio signal." ] # [ doc = "" ] # [ doc = " @return The STT result. The user is responsible for freeing the string using" ] # [ doc = "         {@link DS_FreeString()}. Returns NULL on error." ] pub fn DS_SpeechToText ( aCtx : * mut ModelState , aBuffer : * const :: std :: os :: raw :: c_short , aBufferSize : :: std :: os :: raw :: c_uint , aSampleRate : :: std :: os :: raw :: c_uint ) -> * mut :: std :: os :: raw :: c_char ; } extern "C" { # [ doc = " @brief Use the DeepSpeech model to perform Speech-To-Text and output metadata" ] # [ doc = " about the results." ] # [ doc = "" ] # [ doc = " @param aCtx The ModelState pointer for the model to use." ] # [ doc = " @param aBuffer A 16-bit, mono raw audio signal at the appropriate" ] # [ doc = "                sample rate." ] # [ doc = " @param aBufferSize The number of samples in the audio signal." ] # [ doc = " @param aSampleRate The sample-rate of the audio signal." ] # [ doc = "" ] # [ doc = " @return Outputs a struct of individual letters along with their timing information." ] # [ doc = "         The user is responsible for freeing Metadata by calling {@link DS_FreeMetadata()}. Returns NULL on error." ] pub fn DS_SpeechToTextWithMetadata ( aCtx : * mut ModelState , aBuffer : * const :: std :: os :: raw :: c_short , aBufferSize : :: std :: os :: raw :: c_uint , aSampleRate : :: std :: os :: raw :: c_uint ) -> * mut Metadata ; } extern "C" { # [ doc = " @brief Create a new streaming inference state. The streaming state returned" ] # [ doc = "        by this function can then be passed to {@link DS_FeedAudioContent()}" ] # [ doc = "        and {@link DS_FinishStream()}." ] # [ doc = "" ] # [ doc = " @param aCtx The ModelState pointer for the model to use." ] # [ doc = " @param aPreAllocFrames Number of timestep frames to reserve. One timestep" ] # [ doc = "                        is equivalent to two window lengths (20ms). If set to" ] # [ doc = "                        0 we reserve enough frames for 3 seconds of audio (150)." ] # [ doc = " @param aSampleRate The sample-rate of the audio signal." ] # [ doc = " @param[out] retval an opaque pointer that represents the streaming state. Can" ] # [ doc = "                    be NULL if an error occurs." ] # [ doc = "" ] # [ doc = " @return Zero for success, non-zero on failure." ] pub fn DS_SetupStream ( aCtx : * mut ModelState , aPreAllocFrames : :: std :: os :: raw :: c_uint , aSampleRate : :: std :: os :: raw :: c_uint , retval : * mut * mut StreamingState ) -> :: std :: os :: raw :: c_int ; } extern "C" { # [ doc = " @brief Feed audio samples to an ongoing streaming inference." ] # [ doc = "" ] # [ doc = " @param aSctx A streaming state pointer returned by {@link DS_SetupStream()}." ] # [ doc = " @param aBuffer An array of 16-bit, mono raw audio samples at the" ] # [ doc = "                appropriate sample rate." ] # [ doc = " @param aBufferSize The number of samples in @p aBuffer." ] pub fn DS_FeedAudioContent ( aSctx : * mut StreamingState , aBuffer : * const :: std :: os :: raw :: c_short , aBufferSize : :: std :: os :: raw :: c_uint ) ; } extern "C" { # [ doc = " @brief Compute the intermediate decoding of an ongoing streaming inference." ] # [ doc = "        This is an expensive process as the decoder implementation isn't" ] # [ doc = "        currently capable of streaming, so it always starts from the beginning" ] # [ doc = "        of the audio." ] # [ doc = "" ] # [ doc = " @param aSctx A streaming state pointer returned by {@link DS_SetupStream()}." ] # [ doc = "" ] # [ doc = " @return The STT intermediate result. The user is responsible for freeing the" ] # [ doc = "         string using {@link DS_FreeString()}." ] pub fn DS_IntermediateDecode ( aSctx : * mut StreamingState ) -> * mut :: std :: os :: raw :: c_char ; } extern "C" { # [ doc = " @brief Signal the end of an audio signal to an ongoing streaming" ] # [ doc = "        inference, returns the STT result over the whole audio signal." ] # [ doc = "" ] # [ doc = " @param aSctx A streaming state pointer returned by {@link DS_SetupStream()}." ] # [ doc = "" ] # [ doc = " @return The STT result. The user is responsible for freeing the string using" ] # [ doc = "         {@link DS_FreeString()}." ] # [ doc = "" ] # [ doc = " @note This method will free the state pointer (@p aSctx)." ] pub fn DS_FinishStream ( aSctx : * mut StreamingState ) -> * mut :: std :: os :: raw :: c_char ; } extern "C" { # [ doc = " @brief Signal the end of an audio signal to an ongoing streaming" ] # [ doc = "        inference, returns per-letter metadata." ] # [ doc = "" ] # [ doc = " @param aSctx A streaming state pointer returned by {@link DS_SetupStream()}." ] # [ doc = "" ] # [ doc = " @return Outputs a struct of individual letters along with their timing information." ] # [ doc = "         The user is responsible for freeing Metadata by calling {@link DS_FreeMetadata()}. Returns NULL on error." ] # [ doc = "" ] # [ doc = " @note This method will free the state pointer (@p aSctx)." ] pub fn DS_FinishStreamWithMetadata ( aSctx : * mut StreamingState ) -> * mut Metadata ; } extern "C" { # [ doc = " @brief Destroy a streaming state without decoding the computed logits. This" ] # [ doc = "        can be used if you no longer need the result of an ongoing streaming" ] # [ doc = "        inference and don't want to perform a costly decode operation." ] # [ doc = "" ] # [ doc = " @param aSctx A streaming state pointer returned by {@link DS_SetupStream()}." ] # [ doc = "" ] # [ doc = " @note This method will free the state pointer (@p aSctx)." ] pub fn DS_DiscardStream ( aSctx : * mut StreamingState ) ; } extern "C" { # [ doc = " @brief Free memory allocated for metadata information." ] pub fn DS_FreeMetadata ( m : * mut Metadata ) ; } extern "C" { # [ doc = " @brief Free a char* string returned by the DeepSpeech API." ] pub fn DS_FreeString ( str : * mut :: std :: os :: raw :: c_char ) ; } extern "C" { # [ doc = " @brief Print version of this library and of the linked TensorFlow library." ] pub fn DS_PrintVersions ( ) ; }