Ejemplo n.º 1
0
        public static VideoFormatDescription Match(Size imageSize, RationalNumber frameRate, RationalNumber sar, bool interlaced)
        {
            var result = Descriptions.Values.FirstOrDefault(v => v.ImageSize.Equals(imageSize) &&
                                                            (v.FrameRate.Equals(frameRate) || frameRate.Equals(RationalNumber.Zero)) &&
                                                            (v.SAR.Equals(sar) || sar.Equals(RationalNumber.Zero)) &&
                                                            v.Interlaced == interlaced);

            if (result != null)
            {
                return(result);
            }
            if (imageSize.Height == Descriptions[TVideoFormat.PAL].ImageSize.Height &&
                frameRate == Descriptions[TVideoFormat.PAL].FrameRate &&
                imageSize.Width == 768)
            {
                return(interlaced ? Descriptions[TVideoFormat.PAL] : Descriptions[TVideoFormat.PAL_P]);
            }
            if (imageSize.Height == Descriptions[TVideoFormat.PAL].ImageSize.Height && imageSize.Width == Descriptions[TVideoFormat.PAL].ImageSize.Width &&
                frameRate == Descriptions[TVideoFormat.PAL].FrameRate &&
                sar.Equals(new RationalNumber(59, 54)))
            {
                return(interlaced ? Descriptions[TVideoFormat.PAL] : Descriptions[TVideoFormat.PAL_P]);
            }
            if (imageSize.Height == Descriptions[TVideoFormat.PAL_FHA].ImageSize.Height &&
                frameRate == Descriptions[TVideoFormat.PAL_FHA].FrameRate &&
                (imageSize.Width == 1024 || imageSize.Width == 1050))
            {
                return(interlaced ? Descriptions[TVideoFormat.PAL_FHA] : Descriptions[TVideoFormat.PAL_FHA_P]);
            }
            return(new VideoFormatDescription(imageSize, frameRate, sar, interlaced));
        }
Ejemplo n.º 2
0
        public static VideoFormatDescription Match(Size imageSize, RationalNumber frameRate, RationalNumber sar, bool interlaced)
        {
            var result = Descriptions.Values.FirstOrDefault((v) => v.ImageSize.Equals(imageSize) &&
                                                            (v.FrameRate.Equals(frameRate) || frameRate.Equals(RationalNumber.Zero)) &&
                                                            (v.SAR.Equals(sar) || sar.Equals(RationalNumber.Zero)) &&
                                                            v.Interlaced == interlaced);

            return(result != null ? result : new VideoFormatDescription(imageSize, frameRate, sar, interlaced));
        }