jellyfin-server/MediaBrowser.Api/Playback/Progressive/VideoService.cs

101 lines
4.3 KiB
C#
Raw Normal View History

using MediaBrowser.Controller.Configuration;
2015-01-20 05:19:13 +00:00
using MediaBrowser.Controller.Devices;
2014-03-25 05:25:03 +00:00
using MediaBrowser.Controller.Dlna;
2013-09-18 18:49:06 +00:00
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Library;
2014-02-20 16:37:41 +00:00
using MediaBrowser.Controller.MediaEncoding;
2013-08-10 01:16:31 +00:00
using MediaBrowser.Model.IO;
2015-05-04 17:44:25 +00:00
using MediaBrowser.Model.Serialization;
2016-06-19 06:18:29 +00:00
using System.Threading.Tasks;
2016-11-10 14:41:24 +00:00
using MediaBrowser.Controller.Net;
2016-10-25 19:02:04 +00:00
using MediaBrowser.Model.Services;
2017-05-22 04:54:02 +00:00
using MediaBrowser.Model.System;
2013-02-21 01:33:05 +00:00
2013-02-27 04:19:05 +00:00
namespace MediaBrowser.Api.Playback.Progressive
2013-02-21 01:33:05 +00:00
{
2013-02-27 04:44:41 +00:00
/// <summary>
2015-05-24 18:33:28 +00:00
/// Class GetVideoStream
2013-02-27 04:44:41 +00:00
/// </summary>
2015-09-10 03:22:52 +00:00
[Route("/Videos/{Id}/stream.mpegts", "GET")]
2013-02-27 04:44:41 +00:00
[Route("/Videos/{Id}/stream.ts", "GET")]
[Route("/Videos/{Id}/stream.webm", "GET")]
[Route("/Videos/{Id}/stream.asf", "GET")]
[Route("/Videos/{Id}/stream.wmv", "GET")]
[Route("/Videos/{Id}/stream.ogv", "GET")]
[Route("/Videos/{Id}/stream.mp4", "GET")]
[Route("/Videos/{Id}/stream.m4v", "GET")]
[Route("/Videos/{Id}/stream.mkv", "GET")]
[Route("/Videos/{Id}/stream.mpeg", "GET")]
2014-06-18 05:16:00 +00:00
[Route("/Videos/{Id}/stream.mpg", "GET")]
2013-02-27 04:44:41 +00:00
[Route("/Videos/{Id}/stream.avi", "GET")]
2013-03-11 14:54:08 +00:00
[Route("/Videos/{Id}/stream.m2ts", "GET")]
[Route("/Videos/{Id}/stream.3gp", "GET")]
2013-04-10 21:03:41 +00:00
[Route("/Videos/{Id}/stream.wmv", "GET")]
[Route("/Videos/{Id}/stream.wtv", "GET")]
2014-10-11 20:38:13 +00:00
[Route("/Videos/{Id}/stream.mov", "GET")]
2016-02-29 16:23:30 +00:00
[Route("/Videos/{Id}/stream.iso", "GET")]
2017-02-15 21:18:56 +00:00
[Route("/Videos/{Id}/stream.flv", "GET")]
2013-02-27 04:44:41 +00:00
[Route("/Videos/{Id}/stream", "GET")]
2013-03-13 03:57:54 +00:00
[Route("/Videos/{Id}/stream.ts", "HEAD")]
[Route("/Videos/{Id}/stream.webm", "HEAD")]
[Route("/Videos/{Id}/stream.asf", "HEAD")]
[Route("/Videos/{Id}/stream.wmv", "HEAD")]
[Route("/Videos/{Id}/stream.ogv", "HEAD")]
[Route("/Videos/{Id}/stream.mp4", "HEAD")]
[Route("/Videos/{Id}/stream.m4v", "HEAD")]
[Route("/Videos/{Id}/stream.mkv", "HEAD")]
[Route("/Videos/{Id}/stream.mpeg", "HEAD")]
2014-06-18 05:16:00 +00:00
[Route("/Videos/{Id}/stream.mpg", "HEAD")]
2013-03-13 03:57:54 +00:00
[Route("/Videos/{Id}/stream.avi", "HEAD")]
[Route("/Videos/{Id}/stream.3gp", "HEAD")]
2013-04-10 21:03:41 +00:00
[Route("/Videos/{Id}/stream.wmv", "HEAD")]
[Route("/Videos/{Id}/stream.wtv", "HEAD")]
2013-03-13 03:57:54 +00:00
[Route("/Videos/{Id}/stream.m2ts", "HEAD")]
2014-10-11 20:38:13 +00:00
[Route("/Videos/{Id}/stream.mov", "HEAD")]
2016-02-29 16:23:30 +00:00
[Route("/Videos/{Id}/stream.iso", "HEAD")]
2017-02-15 21:18:56 +00:00
[Route("/Videos/{Id}/stream.flv", "HEAD")]
2013-03-13 03:57:54 +00:00
[Route("/Videos/{Id}/stream", "HEAD")]
2013-03-09 02:34:54 +00:00
public class GetVideoStream : VideoStreamRequest
2013-02-27 04:44:41 +00:00
{
}
2013-03-07 17:39:21 +00:00
2013-02-21 01:33:05 +00:00
/// <summary>
2013-02-27 04:19:05 +00:00
/// Class VideoService
2013-02-21 01:33:05 +00:00
/// </summary>
2017-04-25 18:23:38 +00:00
// TODO: In order to autheneticate this in the future, Dlna playback will require updating
//[Authenticated]
2013-02-27 04:19:05 +00:00
public class VideoService : BaseProgressiveStreamingService
2013-02-21 01:33:05 +00:00
{
2017-05-22 04:54:02 +00:00
public VideoService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IDlnaManager dlnaManager, ISubtitleEncoder subtitleEncoder, IDeviceManager deviceManager, IMediaSourceManager mediaSourceManager, IZipClient zipClient, IJsonSerializer jsonSerializer, IAuthorizationContext authorizationContext, IImageProcessor imageProcessor, IEnvironmentInfo environmentInfo) : base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, dlnaManager, subtitleEncoder, deviceManager, mediaSourceManager, zipClient, jsonSerializer, authorizationContext, imageProcessor, environmentInfo)
2013-02-21 01:33:05 +00:00
{
}
2013-02-27 04:44:41 +00:00
/// <summary>
/// Gets the specified request.
/// </summary>
/// <param name="request">The request.</param>
/// <returns>System.Object.</returns>
2016-06-19 06:18:29 +00:00
public Task<object> Get(GetVideoStream request)
2013-02-27 04:44:41 +00:00
{
2013-03-13 03:57:54 +00:00
return ProcessRequest(request, false);
2013-02-27 04:44:41 +00:00
}
2013-03-07 17:39:21 +00:00
2013-04-29 16:01:23 +00:00
/// <summary>
/// Heads the specified request.
/// </summary>
/// <param name="request">The request.</param>
/// <returns>System.Object.</returns>
2016-06-19 06:18:29 +00:00
public Task<object> Head(GetVideoStream request)
2013-03-13 03:57:54 +00:00
{
return ProcessRequest(request, true);
}
2015-03-28 20:22:27 +00:00
protected override string GetCommandLineArguments(string outputPath, StreamState state, bool isEncoding)
2013-02-21 01:33:05 +00:00
{
var encodingOptions = ApiEntryPoint.Instance.GetEncodingOptions();
2017-03-19 18:59:05 +00:00
return EncodingHelper.GetProgressiveVideoFullCommandLine(state, encodingOptions, outputPath, GetDefaultH264Preset());
2013-02-21 01:33:05 +00:00
}
}
2016-08-07 20:13:30 +00:00
}