public int CompareTo(object obj) { VideoSize other = (VideoSize)obj; if (Width > other.Width || Height > other.Height) { return(1); } else if (Width < other.Width && Height < other.Height) { return(-1); } else { return(0); } }
/// <summary> /// Obtain size argument for FFMPEG, in -s WIDTHxHEIGHT format. /// If either dimension of the input video is larger than target /// size, this will resize it to fit into the target size. /// Otherwise will return a blank string. /// </summary> /// <param name="inputFileName"></param> /// <param name="targetSize"></param> /// <returns></returns> protected string GetSizeArgument(string inputFileName, VideoSize targetSize) { VideoParameters parms = VideoParameterOracle.GetParameters(inputFileName); VideoSize size = parms == null ? null : parms.VideoSize; string sizeArg = ""; if (size != null && size.CompareTo(targetSize) > 0) { float widthRatio = (float)size.Width / targetSize.Width; float heightRatio = (float)size.Height / targetSize.Height; float ratio = Math.Max(widthRatio, heightRatio); sizeArg = string.Format("-s {0}x{1}", RoundEven((int)(size.Width / ratio)), RoundEven((int)(size.Height / ratio))); } return(sizeArg); }
/// <summary> /// Obtain size argument for FFMPEG, in -s WIDTHxHEIGHT format. /// If either dimension of the input video is larger than target /// size, this will resize it to fit into the target size. /// Otherwise will return a blank string. /// </summary> /// <param name="inputFileName"></param> /// <param name="targetSize"></param> /// <returns></returns> protected string GetSizeArgument(string inputFileName, VideoSize targetSize) { VideoParameters parms = VideoParameterOracle.GetParameters(inputFileName); VideoSize size = parms == null ? null : parms.VideoSize; string sizeArg = ""; if (size != null && size.CompareTo(targetSize) > 0) { float widthRatio = (float)size.Width / targetSize.Width; float heightRatio = (float)size.Height / targetSize.Height; float ratio = Math.Max(widthRatio, heightRatio); sizeArg = string.Format("-s {0}x{1}", RoundEven((int)(size.Width / ratio)), RoundEven((int)(size.Height / ratio))); } return sizeArg; }
private AppleVideoFormat(string displayName, string filePart, VideoSize size) : base(displayName, filePart, "mp4", VideoFormatGroup.Apple) { this.size = size; }
private AmazonVideoFormat(string displayName, string filePart, VideoSize size) : base(displayName, filePart, "mp4", VideoFormatGroup.Other) { this.size = size; }