mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-22 18:14:42 +01:00
update hls to support mpeg2video
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
NumVideoStreams = 17,
|
||||
IsSecondaryAudio = 18,
|
||||
VideoCodecTag = 19,
|
||||
IsAvc = 20
|
||||
IsAvc = 20,
|
||||
IsInterlaced = 21
|
||||
}
|
||||
}
|
||||
@@ -231,6 +231,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
{
|
||||
playlistItem.AudioCodecs = transcodingProfile.AudioCodec.Split(',');
|
||||
}
|
||||
|
||||
playlistItem.SubProtocol = transcodingProfile.Protocol;
|
||||
|
||||
List<CodecProfile> audioCodecProfiles = new List<CodecProfile>();
|
||||
@@ -479,7 +480,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
playlistItem.AudioCodecs = transcodingProfile.AudioCodec.Split(',');
|
||||
|
||||
playlistItem.VideoCodec = transcodingProfile.VideoCodec;
|
||||
playlistItem.VideoCodecs = transcodingProfile.VideoCodec.Split(',');
|
||||
playlistItem.CopyTimestamps = transcodingProfile.CopyTimestamps;
|
||||
playlistItem.EnableSubtitlesInManifest = transcodingProfile.EnableSubtitlesInManifest;
|
||||
|
||||
@@ -1137,6 +1138,37 @@ namespace MediaBrowser.Model.Dlna
|
||||
break;
|
||||
}
|
||||
case ProfileConditionValue.IsAnamorphic:
|
||||
{
|
||||
bool isAnamorphic;
|
||||
if (bool.TryParse(value, out isAnamorphic))
|
||||
{
|
||||
if (isAnamorphic && condition.Condition == ProfileConditionType.Equals)
|
||||
{
|
||||
item.RequireNonAnamorphic = true;
|
||||
}
|
||||
else if (!isAnamorphic && condition.Condition == ProfileConditionType.NotEquals)
|
||||
{
|
||||
item.RequireNonAnamorphic = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ProfileConditionValue.IsInterlaced:
|
||||
{
|
||||
bool isInterlaced;
|
||||
if (bool.TryParse(value, out isInterlaced))
|
||||
{
|
||||
if (isInterlaced && condition.Condition == ProfileConditionType.Equals)
|
||||
{
|
||||
item.DeInterlace = true;
|
||||
}
|
||||
else if (!isInterlaced && condition.Condition == ProfileConditionType.NotEquals)
|
||||
{
|
||||
item.DeInterlace = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ProfileConditionValue.AudioProfile:
|
||||
case ProfileConditionValue.Has64BitOffsets:
|
||||
case ProfileConditionValue.PacketLength:
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace MediaBrowser.Model.Dlna
|
||||
public StreamInfo()
|
||||
{
|
||||
AudioCodecs = new string[] { };
|
||||
VideoCodecs = new string[] { };
|
||||
SubtitleCodecs = new string[] { };
|
||||
}
|
||||
|
||||
@@ -34,13 +35,15 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
public long StartPositionTicks { get; set; }
|
||||
|
||||
public string VideoCodec { get; set; }
|
||||
public string VideoProfile { get; set; }
|
||||
|
||||
public bool RequireAvc { get; set; }
|
||||
public bool DeInterlace { get; set; }
|
||||
public bool RequireNonAnamorphic { get; set; }
|
||||
public bool CopyTimestamps { get; set; }
|
||||
public bool EnableSubtitlesInManifest { get; set; }
|
||||
public string[] AudioCodecs { get; set; }
|
||||
public string[] VideoCodecs { get; set; }
|
||||
|
||||
public int? AudioStreamIndex { get; set; }
|
||||
|
||||
@@ -204,11 +207,15 @@ namespace MediaBrowser.Model.Dlna
|
||||
string.Empty :
|
||||
string.Join(",", item.AudioCodecs);
|
||||
|
||||
string videoCodecs = item.VideoCodecs.Length == 0 ?
|
||||
string.Empty :
|
||||
string.Join(",", item.VideoCodecs);
|
||||
|
||||
list.Add(new NameValuePair("DeviceProfileId", item.DeviceProfileId ?? string.Empty));
|
||||
list.Add(new NameValuePair("DeviceId", item.DeviceId ?? string.Empty));
|
||||
list.Add(new NameValuePair("MediaSourceId", item.MediaSourceId ?? string.Empty));
|
||||
list.Add(new NameValuePair("Static", item.IsDirectStream.ToString().ToLower()));
|
||||
list.Add(new NameValuePair("VideoCodec", item.VideoCodec ?? string.Empty));
|
||||
list.Add(new NameValuePair("VideoCodec", videoCodecs));
|
||||
list.Add(new NameValuePair("AudioCodec", audioCodecs));
|
||||
list.Add(new NameValuePair("AudioStreamIndex", item.AudioStreamIndex.HasValue ? StringHelper.ToStringCultureInvariant(item.AudioStreamIndex.Value) : string.Empty));
|
||||
list.Add(new NameValuePair("SubtitleStreamIndex", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External ? StringHelper.ToStringCultureInvariant(item.SubtitleStreamIndex.Value) : string.Empty));
|
||||
@@ -232,7 +239,9 @@ namespace MediaBrowser.Model.Dlna
|
||||
// }
|
||||
//}
|
||||
|
||||
if (StringHelper.EqualsIgnoreCase(item.SubProtocol, "hls") && !forceStartPosition)
|
||||
var isHls = StringHelper.EqualsIgnoreCase(item.SubProtocol, "hls");
|
||||
|
||||
if (isHls && !forceStartPosition)
|
||||
{
|
||||
list.Add(new NameValuePair("StartTimeTicks", string.Empty));
|
||||
}
|
||||
@@ -276,6 +285,14 @@ namespace MediaBrowser.Model.Dlna
|
||||
|
||||
list.Add(new NameValuePair("SubtitleCodec", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Embed ? subtitleCodecs : string.Empty));
|
||||
|
||||
list.Add(new NameValuePair("RequireNonAnamorphic", item.RequireNonAnamorphic.ToString().ToLower()));
|
||||
list.Add(new NameValuePair("DeInterlace", item.DeInterlace.ToString().ToLower()));
|
||||
|
||||
if (!isDlna && isHls)
|
||||
{
|
||||
list.Add(new NameValuePair("SegmentContainer", item.Container ?? string.Empty));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -609,9 +626,34 @@ namespace MediaBrowser.Model.Dlna
|
||||
}
|
||||
}
|
||||
|
||||
public string TargetVideoCodec
|
||||
{
|
||||
get
|
||||
{
|
||||
MediaStream stream = TargetVideoStream;
|
||||
|
||||
string inputCodec = stream == null ? null : stream.Codec;
|
||||
|
||||
if (IsDirectStream)
|
||||
{
|
||||
return inputCodec;
|
||||
}
|
||||
|
||||
foreach (string codec in VideoCodecs)
|
||||
{
|
||||
if (StringHelper.EqualsIgnoreCase(codec, inputCodec))
|
||||
{
|
||||
return codec;
|
||||
}
|
||||
}
|
||||
|
||||
return VideoCodecs.Length == 0 ? null : VideoCodecs[0];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Predicts the audio channels that will be in the output stream
|
||||
/// </summary>
|
||||
/// Predicts the audio channels that will be in the output stream
|
||||
/// </summary>
|
||||
public long? TargetSize
|
||||
{
|
||||
get
|
||||
|
||||
Reference in New Issue
Block a user