Browse Source

Add options to allow HEVC remuxing and force HDR transcoding.

Ian Walton 1 year ago
parent
commit
373a5a8b74
3 changed files with 40 additions and 13 deletions
  1. 30 13
      native/nativeshell.js
  2. 8 0
      resources/settings/settings_description.json
  3. 2 0
      src/system/SystemComponent.cpp

+ 30 - 13
native/nativeshell.js

@@ -64,6 +64,32 @@ window.NativeShell = {
 };
 
 function getDeviceProfile() {
+    const CodecProfiles = [
+        {
+            'Type': 'Video',
+            'Conditions': [
+                {
+                    'Condition': 'NotEquals',
+                    'Property': 'VideoRangeType',
+                    'Value': 'DOVI'
+                }
+            ]
+        }
+    ];
+
+    if (viewdata.force_transcode_hdr) {
+        CodecProfiles.push({
+            'Type': 'Video',
+            'Conditions': [
+                {
+                    'Condition': 'Equals',
+                    'Property': 'VideoRangeType',
+                    'Value': 'SDR'
+                }
+            ]
+        });
+    }
+
     return {
         'Name': 'Jellyfin Media Player',
         'MaxStaticBitrate': 1000000000,
@@ -76,7 +102,9 @@ function getDeviceProfile() {
                 'Type': 'Video',
                 'Protocol': 'hls',
                 'AudioCodec': 'aac,mp3,ac3,opus,flac,vorbis',
-                'VideoCodec': 'h264,h265,hevc,mpeg4,mpeg2video',
+                'VideoCodec': viewdata.allow_transcode_to_hevc
+                    ? 'h264,h265,hevc,mpeg4,mpeg2video'
+                    : 'h264,mpeg4,mpeg2video',
                 'MaxAudioChannels': '6'
             },
             {'Container': 'jpeg', 'Type': 'Photo'}
@@ -84,18 +112,7 @@ function getDeviceProfile() {
         'DirectPlayProfiles': [{'Type': 'Video'}, {'Type': 'Audio'}, {'Type': 'Photo'}],
         'ResponseProfiles': [],
         'ContainerProfiles': [],
-        'CodecProfiles': [
-            {
-                'Type': 'Video',
-                'Conditions': [
-                    {
-                        'Condition': 'NotEquals',
-                        'Property': 'VideoRangeType',
-                        'Value': 'DOVI'
-                    }
-                ]
-            }
-        ],
+        CodecProfiles,
         'SubtitleProfiles': [
             {'Format': 'srt', 'Method': 'External'},
             {'Format': 'srt', 'Method': 'Embed'},

+ 8 - 0
resources/settings/settings_description.json

@@ -251,6 +251,14 @@
         "default": false,
         "platforms_excluded": "oe_rpi"
       },
+      {
+        "value": "allow_transcode_to_hevc",
+        "default": false
+      },
+      {
+        "value": "force_transcode_hdr",
+        "default": false
+      },
       {
         "value": "sync_mode",
         "default": "audio",

+ 2 - 0
src/system/SystemComponent.cpp

@@ -330,6 +330,8 @@ QString SystemComponent::getNativeShellScript()
   clientData.insert("deviceName", QJsonValue::fromVariant(SettingsComponent::Get().getClientName()));
   clientData.insert("scriptPath", QJsonValue::fromVariant("file:///" + path));
   clientData.insert("mode", QJsonValue::fromVariant(SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "layout").toString()));
+  clientData.insert("allow_transcode_to_hevc", QJsonValue::fromVariant(SettingsComponent::Get().value(SETTINGS_SECTION_VIDEO, "allow_transcode_to_hevc").toBool()));
+  clientData.insert("force_transcode_hdr", QJsonValue::fromVariant(SettingsComponent::Get().value(SETTINGS_SECTION_VIDEO, "force_transcode_hdr").toBool()));
   nativeshellString.replace("@@data@@", QJsonDocument(clientData).toJson(QJsonDocument::Compact).toBase64());
   return nativeshellString;
 }