@ -686,7 +686,7 @@ namespace MediaBrowser.Model.Dlna
if ( subtitleStream ! = null )
{
SubtitleProfile subtitleProfile = GetSubtitleProfile ( subtitleStream, options . Profile . SubtitleProfiles , directPlay . Value , _transcoderSupport , null , null ) ;
SubtitleProfile subtitleProfile = GetSubtitleProfile ( item, subtitleStream, options . Profile . SubtitleProfiles , directPlay . Value , _transcoderSupport , null , null ) ;
playlistItem . SubtitleDeliveryMethod = subtitleProfile . Method ;
playlistItem . SubtitleFormat = subtitleProfile . Format ;
@ -728,7 +728,7 @@ namespace MediaBrowser.Model.Dlna
if ( subtitleStream ! = null )
{
SubtitleProfile subtitleProfile = GetSubtitleProfile ( subtitleStream, options . Profile . SubtitleProfiles , PlayMethod . Transcode , _transcoderSupport , transcodingProfile . Protocol , transcodingProfile . Container ) ;
SubtitleProfile subtitleProfile = GetSubtitleProfile ( item, subtitleStream, options . Profile . SubtitleProfiles , PlayMethod . Transcode , _transcoderSupport , transcodingProfile . Protocol , transcodingProfile . Container ) ;
playlistItem . SubtitleDeliveryMethod = subtitleProfile . Method ;
playlistItem . SubtitleFormat = subtitleProfile . Format ;
@ -1054,15 +1054,6 @@ namespace MediaBrowser.Model.Dlna
string videoCodec = videoStream = = null ? null : videoStream . Codec ;
if ( string . IsNullOrEmpty ( videoCodec ) )
{
_logger . Info ( "Profile: {0}, DirectPlay=false. Reason=Unknown video codec. Path: {1}" ,
profile . Name ? ? "Unknown Profile" ,
mediaSource . Path ? ? "Unknown path" ) ;
return new Tuple < PlayMethod ? , List < TranscodeReason > > ( null , new List < TranscodeReason > { TranscodeReason . UnknownVideoStreamInfo } ) ;
}
conditions = new List < ProfileCondition > ( ) ;
foreach ( CodecProfile i in profile . CodecProfiles )
{
@ -1189,7 +1180,7 @@ namespace MediaBrowser.Model.Dlna
{
if ( subtitleStream ! = null )
{
SubtitleProfile subtitleProfile = GetSubtitleProfile ( subtitleStream, options . Profile . SubtitleProfiles , playMethod , _transcoderSupport , null , null ) ;
SubtitleProfile subtitleProfile = GetSubtitleProfile ( item, subtitleStream, options . Profile . SubtitleProfiles , playMethod , _transcoderSupport , null , null ) ;
if ( subtitleProfile . Method ! = SubtitleDeliveryMethod . External & & subtitleProfile . Method ! = SubtitleDeliveryMethod . Embed )
{
@ -1208,7 +1199,7 @@ namespace MediaBrowser.Model.Dlna
return new Tuple < bool , TranscodeReason ? > ( result , TranscodeReason . ContainerBitrateExceedsLimit ) ;
}
public static SubtitleProfile GetSubtitleProfile ( MediaS tream subtitleStream , SubtitleProfile [ ] subtitleProfiles , PlayMethod playMethod , ITranscoderSupport transcoderSupport , string transcodingSubProtocol , string transcodingContainer )
public static SubtitleProfile GetSubtitleProfile ( MediaS ourceInfo mediaSource , MediaS tream subtitleStream , SubtitleProfile [ ] subtitleProfiles , PlayMethod playMethod , ITranscoderSupport transcoderSupport , string transcodingSubProtocol , string transcodingContainer )
{
if ( ! subtitleStream . IsExternal & & ( playMethod ! = PlayMethod . Transcode | | ! string . Equals ( transcodingSubProtocol , "hls" , StringComparison . OrdinalIgnoreCase ) ) )
{
@ -1262,8 +1253,8 @@ namespace MediaBrowser.Model.Dlna
}
// Look for an external or hls profile that matches the stream type (text/graphical) and doesn't require conversion
return GetExternalSubtitleProfile ( subtitleStream, subtitleProfiles , playMethod , transcoderSupport , false ) ? ?
GetExternalSubtitleProfile ( subtitleStream, subtitleProfiles , playMethod , transcoderSupport , true ) ? ?
return GetExternalSubtitleProfile ( mediaSource, subtitleStream, subtitleProfiles , playMethod , transcoderSupport , false ) ? ?
GetExternalSubtitleProfile ( mediaSource, subtitleStream, subtitleProfiles , playMethod , transcoderSupport , true ) ? ?
new SubtitleProfile
{
Method = SubtitleDeliveryMethod . Encode ,
@ -1299,7 +1290,7 @@ namespace MediaBrowser.Model.Dlna
return false ;
}
private static SubtitleProfile GetExternalSubtitleProfile ( MediaS tream subtitleStream , SubtitleProfile [ ] subtitleProfiles , PlayMethod playMethod , ITranscoderSupport transcoderSupport , bool allowConversion )
private static SubtitleProfile GetExternalSubtitleProfile ( MediaS ourceInfo mediaSource , MediaS tream subtitleStream , SubtitleProfile [ ] subtitleProfiles , PlayMethod playMethod , ITranscoderSupport transcoderSupport , bool allowConversion )
{
foreach ( SubtitleProfile profile in subtitleProfiles )
{
@ -1338,6 +1329,12 @@ namespace MediaBrowser.Model.Dlna
continue ;
}
// TODO: Build this into subtitleStream.SupportsExternalStream
if ( mediaSource . IsInfiniteStream )
{
continue ;
}
if ( subtitleStream . IsTextSubtitleStream & & subtitleStream . SupportsExternalStream & & subtitleStream . SupportsSubtitleConversionTo ( profile . Format ) )
{
return profile ;