Allow streaming of raw PGS subtitles without transcoding (#12056)
This commit is contained in:
@@ -585,6 +585,31 @@ namespace MediaBrowser.Model.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsPgsSubtitleStream
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Type != MediaStreamType.Subtitle)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(Codec) && !IsExternal)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return IsPgsFormat(Codec);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this is a subtitle steam that is extractable by ffmpeg.
|
||||
/// All text-based and pgs subtitles can be extracted.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this is a extractable subtitle steam otherwise, <c>false</c>.</value>
|
||||
public bool IsExtractableSubtitleStream => IsTextSubtitleStream || IsPgsSubtitleStream;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [supports external stream].
|
||||
/// </summary>
|
||||
@@ -666,6 +691,14 @@ namespace MediaBrowser.Model.Entities
|
||||
&& !string.Equals(codec, "sub", StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
public static bool IsPgsFormat(string format)
|
||||
{
|
||||
string codec = format ?? string.Empty;
|
||||
|
||||
return codec.Contains("pgs", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(codec, "sup", StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
public bool SupportsSubtitleConversionTo(string toCodec)
|
||||
{
|
||||
if (!IsTextSubtitleStream)
|
||||
|
||||
Reference in New Issue
Block a user