/// <summary> /// Get the H.26X level of the output video stream. /// </summary> /// <param name="state">StreamState of the current stream.</param> /// <returns>H.26X level of the output video stream.</returns> private int?GetOutputVideoCodecLevel(StreamState state) { string levelString = string.Empty; if (EncodingHelper.IsCopyCodec(state.OutputVideoCodec) && state.VideoStream != null && state.VideoStream.Level.HasValue) { levelString = state.VideoStream.Level.ToString() ?? string.Empty; } else { if (string.Equals(state.ActualOutputVideoCodec, "h264", StringComparison.OrdinalIgnoreCase)) { levelString = state.GetRequestedLevel(state.ActualOutputVideoCodec) ?? "41"; levelString = EncodingHelper.NormalizeTranscodingLevel(state, levelString); } if (string.Equals(state.ActualOutputVideoCodec, "h265", StringComparison.OrdinalIgnoreCase) || string.Equals(state.ActualOutputVideoCodec, "hevc", StringComparison.OrdinalIgnoreCase)) { levelString = state.GetRequestedLevel("h265") ?? state.GetRequestedLevel("hevc") ?? "120"; levelString = EncodingHelper.NormalizeTranscodingLevel(state, levelString); } } if (int.TryParse(levelString, NumberStyles.Integer, CultureInfo.InvariantCulture, out var parsedLevel)) { return(parsedLevel); } return(null); }
/// <summary> /// Get the H.26X level of the output video stream. /// </summary> /// <param name="state">StreamState of the current stream.</param> /// <returns>H.26X level of the output video stream.</returns> private int?GetOutputVideoCodecLevel(StreamState state) { string levelString; if (EncodingHelper.IsCopyCodec(state.OutputVideoCodec) && state.VideoStream.Level.HasValue) { levelString = state.VideoStream?.Level.ToString(); } else { levelString = state.GetRequestedLevel(state.ActualOutputVideoCodec); } if (int.TryParse(levelString, NumberStyles.Integer, CultureInfo.InvariantCulture, out var parsedLevel)) { return(parsedLevel); } return(null); }
/// <summary> /// Get the H.26X level of the output video stream. /// </summary> /// <param name="state">StreamState of the current stream.</param> /// <returns>H.26X level of the output video stream.</returns> private int?GetOutputVideoCodecLevel(StreamState state) { string levelString; if (string.Equals(state.OutputVideoCodec, "copy", StringComparison.OrdinalIgnoreCase) && state.VideoStream.Level.HasValue) { levelString = state.VideoStream?.Level.ToString(); } else { levelString = state.GetRequestedLevel(state.ActualOutputVideoCodec); } if (int.TryParse(levelString, NumberStyles.Integer, CultureInfo.InvariantCulture, out var parsedLevel)) { return(parsedLevel); } return(null); }