aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Models
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Api/Models')
-rw-r--r--Jellyfin.Api/Models/StreamingDtos/StreamState.cs (renamed from Jellyfin.Api/Models/StreamState.cs)122
1 files changed, 92 insertions, 30 deletions
diff --git a/Jellyfin.Api/Models/StreamState.cs b/Jellyfin.Api/Models/StreamingDtos/StreamState.cs
index 9fe5f52c3..b962e0ac7 100644
--- a/Jellyfin.Api/Models/StreamState.cs
+++ b/Jellyfin.Api/Models/StreamingDtos/StreamState.cs
@@ -5,36 +5,77 @@ using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Dlna;
-namespace Jellyfin.Api.Models
+namespace Jellyfin.Api.Models.StreamingDtos
{
+ /// <summary>
+ /// The stream state dto.
+ /// </summary>
public class StreamState : EncodingJobInfo, IDisposable
{
private readonly IMediaSourceManager _mediaSourceManager;
- private bool _disposed = false;
-
- public string RequestedUrl { get; set; }
-
- public StreamRequest Request
+ 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="mediaSourceManager" /> 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 => (StreamRequest)BaseRequest;
- set
- {
- BaseRequest = value;
-
- IsVideoRequest = VideoRequest != null;
- }
+ _mediaSourceManager = mediaSourceManager;
+ _transcodingJobHelper = transcodingJobHelper;
}
- public TranscodingThrottler TranscodingThrottler { get; set; }
-
+ /// <summary>
+ /// Gets or sets the requested url.
+ /// </summary>
+ public string? RequestedUrl { get; set; }
+
+ // /// <summary>
+ // /// Gets or sets the request.
+ // /// </summary>
+ // public StreamRequest Request
+ // {
+ // get => (StreamRequest)BaseRequest;
+ // set
+ // {
+ // BaseRequest = value;
+ //
+ // IsVideoRequest = VideoRequest != null;
+ // }
+ // }
+
+ /// <summary>
+ /// Gets or sets the transcoding throttler.
+ /// </summary>
+ public TranscodingThrottler? TranscodingThrottler { get; set; }
+
+ /// <summary>
+ /// Gets the video request.
+ /// </summary>
public VideoStreamRequest VideoRequest => Request as VideoStreamRequest;
- public IDirectStreamProvider DirectStreamProvider { get; set; }
+ /// <summary>
+ /// Gets or sets the direct stream provicer.
+ /// </summary>
+ public IDirectStreamProvider? DirectStreamProvider { get; set; }
- public string WaitForPath { 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 VideoStreamRequest;
+ /// <summary>
+ /// Gets the segment length.
+ /// </summary>
public int SegmentLength
{
get
@@ -74,6 +115,9 @@ namespace Jellyfin.Api.Models
}
}
+ /// <summary>
+ /// Gets the minimum number of segments.
+ /// </summary>
public int MinSegments
{
get
@@ -87,35 +131,53 @@ namespace Jellyfin.Api.Models
}
}
- public string UserAgent { get; set; }
+ /// <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; }
- public DeviceProfile DeviceProfile { get; set; }
+ /// <summary>
+ /// Gets or sets the device profile.
+ /// </summary>
+ public DeviceProfile? DeviceProfile { get; set; }
- public TranscodingJobDto TranscodingJob { get; set; }
+ /// <summary>
+ /// Gets or sets the transcoding job.
+ /// </summary>
+ public TranscodingJobDto? TranscodingJob { get; set; }
- public StreamState(IMediaSourceManager mediaSourceManager, TranscodingJobType transcodingType)
- : base(transcodingType)
+ /// <inheritdoc />
+ public void Dispose()
{
- _mediaSourceManager = mediaSourceManager;
+ 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);
- }
-
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
+ _transcodingJobHelper.ReportTranscodingProgress(TranscodingJob!, this, transcodingPosition, framerate, percentComplete, bytesTranscoded, bitRate);
}
+ /// <summary>
+ /// Disposes the stream state.
+ /// </summary>
+ /// <param name="disposing">Whether the object is currently beeing disposed.</param>
protected virtual void Dispose(bool disposing)
{
if (_disposed)