Linuxメモ / UniMRCP / プラグイン追加方法


Last update: 2010-08-06 (金) 15:22:34

Linuxメモ/UniMRCP/プラグイン追加方法
Tag: Linux UniMRCP

緑文字が入力コマンド。
桃文字が今回の変更箇所。


UniMRCPプラグイン追加方法

demo-recogの代わりにoppekepe-recogを追加する。
UniMRCPのソースファイルはunimrcpに格納してあるものとする。

oppekepe-recog構築

unimrcp/plugins/demo-recogを参考にunimrcp/plugins/oppekepe-recogを構築する。
以下の例ではソースはoppekepe_recog_engine.cのみの構成としている。

unimrcp/plugins配下の構成

├─oppekepe-recog
│ ├─include
│ └─src
├─demo-recog
│ ├─include
│ └─src
├─demo-synth
│ ├─include
│ └─src
└─mrcp-cepstral
  ├─include
  └─src

unimrcp/plugins/oppekepe-recog/Makefile.amの例


MAINTAINERCLEANFILES 	   = Makefile.in

INCLUDES                   = -Iinclude \
                             -I$(top_srcdir)/libs/mrcp-engine/include \
                             -I$(top_srcdir)/libs/mrcp/include \
                             -I$(top_srcdir)/libs/mrcp/message/include \
                             -I$(top_srcdir)/libs/mrcp/control/include \
                             -I$(top_srcdir)/libs/mrcp/resources/include \
                             -I$(top_srcdir)/libs/mpf/include \
                             -I$(top_srcdir)/libs/apr-toolkit/include \
                             $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_APU_INCLUDES)

plugin_LTLIBRARIES         = oppekeperecog.la

oppekeperecog_la_SOURCES   = src/oppekepe_recog_engine.c
oppekeperecog_la_LDFLAGS   = -module $(PLUGIN_LT_VERSION)

plugins追加

プラグインのmakefile用autoconf設定ファイルunimrcp/plugins/oppekepe-recog/Makefile.amoppekepe-recogを追加する。

unimrcp/plugins/Makefile.amの例


MAINTAINERCLEANFILES   = Makefile.in

SUBDIRS                =

if DEMOSYNTH_PLUGIN
SUBDIRS               += demo-synth
endif

if DEMORECOG_PLUGIN
SUBDIRS               += demo-recog
endif

if CEPSTRAL_PLUGIN
SUBDIRS               += mrcp-cepstral
endif

以下の4行を追加

if OPPEKEPERECOG_PLUGIN
SUBDIRS               += oppekepe-recog
endif

autoconfig追加

configure用autoconf設定ファイルunimrcp/configure.acoppekepe-recogを追加する。

unimrcp/configure.acの例


#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.57)

AC_INIT([unimrcp],[0.6.0])

AC_CONFIG_AUX_DIR([build])
AC_CONFIG_MACRO_DIR([build/acmacros])
AC_PREFIX_DEFAULT(/usr/local/unimrcp)

plugindir='${prefix}/plugin'
confdir='${prefix}/conf'
logdir='${prefix}/log'
datadir='${prefix}/data'

AM_INIT_AUTOMAKE(foreign)

#Set default language
AC_LANG_C

AC_PROG_CC
AC_PROG_CXX
AC_PROG_INSTALL

#skip detection of Fortran
m4_undefine([AC_PROG_F77])
m4_defun([AC_PROG_F77],[])
AC_PROG_LIBTOOL

# get version information
get_version="build/get-version.sh"
version_hdr="build/uni_version.h"
plugin_version_hdr="libs/mrcp-engine/include/mrcp_resource_plugin.h"
UNI_DOTTED_VERSION="`$get_version all $version_hdr UNI`"
UNI_LT_VERSION="-version-info `$get_version libtool $version_hdr UNI`"
PLUGIN_LT_VERSION="-version-info `$get_version libtool $plugin_version_hdr PLUGIN`"

AC_SUBST(UNI_DOTTED_VERSION)
AC_SUBST(UNI_LT_VERSION)
AC_SUBST(PLUGIN_LT_VERSION)

echo "UniMRCP Version: ${UNI_DOTTED_VERSION}"

UNIMRCP_CHECK_APR
UNIMRCP_CHECK_APU

UNIMRCP_CHECK_SOFIA

UNIMRCP_CHECK_SWIFT


