From f4dd0b700506c6fee2fb07ebdf6e6c6c16f2cff3 Mon Sep 17 00:00:00 2001 From: Koen Kooi Date: Thu, 27 Aug 2009 11:11:06 +0200 Subject: [PATCH] julius: add commandpipe patch from TI to allow commands over a pipe to control apps using your voice --- .../patch-julius-4.1.2-command-pipe.patch | 162 ++++++++++++++++++ recipes/julius/julius_4.1.2.bb | 5 +- 2 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 recipes/julius/julius/patch-julius-4.1.2-command-pipe.patch diff --git a/recipes/julius/julius/patch-julius-4.1.2-command-pipe.patch b/recipes/julius/julius/patch-julius-4.1.2-command-pipe.patch new file mode 100644 index 0000000000..61b63614ce --- /dev/null +++ b/recipes/julius/julius/patch-julius-4.1.2-command-pipe.patch @@ -0,0 +1,162 @@ +diff -uNr julius-4.1/julius/main.c ../Desktop/julius-4.1/julius/main.c +--- julius-4.1/julius/main.c 2008-11-21 14:00:56.000000000 +0000 ++++ ../Desktop/julius-4.1/julius/main.c 2008-03-17 16:58:37.000000000 +0000 +@@ -24,12 +24,14 @@ + */ + + #include "app.h" ++#define CMDPIPE "/tmp/cmdpipe" + + boolean separate_score_flag = FALSE; + boolean outfile_enabled = FALSE; + + static char *logfile = NULL; + static boolean nolog = FALSE; ++FILE *pipeFd; + + /************************************************************************/ + /** +@@ -77,6 +79,31 @@ + FILE *fp; + Recog *recog; + Jconf *jconf; ++ ++ ++ ++ printf("Initialise cmd pipe in Julius\n"); ++ ++ ++ ++ pipeFd = fopen(CMDPIPE,"w"); ++ ++ if (pipeFd == NULL) { ++ printf("Creating named pipe '%s' as it doesn't exist\n",CMDPIPE); ++ ++ unlink(CMDPIPE); ++ ++ if (mkfifo(CMDPIPE,0777)) { ++ fprintf(stderr,"Failed to create command pipe \"%s\"\n", ++ CMDPIPE); ++ } ++ ++ chmod(CMDPIPE,0666); ++ ++ } ++ else { ++ fclose(pipeFd); ++ } + + /* inihibit system log output (default: stdout) */ + //jlog_set_output(NULL); +--- /julius/output_stdout.c 2008-12-12 07:14:57.000000000 +0000 ++++ /julius/output_stdout.c 2009-03-26 10:39:19.000000000 +0000 +@@ -21,21 +21,26 @@ + * Copyright (c) 2005-2007 Julius project team, Nagoya Institute of Technology + * All rights reserved + */ ++#define CMDPIPE "/tmp/cmdpipe" + + #include "app.h" + + extern boolean separate_score_flag; + ++FILE *cmdpipeFd = NULL; ++ + static boolean have_progout = FALSE; + + /* for short pause segmentation and successive decoding */ + static WORD_ID confword[MAXSEQNUM]; + static int confwordnum; +- ++// for cmd pipe ++static int osdFlag = 1; + #ifdef CHARACTER_CONVERSION + #define MAXBUFLEN 4096 ///< Maximum line length of a message sent from a client + static char inbuf[MAXBUFLEN]; + static char outbuf[MAXBUFLEN]; ++static char command[MAXBUFLEN]; + void + myprintf(char *fmt, ...) + { +@@ -614,13 +619,80 @@ + put_hypo_woutput(WORD_ID *seq, int n, WORD_INFO *winfo) + { + int i; ++cmdpipeFd = fopen(CMDPIPE,"w"); ++ + + if (seq != NULL) { + for (i=0;iwoutput[seq[i]]); +- } ++ strcat(command,winfo->woutput[seq[i]]); ++ } + } + printf("\n"); ++ ++ ++if (!(strncmp(command,"STOP",12))) { ++ fputs("stop\n",cmdpipeFd); ++ return 0; ++ } ++ else if (!(strncmp(command,"OSDOFF",14)) && osdFlag == 1) { ++ fputs("hide",cmdpipeFd); ++ osdFlag = 0; ++ } ++ else if (!(strncmp(command,"OSDON",12)) && osdFlag == 0) { ++ fputs("hide",cmdpipeFd); ++ osdFlag = 1; ++ } ++ else if (!(strncmp(command,"PAUSE",13))) { ++ fputs("pause",cmdpipeFd); ++ } ++ else if (!(strncmp(command,"SELECT",14))) { ++ fputs("start",cmdpipeFd); ++ } ++ else if (!(strncmp(command,"PLAY",12))) { ++ fputs("play",cmdpipeFd); ++ } ++ else if (!(strncmp(command,"BLENDINGUP",17))) { ++ fputs("inc",cmdpipeFd); ++ } ++ else if (!(strncmp(command,"BLENDINGDOWN",19))) { ++ fputs("dec",cmdpipeFd); ++ } ++ else if (!(strncmp(command,"HELP",12))) { ++ fputs("help",cmdpipeFd); ++ } ++ else if (!(strncmp(command,"SELECTTRANSCODE",23))) { ++ fputs("encdec",cmdpipeFd); ++ } ++ else if (!(strncmp(command,"SELECTENCODE",20))) { ++ fputs("encboth",cmdpipeFd); ++ } ++ else if (!(strncmp(command,"SELECTDECODE",20))) { ++ fputs("decboth\n",cmdpipeFd); ++ } ++ else if (!(strncmp(command,"UP",10))) { ++ fputs("up",cmdpipeFd); ++ } ++ else if (!(strncmp(command,"DOWN",12))) { ++ fputs("down",cmdpipeFd); ++ } ++ else if (!(strncmp(command,"LEFT",12))) { ++ fputs("left",cmdpipeFd); ++ } ++ else if (!(strncmp(command,"RIGHT",13))) { ++ fputs("right",cmdpipeFd); ++ } ++ else if (!(strncmp(command,"START",13))) { ++ fputs("start",cmdpipeFd); ++ } ++ else if (!(strncmp(command,"BACK",12))) { ++ fputs("back",cmdpipeFd); ++ } ++ else if (!(strncmp(command,"RECORD",14))) { ++ fputs("rec",cmdpipeFd); ++ } ++strcpy(command,""); ++fclose(cmdpipeFd); + } + + /** diff --git a/recipes/julius/julius_4.1.2.bb b/recipes/julius/julius_4.1.2.bb index d528357122..f6b2f1509f 100644 --- a/recipes/julius/julius_4.1.2.bb +++ b/recipes/julius/julius_4.1.2.bb @@ -2,7 +2,10 @@ DESCRIPTION = "Julius is a high-performance, two-pass large vocabulary continuou LICENSE = "julius" DEPENDS = "libsndfile1 flex zlib alsa-lib" -SRC_URI = "http://iij.dl.sourceforge.jp/julius/37582/julius-${PV}.tar.gz" +PR = "r1" + +SRC_URI = "http://iij.dl.sourceforge.jp/julius/37582/julius-${PV}.tar.gz \ + file://patch-julius-4.1.2-command-pipe.patch;patch=1 " inherit autotools -- 2.39.5