diff options
| author | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-27 18:33:40 -0500 |
|---|---|---|
| committer | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-27 18:33:40 -0500 |
| commit | 8d32971354f2dd6a8e1a70066544aee8ff87f92f (patch) | |
| tree | 41331feb5811cda86e792768c023c19c3b0d5e48 /MediaBrowser.Api/Streaming/HlsSegmentHandler.cs | |
| parent | 94b6168e27f0c9595699872e9371451052b817ff (diff) | |
fixed api shutdown and more hls progress
Diffstat (limited to 'MediaBrowser.Api/Streaming/HlsSegmentHandler.cs')
| -rw-r--r-- | MediaBrowser.Api/Streaming/HlsSegmentHandler.cs | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/MediaBrowser.Api/Streaming/HlsSegmentHandler.cs b/MediaBrowser.Api/Streaming/HlsSegmentHandler.cs deleted file mode 100644 index 4305fd8a79..0000000000 --- a/MediaBrowser.Api/Streaming/HlsSegmentHandler.cs +++ /dev/null @@ -1,85 +0,0 @@ -using MediaBrowser.Common.Net.Handlers; -using MediaBrowser.Controller; -using System; -using System.IO; -using System.Net; -using System.Threading.Tasks; - -namespace MediaBrowser.Api.Streaming -{ - /// <summary> - /// Class HlsSegmentHandler - /// </summary> - public class HlsSegmentHandler : BaseHandler<Kernel> - { - /// <summary> - /// The segment file prefix - /// </summary> - public const string SegmentFilePrefix = "segment-"; - - /// <summary> - /// Handleses the request. - /// </summary> - /// <param name="request">The request.</param> - /// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns> - public override bool HandlesRequest(HttpListenerRequest request) - { - const string url = "/api/" + SegmentFilePrefix; - - return request.Url.LocalPath.IndexOf(url, StringComparison.OrdinalIgnoreCase) != -1; - } - - /// <summary> - /// Writes the response to output stream. - /// </summary> - /// <param name="stream">The stream.</param> - /// <param name="responseInfo">The response info.</param> - /// <param name="contentLength">Length of the content.</param> - /// <returns>Task.</returns> - /// <exception cref="System.NotImplementedException"></exception> - /// <exception cref="NotImplementedException"></exception> - protected override Task WriteResponseToOutputStream(Stream stream, ResponseInfo responseInfo, long? contentLength) - { - throw new NotImplementedException(); - } - - /// <summary> - /// Gets the response info. - /// </summary> - /// <returns>Task{ResponseInfo}.</returns> - /// <exception cref="System.NotImplementedException"></exception> - /// <exception cref="NotImplementedException"></exception> - protected override Task<ResponseInfo> GetResponseInfo() - { - throw new NotImplementedException(); - } - - /// <summary> - /// Processes the request. - /// </summary> - /// <param name="ctx">The CTX.</param> - /// <returns>Task.</returns> - public override async Task ProcessRequest(HttpListenerContext ctx) - { - var path = Path.GetFileName(ctx.Request.Url.LocalPath); - - path = Path.Combine(Kernel.ApplicationPaths.FFMpegStreamCachePath, path); - - var playlistFilename = Path.GetFileNameWithoutExtension(path).Substring(SegmentFilePrefix.Length); - playlistFilename = playlistFilename.Substring(0, playlistFilename.Length - 3); - - var playlistPath = Path.Combine(Path.GetDirectoryName(path), playlistFilename + ".m3u8"); - - Plugin.Instance.OnTranscodeBeginRequest(playlistPath, TranscodingJobType.Hls); - - try - { - await new StaticFileHandler(Kernel) { Path = path }.ProcessRequest(ctx).ConfigureAwait(false); - } - finally - { - Plugin.Instance.OnTranscodeEndRequest(playlistPath, TranscodingJobType.Hls); - } - } - } -} |
