Merge pull request #5859 from cvium/fix-streambuilder-permissions

Respect user settings for transcode and remux
pull/5878/head
Bond-009 4 years ago committed by GitHub
commit 5a6e60b414
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -199,10 +199,15 @@ namespace Emby.Server.Implementations.Library
{ {
source.SupportsTranscoding = user.HasPermission(PermissionKind.EnableAudioPlaybackTranscoding); source.SupportsTranscoding = user.HasPermission(PermissionKind.EnableAudioPlaybackTranscoding);
} }
else if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
{
source.SupportsTranscoding = user.HasPermission(PermissionKind.EnableVideoPlaybackTranscoding);
source.SupportsDirectStream = user.HasPermission(PermissionKind.EnablePlaybackRemuxing);
}
} }
} }
return SortMediaSources(list).Where(i => i.Type != MediaSourceType.Placeholder).ToList(); return SortMediaSources(list);
} }
public MediaProtocol GetPathProtocol(string path) public MediaProtocol GetPathProtocol(string path)
@ -436,7 +441,7 @@ namespace Emby.Server.Implementations.Library
} }
} }
private static IEnumerable<MediaSourceInfo> SortMediaSources(IEnumerable<MediaSourceInfo> sources) private static List<MediaSourceInfo> SortMediaSources(IEnumerable<MediaSourceInfo> sources)
{ {
return sources.OrderBy(i => return sources.OrderBy(i =>
{ {
@ -451,8 +456,9 @@ namespace Emby.Server.Implementations.Library
{ {
var stream = i.VideoStream; var stream = i.VideoStream;
return stream == null || stream.Width == null ? 0 : stream.Width.Value; return stream?.Width ?? 0;
}) })
.Where(i => i.Type != MediaSourceType.Placeholder)
.ToList(); .ToList();
} }

@ -309,7 +309,7 @@ namespace Jellyfin.Api.Helpers
{ {
if (!user.HasPermission(PermissionKind.EnableAudioPlaybackTranscoding) if (!user.HasPermission(PermissionKind.EnableAudioPlaybackTranscoding)
&& !user.HasPermission(PermissionKind.EnableVideoPlaybackTranscoding) && !user.HasPermission(PermissionKind.EnableVideoPlaybackTranscoding)
&& !user.HasPermission(PermissionKind.EnablePlaybackRemuxing)) && user.HasPermission(PermissionKind.EnablePlaybackRemuxing))
{ {
options.ForceDirectStream = true; options.ForceDirectStream = true;
} }

Loading…
Cancel
Save