using System.Security;
using MediaBrowser.Common.IO;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.IO;
using ServiceStack;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Api.Playback.Hls
{
///
/// Options is needed for chromecast. Threw Head in there since it's related
///
[Route("/Videos/{Id}/master.mpd", "GET", Summary = "Gets a video stream using Mpeg dash.")]
[Route("/Videos/{Id}/master.mpd", "HEAD", Summary = "Gets a video stream using Mpeg dash.")]
public class GetMasterManifest : VideoStreamRequest
{
public bool EnableAdaptiveBitrateStreaming { get; set; }
public GetMasterManifest()
{
EnableAdaptiveBitrateStreaming = true;
}
}
[Route("/Videos/{Id}/dash/{SegmentId}.ts", "GET")]
public class GetDashSegment : VideoStreamRequest
{
///
/// Gets or sets the segment id.
///
/// The segment id.
public string SegmentId { get; set; }
}
public class MpegDashService : BaseHlsService
{
protected INetworkManager NetworkManager { get; private set; }
public MpegDashService(IServerConfigurationManager serverConfig, IUserManager userManager, ILibraryManager libraryManager, IIsoManager isoManager, IMediaEncoder mediaEncoder, IFileSystem fileSystem, ILiveTvManager liveTvManager, IDlnaManager dlnaManager, IChannelManager channelManager, ISubtitleEncoder subtitleEncoder, INetworkManager networkManager)
: base(serverConfig, userManager, libraryManager, isoManager, mediaEncoder, fileSystem, liveTvManager, dlnaManager, channelManager, subtitleEncoder)
{
NetworkManager = networkManager;
}
public object Get(GetMasterManifest request)
{
var result = GetAsync(request, "GET").Result;
return result;
}
public object Head(GetMasterManifest request)
{
var result = GetAsync(request, "HEAD").Result;
return result;
}
private async Task