update ProcessManager

This commit is contained in:
Luke Pulverenti
2015-03-02 13:48:21 -05:00
parent 0d8636d859
commit f3159f3fef
18 changed files with 77 additions and 101 deletions

View File

@@ -0,0 +1,9 @@

namespace MediaBrowser.Model.Dlna
{
public enum PlaybackErrorCode
{
NotAllowed = 0,
NoCompatibleStream = 1
}
}

View File

@@ -0,0 +1,9 @@
using System;
namespace MediaBrowser.Model.Dlna
{
public class PlaybackException : Exception
{
public PlaybackErrorCode ErrorCode { get; set;}
}
}

View File

@@ -31,7 +31,13 @@ namespace MediaBrowser.Model.Dlna
List<StreamInfo> streams = new List<StreamInfo>();
foreach (MediaSourceInfo i in mediaSources)
streams.Add(BuildAudioItem(i, options));
{
StreamInfo streamInfo = BuildAudioItem(i, options);
if (streamInfo != null)
{
streams.Add(streamInfo);
}
}
foreach (StreamInfo stream in streams)
{
@@ -63,7 +69,13 @@ namespace MediaBrowser.Model.Dlna
List<StreamInfo> streams = new List<StreamInfo>();
foreach (MediaSourceInfo i in mediaSources)
streams.Add(BuildVideoItem(i, options));
{
StreamInfo streamInfo = BuildVideoItem(i, options);
if (streamInfo != null)
{
streams.Add(streamInfo);
}
}
foreach (StreamInfo stream in streams)
{
@@ -97,7 +109,10 @@ namespace MediaBrowser.Model.Dlna
{
return stream;
}
return null;
PlaybackException error = new PlaybackException();
error.ErrorCode = PlaybackErrorCode.NoCompatibleStream;
throw error;
}
private StreamInfo BuildAudioItem(MediaSourceInfo item, AudioOptions options)
@@ -186,6 +201,11 @@ namespace MediaBrowser.Model.Dlna
if (transcodingProfile != null)
{
if (!item.SupportsTranscoding)
{
return null;
}
playlistItem.PlayMethod = PlayMethod.Transcode;
playlistItem.TranscodeSeekInfo = transcodingProfile.TranscodeSeekInfo;
playlistItem.EstimateContentLength = transcodingProfile.EstimateContentLength;
@@ -290,6 +310,11 @@ namespace MediaBrowser.Model.Dlna
if (transcodingProfile != null)
{
if (!item.SupportsTranscoding)
{
return null;
}
if (subtitleStream != null)
{
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile, options.Context);

View File

@@ -22,6 +22,7 @@ namespace MediaBrowser.Model.Dto
public long? RunTimeTicks { get; set; }
public bool ReadAtNativeFramerate { get; set; }
public bool SupportsTranscoding { get; set; }
public VideoType? VideoType { get; set; }
@@ -45,6 +46,7 @@ namespace MediaBrowser.Model.Dto
MediaStreams = new List<MediaStream>();
RequiredHttpHeaders = new Dictionary<string, string>();
PlayableStreamFileNames = new List<string>();
SupportsTranscoding = true;
}
public int? DefaultAudioStreamIndex { get; set; }

View File

@@ -125,6 +125,8 @@
<Compile Include="Devices\DeviceInfo.cs" />
<Compile Include="Devices\DevicesOptions.cs" />
<Compile Include="Dlna\EncodingContext.cs" />
<Compile Include="Dlna\PlaybackErrorCode.cs" />
<Compile Include="Dlna\PlaybackException.cs" />
<Compile Include="Dlna\Profiles\DefaultProfile.cs" />
<Compile Include="Dlna\ResolutionConfiguration.cs" />
<Compile Include="Dlna\ResolutionNormalizer.cs" />