]> khamidou — GitHub mirrors - electron.git/commitdiff
Update the libspeechd_loader
authorCheng Zhao <zcbenz@gmail.com>
Tue, 8 Dec 2015 02:26:32 +0000 (10:26 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 8 Dec 2015 02:26:32 +0000 (10:26 +0800)
chromium_src/library_loaders/libspeechd.h
chromium_src/library_loaders/libspeechd_loader.cc

index 0d62f2c5da6e88d5875def53047a3bd6324adeef..f7b276287a416c1d62b2e96a21d8387f2d670a06 100644 (file)
@@ -33,6 +33,7 @@ class LibSpeechdLoader {
   decltype(&::spd_set_synthesis_voice) spd_set_synthesis_voice;
   decltype(&::spd_list_modules) spd_list_modules;
   decltype(&::spd_set_output_module) spd_set_output_module;
+  decltype(&::spd_set_language) spd_set_language;
 
 
  private:
index 6066610005287febd895bef5474e5030a3b0bf95..f09ea3ae861bda8fa211934a8cbdb740f0c7eab7 100644 (file)
@@ -201,6 +201,19 @@ bool LibSpeechdLoader::Load(const std::string& library_name) {
     return false;
   }
 
+#if defined(LIBRARY_LOADER_OUT_RELEASE_GEN_LIBRARY_LOADERS_LIBSPEECHD_H_DLOPEN)
+  spd_set_language =
+      reinterpret_cast<decltype(this->spd_set_language)>(
+          dlsym(library_, "spd_set_language"));
+#endif
+#if defined(LIBRARY_LOADER_OUT_RELEASE_GEN_LIBRARY_LOADERS_LIBSPEECHD_H_DT_NEEDED)
+  spd_set_language = &::spd_set_language;
+#endif
+  if (!spd_set_language) {
+    CleanUp(true);
+    return false;
+  }
+
 
   loaded_ = true;
   return true;
@@ -227,5 +240,6 @@ void LibSpeechdLoader::CleanUp(bool unload) {
   spd_set_synthesis_voice = NULL;
   spd_list_modules = NULL;
   spd_set_output_module = NULL;
+  spd_set_language = NULL;
 
 }