Skip to content

Commit 600fe3e

Browse files
authored
Merge pull request #157 from nxdefiant/master
Support -jsgf switch in gstreamer
2 parents 2da38af + 9e3e558 commit 600fe3e

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/gst-plugin/gstpocketsphinx.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ enum
134134
PROP_FSG_FILE,
135135
PROP_ALLPHONE_FILE,
136136
PROP_KWS_FILE,
137+
PROP_JSGF_FILE,
137138
PROP_FWDFLAT,
138139
PROP_BESTPATH,
139140
PROP_MAXHMMPF,
@@ -248,6 +249,12 @@ gst_pocketsphinx_class_init(GstPocketSphinxClass * klass)
248249
"List of keyphrases for spotting",
249250
NULL,
250251
G_PARAM_READWRITE));
252+
g_object_class_install_property
253+
(gobject_class, PROP_JSGF_FILE,
254+
g_param_spec_string("jsgf", "Grammer file",
255+
"File with grammer in Java Speech Grammar Format (JSGF)",
256+
NULL,
257+
G_PARAM_READWRITE));
251258
g_object_class_install_property
252259
(gobject_class, PROP_DICT_FILE,
253260
g_param_spec_string("dict", "Dictionary File",
@@ -389,6 +396,7 @@ gst_pocketsphinx_set_property(GObject * object, guint prop_id,
389396
gst_pocketsphinx_set_string(ps, "-fsg", NULL);
390397
gst_pocketsphinx_set_string(ps, "-allphone", NULL);
391398
gst_pocketsphinx_set_string(ps, "-kws", NULL);
399+
gst_pocketsphinx_set_string(ps, "-jsgf", NULL);
392400
break;
393401
case PROP_LMCTL_FILE:
394402
/* FSG and LM are mutually exclusive. */
@@ -397,6 +405,7 @@ gst_pocketsphinx_set_property(GObject * object, guint prop_id,
397405
gst_pocketsphinx_set_string(ps, "-fsg", NULL);
398406
gst_pocketsphinx_set_string(ps, "-allphone", NULL);
399407
gst_pocketsphinx_set_string(ps, "-kws", NULL);
408+
gst_pocketsphinx_set_string(ps, "-jsgf", NULL);
400409
break;
401410
case PROP_DICT_FILE:
402411
gst_pocketsphinx_set_string(ps, "-dict", value);
@@ -411,6 +420,7 @@ gst_pocketsphinx_set_property(GObject * object, guint prop_id,
411420
gst_pocketsphinx_set_string(ps, "-fsg", value);
412421
gst_pocketsphinx_set_string(ps, "-allphone", NULL);
413422
gst_pocketsphinx_set_string(ps, "-kws", NULL);
423+
gst_pocketsphinx_set_string(ps, "-jsgf", NULL);
414424
break;
415425
case PROP_ALLPHONE_FILE:
416426
/* FSG and LM are mutually exclusive. */
@@ -419,15 +429,26 @@ gst_pocketsphinx_set_property(GObject * object, guint prop_id,
419429
gst_pocketsphinx_set_string(ps, "-fsg", NULL);
420430
gst_pocketsphinx_set_string(ps, "-allphone", value);
421431
gst_pocketsphinx_set_string(ps, "-kws", NULL);
432+
gst_pocketsphinx_set_string(ps, "-jsgf", NULL);
422433
break;
423434
case PROP_KWS_FILE:
424435
/* FSG and LM are mutually exclusive. */
425436
gst_pocketsphinx_set_string(ps, "-lm", NULL);
426437
gst_pocketsphinx_set_string(ps, "-lmctl", NULL);
427438
gst_pocketsphinx_set_string(ps, "-fsg", NULL);
428439
gst_pocketsphinx_set_string(ps, "-allphone", NULL);
440+
gst_pocketsphinx_set_string(ps, "-jsgf", NULL);
429441
gst_pocketsphinx_set_string(ps, "-kws", value);
430442
break;
443+
case PROP_JSGF_FILE:
444+
/* FSG and LM are mutually exclusive. */
445+
gst_pocketsphinx_set_string(ps, "-lm", NULL);
446+
gst_pocketsphinx_set_string(ps, "-lmctl", NULL);
447+
gst_pocketsphinx_set_string(ps, "-fsg", NULL);
448+
gst_pocketsphinx_set_string(ps, "-allphone", NULL);
449+
gst_pocketsphinx_set_string(ps, "-kws", NULL);
450+
gst_pocketsphinx_set_string(ps, "-jsgf", value);
451+
break;
431452
case PROP_FWDFLAT:
432453
gst_pocketsphinx_set_boolean(ps, "-fwdflat", value);
433454
break;
@@ -464,6 +485,7 @@ gst_pocketsphinx_set_property(GObject * object, guint prop_id,
464485
gst_pocketsphinx_set_string(ps, "-lm", NULL);
465486
gst_pocketsphinx_set_string(ps, "-allphone", NULL);
466487
gst_pocketsphinx_set_string(ps, "-kws", NULL);
488+
gst_pocketsphinx_set_string(ps, "-jsgf", NULL);
467489
gst_pocketsphinx_set_string(ps, "-lmname", value);
468490

469491
/**
@@ -523,6 +545,9 @@ gst_pocketsphinx_get_property(GObject * object, guint prop_id,
523545
case PROP_KWS_FILE:
524546
g_value_set_string(value, cmd_ln_str_r(ps->config, "-kws"));
525547
break;
548+
case PROP_JSGF_FILE:
549+
g_value_set_string(value, cmd_ln_str_r(ps->config, "-jsgf"));
550+
break;
526551
case PROP_FWDFLAT:
527552
g_value_set_boolean(value, cmd_ln_boolean_r(ps->config, "-fwdflat"));
528553
break;

0 commit comments

Comments
 (0)