mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-25 11:36:35 +00:00
update stream closing
This commit is contained in:
@@ -37,11 +37,6 @@ namespace MediaBrowser.Model.ApiClient
|
||||
/// </summary>
|
||||
event EventHandler<GenericEventArgs<RemoteLogoutReason>> RemoteLoggedOut;
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when [authenticated].
|
||||
/// </summary>
|
||||
event EventHandler<GenericEventArgs<AuthenticationResult>> Authenticated;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the API URL.
|
||||
/// </summary>
|
||||
|
||||
@@ -92,6 +92,13 @@ namespace MediaBrowser.Model.Dlna
|
||||
// Grab the first one that can be direct streamed
|
||||
// If that doesn't produce anything, just take the first
|
||||
foreach (StreamInfo i in streams)
|
||||
{
|
||||
if (i.PlayMethod == PlayMethod.DirectPlay && i.MediaSource.Protocol == MediaProtocol.File)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
foreach (StreamInfo i in streams)
|
||||
{
|
||||
if (i.PlayMethod == PlayMethod.DirectPlay)
|
||||
{
|
||||
@@ -128,12 +135,12 @@ namespace MediaBrowser.Model.Dlna
|
||||
DeviceProfile = options.Profile
|
||||
};
|
||||
|
||||
List<PlayMethod> directPlayMethods = GetAudioDirectPlayMethods(item, options);
|
||||
MediaStream audioStream = item.GetDefaultAudioStream(null);
|
||||
|
||||
List<PlayMethod> directPlayMethods = GetAudioDirectPlayMethods(item, audioStream, options);
|
||||
|
||||
if (directPlayMethods.Count > 0)
|
||||
{
|
||||
MediaStream audioStream = item.DefaultAudioStream;
|
||||
|
||||
string audioCodec = audioStream == null ? null : audioStream.Codec;
|
||||
|
||||
// Make sure audio codec profiles are satisfied
|
||||
@@ -256,10 +263,8 @@ namespace MediaBrowser.Model.Dlna
|
||||
return playlistItem;
|
||||
}
|
||||
|
||||
private List<PlayMethod> GetAudioDirectPlayMethods(MediaSourceInfo item, AudioOptions options)
|
||||
private List<PlayMethod> GetAudioDirectPlayMethods(MediaSourceInfo item, MediaStream audioStream, AudioOptions options)
|
||||
{
|
||||
MediaStream audioStream = item.DefaultAudioStream;
|
||||
|
||||
DirectPlayProfile directPlayProfile = null;
|
||||
foreach (DirectPlayProfile i in options.Profile.DirectPlayProfiles)
|
||||
{
|
||||
@@ -303,12 +308,12 @@ namespace MediaBrowser.Model.Dlna
|
||||
DeviceProfile = options.Profile
|
||||
};
|
||||
|
||||
int? audioStreamIndex = options.AudioStreamIndex ?? item.DefaultAudioStreamIndex;
|
||||
playlistItem.SubtitleStreamIndex = options.SubtitleStreamIndex ?? item.DefaultSubtitleStreamIndex;
|
||||
|
||||
MediaStream audioStream = audioStreamIndex.HasValue ? item.GetMediaStream(MediaStreamType.Audio, audioStreamIndex.Value) : null;
|
||||
MediaStream subtitleStream = playlistItem.SubtitleStreamIndex.HasValue ? item.GetMediaStream(MediaStreamType.Subtitle, playlistItem.SubtitleStreamIndex.Value) : null;
|
||||
|
||||
MediaStream audioStream = item.GetDefaultAudioStream(options.AudioStreamIndex ?? item.DefaultAudioStreamIndex);
|
||||
int? audioStreamIndex = audioStream == null ? (int?)null : audioStream.Index;
|
||||
|
||||
MediaStream videoStream = item.VideoStream;
|
||||
|
||||
int? maxBitrateSetting = options.GetMaxBitrate();
|
||||
@@ -325,7 +330,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
if (subtitleStream != null)
|
||||
{
|
||||
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile, options.Context);
|
||||
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context);
|
||||
|
||||
playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method;
|
||||
playlistItem.SubtitleFormat = subtitleProfile.Format;
|
||||
@@ -355,7 +360,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
if (subtitleStream != null)
|
||||
{
|
||||
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile, options.Context);
|
||||
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context);
|
||||
|
||||
playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method;
|
||||
playlistItem.SubtitleFormat = subtitleProfile.Format;
|
||||
@@ -597,7 +602,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
if (subtitleStream != null)
|
||||
{
|
||||
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile, options.Context);
|
||||
SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context);
|
||||
|
||||
if (subtitleProfile.Method != SubtitleDeliveryMethod.External && subtitleProfile.Method != SubtitleDeliveryMethod.Embed)
|
||||
{
|
||||
@@ -608,10 +613,10 @@ namespace MediaBrowser.Model.Dlna
|
||||
return IsAudioEligibleForDirectPlay(item, maxBitrate);
|
||||
}
|
||||
|
||||
public static SubtitleProfile GetSubtitleProfile(MediaStream subtitleStream, DeviceProfile deviceProfile, EncodingContext context)
|
||||
public static SubtitleProfile GetSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, EncodingContext context)
|
||||
{
|
||||
// Look for an external profile that matches the stream type (text/graphical)
|
||||
foreach (SubtitleProfile profile in deviceProfile.SubtitleProfiles)
|
||||
foreach (SubtitleProfile profile in subtitleProfiles)
|
||||
{
|
||||
if (profile.Method == SubtitleDeliveryMethod.External && subtitleStream.IsTextSubtitleStream == MediaStream.IsTextFormat(profile.Format))
|
||||
{
|
||||
@@ -628,7 +633,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
}
|
||||
|
||||
foreach (SubtitleProfile profile in deviceProfile.SubtitleProfiles)
|
||||
foreach (SubtitleProfile profile in subtitleProfiles)
|
||||
{
|
||||
if (profile.Method == SubtitleDeliveryMethod.Embed && subtitleStream.IsTextSubtitleStream == MediaStream.IsTextFormat(profile.Format))
|
||||
{
|
||||
|
||||
@@ -69,6 +69,8 @@ namespace MediaBrowser.Model.Dlna
|
||||
public SubtitleDeliveryMethod SubtitleDeliveryMethod { get; set; }
|
||||
public string SubtitleFormat { get; set; }
|
||||
|
||||
public LiveMediaInfoResult PlaybackInfo { get; set; }
|
||||
|
||||
public string MediaSourceId
|
||||
{
|
||||
get
|
||||
@@ -262,7 +264,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
private SubtitleStreamInfo GetSubtitleStreamInfo(MediaStream stream)
|
||||
{
|
||||
SubtitleProfile subtitleProfile = StreamBuilder.GetSubtitleProfile(stream, DeviceProfile, Context);
|
||||
SubtitleProfile subtitleProfile = StreamBuilder.GetSubtitleProfile(stream, DeviceProfile.SubtitleProfiles, Context);
|
||||
|
||||
if (subtitleProfile.Method != SubtitleDeliveryMethod.External)
|
||||
{
|
||||
@@ -288,17 +290,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
if (MediaSource != null)
|
||||
{
|
||||
if (AudioStreamIndex.HasValue)
|
||||
{
|
||||
foreach (MediaStream i in MediaSource.MediaStreams)
|
||||
{
|
||||
if (i.Index == AudioStreamIndex.Value && i.Type == MediaStreamType.Audio)
|
||||
return i;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return MediaSource.DefaultAudioStream;
|
||||
return MediaSource.GetDefaultAudioStream(AudioStreamIndex);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -57,39 +57,41 @@ namespace MediaBrowser.Model.Dto
|
||||
[IgnoreDataMember]
|
||||
public MediaStream DefaultAudioStream
|
||||
{
|
||||
get
|
||||
get { return GetDefaultAudioStream(DefaultAudioStreamIndex); }
|
||||
}
|
||||
|
||||
public MediaStream GetDefaultAudioStream(int? defaultIndex)
|
||||
{
|
||||
if (defaultIndex.HasValue)
|
||||
{
|
||||
if (DefaultAudioStreamIndex.HasValue)
|
||||
{
|
||||
var val = DefaultAudioStreamIndex.Value;
|
||||
|
||||
foreach (MediaStream i in MediaStreams)
|
||||
{
|
||||
if (i.Type == MediaStreamType.Audio && i.Index == val)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
var val = defaultIndex.Value;
|
||||
|
||||
foreach (MediaStream i in MediaStreams)
|
||||
{
|
||||
if (i.Type == MediaStreamType.Audio && i.IsDefault)
|
||||
if (i.Type == MediaStreamType.Audio && i.Index == val)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (MediaStream i in MediaStreams)
|
||||
{
|
||||
if (i.Type == MediaStreamType.Audio)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
foreach (MediaStream i in MediaStreams)
|
||||
{
|
||||
if (i.Type == MediaStreamType.Audio && i.IsDefault)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (MediaStream i in MediaStreams)
|
||||
{
|
||||
if (i.Type == MediaStreamType.Audio)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
[IgnoreDataMember]
|
||||
|
||||
@@ -13,10 +13,10 @@ namespace MediaBrowser.Model.MediaInfo
|
||||
public List<MediaSourceInfo> MediaSources { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the live stream identifier.
|
||||
/// Gets or sets the stream identifier.
|
||||
/// </summary>
|
||||
/// <value>The live stream identifier.</value>
|
||||
public string LiveStreamId { get; set; }
|
||||
/// <value>The stream identifier.</value>
|
||||
public string StreamId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the error code.
|
||||
|
||||
Reference in New Issue
Block a user