Skip to content

The Free Software Media System - Server Backend & API

Merge pull request #7137 from SenorSmartyPants/master

Bond-0092579b2db5615
diff --cc Jellyfin.Api/Controllers/DynamicHlsController.cs
index f2fdeeea59,f6d8347a4d..af69166300
--- a/Jellyfin.Api/Controllers/DynamicHlsController.cs
+++ b/Jellyfin.Api/Controllers/DynamicHlsController.cs
@@@ -1944,9 -1954,32 +1944,9 @@@ namespace Jellyfin.Api.Controller
return Task.CompletedTask;
});
- return FileStreamResponseHelpers.GetStaticFileResult(segmentPath, MimeTypes.GetMimeType(segmentPath), false, HttpContext);
+ return FileStreamResponseHelpers.GetStaticFileResult(segmentPath, MimeTypes.GetMimeType(segmentPath));
}
- private long GetEndPositionTicks(StreamState state, int requestedIndex)
- {
- double startSeconds = 0;
- var lengths = GetSegmentLengths(state);
-
- if (requestedIndex >= lengths.Length)
- {
- var msg = string.Format(
- CultureInfo.InvariantCulture,
- "Invalid segment index requested: {0} - Segment count: {1}",
- requestedIndex,
- lengths.Length);
- throw new ArgumentException(msg);
- }
-
- for (var i = 0; i <= requestedIndex; i++)
- {
- startSeconds += lengths[i];
- }
-
- return TimeSpan.FromSeconds(startSeconds).Ticks;
- }
-
private int? GetCurrentTranscodingIndex(string playlist, string segmentExtension)
{
var job = _transcodingJobHelper.GetTranscodingJob(playlist, TranscodingJobType);
diff --cc Jellyfin.Api/Controllers/ImageController.cs
index aafffc2a1d,e1193d17eb..5da1af42a7
--- a/Jellyfin.Api/Controllers/ImageController.cs
+++ b/Jellyfin.Api/Controllers/ImageController.cs
@@@ -1958,38 -1808,27 +1943,37 @@@ namespace Jellyfin.Api.Controller
{ "realTimeInfo.dlna.org", "DLNA.ORG_TLAG=*" }
};
+ if (!imageInfo.IsLocalFile && item != null)
+ {
+ imageInfo = await _libraryManager.ConvertImageToLocal(item, imageInfo, imageIndex ?? 0).ConfigureAwait(false);
+ }
+
+ var options = new ImageProcessingOptions
+ {
+ Height = height,
+ ImageIndex = imageIndex ?? 0,
+ Image = imageInfo,
+ Item = item,
+ ItemId = itemId,
+ MaxHeight = maxHeight,
+ MaxWidth = maxWidth,
+ FillHeight = fillHeight,
+ FillWidth = fillWidth,
+ Quality = quality ?? 100,
+ Width = width,
+ AddPlayedIndicator = addPlayedIndicator ?? false,
+ PercentPlayed = percentPlayed ?? 0,
+ UnplayedCount = unplayedCount,
+ Blur = blur,
+ BackgroundColor = backgroundColor,
+ ForegroundLayer = foregroundLayer,
+ SupportedOutputFormats = outputFormats
+ };
+
return await GetImageResult(
- item,
- itemId,
- imageIndex,
- width,
- height,
- maxWidth,
- maxHeight,
- fillWidth,
- fillHeight,
- quality,
- addPlayedIndicator,
- percentPlayed,
- unplayedCount,
- blur,
- backgroundColor,
- foregroundLayer,
- imageInfo,
- outputFormats,
+ options,
cacheDuration,
- responseHeaders,
- isHeadRequest).ConfigureAwait(false);
+ responseHeaders).ConfigureAwait(false);
}
private ImageFormat[] GetOutputFormats(ImageFormat? format)
@@@ -2066,12 -1906,55 +2050,11 @@@
}
private async Task<ActionResult> GetImageResult(
- BaseItem? item,
- Guid itemId,
- int? index,
- int? width,
- int? height,
- int? maxWidth,
- int? maxHeight,
- int? fillWidth,
- int? fillHeight,
- int? quality,
- bool? addPlayedIndicator,
- double? percentPlayed,
- int? unplayedCount,
- int? blur,
- string? backgroundColor,
- string? foregroundLayer,
- ItemImageInfo imageInfo,
- IReadOnlyCollection<ImageFormat> supportedFormats,
+ ImageProcessingOptions imageProcessingOptions,
TimeSpan? cacheDuration,
- IDictionary<string, string> headers,
- bool isHeadRequest)
+ IDictionary<string, string> headers)
{
- if (!imageInfo.IsLocalFile && item != null)
- {
- imageInfo = await _libraryManager.ConvertImageToLocal(item, imageInfo, index ?? 0).ConfigureAwait(false);
- }
-
- var options = new ImageProcessingOptions
- {
- Height = height,
- ImageIndex = index ?? 0,
- Image = imageInfo,
- Item = item,
- ItemId = itemId,
- MaxHeight = maxHeight,
- MaxWidth = maxWidth,
- FillHeight = fillHeight,
- FillWidth = fillWidth,
- Quality = quality ?? 100,
- Width = width,
- AddPlayedIndicator = addPlayedIndicator ?? false,
- PercentPlayed = percentPlayed ?? 0,
- UnplayedCount = unplayedCount,
- Blur = blur,
- BackgroundColor = backgroundColor,
- ForegroundLayer = foregroundLayer,
- SupportedOutputFormats = supportedFormats
- };
-
- var (imagePath, imageContentType, dateImageModified) = await _imageProcessor.ProcessImage(options).ConfigureAwait(false);
+ var (imagePath, imageContentType, dateImageModified) = await _imageProcessor.ProcessImage(imageProcessingOptions).ConfigureAwait(false);
var disableCaching = Request.Headers[HeaderNames.CacheControl].Contains("no-cache");
var parsingSuccessful = DateTime.TryParse(Request.Headers[HeaderNames.IfModifiedSince], out var ifModifiedSinceHeader);