Skip to content

Commit 6748b81

Browse files
committed
remove transcode audio to preserve multichannel
1 parent 1b9511e commit 6748b81

File tree

2 files changed

+0
-61
lines changed

2 files changed

+0
-61
lines changed

components/ItemGrid/LoadVideoContentTask.brs

-39
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ function LoadItems_VideoPlayer(id as string, mediaSourceId = invalid as dynamic,
6262
return invalid
6363
end if
6464

65-
print "video=", video
66-
print "video.content=", video.content
6765
return video
6866
end function
6967

@@ -143,13 +141,6 @@ sub LoadItems_AddVideoContent(video as object, mediaSourceId as dynamic, audio_s
143141

144142

145143
' 'TODO: allow user selection of subtitle track before playback initiated, for now set to no subtitles
146-
print "m.playbackInfo.MediaSources[0]", m.playbackInfo.MediaSources[0]
147-
print "m.playbackInfo.MediaSources[0].Formats", m.playbackInfo.MediaSources[0].Formats
148-
print "m.playbackInfo.MediaSources[0].MediaStreams", m.playbackInfo.MediaSources[0].MediaStreams
149-
for each stream in m.playbackInfo.MediaSources[0].MediaStreams
150-
print "stream=", stream
151-
end for
152-
print "video.audioIndex=", video.audioIndex
153144
video.directPlaySupported = m.playbackInfo.MediaSources[0].SupportsDirectPlay
154145
fully_external = false
155146

@@ -219,36 +210,6 @@ sub addVideoContentURL(video, mediaSourceId, audio_stream_idx, fully_external)
219210
"AudioStreamIndex": audio_stream_idx
220211
}
221212

222-
selectedAudioStream = m.playbackInfo.MediaSources[0].MediaStreams[audio_stream_idx]
223-
if selectedAudioStream.Channels > 2 and Lcase(selectedAudioStream.Codec) = "aac" or Lcase(selectedAudioStream.Codec) = "opus"
224-
' does the user have an HDMI device attached that can decode this multichannel audio stream?
225-
di = CreateObject("roDeviceInfo")
226-
if not di.CanDecodeAudio({ Codec: selectedAudioStream.Codec, ChCnt: selectedAudioStream.Channels, PassThru: 1 }).Result
227-
print "Attached HDMI device can not decode the selected multichannel audio codec"
228-
' check to see if the attached HDMI device can decode our preferred audio codec
229-
preferredAudioCodec = m.global.session.user.playback.preferredAudioCodec
230-
231-
if di.CanDecodeAudio({ Codec: preferredAudioCodec, Container: selectedAudioStream.Container, ChCnt: selectedAudioStream.Channels, PassThru: 1 }).Result
232-
print "Attached HDMI device can decode our preferred multichannel audio codec"
233-
print "Attempting to transcode audio to the users preferred multichannel audio codec"
234-
' transcode the audio to keep multichannel support
235-
' otherwise the roku device will downmix aac/opus to stereo
236-
params.Static = false
237-
params.context = "Streaming"
238-
params.audioCodec = preferredAudioCodec
239-
' force all multichannel aac files to use mkv container
240-
if selectedAudioStream.Codec = "aac"
241-
params.container = "mkv"
242-
end if
243-
244-
video.isTranscoded = true
245-
video.directplaysupported = false
246-
params.transcodeReasons = "Switching audio codecs to preserve multichannel audio support"
247-
video.transcodeReasons = params.transcodeReasons
248-
end if
249-
end if
250-
end if
251-
252213
if mediaSourceId <> ""
253214
params.MediaSourceId = mediaSourceId
254215
end if

source/utils/session.bs

-22
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ namespace session
1010
server: {},
1111
user: {
1212
Configuration: {},
13-
playback: {},
1413
Policy: {},
1514
settings: {}
1615
}
@@ -108,24 +107,6 @@ namespace session
108107

109108
namespace user
110109

111-
sub SavePlaybackSettings()
112-
playbackArray = {}
113-
di = CreateObject("roDeviceInfo")
114-
115-
' Preferred Audio Codec
116-
' Use AAC for everything
117-
playbackArray.preferredAudioCodec = "aac"
118-
if di.GetAudioOutputChannel() <> "Stereo"
119-
' Use Dolby Digital as default surround sound codec
120-
playbackArray.preferredAudioCodec = "ac3"
121-
if m.global.session.user.settings["playback.forceDTS"]
122-
playbackArray.preferredAudioCodec = "dts"
123-
end if
124-
end if
125-
126-
session.user.Update("playback", playbackArray)
127-
end sub
128-
129110
' Add or update one value from the global user session array (m.global.session.user)
130111
sub Update(key as string, value as dynamic)
131112
' validate parameters
@@ -171,9 +152,6 @@ namespace session
171152
session.user.settings.Save(setting, userSettings[setting])
172153
end for
173154

174-
session.user.SavePlaybackSettings()
175-
176-
' debugging
177155
if m.global.app.isDev
178156
print "m.global.session.user.settings = ", m.global.session.user.settings
179157
end if

0 commit comments

Comments
 (0)