The Free Software Media System - Server Backend & API
respect music quality settings when transcoding
nyanmisaka00f0c14d7b95
diff --git a/Jellyfin.Api/Controllers/DynamicHlsController.cs b/Jellyfin.Api/Controllers/DynamicHlsController.csindex 1153a601e7..e07690e110 100644--- a/Jellyfin.Api/Controllers/DynamicHlsController.cs+++ b/Jellyfin.Api/Controllers/DynamicHlsController.cs@@ -295,6 +295,7 @@ namespace Jellyfin.Api.Controllers/// <param name="breakOnNonKeyFrames">Optional. Whether to break on non key frames.</param>/// <param name="audioSampleRate">Optional. Specify a specific audio sample rate, e.g. 44100.</param>/// <param name="maxAudioBitDepth">Optional. The maximum audio bit depth.</param>+ /// <param name="maxStreamingBitrate">Optional. The maximum streaming bitrate.</param>/// <param name="audioBitRate">Optional. Specify an audio bitrate to encode to, e.g. 128000. If omitted this will be left to encoder defaults.</param>/// <param name="audioChannels">Optional. Specify a specific number of audio channels to encode to, e.g. 2.</param>/// <param name="maxAudioChannels">Optional. Specify a maximum number of audio channels to encode to, e.g. 2.</param>@@ -351,6 +352,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] bool? breakOnNonKeyFrames,[FromQuery] int? audioSampleRate,[FromQuery] int? maxAudioBitDepth,+ [FromQuery] int? maxStreamingBitrate,[FromQuery] int? audioBitRate,[FromQuery] int? audioChannels,[FromQuery] int? maxAudioChannels,@@ -403,7 +405,7 @@ namespace Jellyfin.Api.ControllersBreakOnNonKeyFrames = breakOnNonKeyFrames ?? false,AudioSampleRate = audioSampleRate,MaxAudioChannels = maxAudioChannels,- AudioBitRate = audioBitRate,+ AudioBitRate = audioBitRate ?? maxStreamingBitrate,MaxAudioBitDepth = maxAudioBitDepth,AudioChannels = audioChannels,Profile = profile,@@ -623,6 +625,7 @@ namespace Jellyfin.Api.Controllers/// <param name="breakOnNonKeyFrames">Optional. Whether to break on non key frames.</param>/// <param name="audioSampleRate">Optional. Specify a specific audio sample rate, e.g. 44100.</param>/// <param name="maxAudioBitDepth">Optional. The maximum audio bit depth.</param>+ /// <param name="maxStreamingBitrate">Optional. The maximum streaming bitrate.</param>/// <param name="audioBitRate">Optional. Specify an audio bitrate to encode to, e.g. 128000. If omitted this will be left to encoder defaults.</param>/// <param name="audioChannels">Optional. Specify a specific number of audio channels to encode to, e.g. 2.</param>/// <param name="maxAudioChannels">Optional. Specify a maximum number of audio channels to encode to, e.g. 2.</param>@@ -677,6 +680,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] bool? breakOnNonKeyFrames,[FromQuery] int? audioSampleRate,[FromQuery] int? maxAudioBitDepth,+ [FromQuery] int? maxStreamingBitrate,[FromQuery] int? audioBitRate,[FromQuery] int? audioChannels,[FromQuery] int? maxAudioChannels,@@ -729,7 +733,7 @@ namespace Jellyfin.Api.ControllersBreakOnNonKeyFrames = breakOnNonKeyFrames ?? false,AudioSampleRate = audioSampleRate,MaxAudioChannels = maxAudioChannels,- AudioBitRate = audioBitRate,+ AudioBitRate = audioBitRate ?? maxStreamingBitrate,MaxAudioBitDepth = maxAudioBitDepth,AudioChannels = audioChannels,Profile = profile,@@ -959,6 +963,7 @@ namespace Jellyfin.Api.Controllers/// <param name="breakOnNonKeyFrames">Optional. Whether to break on non key frames.</param>/// <param name="audioSampleRate">Optional. Specify a specific audio sample rate, e.g. 44100.</param>/// <param name="maxAudioBitDepth">Optional. The maximum audio bit depth.</param>+ /// <param name="maxStreamingBitrate">Optional. The maximum streaming bitrate.</param>/// <param name="audioBitRate">Optional. Specify an audio bitrate to encode to, e.g. 128000. If omitted this will be left to encoder defaults.</param>/// <param name="audioChannels">Optional. Specify a specific number of audio channels to encode to, e.g. 2.</param>/// <param name="maxAudioChannels">Optional. Specify a maximum number of audio channels to encode to, e.g. 2.</param>@@ -1017,6 +1022,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] bool? breakOnNonKeyFrames,[FromQuery] int? audioSampleRate,[FromQuery] int? maxAudioBitDepth,+ [FromQuery] int? maxStreamingBitrate,[FromQuery] int? audioBitRate,[FromQuery] int? audioChannels,[FromQuery] int? maxAudioChannels,@@ -1069,7 +1075,7 @@ namespace Jellyfin.Api.ControllersBreakOnNonKeyFrames = breakOnNonKeyFrames ?? false,AudioSampleRate = audioSampleRate,MaxAudioChannels = maxAudioChannels,- AudioBitRate = audioBitRate,+ AudioBitRate = audioBitRate ?? maxStreamingBitrate,MaxAudioBitDepth = maxAudioBitDepth,AudioChannels = audioChannels,Profile = profile,diff --git a/Jellyfin.Api/Controllers/MediaInfoController.cs b/Jellyfin.Api/Controllers/MediaInfoController.csindex 4c21999b1b..186024585b 100644--- a/Jellyfin.Api/Controllers/MediaInfoController.cs+++ b/Jellyfin.Api/Controllers/MediaInfoController.cs@@ -104,7 +104,7 @@ namespace Jellyfin.Api.Controllerspublic async Task<ActionResult<PlaybackInfoResponse>> GetPostedPlaybackInfo([FromRoute, Required] Guid itemId,[FromQuery] Guid? userId,- [FromQuery] long? maxStreamingBitrate,+ [FromQuery] int? maxStreamingBitrate,[FromQuery] long? startTimeTicks,[FromQuery] int? audioStreamIndex,[FromQuery] int? subtitleStreamIndex,@@ -234,7 +234,7 @@ namespace Jellyfin.Api.Controllers[FromQuery] string? openToken,[FromQuery] Guid? userId,[FromQuery] string? playSessionId,- [FromQuery] long? maxStreamingBitrate,+ [FromQuery] int? maxStreamingBitrate,[FromQuery] long? startTimeTicks,[FromQuery] int? audioStreamIndex,[FromQuery] int? subtitleStreamIndex,diff --git a/Jellyfin.Api/Controllers/UniversalAudioController.cs b/Jellyfin.Api/Controllers/UniversalAudioController.csindex df20a92b3d..1cfdb9d8b4 100644--- a/Jellyfin.Api/Controllers/UniversalAudioController.cs+++ b/Jellyfin.Api/Controllers/UniversalAudioController.cs@@ -76,6 +76,7 @@ namespace Jellyfin.Api.Controllers/// <param name="maxAudioChannels">Optional. The maximum number of audio channels.</param>/// <param name="transcodingAudioChannels">Optional. The number of how many audio channels to transcode to.</param>/// <param name="maxStreamingBitrate">Optional. The maximum streaming bitrate.</param>+ /// <param name="audioBitRate">Optional. Specify an audio bitrate to encode to, e.g. 128000. If omitted this will be left to encoder defaults.</param>/// <param name="startTimeTicks">Optional. Specify a starting offset, in ticks. 1 tick = 10000 ms.</param>/// <param name="transcodingContainer">Optional. The container to transcode to.</param>/// <param name="transcodingProtocol">Optional. The transcoding protocol.</param>@@ -104,7 +105,8 @@ namespace Jellyfin.Api.Controllers[FromQuery] string? audioCodec,[FromQuery] int? maxAudioChannels,[FromQuery] int? transcodingAudioChannels,- [FromQuery] long? maxStreamingBitrate,+ [FromQuery] int? maxStreamingBitrate,+ [FromQuery] int? audioBitRate,[FromQuery] long? startTimeTicks,[FromQuery] string? transcodingContainer,[FromQuery] string? transcodingProtocol,@@ -212,7 +214,7 @@ namespace Jellyfin.Api.ControllersAudioSampleRate = maxAudioSampleRate,MaxAudioChannels = maxAudioChannels,MaxAudioBitDepth = maxAudioBitDepth,- AudioChannels = isStatic ? (int?)null : Convert.ToInt32(Math.Min(maxStreamingBitrate ?? 192000, int.MaxValue)),+ AudioBitRate = audioBitRate ?? maxStreamingBitrate,StartTimeTicks = startTimeTicks,SubtitleMethod = SubtitleDeliveryMethod.Hls,RequireAvc = true,@@ -244,7 +246,7 @@ namespace Jellyfin.Api.ControllersBreakOnNonKeyFrames = breakOnNonKeyFrames,AudioSampleRate = maxAudioSampleRate,MaxAudioChannels = maxAudioChannels,- AudioBitRate = isStatic ? (int?)null : Convert.ToInt32(Math.Min(maxStreamingBitrate ?? 192000, int.MaxValue)),+ AudioBitRate = isStatic ? (int?)null : (audioBitRate ?? maxStreamingBitrate),MaxAudioBitDepth = maxAudioBitDepth,AudioChannels = maxAudioChannels,CopyTimestamps = true,diff --git a/Jellyfin.Api/Helpers/MediaInfoHelper.cs b/Jellyfin.Api/Helpers/MediaInfoHelper.csindex e78f63b256..0d8315dee1 100644--- a/Jellyfin.Api/Helpers/MediaInfoHelper.cs+++ b/Jellyfin.Api/Helpers/MediaInfoHelper.cs@@ -166,7 +166,7 @@ namespace Jellyfin.Api.HelpersMediaSourceInfo mediaSource,DeviceProfile profile,AuthorizationInfo auth,- long? maxBitrate,+ int? maxBitrate,long startTimeTicks,string mediaSourceId,int? audioStreamIndex,@@ -551,7 +551,7 @@ namespace Jellyfin.Api.Helpers}}- private long? GetMaxBitrate(long? clientMaxBitrate, User user, string ipAddress)+ private int? GetMaxBitrate(int? clientMaxBitrate, User user, string ipAddress){var maxBitrate = clientMaxBitrate;var remoteClientMaxBitrate = user.RemoteClientBitrateLimit ?? 0;diff --git a/MediaBrowser.Model/Dlna/AudioOptions.cs b/MediaBrowser.Model/Dlna/AudioOptions.csindex 67e4ffe03e..bbb8bf4263 100644--- a/MediaBrowser.Model/Dlna/AudioOptions.cs+++ b/MediaBrowser.Model/Dlna/AudioOptions.cs@@ -49,7 +49,7 @@ namespace MediaBrowser.Model.Dlna/// <summary>/// The application's configured quality setting./// </summary>- public long? MaxBitrate { get; set; }+ public int? MaxBitrate { get; set; }/// <summary>/// Gets or sets the context.@@ -67,7 +67,7 @@ namespace MediaBrowser.Model.Dlna/// Gets the maximum bitrate./// </summary>/// <returns>System.Nullable<System.Int32>.</returns>- public long? GetMaxBitrate(bool isAudio)+ public int? GetMaxBitrate(bool isAudio){if (MaxBitrate.HasValue){diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.csindex 44412f3e41..e842efead9 100644--- a/MediaBrowser.Model/Dlna/DeviceProfile.cs+++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs@@ -62,9 +62,9 @@ namespace MediaBrowser.Model.Dlnapublic int? MaxIconHeight { get; set; }- public long? MaxStreamingBitrate { get; set; }+ public int? MaxStreamingBitrate { get; set; }- public long? MaxStaticBitrate { get; set; }+ public int? MaxStaticBitrate { get; set; }public int? MusicStreamingTranscodingBitrate { get; set; }diff --git a/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs b/MediaBrowser.Model/MediaInfo/LiveStreamRequest.csindex 83bda5d569..a8ea405e28 100644--- a/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs+++ b/MediaBrowser.Model/MediaInfo/LiveStreamRequest.cs@@ -37,7 +37,7 @@ namespace MediaBrowser.Model.MediaInfopublic string PlaySessionId { get; set; }- public long? MaxStreamingBitrate { get; set; }+ public int? MaxStreamingBitrate { get; set; }public long? StartTimeTicks { get; set; }