aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Api')
-rw-r--r--Jellyfin.Api/Controllers/TrickplayController.cs19
-rw-r--r--Jellyfin.Api/Helpers/DynamicHlsHelper.cs18
2 files changed, 19 insertions, 18 deletions
diff --git a/Jellyfin.Api/Controllers/TrickplayController.cs b/Jellyfin.Api/Controllers/TrickplayController.cs
index 36464d726e..e4f8f076e4 100644
--- a/Jellyfin.Api/Controllers/TrickplayController.cs
+++ b/Jellyfin.Api/Controllers/TrickplayController.cs
@@ -2,6 +2,7 @@ using System;
using System.ComponentModel.DataAnnotations;
using System.Net.Mime;
using System.Text;
+using System.Threading.Tasks;
using Jellyfin.Api.Attributes;
using Jellyfin.Api.Extensions;
using MediaBrowser.Controller.Library;
@@ -42,18 +43,18 @@ public class TrickplayController : BaseJellyfinApiController
/// <param name="itemId">The item id.</param>
/// <param name="width">The width of a single tile.</param>
/// <param name="mediaSourceId">The media version id, if using an alternate version.</param>
- /// <response code="200">Tiles stream returned.</response>
- /// <returns>A <see cref="FileResult"/> containing the trickplay tiles file.</returns>
+ /// <response code="200">Tiles playlist returned.</response>
+ /// <returns>A <see cref="FileResult"/> containing the trickplay playlist file.</returns>
[HttpGet("Videos/{itemId}/Trickplay/{width}/tiles.m3u8")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesPlaylistFile]
- public ActionResult GetTrickplayHlsPlaylist(
+ public async Task<ActionResult> GetTrickplayHlsPlaylist(
[FromRoute, Required] Guid itemId,
[FromRoute, Required] int width,
[FromQuery] Guid? mediaSourceId)
{
- string? playlist = _trickplayManager.GetHlsPlaylist(mediaSourceId ?? itemId, width, User.GetToken());
+ string? playlist = await _trickplayManager.GetHlsPlaylist(mediaSourceId ?? itemId, width, User.GetToken()).ConfigureAwait(false);
if (string.IsNullOrEmpty(playlist))
{
@@ -64,20 +65,20 @@ public class TrickplayController : BaseJellyfinApiController
}
/// <summary>
- /// Gets a trickplay tile grid image.
+ /// Gets a trickplay tile image.
/// </summary>
/// <param name="itemId">The item id.</param>
/// <param name="width">The width of a single tile.</param>
- /// <param name="index">The index of the desired tile grid.</param>
+ /// <param name="index">The index of the desired tile.</param>
/// <param name="mediaSourceId">The media version id, if using an alternate version.</param>
- /// <response code="200">Tiles image returned.</response>
- /// <response code="200">Tiles image not found at specified index.</response>
+ /// <response code="200">Tile image returned.</response>
+ /// <response code="200">Tile image not found at specified index.</response>
/// <returns>A <see cref="FileResult"/> containing the trickplay tiles image.</returns>
[HttpGet("Videos/{itemId}/Trickplay/{width}/{index}.jpg")]
[ProducesResponseType(StatusCodes.Status200OK)]
[ProducesResponseType(StatusCodes.Status404NotFound)]
[ProducesImageFile]
- public ActionResult GetTrickplayGridImage(
+ public ActionResult GetTrickplayTileImage(
[FromRoute, Required] Guid itemId,
[FromRoute, Required] int width,
[FromRoute, Required] int index,
diff --git a/Jellyfin.Api/Helpers/DynamicHlsHelper.cs b/Jellyfin.Api/Helpers/DynamicHlsHelper.cs
index b1657aeae2..bd30910558 100644
--- a/Jellyfin.Api/Helpers/DynamicHlsHelper.cs
+++ b/Jellyfin.Api/Helpers/DynamicHlsHelper.cs
@@ -308,8 +308,8 @@ public class DynamicHlsHelper
if (!isLiveStream && (state.VideoRequest?.EnableTrickplay).GetValueOrDefault(false))
{
var sourceId = Guid.Parse(state.Request.MediaSourceId);
- var tilesResolutions = _trickplayManager.GetTilesResolutions(sourceId);
- AddTrickplay(state, tilesResolutions, builder, _httpContextAccessor.HttpContext.User);
+ var trickplayResolutions = await _trickplayManager.GetTrickplayResolutions(sourceId).ConfigureAwait(false);
+ AddTrickplay(state, trickplayResolutions, builder, _httpContextAccessor.HttpContext.User);
}
return new FileContentResult(Encoding.UTF8.GetBytes(builder.ToString()), MimeTypes.GetMimeType("playlist.m3u8"));
@@ -544,17 +544,17 @@ public class DynamicHlsHelper
/// Appends EXT-X-IMAGE-STREAM-INF playlists for each available trickplay resolution.
/// </summary>
/// <param name="state">StreamState of the current stream.</param>
- /// <param name="tilesResolutions">Dictionary of widths to corresponding tiles info.</param>
+ /// <param name="trickplayResolutions">Dictionary of widths to corresponding tiles info.</param>
/// <param name="builder">StringBuilder to append the field to.</param>
/// <param name="user">Http user context.</param>
- private void AddTrickplay(StreamState state, Dictionary<int, TrickplayTilesInfo> tilesResolutions, StringBuilder builder, ClaimsPrincipal user)
+ private void AddTrickplay(StreamState state, Dictionary<int, TrickplayInfo> trickplayResolutions, StringBuilder builder, ClaimsPrincipal user)
{
const string playlistFormat = "#EXT-X-IMAGE-STREAM-INF:BANDWIDTH={0},RESOLUTION={1}x{2},CODECS=\"jpeg\",URI=\"{3}\"";
- foreach (var resolution in tilesResolutions)
+ foreach (var resolution in trickplayResolutions)
{
var width = resolution.Key;
- var tilesInfo = resolution.Value;
+ var trickplayInfo = resolution.Value;
var url = string.Format(
CultureInfo.InvariantCulture,
@@ -566,9 +566,9 @@ public class DynamicHlsHelper
var line = string.Format(
CultureInfo.InvariantCulture,
playlistFormat,
- tilesInfo.Bandwidth.ToString(CultureInfo.InvariantCulture),
- tilesInfo.Width.ToString(CultureInfo.InvariantCulture),
- tilesInfo.Height.ToString(CultureInfo.InvariantCulture),
+ trickplayInfo.Bandwidth.ToString(CultureInfo.InvariantCulture),
+ trickplayInfo.Width.ToString(CultureInfo.InvariantCulture),
+ trickplayInfo.Height.ToString(CultureInfo.InvariantCulture),
url);
builder.AppendLine(line);