From 0241f725cdf2b905ada67fb17550d522f5fde8a4 Mon Sep 17 00:00:00 2001
From: Reuben Morais <reuben.morais@gmail.com>
Date: Thu, 10 Oct 2019 21:45:33 +0200
Subject: [PATCH] Expose model sample rate in API

---
 native_client/deepspeech.cc |  6 ++++++
 native_client/deepspeech.h  | 10 ++++++++++
 2 files changed, 16 insertions(+)

diff --git a/native_client/deepspeech.cc b/native_client/deepspeech.cc
index 439702a6..9aee0f8e 100644
--- a/native_client/deepspeech.cc
+++ b/native_client/deepspeech.cc
@@ -292,6 +292,12 @@ DS_CreateModel(const char* aModelPath,
   return DS_ERR_OK;
 }
 
+int
+DS_GetModelSampleRate(ModelState* aCtx)
+{
+  return aCtx->sample_rate_;
+}
+
 void
 DS_FreeModel(ModelState* ctx)
 {
diff --git a/native_client/deepspeech.h b/native_client/deepspeech.h
index ef25e985..ed9d8638 100644
--- a/native_client/deepspeech.h
+++ b/native_client/deepspeech.h
@@ -92,6 +92,16 @@ int DS_CreateModel(const char* aModelPath,
                    unsigned int aBeamWidth,
                    ModelState** retval);
 
+/**
+ * @brief Return the sample rate expected by a model.
+ *
+ * @param aCtx A ModelState pointer created with {@link DS_CreateModel}.
+ *
+ * @return Sample rate expected by the model for its input.
+ */
+DEEPSPEECH_EXPORT
+int DS_GetModelSampleRate(ModelState* aCtx);
+
 /**
  * @brief Frees associated resources and destroys model object.
  */