add: role ForcedSubtitle, useful for filtering (#574)
see also https://github.com/google/ExoPlayer/issues/9727
This commit is contained in:
parent
f47a0722cf
commit
cd4dfb5e75
|
@ -11,4 +11,5 @@ public enum RoleType
|
||||||
Description = 6,
|
Description = 6,
|
||||||
Sign = 7,
|
Sign = 7,
|
||||||
Metadata = 8,
|
Metadata = 8,
|
||||||
|
ForcedSubtitle = 9
|
||||||
}
|
}
|
|
@ -178,8 +178,8 @@ internal partial class DASHExtractor2 : IExtractor
|
||||||
var role = representation.Elements().FirstOrDefault(e => e.Name.LocalName == "Role") ?? adaptationSet.Elements().FirstOrDefault(e => e.Name.LocalName == "Role");
|
var role = representation.Elements().FirstOrDefault(e => e.Name.LocalName == "Role") ?? adaptationSet.Elements().FirstOrDefault(e => e.Name.LocalName == "Role");
|
||||||
if (role != null)
|
if (role != null)
|
||||||
{
|
{
|
||||||
var v = role.Attribute("value")?.Value;
|
var roleValue = role.Attribute("value")?.Value;
|
||||||
if (Enum.TryParse(v, true, out RoleType roleType))
|
if (Enum.TryParse(roleValue, true, out RoleType roleType))
|
||||||
{
|
{
|
||||||
streamSpec.Role = roleType;
|
streamSpec.Role = roleType;
|
||||||
|
|
||||||
|
@ -190,6 +190,21 @@ internal partial class DASHExtractor2 : IExtractor
|
||||||
streamSpec.Extension = "ttml";
|
streamSpec.Extension = "ttml";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (roleValue != null && roleValue.Contains('-'))
|
||||||
|
{
|
||||||
|
roleValue = roleValue.Replace("-", "");
|
||||||
|
if (Enum.TryParse(roleValue, true, out RoleType roleType_))
|
||||||
|
{
|
||||||
|
streamSpec.Role = roleType_;
|
||||||
|
|
||||||
|
if (roleType_ == RoleType.ForcedSubtitle)
|
||||||
|
{
|
||||||
|
streamSpec.MediaType = MediaType.SUBTITLES; // or maybe MediaType.CLOSED_CAPTIONS?
|
||||||
|
if (mType != null && mType.Contains("ttml"))
|
||||||
|
streamSpec.Extension = "ttml";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
streamSpec.Playlist.IsLive = isLive;
|
streamSpec.Playlist.IsLive = isLive;
|
||||||
// 设置刷新间隔 timeShiftBufferDepth / 2
|
// 设置刷新间隔 timeShiftBufferDepth / 2
|
||||||
|
|
Loading…
Reference in New Issue