aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Models/StreamingDtos
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Api/Models/StreamingDtos')
-rw-r--r--Jellyfin.Api/Models/StreamingDtos/HlsAudioRequestDto.cs17
-rw-r--r--Jellyfin.Api/Models/StreamingDtos/HlsVideoRequestDto.cs17
-rw-r--r--Jellyfin.Api/Models/StreamingDtos/StreamState.cs301
-rw-r--r--Jellyfin.Api/Models/StreamingDtos/StreamingRequestDto.cs99
-rw-r--r--Jellyfin.Api/Models/StreamingDtos/VideoRequestDto.cs27
5 files changed, 228 insertions, 233 deletions
diff --git a/Jellyfin.Api/Models/StreamingDtos/HlsAudioRequestDto.cs b/Jellyfin.Api/Models/StreamingDtos/HlsAudioRequestDto.cs
index 3791fadbe..4f1abb1ff 100644
--- a/Jellyfin.Api/Models/StreamingDtos/HlsAudioRequestDto.cs
+++ b/Jellyfin.Api/Models/StreamingDtos/HlsAudioRequestDto.cs
@@ -1,13 +1,12 @@
-namespace Jellyfin.Api.Models.StreamingDtos
+namespace Jellyfin.Api.Models.StreamingDtos;
+
+/// <summary>
+/// The hls video request dto.
+/// </summary>
+public class HlsAudioRequestDto : StreamingRequestDto
{
/// <summary>
- /// The hls video request dto.
+ /// Gets or sets a value indicating whether enable adaptive bitrate streaming.
/// </summary>
- public class HlsAudioRequestDto : StreamingRequestDto
- {
- /// <summary>
- /// Gets or sets a value indicating whether enable adaptive bitrate streaming.
- /// </summary>
- public bool EnableAdaptiveBitrateStreaming { get; set; }
- }
+ public bool EnableAdaptiveBitrateStreaming { get; set; }
}
diff --git a/Jellyfin.Api/Models/StreamingDtos/HlsVideoRequestDto.cs b/Jellyfin.Api/Models/StreamingDtos/HlsVideoRequestDto.cs
index 7a4be091b..1cd3d0132 100644
--- a/Jellyfin.Api/Models/StreamingDtos/HlsVideoRequestDto.cs
+++ b/Jellyfin.Api/Models/StreamingDtos/HlsVideoRequestDto.cs
@@ -1,13 +1,12 @@
-namespace Jellyfin.Api.Models.StreamingDtos
+namespace Jellyfin.Api.Models.StreamingDtos;
+
+/// <summary>
+/// The hls video request dto.
+/// </summary>
+public class HlsVideoRequestDto : VideoRequestDto
{
/// <summary>
- /// The hls video request dto.
+ /// Gets or sets a value indicating whether enable adaptive bitrate streaming.
/// </summary>
- public class HlsVideoRequestDto : VideoRequestDto
- {
- /// <summary>
- /// Gets or sets a value indicating whether enable adaptive bitrate streaming.
- /// </summary>
- public bool EnableAdaptiveBitrateStreaming { get; set; }
- }
+ public bool EnableAdaptiveBitrateStreaming { get; set; }
}
diff --git a/Jellyfin.Api/Models/StreamingDtos/StreamState.cs b/Jellyfin.Api/Models/StreamingDtos/StreamState.cs
index 1fce1d20a..b75272d3f 100644
--- a/Jellyfin.Api/Models/StreamingDtos/StreamState.cs
+++ b/Jellyfin.Api/Models/StreamingDtos/StreamState.cs
@@ -5,192 +5,191 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Dlna;
-namespace Jellyfin.Api.Models.StreamingDtos
+namespace Jellyfin.Api.Models.StreamingDtos;
+
+/// <summary>
+/// The stream state dto.
+/// </summary>
+public class StreamState : EncodingJobInfo, IDisposable
{
+ private readonly IMediaSourceManager _mediaSourceManager;
+ private readonly TranscodingJobHelper _transcodingJobHelper;
+ private bool _disposed;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="StreamState" /> class.
+ /// </summary>
+ /// <param name="mediaSourceManager">Instance of the <see cref="IMediaSourceManager" /> interface.</param>
+ /// <param name="transcodingType">The <see cref="TranscodingJobType" />.</param>
+ /// <param name="transcodingJobHelper">The <see cref="TranscodingJobHelper" /> singleton.</param>
+ public StreamState(IMediaSourceManager mediaSourceManager, TranscodingJobType transcodingType, TranscodingJobHelper transcodingJobHelper)
+ : base(transcodingType)
+ {
+ _mediaSourceManager = mediaSourceManager;
+ _transcodingJobHelper = transcodingJobHelper;
+ }
+
+ /// <summary>
+ /// Gets or sets the requested url.
+ /// </summary>
+ public string? RequestedUrl { get; set; }
+
/// <summary>
- /// The stream state dto.
+ /// Gets or sets the request.
/// </summary>
- public class StreamState : EncodingJobInfo, IDisposable
+ public StreamingRequestDto Request
{
- private readonly IMediaSourceManager _mediaSourceManager;
- private readonly TranscodingJobHelper _transcodingJobHelper;
- private bool _disposed;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="StreamState" /> class.
- /// </summary>
- /// <param name="mediaSourceManager">Instance of the <see cref="IMediaSourceManager" /> interface.</param>
- /// <param name="transcodingType">The <see cref="TranscodingJobType" />.</param>
- /// <param name="transcodingJobHelper">The <see cref="TranscodingJobHelper" /> singleton.</param>
- public StreamState(IMediaSourceManager mediaSourceManager, TranscodingJobType transcodingType, TranscodingJobHelper transcodingJobHelper)
- : base(transcodingType)
+ get => (StreamingRequestDto)BaseRequest;
+ set
{
- _mediaSourceManager = mediaSourceManager;
- _transcodingJobHelper = transcodingJobHelper;
+ BaseRequest = value;
+ IsVideoRequest = VideoRequest is not null;
}
+ }
+
+ /// <summary>
+ /// Gets the video request.
+ /// </summary>
+ public VideoRequestDto? VideoRequest => Request as VideoRequestDto;
+
+ /// <summary>
+ /// Gets or sets the direct stream provicer.
+ /// </summary>
+ /// <remarks>
+ /// Deprecated.
+ /// </remarks>
+ public IDirectStreamProvider? DirectStreamProvider { get; set; }
+
+ /// <summary>
+ /// Gets or sets the path to wait for.
+ /// </summary>
+ public string? WaitForPath { get; set; }
- /// <summary>
- /// Gets or sets the requested url.
- /// </summary>
- public string? RequestedUrl { get; set; }
+ /// <summary>
+ /// Gets a value indicating whether the request outputs video.
+ /// </summary>
+ public bool IsOutputVideo => Request is VideoRequestDto;
- /// <summary>
- /// Gets or sets the request.
- /// </summary>
- public StreamingRequestDto Request
+ /// <summary>
+ /// Gets the segment length.
+ /// </summary>
+ public int SegmentLength
+ {
+ get
{
- get => (StreamingRequestDto)BaseRequest;
- set
+ if (Request.SegmentLength.HasValue)
{
- BaseRequest = value;
- IsVideoRequest = VideoRequest is not null;
+ return Request.SegmentLength.Value;
}
- }
- /// <summary>
- /// Gets the video request.
- /// </summary>
- public VideoRequestDto? VideoRequest => Request as VideoRequestDto;
-
- /// <summary>
- /// Gets or sets the direct stream provicer.
- /// </summary>
- /// <remarks>
- /// Deprecated.
- /// </remarks>
- public IDirectStreamProvider? DirectStreamProvider { get; set; }
-
- /// <summary>
- /// Gets or sets the path to wait for.
- /// </summary>
- public string? WaitForPath { get; set; }
-
- /// <summary>
- /// Gets a value indicating whether the request outputs video.
- /// </summary>
- public bool IsOutputVideo => Request is VideoRequestDto;
-
- /// <summary>
- /// Gets the segment length.
- /// </summary>
- public int SegmentLength
- {
- get
+ if (EncodingHelper.IsCopyCodec(OutputVideoCodec))
{
- if (Request.SegmentLength.HasValue)
+ var userAgent = UserAgent ?? string.Empty;
+
+ if (userAgent.IndexOf("AppleTV", StringComparison.OrdinalIgnoreCase) != -1
+ || userAgent.IndexOf("cfnetwork", StringComparison.OrdinalIgnoreCase) != -1
+ || userAgent.IndexOf("ipad", StringComparison.OrdinalIgnoreCase) != -1
+ || userAgent.IndexOf("iphone", StringComparison.OrdinalIgnoreCase) != -1
+ || userAgent.IndexOf("ipod", StringComparison.OrdinalIgnoreCase) != -1)
{
- return Request.SegmentLength.Value;
+ return 6;
}
- if (EncodingHelper.IsCopyCodec(OutputVideoCodec))
+ if (IsSegmentedLiveStream)
{
- var userAgent = UserAgent ?? string.Empty;
-
- if (userAgent.IndexOf("AppleTV", StringComparison.OrdinalIgnoreCase) != -1
- || userAgent.IndexOf("cfnetwork", StringComparison.OrdinalIgnoreCase) != -1
- || userAgent.IndexOf("ipad", StringComparison.OrdinalIgnoreCase) != -1
- || userAgent.IndexOf("iphone", StringComparison.OrdinalIgnoreCase) != -1
- || userAgent.IndexOf("ipod", StringComparison.OrdinalIgnoreCase) != -1)
- {
- return 6;
- }
-
- if (IsSegmentedLiveStream)
- {
- return 3;
- }
-
- return 6;
+ return 3;
}
- return 3;
+ return 6;
}
+
+ return 3;
}
+ }
- /// <summary>
- /// Gets the minimum number of segments.
- /// </summary>
- public int MinSegments
+ /// <summary>
+ /// Gets the minimum number of segments.
+ /// </summary>
+ public int MinSegments
+ {
+ get
{
- get
+ if (Request.MinSegments.HasValue)
{
- if (Request.MinSegments.HasValue)
- {
- return Request.MinSegments.Value;
- }
-
- return SegmentLength >= 10 ? 2 : 3;
+ return Request.MinSegments.Value;
}
- }
- /// <summary>
- /// Gets or sets the user agent.
- /// </summary>
- public string? UserAgent { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether to estimate the content length.
- /// </summary>
- public bool EstimateContentLength { get; set; }
-
- /// <summary>
- /// Gets or sets the transcode seek info.
- /// </summary>
- public TranscodeSeekInfo TranscodeSeekInfo { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether to enable dlna headers.
- /// </summary>
- public bool EnableDlnaHeaders { get; set; }
-
- /// <summary>
- /// Gets or sets the device profile.
- /// </summary>
- public DeviceProfile? DeviceProfile { get; set; }
-
- /// <summary>
- /// Gets or sets the transcoding job.
- /// </summary>
- public TranscodingJobDto? TranscodingJob { get; set; }
-
- /// <inheritdoc />
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
+ return SegmentLength >= 10 ? 2 : 3;
}
+ }
+
+ /// <summary>
+ /// Gets or sets the user agent.
+ /// </summary>
+ public string? UserAgent { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to estimate the content length.
+ /// </summary>
+ public bool EstimateContentLength { get; set; }
+
+ /// <summary>
+ /// Gets or sets the transcode seek info.
+ /// </summary>
+ public TranscodeSeekInfo TranscodeSeekInfo { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to enable dlna headers.
+ /// </summary>
+ public bool EnableDlnaHeaders { get; set; }
+
+ /// <summary>
+ /// Gets or sets the device profile.
+ /// </summary>
+ public DeviceProfile? DeviceProfile { get; set; }
- /// <inheritdoc />
- public override void ReportTranscodingProgress(TimeSpan? transcodingPosition, float? framerate, double? percentComplete, long? bytesTranscoded, int? bitRate)
+ /// <summary>
+ /// Gets or sets the transcoding job.
+ /// </summary>
+ public TranscodingJobDto? TranscodingJob { get; set; }
+
+ /// <inheritdoc />
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ /// <inheritdoc />
+ public override void ReportTranscodingProgress(TimeSpan? transcodingPosition, float? framerate, double? percentComplete, long? bytesTranscoded, int? bitRate)
+ {
+ _transcodingJobHelper.ReportTranscodingProgress(TranscodingJob!, this, transcodingPosition, framerate, percentComplete, bytesTranscoded, bitRate);
+ }
+
+ /// <summary>
+ /// Disposes the stream state.
+ /// </summary>
+ /// <param name="disposing">Whether the object is currently being disposed.</param>
+ protected virtual void Dispose(bool disposing)
+ {
+ if (_disposed)
{
- _transcodingJobHelper.ReportTranscodingProgress(TranscodingJob!, this, transcodingPosition, framerate, percentComplete, bytesTranscoded, bitRate);
+ return;
}
- /// <summary>
- /// Disposes the stream state.
- /// </summary>
- /// <param name="disposing">Whether the object is currently being disposed.</param>
- protected virtual void Dispose(bool disposing)
+ if (disposing)
{
- if (_disposed)
+ // REVIEW: Is this the right place for this?
+ if (MediaSource.RequiresClosing
+ && string.IsNullOrWhiteSpace(Request.LiveStreamId)
+ && !string.IsNullOrWhiteSpace(MediaSource.LiveStreamId))
{
- return;
- }
-
- if (disposing)
- {
- // REVIEW: Is this the right place for this?
- if (MediaSource.RequiresClosing
- && string.IsNullOrWhiteSpace(Request.LiveStreamId)
- && !string.IsNullOrWhiteSpace(MediaSource.LiveStreamId))
- {
- _mediaSourceManager.CloseLiveStream(MediaSource.LiveStreamId).GetAwaiter().GetResult();
- }
+ _mediaSourceManager.CloseLiveStream(MediaSource.LiveStreamId).GetAwaiter().GetResult();
}
+ }
- TranscodingJob = null;
+ TranscodingJob = null;
- _disposed = true;
- }
+ _disposed = true;
}
}
diff --git a/Jellyfin.Api/Models/StreamingDtos/StreamingRequestDto.cs b/Jellyfin.Api/Models/StreamingDtos/StreamingRequestDto.cs
index f8b0212b6..389d6006d 100644
--- a/Jellyfin.Api/Models/StreamingDtos/StreamingRequestDto.cs
+++ b/Jellyfin.Api/Models/StreamingDtos/StreamingRequestDto.cs
@@ -1,55 +1,54 @@
using MediaBrowser.Controller.MediaEncoding;
-namespace Jellyfin.Api.Models.StreamingDtos
+namespace Jellyfin.Api.Models.StreamingDtos;
+
+/// <summary>
+/// The audio streaming request dto.
+/// </summary>
+public class StreamingRequestDto : BaseEncodingJobOptions
{
/// <summary>
- /// The audio streaming request dto.
- /// </summary>
- public class StreamingRequestDto : BaseEncodingJobOptions
- {
- /// <summary>
- /// Gets or sets the device profile.
- /// </summary>
- public string? DeviceProfileId { get; set; }
-
- /// <summary>
- /// Gets or sets the params.
- /// </summary>
- public string? Params { get; set; }
-
- /// <summary>
- /// Gets or sets the play session id.
- /// </summary>
- public string? PlaySessionId { get; set; }
-
- /// <summary>
- /// Gets or sets the tag.
- /// </summary>
- public string? Tag { get; set; }
-
- /// <summary>
- /// Gets or sets the segment container.
- /// </summary>
- public string? SegmentContainer { get; set; }
-
- /// <summary>
- /// Gets or sets the segment length.
- /// </summary>
- public int? SegmentLength { get; set; }
-
- /// <summary>
- /// Gets or sets the min segments.
- /// </summary>
- public int? MinSegments { get; set; }
-
- /// <summary>
- /// Gets or sets the position of the requested segment in ticks.
- /// </summary>
- public long CurrentRuntimeTicks { get; set; }
-
- /// <summary>
- /// Gets or sets the actual segment length in ticks.
- /// </summary>
- public long ActualSegmentLengthTicks { get; set; }
- }
+ /// Gets or sets the device profile.
+ /// </summary>
+ public string? DeviceProfileId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the params.
+ /// </summary>
+ public string? Params { get; set; }
+
+ /// <summary>
+ /// Gets or sets the play session id.
+ /// </summary>
+ public string? PlaySessionId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the tag.
+ /// </summary>
+ public string? Tag { get; set; }
+
+ /// <summary>
+ /// Gets or sets the segment container.
+ /// </summary>
+ public string? SegmentContainer { get; set; }
+
+ /// <summary>
+ /// Gets or sets the segment length.
+ /// </summary>
+ public int? SegmentLength { get; set; }
+
+ /// <summary>
+ /// Gets or sets the min segments.
+ /// </summary>
+ public int? MinSegments { get; set; }
+
+ /// <summary>
+ /// Gets or sets the position of the requested segment in ticks.
+ /// </summary>
+ public long CurrentRuntimeTicks { get; set; }
+
+ /// <summary>
+ /// Gets or sets the actual segment length in ticks.
+ /// </summary>
+ public long ActualSegmentLengthTicks { get; set; }
}
diff --git a/Jellyfin.Api/Models/StreamingDtos/VideoRequestDto.cs b/Jellyfin.Api/Models/StreamingDtos/VideoRequestDto.cs
index cce2a89d4..60c529d4a 100644
--- a/Jellyfin.Api/Models/StreamingDtos/VideoRequestDto.cs
+++ b/Jellyfin.Api/Models/StreamingDtos/VideoRequestDto.cs
@@ -1,19 +1,18 @@
-namespace Jellyfin.Api.Models.StreamingDtos
+namespace Jellyfin.Api.Models.StreamingDtos;
+
+/// <summary>
+/// The video request dto.
+/// </summary>
+public class VideoRequestDto : StreamingRequestDto
{
/// <summary>
- /// The video request dto.
+ /// Gets a value indicating whether this instance has fixed resolution.
/// </summary>
- public class VideoRequestDto : StreamingRequestDto
- {
- /// <summary>
- /// Gets a value indicating whether this instance has fixed resolution.
- /// </summary>
- /// <value><c>true</c> if this instance has fixed resolution; otherwise, <c>false</c>.</value>
- public bool HasFixedResolution => Width.HasValue || Height.HasValue;
+ /// <value><c>true</c> if this instance has fixed resolution; otherwise, <c>false</c>.</value>
+ public bool HasFixedResolution => Width.HasValue || Height.HasValue;
- /// <summary>
- /// Gets or sets a value indicating whether to enable subtitles in the manifest.
- /// </summary>
- public bool EnableSubtitlesInManifest { get; set; }
- }
+ /// <summary>
+ /// Gets or sets a value indicating whether to enable subtitles in the manifest.
+ /// </summary>
+ public bool EnableSubtitlesInManifest { get; set; }
}