AC_SUBST(ac_aux_dir)
AC_SUBST(ac_macro_dir)
AC_SUBST(plugindir)
AC_SUBST(confdir)
AC_SUBST(logdir)

AC_DEFUN([AX_COMPILER_VENDOR],
[
AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,
 [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown
  # note: don't check for gcc first since some other compilers define __GNUC__
  for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do
    vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")"
    AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[
#if !($vencpp)
      thisisanerror;
#endif
])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break])
  done
 ])
])

AX_COMPILER_VENDOR


AC_ARG_ENABLE(maintainer-mode,
    [AC_HELP_STRING([--enable-maintainer-mode  ],[turn on debugging and compile time warnings])],
    [enable_maintainer_mode="$enableval"],
    [enable_maintainer_mode="no"])

if test "${enable_maintainer_mode}" != "no"; then
    CFLAGS="$CFLAGS -g"
    if test "x${ax_cv_c_compiler_vendor}"  =  "xgnu" ; then
      CFLAGS="$CFLAGS -Wall -Werror"
    fi
fi

AC_ARG_ENABLE(test-suites,
    [AC_HELP_STRING([--enable-test-suites  ],[build test suites])],
    [enable_test_suites="$enableval"],
    [enable_test_suites="no"])

AM_CONDITIONAL([TEST_SUITES],[test "${enable_test_suites}" != "no"])

AC_ARG_ENABLE(demosynth-plugin,
    [AC_HELP_STRING([--disable-demosynth-plugin  ],[exclude demo synthesizer plugin from build])],
    [enable_demosynth_plugin="$enableval"],
    [enable_demosynth_plugin="yes"])

AM_CONDITIONAL([DEMOSYNTH_PLUGIN],[test "${enable_demosynth_plugin}" = "yes"])

AC_ARG_ENABLE(demorecog-plugin,
    [AC_HELP_STRING([--disable-demorecog-plugin  ],[exclude demo recognizer plugin from build])],
    [enable_demorecog_plugin="$enableval"],
    [enable_demorecog_plugin="yes"])

AM_CONDITIONAL([DEMORECOG_PLUGIN],[test "${enable_demorecog_plugin}" = "yes"])

以下の7行を追加

AC_ARG_ENABLE(oppekeperecog-plugin,
    [AC_HELP_STRING([--disable-oppekeperecog-plugin  ],[exclude oppekepe recognizer plugin from build])],
    [enable_oppekeperecog_plugin="$enableval"],
    [enable_oppekeperecog_plugin="yes"])

AM_CONDITIONAL([OPPEKEPERECOG_PLUGIN],[test "${enable_oppekeperecog_plugin}" = "yes"])
AC_CONFIG_FILES([
  Makefile
  libs/Makefile
  libs/apr-toolkit/Makefile
  libs/mpf/Makefile
  libs/mrcp/Makefile
  libs/mrcp-signaling/Makefile
  libs/mrcpv2-transport/Makefile
  libs/mrcp-engine/Makefile
  libs/mrcp-server/Makefile
  libs/mrcp-client/Makefile
  libs/uni-rtsp/Makefile
  modules/Makefile
  modules/mrcp-sofiasip/Makefile
  modules/mrcp-unirtsp/Makefile
  plugins/Makefile
  plugins/mrcp-cepstral/Makefile
  plugins/demo-synth/Makefile
  plugins/demo-recog/Makefile

以下の1行を追加

  plugins/oppekepe-recog/Makefile
  platforms/Makefile
  platforms/libunimrcp-server/Makefile
  platforms/libunimrcp-client/Makefile
  platforms/unimrcp-server/Makefile
  platforms/unimrcp-client/Makefile
  tests/Makefile
  tests/apttest/Makefile
  tests/mpftest/Makefile
  tests/mrcptest/Makefile
  tests/rtsptest/Makefile
  tests/strtablegen/Makefile
  build/Makefile
  build/pkgconfig/Makefile
  build/pkgconfig/unimrcpclient.pc
  build/pkgconfig/unimrcpserver.pc
  build/pkgconfig/unimrcpplugin.pc
])

AC_OUTPUT

設定ファイル編集

unimrcpserver用設定ファイルunimrcp/conf/unimrcpserver.xmloppekepe-recogを追加する。

unimrcp/conf/unimrcpserver.xmlの例


