private static Subtitle GetXmlSubtitle(FF.Stream stream) => new Subtitle() { CodecName = stream.codec_name, CodecLongName = stream.codec_long_name, Language = stream.tag.GetLanguage(), Title = stream.tag.GetTitle() };
private static Video GetXmlVideo(FF.Stream stream) => new Video() { CodecName = stream.codec_name, CodecLongName = stream.codec_long_name, AspectRatio = GetAspectRatio(stream), Language = stream.tag.GetLanguage(), Title = stream.tag.GetTitle(), };
private static Audio GetXmlAudio(FF.Stream stream) => new Audio() { CodecName = stream.codec_name, CodecLongName = stream.codec_long_name, SampleRate = stream.sample_rate, Channels = stream.channels, ChannelLayout = stream.channel_layout, Language = stream.tag.GetLanguage(), Title = stream.tag.GetTitle(), };
private static AspectRatio GetAspectRatio(FF.Stream stream) { var ratio = new AspectRatio() { Width = stream.width, Height = stream.height, CodedWidth = stream.coded_width, CodedHeight = stream.coded_height, Ratio = GetAspectRatio(stream.display_aspect_ratio), }; ratio.CodedWidthSpecified = ratio.CodedWidth != 0 && ratio.Width != ratio.CodedWidth; ratio.CodedHeightSpecified = ratio.CodedHeight != 0 && ratio.Height != ratio.CodedHeight; if ((ratio.Ratio == 0) && (ratio.Height > 0)) { ratio.Ratio = CalulateRatio(ratio.Width, ratio.Height); } ratio.RatioSpecified = ratio.Ratio > 0; return(ratio); }
private static bool IsVideo(FF.Stream stream) => stream?.codec_type == "video";
private static bool IsAudio(FF.Stream stream) => stream?.codec_type == "audio";
private static bool IsSubtile(FF.Stream stream) => stream?.codec_type == "subtitle";