From 9e2d52fa40a0b70855c9f6e1a9f5e060272d2317 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Florent=20Thi=C3=A9ry?= <florent.thiery@ubicast.eu>
Date: Wed, 23 Jan 2019 16:04:59 +0100
Subject: [PATCH] apply custom config for demokit, refs #26945

---
 5.MediaServer/3.Deploy_demokit/0_setup.py     |  22 ++-
 .../mirisconf/recorderd/roomA.json            | 161 ++++++++++++++++++
 2 files changed, 175 insertions(+), 8 deletions(-)
 create mode 100755 5.MediaServer/3.Deploy_demokit/mirisconf/recorderd/roomA.json

diff --git a/5.MediaServer/3.Deploy_demokit/0_setup.py b/5.MediaServer/3.Deploy_demokit/0_setup.py
index 829c5a03..78b74872 100644
--- a/5.MediaServer/3.Deploy_demokit/0_setup.py
+++ b/5.MediaServer/3.Deploy_demokit/0_setup.py
@@ -2,6 +2,7 @@
 # -*- coding: utf-8 -*-
 import utils
 import json
+import subprocess
 
 CONTENT = [
     "https://www.ubicast.eu/media/downloads/TradeshowDemoKit/medical_education.zip",
@@ -20,13 +21,18 @@ def setup(interactive=True):
         cmd = cmd_template % c
         cmds.append(cmd)
 
+    cmds.append('rsync -r mirisconf /etc/miris/conf')
     cmds.append('netcapturectl add')
-    # hw acceleration requires boot-time module options so a reboot will be needed
-    with open('/etc/miris/netcapture.json.example', 'r+') as f:
-        c = json.load(f)
-        c['enable_hw_acceleration'] = True
-        json.dump(c, f)
-    cmds.append('echo "options i915 enable_guc_loading=1 enable_guc_submission=1" > /etc/modprobe.d/netcapture.conf')
-    cmds.append('update-initramfs -u')
+
+    # try to enable hw accel if available
+    subprocess.getstatusoutput("apt install -y vainfo")
+    if subprocess.getstatusoutput("vainfo")[0] == 0:
+        # hw acceleration requires boot-time module options so a reboot will be needed
+        with open('/etc/miris/netcapture.json.example', 'r+') as f:
+            c = json.load(f)
+            c['enable_hw_acceleration'] = True
+            json.dump(c, f)
+        cmds.append('echo "options i915 enable_guc_loading=1 enable_guc_submission=1" > /etc/modprobe.d/netcapture.conf')
+        cmds.append('update-initramfs -u')
+        print('A reboot is required')
     utils.run_commands(cmds)
-    print('A reboot is required')
diff --git a/5.MediaServer/3.Deploy_demokit/mirisconf/recorderd/roomA.json b/5.MediaServer/3.Deploy_demokit/mirisconf/recorderd/roomA.json
new file mode 100755
index 00000000..9340aa9b
--- /dev/null
+++ b/5.MediaServer/3.Deploy_demokit/mirisconf/recorderd/roomA.json
@@ -0,0 +1,161 @@
+{
+    "audio_output_enabled": false,
+    "videomixer_width": 2560,
+    "videomixer_height": 1440,
+    "gst_debug_string": "3",
+    "framerate": 30,
+    "autopublish_targets": [{"name": "sonydemo", "channel_oid": "c125ace5617a3a80boud"}],
+    "autoremove": true,
+    "gop_size_s": 1,
+    "benchmark_dur_s": 10,
+    "benchmark_mode": false,
+    "videosources": [
+        {
+            "enabled": true,
+            "name": "sonycam_1",
+            "template": "rtspvsource",
+            "uri": "rtsp://camera/media/video1",
+            "width": 1280,
+            "height": 720,
+            "custom_delay_ms": 100
+        },
+        {
+            "enabled": true,
+            "name": "sonyve_1",
+            "template": "rtspvsource",
+            "uri": "rtsp://display/media/video1",
+            "width": 1920,
+            "height": 1080,
+            "custom_delay_ms": 150,
+            "enable_change_detection": true
+        },
+        {
+            "enabled": false,
+            "name": "canon_1",
+            "template": "rtspvsource",
+            "uri": "rtsp://root:camera@192.168.43.115/stream/profile1=r",
+            "custom_delay_ms": -220,
+            "width": 1920,
+            "height": 1080
+        },
+        {
+            "enabled": false,
+            "name": "q1755",
+            "template": "rtspvsource",
+            "uri": "rtsp://root:admin@192.168.1.233/axis-media/media.amp?streamprofile=Quality",
+            "custom_delay_ms": -60,
+            "width": 1280,
+            "height": 720
+        },
+        {
+            "enabled": false,
+            "name": "rawrtpvideo1",
+            "template": "rawrtpvsource",
+            "port": 6008,
+            "width": 1920,
+            "height": 1080
+        },
+        {
+            "enabled": false,
+            "name": "vtest1",
+            "template": "vtestsource",
+            "pattern": "smpte",
+            "width": 1920,
+            "height": 1080
+        },
+        {
+            "enabled": false,
+            "name": "benchtest1",
+            "template": "benchtestsource",
+            "width": 1920,
+            "height": 1080
+        }
+    ],
+    "audiosources": [
+        {
+            "enabled": false,
+            "name": "alsa1",
+            "template": "alsasource",
+            "device": "hw:0,1",
+            "channels": 1,
+            "format": "S16LE",
+            "rate": 44100
+        },
+        {
+            "enabled": true,
+            "name": "sonycam_1",
+            "template": "rtspasource",
+            "channels": 1,
+            "format": "S16LE",
+            "rate": 44100
+        },
+        {
+            "enabled": true,
+            "name": "sonyve_1",
+            "template": "rtspasource",
+            "channels": 1,
+            "format": "S16LE",
+            "rate": 44100
+        },
+        {
+            "enabled": false,
+            "name": "srg360_1",
+            "template": "rtspasource_adts_workaround",
+            "channels": 1,
+            "format": "S16LE",
+            "rate": 44100
+        },
+        {
+            "enabled": false,
+            "name": "rawrtpaudio1",
+            "template": "rawrtpasource",
+            "port": 6010,
+            "channels": 2,
+            "format": "S16LE",
+            "rate": 44100
+        },
+        {
+            "enabled": false,
+            "name": "atest1",
+            "template": "atestsource",
+            "wave": "ticks",
+            "channels": 1,
+            "format": "S16LE",
+            "rate": 44100
+        }
+    ],
+    "streams": [
+        {
+            "width": 2560,
+            "height": 1440,
+            "framerate": 30,
+            "h264profile": "baseline",
+            "video_bitrate": 16000000,
+            "audio_bitrate": 128000
+        },
+        {
+            "width": 1920,
+            "height": 1080,
+            "framerate": 30,
+            "h264profile": "baseline",
+            "video_bitrate": 8000000,
+            "audio_bitrate": 128000
+        },
+        {
+            "width": 1280,
+            "height": 720,
+            "framerate": 30,
+            "h264profile": "baseline",
+            "video_bitrate": 4000000,
+            "audio_bitrate": 128000
+        },
+        {
+            "width": 640,
+            "height": 360,
+            "framerate": 30,
+            "h264profile": "baseline",
+            "video_bitrate": 1000000,
+            "audio_bitrate": 128000
+        }
+    ]
+}
-- 
GitLab