aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Playback
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api/Playback')
-rw-r--r--MediaBrowser.Api/Playback/BaseStreamingService.cs50
-rw-r--r--MediaBrowser.Api/Playback/ProgressiveStreamService.cs73
-rw-r--r--MediaBrowser.Api/Playback/StreamRequest.cs5
-rw-r--r--MediaBrowser.Api/Playback/StreamState.cs2
4 files changed, 76 insertions, 54 deletions
diff --git a/MediaBrowser.Api/Playback/BaseStreamingService.cs b/MediaBrowser.Api/Playback/BaseStreamingService.cs
index 519ff7947..9b126420a 100644
--- a/MediaBrowser.Api/Playback/BaseStreamingService.cs
+++ b/MediaBrowser.Api/Playback/BaseStreamingService.cs
@@ -835,11 +835,6 @@ namespace MediaBrowser.Api.Playback
/// <returns>System.String.</returns>
protected string GetInputArgument(StreamState state)
{
- if (state.SendInputOverStandardInput)
- {
- return "-";
- }
-
var type = InputType.File;
var inputPath = new[] { state.MediaPath };
@@ -898,9 +893,7 @@ namespace MediaBrowser.Api.Playback
Arguments = commandLineArgs,
WindowStyle = ProcessWindowStyle.Hidden,
- ErrorDialog = false,
-
- RedirectStandardInput = state.SendInputOverStandardInput
+ ErrorDialog = false
},
EnableRaisingEvents = true
@@ -933,11 +926,6 @@ namespace MediaBrowser.Api.Playback
throw;
}
- if (state.SendInputOverStandardInput)
- {
- StreamToStandardInput(process, state);
- }
-
// MUST read both stdout and stderr asynchronously or a deadlock may occurr
process.BeginOutputReadLine();
@@ -965,32 +953,6 @@ namespace MediaBrowser.Api.Playback
}
}
- private async void StreamToStandardInput(Process process, StreamState state)
- {
- try
- {
- await StreamToStandardInputInternal(process, state).ConfigureAwait(false);
- }
- catch (OperationCanceledException)
- {
- Logger.Debug("Stream to standard input closed normally.");
- }
- catch (Exception ex)
- {
- Logger.ErrorException("Error writing to standard input", ex);
- }
- }
-
- private async Task StreamToStandardInputInternal(Process process, StreamState state)
- {
- state.StandardInputCancellationTokenSource = new CancellationTokenSource();
-
- using (var fileStream = FileSystem.GetFileStream(state.MediaPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite, true))
- {
- await new EndlessStreamCopy().CopyStream(fileStream, process.StandardInput.BaseStream, state.StandardInputCancellationTokenSource.Token).ConfigureAwait(false);
- }
- }
-
protected int? GetVideoBitrateParamValue(StreamState state)
{
var bitrate = state.VideoRequest.VideoBitRate;
@@ -1315,11 +1277,6 @@ namespace MediaBrowser.Api.Playback
ParseParams(request);
}
- if (request.ThrowDebugError)
- {
- throw new InvalidOperationException("You asked for a debug error, you got one.");
- }
-
var user = AuthorizationRequestFilterAttribute.GetCurrentUser(Request, UserManager);
var url = Request.PathInfo;
@@ -1369,8 +1326,6 @@ namespace MediaBrowser.Api.Playback
{
state.MediaPath = path;
state.IsRemote = false;
-
- state.SendInputOverStandardInput = recording.RecordingInfo.Status == RecordingStatus.InProgress;
}
else if (!string.IsNullOrEmpty(mediaUrl))
{
@@ -1378,7 +1333,8 @@ namespace MediaBrowser.Api.Playback
state.IsRemote = true;
}
- //state.RunTimeTicks = recording.RunTimeTicks;
+ state.RunTimeTicks = recording.RunTimeTicks;
+
if (recording.RecordingInfo.Status == RecordingStatus.InProgress && !state.IsRemote)
{
await Task.Delay(1000, cancellationToken).ConfigureAwait(false);
diff --git a/MediaBrowser.Api/Playback/ProgressiveStreamService.cs b/MediaBrowser.Api/Playback/ProgressiveStreamService.cs
new file mode 100644
index 000000000..531f79a22
--- /dev/null
+++ b/MediaBrowser.Api/Playback/ProgressiveStreamService.cs
@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using MediaBrowser.Api.Playback.Progressive;
+
+namespace MediaBrowser.Api.Playback
+{
+ //public class GetProgressiveAudioStream : StreamRequest
+ //{
+
+ //}
+
+ //public class ProgressiveStreamService : BaseApiService
+ //{
+ // public object Get(GetProgressiveAudioStream request)
+ // {
+ // return ProcessRequest(request, false);
+ // }
+
+ // /// <summary>
+ // /// Gets the specified request.
+ // /// </summary>
+ // /// <param name="request">The request.</param>
+ // /// <returns>System.Object.</returns>
+ // public object Head(GetProgressiveAudioStream request)
+ // {
+ // return ProcessRequest(request, true);
+ // }
+
+ // protected object ProcessRequest(StreamRequest request, bool isHeadRequest)
+ // {
+ // var state = GetState(request, CancellationToken.None).Result;
+
+ // var responseHeaders = new Dictionary<string, string>();
+
+ // if (request.Static && state.IsRemote)
+ // {
+ // AddDlnaHeaders(state, responseHeaders, true);
+
+ // return GetStaticRemoteStreamResult(state.MediaPath, responseHeaders, isHeadRequest).Result;
+ // }
+
+ // var outputPath = GetOutputFilePath(state);
+ // var outputPathExists = File.Exists(outputPath);
+
+ // var isStatic = request.Static ||
+ // (outputPathExists && !ApiEntryPoint.Instance.HasActiveTranscodingJob(outputPath, TranscodingJobType.Progressive));
+
+ // AddDlnaHeaders(state, responseHeaders, isStatic);
+
+ // if (request.Static)
+ // {
+ // var contentType = state.GetMimeType(state.MediaPath);
+
+ // return ResultFactory.GetStaticFileResult(Request, state.MediaPath, contentType, FileShare.Read, responseHeaders, isHeadRequest);
+ // }
+
+ // if (outputPathExists && !ApiEntryPoint.Instance.HasActiveTranscodingJob(outputPath, TranscodingJobType.Progressive))
+ // {
+ // var contentType = state.GetMimeType(outputPath);
+
+ // return ResultFactory.GetStaticFileResult(Request, outputPath, contentType, FileShare.Read, responseHeaders, isHeadRequest);
+ // }
+
+ // return GetStreamResult(state, responseHeaders, isHeadRequest).Result;
+ // }
+
+ //}
+}
diff --git a/MediaBrowser.Api/Playback/StreamRequest.cs b/MediaBrowser.Api/Playback/StreamRequest.cs
index 0eb2984fb..add517b5d 100644
--- a/MediaBrowser.Api/Playback/StreamRequest.cs
+++ b/MediaBrowser.Api/Playback/StreamRequest.cs
@@ -67,11 +67,6 @@ namespace MediaBrowser.Api.Playback
[ApiMember(Name = "DeviceProfileId", Description = "Optional. The dlna device profile id to utilize.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]
public string DeviceProfileId { get; set; }
-
- /// <summary>
- /// For testing purposes
- /// </summary>
- public bool ThrowDebugError { get; set; }
public string Params { get; set; }
}
diff --git a/MediaBrowser.Api/Playback/StreamState.cs b/MediaBrowser.Api/Playback/StreamState.cs
index 504d7d921..48285a4b1 100644
--- a/MediaBrowser.Api/Playback/StreamState.cs
+++ b/MediaBrowser.Api/Playback/StreamState.cs
@@ -51,8 +51,6 @@ namespace MediaBrowser.Api.Playback
public bool HasMediaStreams { get; set; }
- public bool SendInputOverStandardInput { get; set; }
-
public CancellationTokenSource StandardInputCancellationTokenSource { get; set; }
public string LiveTvStreamId { get; set; }