|
|
|
@ -11,6 +11,7 @@ using System.Linq;
|
|
|
|
|
using System.Text.Json;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using EasyCaching.Core.Configurations;
|
|
|
|
|
using Jellyfin.Data.Entities;
|
|
|
|
|
using Jellyfin.Data.Enums;
|
|
|
|
|
using Jellyfin.Extensions.Json;
|
|
|
|
@ -186,11 +187,11 @@ namespace Emby.Server.Implementations.Library
|
|
|
|
|
{
|
|
|
|
|
SetDefaultAudioAndSubtitleStreamIndexes(item, source, user);
|
|
|
|
|
|
|
|
|
|
if (string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
if (item.MediaType == MediaType.Audio)
|
|
|
|
|
{
|
|
|
|
|
source.SupportsTranscoding = user.HasPermission(PermissionKind.EnableAudioPlaybackTranscoding);
|
|
|
|
|
}
|
|
|
|
|
else if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
else if (item.MediaType == MediaType.Video)
|
|
|
|
|
{
|
|
|
|
|
source.SupportsTranscoding = user.HasPermission(PermissionKind.EnableVideoPlaybackTranscoding);
|
|
|
|
|
source.SupportsDirectStream = user.HasPermission(PermissionKind.EnablePlaybackRemuxing);
|
|
|
|
@ -334,11 +335,11 @@ namespace Emby.Server.Implementations.Library
|
|
|
|
|
{
|
|
|
|
|
SetDefaultAudioAndSubtitleStreamIndexes(item, source, user);
|
|
|
|
|
|
|
|
|
|
if (string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
if (item.MediaType == MediaType.Audio)
|
|
|
|
|
{
|
|
|
|
|
source.SupportsTranscoding = user.HasPermission(PermissionKind.EnableAudioPlaybackTranscoding);
|
|
|
|
|
}
|
|
|
|
|
else if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
else if (item.MediaType == MediaType.Video)
|
|
|
|
|
{
|
|
|
|
|
source.SupportsTranscoding = user.HasPermission(PermissionKind.EnableVideoPlaybackTranscoding);
|
|
|
|
|
source.SupportsDirectStream = user.HasPermission(PermissionKind.EnablePlaybackRemuxing);
|
|
|
|
@ -417,9 +418,9 @@ namespace Emby.Server.Implementations.Library
|
|
|
|
|
public void SetDefaultAudioAndSubtitleStreamIndexes(BaseItem item, MediaSourceInfo source, User user)
|
|
|
|
|
{
|
|
|
|
|
// Item would only be null if the app didn't supply ItemId as part of the live stream open request
|
|
|
|
|
var mediaType = item is null ? MediaType.Video : item.MediaType;
|
|
|
|
|
var mediaType = item?.MediaType ?? MediaType.Video;
|
|
|
|
|
|
|
|
|
|
if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
if (mediaType == MediaType.Video)
|
|
|
|
|
{
|
|
|
|
|
var userData = item is null ? new UserItemData() : _userDataManager.GetUserData(user, item);
|
|
|
|
|
|
|
|
|
@ -428,7 +429,7 @@ namespace Emby.Server.Implementations.Library
|
|
|
|
|
SetDefaultAudioStreamIndex(source, userData, user, allowRememberingSelection);
|
|
|
|
|
SetDefaultSubtitleStreamIndex(source, userData, user, allowRememberingSelection);
|
|
|
|
|
}
|
|
|
|
|
else if (string.Equals(mediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
else if (mediaType == MediaType.Audio)
|
|
|
|
|
{
|
|
|
|
|
var audio = source.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
|
|
|
|
|
|
|
|
|