From 27854912ee3173a9823c5ea5709d51363f235a8e Mon Sep 17 00:00:00 2001 From: agsantos <aline.gondimsantos@savoirfairelinux.com> Date: Thu, 16 Jul 2020 15:03:29 -0400 Subject: [PATCH] Created 7. Jami plugins (markdown) Updated 0.-Introduction.md (markdown) --- technical/0.-Introduction.md | 1 + technical/7. Jami plugins.md | 138 +++++++++++++++++++++++++++++++++++ 2 files changed, 139 insertions(+) create mode 100644 technical/7. Jami plugins.md diff --git a/technical/0.-Introduction.md b/technical/0.-Introduction.md index 7ddb93b9..997ccf7c 100644 --- a/technical/0.-Introduction.md +++ b/technical/0.-Introduction.md @@ -15,6 +15,7 @@ Greetings people. In this part of the documentation, you will learn how Jami wor 4. What is a DHTProxy 5. Supporting SIP 6. [Setup your own TURN server](https://git.jami.net/savoirfairelinux/ring-project/wikis/technical/3.6-Setup-your-own-TURN-server) + 7. [Plugins](7. Jami plugins) 4. Contribute 1. Build instructions diff --git a/technical/7. Jami plugins.md b/technical/7. Jami plugins.md new file mode 100644 index 00000000..408abd47 --- /dev/null +++ b/technical/7. Jami plugins.md @@ -0,0 +1,138 @@ +**NOTE: this page describes what is a Jami Plugin and how to install and use them.** + +# Jami Plugins + +As from September of 2020, Jami team has added plugins as a call/chat feature for Linux and Android users. +This meaning that now they can personalize their call/chat experience by using one of our available plugins. +But that is not all, you can also transform your awesome ideas into a brand new plugin! + +To properly setup a plugin you must follow the step bellow. +To `build` a plugin, please refer to build instructions at the end of this page. + +## How to use it? +### Install / Uninstall +A Jami plugin is a file of the type plugin-name.jpl, and it must be installed to your Jami. +For Android You must go under Setting, enable plugins, and select a plugin file from your phone. +Similarly, for Linux, one must go to Jami Prefences, enable plugins, and select a plugins file from your computer. + +Once installed, Jami will add your new plugin to the available plugins list. + +For Android uninstall, one must click on the plugin and a uninstall option will appear. +For Linux, each plugins in plugins list shows a uninstall button. + +### Load / Unload +Once installed, a plugins is not available for use yet. Plugins are libraries and must be loaded if you want to expose their functionalities. + +For Android and Linux, there is checkbox that indicates plugin's load state. You can load or unload it by clicking on this checkbox. + +### Change Parameters +Each plugin has configurations, and some of them are editable by the user. For example, our Foreground Segmentation plugin allows the user to change the background image displayed. + +For client-gnome it is not yet possible to change those preferences, but for Android you can do so. +Preferences are displayed in the same page one must access to uninstall a plugin. + +To take effect, the plugin has to be reloaded. + +### Use! +Call plugins only take place if you turn them on during a call. +For both Android and Linux you can do so by clicking on the plugins icon on your call screen. + +## How to build? + +### Dependencies +If you want to make something with your video call, it is possible that you will do so with OpenCV and/or Tensorflow. +So, before going to the plugin, it is necessary to build the plugin dependencies. + +#### OpenCV 4.1.1 +##### Android +```bash +cd ${DAEMON} +export ANDROID_NDK=<NDK> +export ANDROID_ABI=arm64-v8a +export ANDROID_API=29 +export TOOLCHAIN=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64 +export TARGET=aarch64-linux-android +export CC=$TOOLCHAIN/bin/$TARGET$ANDROID_API-clang +export CXX=$TOOLCHAIN/bin/$TARGET$ANDROID_API-clang++ +export AR=$TOOLCHAIN/bin/$TARGET-ar +export LD=$TOOLCHAIN/bin/$TARGET-ld +export RANLIB=$TOOLCHAIN/bin/$TARGET-ranlib +export STRIP=$TOOLCHAIN/bin/$TARGET-strip +export PATH=$PATH:$TOOLCHAIN/bin +cd contrib +mkdir native-${TARGET} +cd native +../bootstrap --build=x86_64-pc-linux-gnu --host=$TARGET$ANDROID_API --enable-opencv --enable-opencv_contrib +make +``` +##### Linux +```bash +cd ${DAEMON}/contrib/native +./../bootstrap --enable-opencv --enable-opencv_contrib +make +``` + +#### Tensorflow 2.1 +Dependencies: + +* Python 3 +* Bazel 0.29.1 + +```bash +git clone https://github.com/tensorflow/tensorflow.git +cd tensorflow +git checkout -b v2.1.0 +``` + +Assemble instructions are available under [jami-plugins](https://review.jami.net/admin/repos/jami-plugins) README file + +#### Linux +If you want to build Tensorflow C++ API with GPU suport, be sure to have a CUDA capable GPU and that you have +followed all installation steps for the Nvidia drivers, CUDA Toolkit, CUDNN, Tensor RT, that their versions +matches and that they are correct for the Tensorflow version you want to build. + +The following links may be very helpfull: + +* https://www.tensorflow.org/install/source +* https://developer.nvidia.com/cuda-gpus +* https://developer.nvidia.com/cuda-toolkit-archive +* https://developer.nvidia.com/cudnn + + +`./configure` + +##### LITE +`bazel build //tensorflow/lite:libtensorflowlite.so` +##### C++ API +`bazel build --config=v1 --define framework_shared_object=false //tensorflow:libtensorflow_cc.so` +#### Android - LITE +Depencencie: + +* Android NDK 18r + +```bash +./configure + >> Do you wish to build TensorFlow with XLA JIT support? [Y/n]: n + >> Do you wish to download a fresh release of clang? (Experimental) [y/N]: y + >> Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: y + >> Please specify the home path of the Android NDK to use. [Default is /home/<username>/Android/Sdk/ndk-bundle]: put the right path to ndk 18r +``` + +```bash +bazel build //tensorflow/lite:libtensorflowlite.so --crosstool_top=//external:android/crosstool --cpu=armeabi-v7a --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cxxopt="-std=c++11" +``` + +```bash +bazel build //tensorflow/lite:libtensorflowlite.so --crosstool_top=//external:android/crosstool --cpu=arm64-v8a --host_crosstool_top=@bazel_tools//tools/cpp:toolchain --cxxopt="-std=c++11" +``` + +### Plugin +##### Android +##### Linux + +## TODO +### How it works + +Related articles: + ++ https://jami.net/jami-plugins-foreground-segmentation-artificial-inteligence/ -- GitLab