use server to build initial stream url's

This commit is contained in:
Luke Pulverenti
2015-03-26 12:58:02 -04:00
parent 46c9210749
commit 348b8c4414
12 changed files with 178 additions and 34 deletions

View File

@@ -251,7 +251,7 @@ namespace MediaBrowser.Model.ApiClient
/// <param name="itemId">The item identifier.</param>
/// <param name="userId">The user identifier.</param>
/// <returns>Task&lt;LiveMediaInfoResult&gt;.</returns>
Task<LiveMediaInfoResult> GetPlaybackInfo(string itemId, string userId);
Task<PlaybackInfoResponse> GetPlaybackInfo(string itemId, string userId);
/// <summary>
/// Gets the users async.

View File

@@ -118,9 +118,7 @@ namespace MediaBrowser.Model.Dlna
return stream;
}
PlaybackException error = new PlaybackException();
error.ErrorCode = PlaybackErrorCode.NoCompatibleStream;
throw error;
return null;
}
private StreamInfo BuildAudioItem(MediaSourceInfo item, AudioOptions options)
@@ -221,7 +219,7 @@ namespace MediaBrowser.Model.Dlna
playlistItem.EstimateContentLength = transcodingProfile.EstimateContentLength;
playlistItem.Container = transcodingProfile.Container;
playlistItem.AudioCodec = transcodingProfile.AudioCodec;
playlistItem.Protocol = transcodingProfile.Protocol;
playlistItem.SubProtocol = transcodingProfile.Protocol;
List<CodecProfile> audioCodecProfiles = new List<CodecProfile>();
foreach (CodecProfile i in options.Profile.CodecProfiles)
@@ -374,7 +372,7 @@ namespace MediaBrowser.Model.Dlna
playlistItem.TranscodeSeekInfo = transcodingProfile.TranscodeSeekInfo;
playlistItem.AudioCodec = transcodingProfile.AudioCodec.Split(',')[0];
playlistItem.VideoCodec = transcodingProfile.VideoCodec;
playlistItem.Protocol = transcodingProfile.Protocol;
playlistItem.SubProtocol = transcodingProfile.Protocol;
playlistItem.AudioStreamIndex = audioStreamIndex;
List<ProfileCondition> videoTranscodingConditions = new List<ProfileCondition>();

View File

@@ -24,7 +24,7 @@ namespace MediaBrowser.Model.Dlna
public string Container { get; set; }
public string Protocol { get; set; }
public string SubProtocol { get; set; }
public long StartPositionTicks { get; set; }
@@ -69,7 +69,7 @@ namespace MediaBrowser.Model.Dlna
public SubtitleDeliveryMethod SubtitleDeliveryMethod { get; set; }
public string SubtitleFormat { get; set; }
public LiveMediaInfoResult PlaybackInfo { get; set; }
public PlaybackInfoResponse PlaybackInfo { get; set; }
public string MediaSourceId
{
@@ -115,7 +115,7 @@ namespace MediaBrowser.Model.Dlna
return string.Format("{0}/audio/{1}/stream{2}?{3}", baseUrl, ItemId, extension, dlnaCommand);
}
if (StringHelper.EqualsIgnoreCase(Protocol, "hls"))
if (StringHelper.EqualsIgnoreCase(SubProtocol, "hls"))
{
return string.Format("{0}/videos/{1}/master.m3u8?{2}", baseUrl, ItemId, dlnaCommand);
}
@@ -207,7 +207,7 @@ namespace MediaBrowser.Model.Dlna
List<SubtitleStreamInfo> list = new List<SubtitleStreamInfo>();
// HLS will preserve timestamps so we can just grab the full subtitle stream
long startPositionTicks = StringHelper.EqualsIgnoreCase(Protocol, "hls")
long startPositionTicks = StringHelper.EqualsIgnoreCase(SubProtocol, "hls")
? 0
: StartPositionTicks;

View File

@@ -24,6 +24,7 @@ namespace MediaBrowser.Model.Dto
public bool ReadAtNativeFramerate { get; set; }
public bool SupportsTranscoding { get; set; }
public bool SupportsDirectStream { get; set; }
public bool SupportsDirectPlay { get; set; }
public VideoType? VideoType { get; set; }
@@ -39,7 +40,11 @@ namespace MediaBrowser.Model.Dto
public int? Bitrate { get; set; }
public TransportStreamTimestamp? Timestamp { get; set; }
public Dictionary<string, string> RequiredHttpHeaders { get; set; }
public Dictionary<string, string> RequiredHttpHeaders { get; set; }
public string TranscodingUrl { get; set; }
public string TranscodingSubProtocol { get; set; }
public string TranscodingContainer { get; set; }
public MediaSourceInfo()
{
@@ -49,6 +54,7 @@ namespace MediaBrowser.Model.Dto
PlayableStreamFileNames = new List<string>();
SupportsTranscoding = true;
SupportsDirectStream = true;
SupportsDirectPlay = true;
}
public int? DefaultAudioStreamIndex { get; set; }

View File

@@ -140,7 +140,8 @@
<Compile Include="Dto\MetadataEditorInfo.cs" />
<Compile Include="Dto\NameIdPair.cs" />
<Compile Include="Dto\NameValuePair.cs" />
<Compile Include="MediaInfo\LiveMediaInfoResult.cs" />
<Compile Include="MediaInfo\PlaybackInfoRequest.cs" />
<Compile Include="MediaInfo\PlaybackInfoResponse.cs" />
<Compile Include="Dto\MediaSourceType.cs" />
<Compile Include="Configuration\DynamicDayOfWeek.cs" />
<Compile Include="Entities\ExtraType.cs" />

View File

@@ -0,0 +1,9 @@
using MediaBrowser.Model.Dlna;
namespace MediaBrowser.Model.MediaInfo
{
public class PlaybackInfoRequest
{
public DeviceProfile DeviceProfile { get; set; }
}
}

View File

@@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace MediaBrowser.Model.MediaInfo
{
public class LiveMediaInfoResult
public class PlaybackInfoResponse
{
/// <summary>
/// Gets or sets the media sources.
@@ -24,7 +24,7 @@ namespace MediaBrowser.Model.MediaInfo
/// <value>The error code.</value>
public PlaybackErrorCode? ErrorCode { get; set; }
public LiveMediaInfoResult()
public PlaybackInfoResponse()
{
MediaSources = new List<MediaSourceInfo>();
}