sphinx-speech-engine: deliver recognition notifications.
authorJanos Kovacs <jankovac503@gmail.com>
Thu, 6 Jun 2013 13:32:55 +0000 (16:32 +0300)
committerKrisztian Litkey <krisztian.litkey@intel.com>
Thu, 6 Jun 2013 13:50:43 +0000 (16:50 +0300)
src/plugins/sphinx-speech-engine/sphinx-plugin.c

index 9345f82..e4e3175 100644 (file)
@@ -57,7 +57,18 @@ struct plugin_s {
 
 int32_t plugin_utterance_handler(context_t *ctx, srs_srec_utterance_t *utt)
 {
-    int32_t length = utt->length ? utt->length : -1;
+    plugin_t *pl;
+    srs_srec_notify_t notify;
+    int32_t length;
+
+    if (!(pl = ctx->plugin) || !(notify = pl->notify.callback))
+        length = -1;
+    else {
+        length = notify(utt, pl->notify.data);
+
+        if (length < 0 && utt->length)
+            length = utt->length;
+    }
 
     return length;
 }