<!-- unimrcpserver document -->
<unimrcpserver>
  <!-- Server settings (signaling, media, ...) -->
  <settings>
    <!-- SIP, RTSP signaling agents -->
    <signaling>
      <agent name="SIP-Agent-1" class="SofiaSIP">
        <param name="sip-ip" value="auto"/>
        <!-- <param name="sip-ext-ip" value="auto"/> -->
        <param name="sip-port" value="8060"/>
        <param name="sip-transport" value="udp,tcp"/>
        <!-- <param name="force-destination" value="1"/> -->
 
        <param name="ua-name" value="UniMRCP SofiaSIP"/>
        <param name="sdp-origin" value="UniMRCPServer"/>
      </agent>
      <agent name="RTSP-Agent-1" class="UniRTSP">
        <param name="rtsp-ip" value="auto"/>
        <param name="rtsp-port" value="1554"/>
        <!-- <param name="force-destination" value="1"/> -->
        <resourcemap>
          <param name="speechsynth" value="speechsynthesizer"/>
          <param name="speechrecog" value="speechrecognizer"/>
        </resourcemap>
      </agent>
    </signaling>

    <!-- MRCPv2 connection agents -->
    <connection>
      <agent name="MRCPv2-Agent-1">
        <param name="mrcp-ip" value="auto"/>
        <param name="mrcp-port" value="1544"/>
        <param name="max-connection-count" value="100"/>
        <!-- <param name="force-new-connection" value="1"/> -->
      </agent>
    </connection>

    <!-- Media engines -->
    <media>
      <engine name="Media-Engine-1"/>
      <rtp name="RTP-Factory-1">
        <param name="rtp-ip" value="auto"/>
        <!-- <param name="rtp-ext-ip" value="auto"/> -->
        <param name="rtp-port-min" value="5000"/>
        <param name="rtp-port-max" value="6000"/>
        <!-- <param name="playout-delay" value="50"/> -->
        <!-- <param name="max-playout-delay" value="200"/> -->
        <!-- <param name="ptime" value="20"/> -->
        <param name="codecs" value="PCMU PCMA L16/96/8000"/>
        <!-- <param name="own-preference" value="1"/> -->
      </rtp>
    </media>

    <!-- Resource plugins -->
    <plugin>
      <engine name="Cepstral-Swift-1" class="mrcpcepstral" enable="0"/>
      <engine name="Demo-Synth-1" class="demosynth" enable="1"/>

以下の1行の"1""0"に書き換えてOPPEKEPEの1行を追加

      <engine name="Demo-Recog-1" class="demorecog" enable="1"/>


      <engine name="Demo-Recog-1" class="demorecog" enable="0"/>
      <engine name="OPPEKEPE-Recog-1" class="atrasrrecog" enable="1"/>
    </plugin>
  </settings>

  <!-- Server profiles -->
  <profiles>
    <!-- MRCPv2 default profile -->
    <profile name="MRCPv2-Default">
      <param name="signaling-agent" value="SIP-Agent-1"/>
      <param name="connection-agent" value="MRCPv2-Agent-1"/>
      <param name="media-engine" value="Media-Engine-1"/>
      <param name="rtp-factory" value="RTP-Factory-1"/>
    </profile>
    <!-- MRCPv1 default profile -->
    <profile name="MRCPv1-Default">
      <param name="signaling-agent" value="RTSP-Agent-1"/>
      <param name="media-engine" value="Media-Engine-1"/>
      <param name="rtp-factory" value="RTP-Factory-1"/>
    </profile>

    <!-- more profiles might be added here -->
  </profiles>
</unimrcpserver>

実行時にOPPEKEPEが読み込まれずにdemoが読み込まれる場合は、実際にUniMRCPサーバが使用している他のフォルダにある同名のファイルを編集する。


構築〜実行

以下のファイルを削除しておきます。

  • config.guess
  • config.log
  • config.status
  • config.sub

rm -f ./config.*[ENTER]

後はUniMRCPインストール方法?のbootstrap以降を通常通り実行します。


コメント

コメントはありません。 コメント/Linuxメモ/UniMRCP/プラグイン追加方法?

Online: 1


FrontPage

Soft

Tips


最新の20件

2021-12-21 2020-04-06 2020-03-10 2013-06-28 2013-11-13 2014-06-24

今日の20件

  • counter: 1312
  • today: 1
  • yesterday: 0
  • online: 1

edit