Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added HD Audio support (currently only TrueHD) #283

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 19 additions & 9 deletions lib/_included_packages/plexnet/plexplayer.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def getDecisionPath(self, directPlay=False):
# Global variables for all decisions
decisionPath = http.addUrlParam(decisionPath, "mediaBufferSize=20971") # Kodi default is 20971520 (20MB)
decisionPath = http.addUrlParam(decisionPath, "hasMDE=1")
decisionPath = http.addUrlParam(decisionPath, 'X-Plex-Platform=Chrome')
decisionPath = http.addUrlParam(decisionPath, 'X-Plex-Platform=Generic')

return decisionPath

Expand Down Expand Up @@ -332,14 +332,24 @@ def buildTranscodeMkv(self, obj):
else:
numChannels = 8

for codec in ("ac3", "eac3", "dca"):
if self.item.settings.supportsAudioStream(codec, numChannels):
builder.extras.append("append-transcode-target-audio-codec(type=videoProfile&context=streaming&audioCodec=" + codec + ")")
builder.extras.append("add-direct-play-profile(type=videoProfile&container=matroska&videoCodec=*&audioCodec=" + codec + ")")
if codec == "dca":
builder.extras.append(
"add-limitation(scope=videoAudioCodec&scopeName=dca&type=upperBound&name=audio.channels&value=8&isRequired=false)"
)
codecs = ("ac3", "eac3", "dca")
if self.item.settings.getPreference("allow_hd_audio", False):
codecs += "truehd",

builder.extras.append("add-transcode-target(type=videoProfile&context=streaming&protocol=http&container=mkv&videoCodec=h264&audioCodec=" + ",".join(codecs) + ")")

# for codec in codecs:
# if self.item.settings.supportsAudioStream(codec, numChannels):
# builder.extras.append("append-transcode-target-audio-codec(type=videoProfile&context=streaming&audioCodec=" + codec + ")")
# builder.extras.append("add-direct-play-profile(type=videoProfile&container=matroska&videoCodec=*&audioCodec=" + codec + ")")
# if codec == "dca":
# builder.extras.append(
# "add-limitation(scope=videoAudioCodec&scopeName=dca&type=upperBound&name=audio.channels&value=8&isRequired=false)"
# )
# if codec == "truehd":
# builder.extras.append(
# "add-limitation(scope=videoAudioCodec&scopeName=truhd&type=upperBound&name=audio.channels&value=12&isRequired=false)"
# )

# AAC sample rate cannot be less than 22050hz (HLS is capable).
if self.choice.audioStream is not None and self.choice.audioStream.samplingRate.asInt(22050) < 22050:
Expand Down
7 changes: 4 additions & 3 deletions lib/windows/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ class Settings(object):
)
),
'audio': (
T(32048, 'Audio'),
()
T(32048, 'Audio'), (
BoolSetting('allow_hd_audio', T(32058, 'Allow HD Audio'), False),
)
),
'video': (
T(32053, 'Video'), (
Expand Down Expand Up @@ -257,7 +258,7 @@ class Settings(object):
),
}

SECTION_IDS = ('main', 'video', 'subtitles', 'advanced', 'manual', 'about')
SECTION_IDS = ('main', 'video', 'audio', 'subtitles', 'advanced', 'manual', 'about')

def __getitem__(self, key):
return self.SETTINGS[key]
Expand Down
3 changes: 3 additions & 0 deletions resources/language/English/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ msgctxt "#32057"
msgid "Current Server Version"
msgstr ""

msgctxt "#32058"
msgid "Allow HD Audio"
msgstr ""

msgctxt "#32100"
msgid "Skip user selection and pin entry on startup."
Expand Down