Merge pull request #2324 from bjornbytes/c-compat

Make deepspeech.h compilable as C
This commit is contained in:
Reuben Morais 2019-08-28 10:38:15 +02:00 committed by GitHub
commit 289e346a66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,34 +1,38 @@
#ifndef DEEPSPEECH_H
#define DEEPSPEECH_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef SWIG
#if defined _MSC_VER
#define DEEPSPEECH_EXPORT extern "C" __declspec(dllexport)
#else /*End of _MSC_VER*/
#define DEEPSPEECH_EXPORT extern "C" __attribute__ ((visibility("default")))
#endif /*End of SWIG*/
#define DEEPSPEECH_EXPORT __declspec(dllexport)
#else /*End of _MSC_VER*/
#define DEEPSPEECH_EXPORT __attribute__ ((visibility("default")))
#endif /*End of SWIG*/
#else
#define DEEPSPEECH_EXPORT
#endif
struct ModelState;
typedef struct ModelState ModelState;
struct StreamingState;
typedef struct StreamingState StreamingState;
// Stores each individual character, along with its timing information
struct MetadataItem {
typedef struct MetadataItem {
char* character;
int timestep; // Position of the character in units of 20ms
float start_time; // Position of the character in seconds
};
} MetadataItem;
// Stores the entire CTC output as an array of character metadata objects
struct Metadata {
typedef struct Metadata {
MetadataItem* items;
int num_items;
// Approximated probability (confidence value) for this transcription.
double probability;
};
} Metadata;
enum DeepSpeech_Error_Codes
{
@ -249,4 +253,8 @@ void DS_PrintVersions();
#undef DEEPSPEECH_EXPORT
#ifdef __cplusplus
}
#endif
#endif /* DEEPSPEECH_H */