mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Update MediaInfoService.cs
This commit is contained in:
parent
b31f4ccbc2
commit
f3e7c72bac
@ -407,8 +407,13 @@ namespace MediaBrowser.Api.Playback
|
|||||||
|
|
||||||
if (mediaSource.SupportsDirectPlay)
|
if (mediaSource.SupportsDirectPlay)
|
||||||
{
|
{
|
||||||
if (mediaSource.IsRemote && forceDirectPlayRemoteMediaSource)
|
if (mediaSource.IsRemote && forceDirectPlayRemoteMediaSource && user.Policy.ForceRemoteSourceTranscoding)
|
||||||
{
|
{
|
||||||
|
mediaSource.SupportsDirectPlay = false;
|
||||||
|
}
|
||||||
|
else if (mediaSource.IsRemote && user.Policy.ForceRemoteSourceTranscoding)
|
||||||
|
{
|
||||||
|
mediaSource.SupportsDirectPlay = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -454,6 +459,16 @@ namespace MediaBrowser.Api.Playback
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mediaSource.SupportsDirectStream)
|
if (mediaSource.SupportsDirectStream)
|
||||||
|
{
|
||||||
|
if (mediaSource.IsRemote && forceDirectPlayRemoteMediaSource && user.Policy.ForceRemoteSourceTranscoding)
|
||||||
|
{
|
||||||
|
mediaSource.SupportsDirectStream = false;
|
||||||
|
}
|
||||||
|
else if (mediaSource.IsRemote && user.Policy.ForceRemoteSourceTranscoding)
|
||||||
|
{
|
||||||
|
mediaSource.SupportsDirectStream = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
options.MaxBitrate = GetMaxBitrate(maxBitrate, user);
|
options.MaxBitrate = GetMaxBitrate(maxBitrate, user);
|
||||||
|
|
||||||
@ -487,16 +502,50 @@ namespace MediaBrowser.Api.Playback
|
|||||||
SetDeviceSpecificSubtitleInfo(streamInfo, mediaSource, auth.Token);
|
SetDeviceSpecificSubtitleInfo(streamInfo, mediaSource, auth.Token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (mediaSource.SupportsTranscoding)
|
if (mediaSource.SupportsTranscoding)
|
||||||
|
{
|
||||||
|
if (mediaSource.IsRemote && user.Policy.ForceRemoteSourceTranscoding)
|
||||||
|
{
|
||||||
|
if (GetMaxBitrate(maxBitrate, user) < mediaSource.Bitrate)
|
||||||
{
|
{
|
||||||
options.MaxBitrate = GetMaxBitrate(maxBitrate, user);
|
options.MaxBitrate = GetMaxBitrate(maxBitrate, user);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
options.MaxBitrate = mediaSource.Bitrate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
options.MaxBitrate = GetMaxBitrate(maxBitrate, user);
|
||||||
|
}
|
||||||
|
|
||||||
// The MediaSource supports direct stream, now test to see if the client supports it
|
// The MediaSource supports direct stream, now test to see if the client supports it
|
||||||
var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ?
|
var streamInfo = string.Equals(item.MediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase) ?
|
||||||
streamBuilder.BuildAudioItem(options) :
|
streamBuilder.BuildAudioItem(options) :
|
||||||
streamBuilder.BuildVideoItem(options);
|
streamBuilder.BuildVideoItem(options);
|
||||||
|
|
||||||
|
|
||||||
|
if (mediaSource.IsRemote && user.Policy.ForceRemoteSourceTranscoding)
|
||||||
|
{
|
||||||
|
if (streamInfo != null)
|
||||||
|
{
|
||||||
|
streamInfo.PlaySessionId = playSessionId;
|
||||||
|
streamInfo.StartPositionTicks = startTimeTicks;
|
||||||
|
mediaSource.TranscodingUrl = streamInfo.ToUrl("-", auth.Token).TrimStart('-');
|
||||||
|
mediaSource.TranscodingUrl += "&allowVideoStreamCopy=false";
|
||||||
|
mediaSource.TranscodingUrl += "&allowAudioStreamCopy=false";
|
||||||
|
mediaSource.TranscodingContainer = streamInfo.Container;
|
||||||
|
mediaSource.TranscodingSubProtocol = streamInfo.SubProtocol;
|
||||||
|
|
||||||
|
// Do this after the above so that StartPositionTicks is set
|
||||||
|
SetDeviceSpecificSubtitleInfo(streamInfo, mediaSource, auth.Token);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (streamInfo != null)
|
if (streamInfo != null)
|
||||||
{
|
{
|
||||||
streamInfo.PlaySessionId = playSessionId;
|
streamInfo.PlaySessionId = playSessionId;
|
||||||
@ -523,6 +572,7 @@ namespace MediaBrowser.Api.Playback
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private long? GetMaxBitrate(long? clientMaxBitrate, User user)
|
private long? GetMaxBitrate(long? clientMaxBitrate, User user)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user