diff options
| author | BaronGreenback <jimcartlidge@yahoo.co.uk> | 2021-02-21 00:44:14 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-21 00:44:14 +0000 |
| commit | 5756c6dbad8734171ee539e1a73d15c907168d93 (patch) | |
| tree | 6d2f238a64f2ed233eadd1139af78a8c72d6cf21 /MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs | |
| parent | cb09096a59c0df9b02f4c057db93d8479678af8f (diff) | |
| parent | 55dd0da5dae868a944e729e41973755eaff8d230 (diff) | |
Merge branch 'master' into bindfix
Diffstat (limited to 'MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs')
| -rw-r--r-- | MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs index 92f16ab95..9e2417603 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncoderValidator.cs @@ -296,6 +296,38 @@ namespace MediaBrowser.MediaEncoding.Encoder return found; } + public bool CheckFilter(string filter, string option) + { + if (string.IsNullOrEmpty(filter)) + { + return false; + } + + string output = null; + try + { + output = GetProcessOutput(_encoderPath, "-h filter=" + filter); + } + catch (Exception ex) + { + _logger.LogError(ex, "Error detecting the given filter"); + } + + if (output.Contains("Filter " + filter, StringComparison.Ordinal)) + { + if (string.IsNullOrEmpty(option)) + { + return true; + } + + return output.Contains(option, StringComparison.Ordinal); + } + + _logger.LogWarning("Filter: {Name} with option {Option} is not available", filter, option); + + return false; + } + private IEnumerable<string> GetCodecs(Codec codec) { string codecstr = codec == Codec.Encoder ? "encoders" : "decoders"; |
