mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-12 02:30:23 +01:00
expose more dlna profile settings in the web interface
This commit is contained in:
@@ -923,14 +923,6 @@ namespace MediaBrowser.Model.ApiClient
|
||||
/// <exception cref="ArgumentNullException">options</exception>
|
||||
string GetVideoStreamUrl(VideoStreamOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Formulates a url for streaming audio using the HLS protocol
|
||||
/// </summary>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
/// <exception cref="ArgumentNullException">options</exception>
|
||||
string GetHlsAudioStreamUrl(StreamOptions options);
|
||||
|
||||
/// <summary>
|
||||
/// Formulates a url for streaming video using the HLS protocol
|
||||
/// </summary>
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace MediaBrowser.Model.Configuration
|
||||
EnableServer = true;
|
||||
BlastAliveMessages = true;
|
||||
ClientDiscoveryIntervalSeconds = 60;
|
||||
BlastAliveMessageIntervalSeconds = 60;
|
||||
BlastAliveMessageIntervalSeconds = 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,16 @@ namespace MediaBrowser.Model.Dlna
|
||||
public string SupportedMediaTypes { get; set; }
|
||||
|
||||
public string UserId { get; set; }
|
||||
|
||||
public string AlbumArtPn { get; set; }
|
||||
|
||||
public int? MaxAlbumArtWidth { get; set; }
|
||||
public int? MaxAlbumArtHeight { get; set; }
|
||||
|
||||
public int? MaxIconWidth { get; set; }
|
||||
public int? MaxIconHeight { get; set; }
|
||||
|
||||
public int? MaxBitrate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Controls the content of the X_DLNADOC element in the urn:schemas-dlna-org:device-1-0 namespace.
|
||||
|
||||
@@ -85,10 +85,12 @@ namespace MediaBrowser.Model.Dlna
|
||||
RunTimeTicks = item.RunTimeTicks
|
||||
};
|
||||
|
||||
var maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate;
|
||||
|
||||
var audioStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||
|
||||
// Honor the max bitrate setting
|
||||
if (IsAudioEligibleForDirectPlay(item, options))
|
||||
if (IsAudioEligibleForDirectPlay(item, maxBitrateSetting))
|
||||
{
|
||||
var directPlay = options.Profile.DirectPlayProfiles
|
||||
.FirstOrDefault(i => i.Type == playlistItem.MediaType && IsAudioDirectPlaySupported(i, item, audioStream));
|
||||
@@ -119,6 +121,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
playlistItem.EstimateContentLength = transcodingProfile.EstimateContentLength;
|
||||
playlistItem.Container = transcodingProfile.Container;
|
||||
playlistItem.AudioCodec = transcodingProfile.AudioCodec;
|
||||
playlistItem.Protocol = transcodingProfile.Protocol;
|
||||
|
||||
var audioTranscodingConditions = options.Profile.CodecProfiles
|
||||
.Where(i => i.Type == CodecType.Audio && i.ContainsCodec(transcodingProfile.AudioCodec))
|
||||
@@ -136,11 +139,11 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
|
||||
// Honor requested max bitrate
|
||||
if (options.MaxBitrate.HasValue)
|
||||
if (maxBitrateSetting.HasValue)
|
||||
{
|
||||
var currentValue = playlistItem.AudioBitrate ?? options.MaxBitrate.Value;
|
||||
var currentValue = playlistItem.AudioBitrate ?? maxBitrateSetting.Value;
|
||||
|
||||
playlistItem.AudioBitrate = Math.Min(options.MaxBitrate.Value, currentValue);
|
||||
playlistItem.AudioBitrate = Math.Min(maxBitrateSetting.Value, currentValue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,7 +163,9 @@ namespace MediaBrowser.Model.Dlna
|
||||
var audioStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||
var videoStream = item.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Video);
|
||||
|
||||
if (IsEligibleForDirectPlay(item, options))
|
||||
var maxBitrateSetting = options.MaxBitrate ?? options.Profile.MaxBitrate;
|
||||
|
||||
if (IsEligibleForDirectPlay(item, options, maxBitrateSetting))
|
||||
{
|
||||
// See if it can be direct played
|
||||
var directPlay = options.Profile.DirectPlayProfiles
|
||||
@@ -201,6 +206,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
playlistItem.TranscodeSeekInfo = transcodingProfile.TranscodeSeekInfo;
|
||||
playlistItem.AudioCodec = transcodingProfile.AudioCodec.Split(',').FirstOrDefault();
|
||||
playlistItem.VideoCodec = transcodingProfile.VideoCodec;
|
||||
playlistItem.Protocol = transcodingProfile.Protocol;
|
||||
|
||||
var videoTranscodingConditions = options.Profile.CodecProfiles
|
||||
.Where(i => i.Type == CodecType.Video && i.ContainsCodec(transcodingProfile.VideoCodec))
|
||||
@@ -233,9 +239,9 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
|
||||
// Honor max rate
|
||||
if (options.MaxBitrate.HasValue)
|
||||
if (maxBitrateSetting.HasValue)
|
||||
{
|
||||
var videoBitrate = options.MaxBitrate.Value;
|
||||
var videoBitrate = maxBitrateSetting.Value;
|
||||
|
||||
if (playlistItem.AudioBitrate.HasValue)
|
||||
{
|
||||
@@ -251,7 +257,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
return playlistItem;
|
||||
}
|
||||
|
||||
private bool IsEligibleForDirectPlay(MediaSourceInfo item, VideoOptions options)
|
||||
private bool IsEligibleForDirectPlay(MediaSourceInfo item, VideoOptions options, int? maxBitrate)
|
||||
{
|
||||
if (options.SubtitleStreamIndex.HasValue)
|
||||
{
|
||||
@@ -264,13 +270,13 @@ namespace MediaBrowser.Model.Dlna
|
||||
return false;
|
||||
}
|
||||
|
||||
return IsAudioEligibleForDirectPlay(item, options);
|
||||
return IsAudioEligibleForDirectPlay(item, maxBitrate);
|
||||
}
|
||||
|
||||
private bool IsAudioEligibleForDirectPlay(MediaSourceInfo item, AudioOptions options)
|
||||
private bool IsAudioEligibleForDirectPlay(MediaSourceInfo item, int? maxBitrate)
|
||||
{
|
||||
// Honor the max bitrate setting
|
||||
return !options.MaxBitrate.HasValue || (item.Bitrate.HasValue && item.Bitrate.Value <= options.MaxBitrate.Value);
|
||||
return !maxBitrate.HasValue || (item.Bitrate.HasValue && item.Bitrate.Value <= maxBitrate.Value);
|
||||
}
|
||||
|
||||
private void ValidateInput(VideoOptions options)
|
||||
|
||||
@@ -20,6 +20,8 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
public string Container { get; set; }
|
||||
|
||||
public string Protocol { get; set; }
|
||||
|
||||
public long StartPositionTicks { get; set; }
|
||||
|
||||
public string VideoCodec { get; set; }
|
||||
@@ -84,6 +86,12 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
return string.Format("{0}/audio/{1}/stream{2}?{3}", baseUrl, ItemId, extension, dlnaCommand);
|
||||
}
|
||||
|
||||
if (string.Equals(Protocol, "hls", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return string.Format("{0}/videos/{1}/stream.m3u8?{2}", baseUrl, ItemId, dlnaCommand);
|
||||
}
|
||||
|
||||
return string.Format("{0}/videos/{1}/stream{2}?{3}", baseUrl, ItemId, extension, dlnaCommand);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user