aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Playback/StreamState.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api/Playback/StreamState.cs')
-rw-r--r--MediaBrowser.Api/Playback/StreamState.cs125
1 files changed, 21 insertions, 104 deletions
diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs
index 67fb04d0c..8d4b0cb3d 100644
--- a/MediaBrowser.Api/Playback/StreamState.cs
+++ b/MediaBrowser.Api/Playback/StreamState.cs
@@ -1,18 +1,9 @@
-using MediaBrowser.Controller.Library;
-using MediaBrowser.Model.Dlna;
-using MediaBrowser.Model.Drawing;
-using MediaBrowser.Model.Dto;
-using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.IO;
-using MediaBrowser.Model.MediaInfo;
-using MediaBrowser.Model.Net;
using System;
-using System.Collections.Generic;
-using System.Globalization;
using System.IO;
-using System.Linq;
-using System.Threading;
+using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.MediaEncoding;
+using MediaBrowser.Model.Dlna;
+using MediaBrowser.Model.Net;
using Microsoft.Extensions.Logging;
namespace MediaBrowser.Api.Playback
@@ -26,7 +17,7 @@ namespace MediaBrowser.Api.Playback
public StreamRequest Request
{
- get { return (StreamRequest)BaseRequest; }
+ get => (StreamRequest)BaseRequest;
set
{
BaseRequest = value;
@@ -37,10 +28,7 @@ namespace MediaBrowser.Api.Playback
public TranscodingThrottler TranscodingThrottler { get; set; }
- public VideoStreamRequest VideoRequest
- {
- get { return Request as VideoStreamRequest; }
- }
+ public VideoStreamRequest VideoRequest => Request as VideoStreamRequest;
/// <summary>
/// Gets or sets the log file stream.
@@ -51,10 +39,7 @@ namespace MediaBrowser.Api.Playback
public string WaitForPath { get; set; }
- public bool IsOutputVideo
- {
- get { return Request is VideoStreamRequest; }
- }
+ public bool IsOutputVideo => Request is VideoStreamRequest;
public int SegmentLength
{
@@ -107,82 +92,60 @@ namespace MediaBrowser.Api.Playback
}
}
- public int HlsListSize
- {
- get
- {
- return 0;
- }
- }
-
public string UserAgent { get; set; }
- public StreamState(IMediaSourceManager mediaSourceManager, ILogger logger, TranscodingJobType transcodingType)
- : base(logger, mediaSourceManager, transcodingType)
+ public StreamState(IMediaSourceManager mediaSourceManager, ILogger logger, TranscodingJobType transcodingType)
+ : base(transcodingType)
{
_mediaSourceManager = mediaSourceManager;
_logger = logger;
}
- public string MimeType { get; set; }
-
public bool EstimateContentLength { get; set; }
public TranscodeSeekInfo TranscodeSeekInfo { get; set; }
- public long? EncodingDurationTicks { get; set; }
-
- public string GetMimeType(string outputPath, bool enableStreamDefault = true)
- {
- if (!string.IsNullOrEmpty(MimeType))
- {
- return MimeType;
- }
-
- return MimeTypes.GetMimeType(outputPath, enableStreamDefault);
- }
-
public bool EnableDlnaHeaders { get; set; }
- public void Dispose()
+ public override void Dispose()
{
DisposeTranscodingThrottler();
- DisposeLiveStream();
DisposeLogStream();
+ DisposeLiveStream();
TranscodingJob = null;
}
- private void DisposeLogStream()
+ private void DisposeTranscodingThrottler()
{
- if (LogFileStream != null)
+ if (TranscodingThrottler != null)
{
try
{
- LogFileStream.Dispose();
+ TranscodingThrottler.Dispose();
}
catch (Exception ex)
{
- _logger.LogError(ex, "Error disposing log stream");
+ _logger.LogError(ex, "Error disposing TranscodingThrottler");
}
- LogFileStream = null;
+ TranscodingThrottler = null;
}
}
- private void DisposeTranscodingThrottler()
+ private void DisposeLogStream()
{
- if (TranscodingThrottler != null)
+ if (LogFileStream != null)
{
try
{
- TranscodingThrottler.Dispose();
+ LogFileStream.Dispose();
}
catch (Exception ex)
{
- _logger.LogError(ex, "Error disposing TranscodingThrottler");
+ _logger.LogError(ex, "Error disposing log stream");
}
- TranscodingThrottler = null;
+ LogFileStream = null;
}
}
@@ -201,58 +164,12 @@ namespace MediaBrowser.Api.Playback
}
}
- public string OutputFilePath { get; set; }
-
- public string ActualOutputVideoCodec
- {
- get
- {
- var codec = OutputVideoCodec;
-
- if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
- {
- var stream = VideoStream;
-
- if (stream != null)
- {
- return stream.Codec;
- }
-
- return null;
- }
-
- return codec;
- }
- }
-
- public string ActualOutputAudioCodec
- {
- get
- {
- var codec = OutputAudioCodec;
-
- if (string.Equals(codec, "copy", StringComparison.OrdinalIgnoreCase))
- {
- var stream = AudioStream;
-
- if (stream != null)
- {
- return stream.Codec;
- }
-
- return null;
- }
-
- return codec;
- }
- }
-
public DeviceProfile DeviceProfile { get; set; }
public TranscodingJob TranscodingJob;
public override void ReportTranscodingProgress(TimeSpan? transcodingPosition, float framerate, double? percentComplete, long bytesTranscoded, int? bitRate)
{
- ApiEntryPoint.Instance.ReportTranscodingProgress(TranscodingJob, this, transcodingPosition, 0, percentComplete, 0, bitRate);
+ ApiEntryPoint.Instance.ReportTranscodingProgress(TranscodingJob, this, transcodingPosition, framerate, percentComplete, bytesTranscoded, bitRate);
}
}
}