Add API to get version information (#2309)
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "sherpa-onnx/csrc/speaker-embedding-manager.h"
|
||||
#include "sherpa-onnx/csrc/spoken-language-identification.h"
|
||||
#include "sherpa-onnx/csrc/text-utils.h"
|
||||
#include "sherpa-onnx/csrc/version.h"
|
||||
#include "sherpa-onnx/csrc/voice-activity-detector.h"
|
||||
#include "sherpa-onnx/csrc/wave-reader.h"
|
||||
#include "sherpa-onnx/csrc/wave-writer.h"
|
||||
@@ -44,6 +45,10 @@
|
||||
#include "sherpa-onnx/csrc/offline-speaker-diarization.h"
|
||||
#endif
|
||||
|
||||
const char *SherpaOnnxGetVersionStr() { return sherpa_onnx::GetVersionStr(); }
|
||||
const char *SherpaOnnxGetGitSha1() { return sherpa_onnx::GetGitSha1(); }
|
||||
const char *SherpaOnnxGetGitDate() { return sherpa_onnx::GetGitDate(); }
|
||||
|
||||
struct SherpaOnnxOnlineRecognizer {
|
||||
std::unique_ptr<sherpa_onnx::OnlineRecognizer> impl;
|
||||
};
|
||||
@@ -1369,9 +1374,8 @@ int64_t SherpaOnnxWaveFileSize(int32_t n_samples) {
|
||||
return sherpa_onnx::WaveFileSize(n_samples);
|
||||
}
|
||||
|
||||
SHERPA_ONNX_API void SherpaOnnxWriteWaveToBuffer(const float *samples,
|
||||
int32_t n, int32_t sample_rate,
|
||||
char *buffer) {
|
||||
void SherpaOnnxWriteWaveToBuffer(const float *samples, int32_t n,
|
||||
int32_t sample_rate, char *buffer) {
|
||||
sherpa_onnx::WriteWave(buffer, sample_rate, samples, n);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,30 @@ extern "C" {
|
||||
#define SHERPA_ONNX_API SHERPA_ONNX_IMPORT
|
||||
#endif
|
||||
|
||||
// Please don't free the returned pointer.
|
||||
// Please don't modify the memory pointed by the returned pointer.
|
||||
//
|
||||
// The memory pointed by the returned pointer is statically allocated.
|
||||
//
|
||||
// Example return value: "1.12.1"
|
||||
SHERPA_ONNX_API const char *SherpaOnnxGetVersionStr();
|
||||
|
||||
// Please don't free the returned pointer.
|
||||
// Please don't modify the memory pointed by the returned pointer.
|
||||
//
|
||||
// The memory pointed by the returned pointer is statically allocated.
|
||||
//
|
||||
// Example return value: "6982b86c"
|
||||
SHERPA_ONNX_API const char *SherpaOnnxGetGitSha1();
|
||||
|
||||
// Please don't free the returned pointer.
|
||||
// Please don't modify the memory pointed by the returned pointer.
|
||||
//
|
||||
// The memory pointed by the returned pointer is statically allocated.
|
||||
//
|
||||
// Example return value: "Fri Jun 20 11:22:52 2025"
|
||||
SHERPA_ONNX_API const char *SherpaOnnxGetGitDate();
|
||||
|
||||
/// Please refer to
|
||||
/// https://k2-fsa.github.io/sherpa/onnx/pretrained_models/index.html
|
||||
/// to download pre-trained models. That is, you can find encoder-xxx.onnx
|
||||
|
||||
@@ -717,4 +717,10 @@ int32_t LinearResampler::GetOutputSamplingRate() const {
|
||||
return SherpaOnnxLinearResamplerResampleGetOutputSampleRate(p_);
|
||||
}
|
||||
|
||||
std::string GetVersionStr() { return SherpaOnnxGetVersionStr(); }
|
||||
|
||||
std::string GetGitSha1() { return SherpaOnnxGetGitSha1(); }
|
||||
|
||||
std::string GetGitDate() { return SherpaOnnxGetGitDate(); }
|
||||
|
||||
} // namespace sherpa_onnx::cxx
|
||||
|
||||
@@ -615,6 +615,10 @@ class SHERPA_ONNX_API LinearResampler
|
||||
explicit LinearResampler(const SherpaOnnxLinearResampler *p);
|
||||
};
|
||||
|
||||
std::string GetVersionStr();
|
||||
std::string GetGitSha1();
|
||||
std::string GetGitDate();
|
||||
|
||||
} // namespace sherpa_onnx::cxx
|
||||
|
||||
#endif // SHERPA_ONNX_C_API_CXX_API_H_
|
||||
|
||||
Reference in New Issue
Block a user