示例#1
0
        /// <summary>
        /// Gets label for given video quality and framerate, as displayed on YouTube.
        /// </summary>
        public static string GetVideoQualityLabel(this VideoQuality videoQuality, int framerate)
        {
            framerate.GuardNotNegative(nameof(framerate));

            // Framerate appears only if it's above 30
            if (framerate <= 30)
            {
                return(videoQuality.GetVideoQualityLabel());
            }

            // YouTube always shows framerate as 60, no matter what it is
            return(videoQuality.GetVideoQualityLabel() + "60");
        }
示例#2
0
        /// <summary>
        /// Gets label for given video quality and framerate, as displayed on YouTube.
        /// </summary>
        public static string GetVideoQualityLabel(this VideoQuality videoQuality, int framerate)
        {
            framerate.GuardNotNegative(nameof(framerate));

            // Framerate appears only if it's above 30
            if (framerate <= 30)
            {
                return(videoQuality.GetVideoQualityLabel());
            }

            // YouTube rounds framerate to nearest next ten
            var framerateRounded = (int)Math.Ceiling(framerate / 10.0) * 10;

            return(videoQuality.GetVideoQualityLabel() + framerateRounded);
        }
示例#3
0
        public void Extensions_VideoQuality_GetVideoQualityLabel_Test(VideoQuality quality,
                                                                      [Values(24, 30, 60)] int framerate)
        {
            var label = quality.GetVideoQualityLabel(framerate);

            Assert.That(label, Is.Not.Null.Or.Empty);
        }
示例#4
0
 /// <summary />
 public MuxedStreamInfo(int itag, string url, long size) : base(itag, url, size)
 {
     AudioEncoding     = GetAudioEncoding(itag);
     VideoEncoding     = GetVideoEncoding(itag);
     VideoQuality      = GetVideoQuality(itag);
     VideoQualityLabel = VideoQuality.GetVideoQualityLabel();
 }
 /// <summary />
 public VideoStreamInfo(int itag, string url, long size, long bitrate, VideoResolution resolution, int framerate)
     : base(itag, url, size)
 {
     Bitrate           = bitrate.EnsureNotNegative(nameof(bitrate));
     VideoEncoding     = GetVideoEncoding(itag);
     VideoQuality      = GetVideoQuality(itag);
     Resolution        = resolution;
     Framerate         = framerate.EnsureNotNegative(nameof(framerate));
     VideoQualityLabel = VideoQuality.GetVideoQualityLabel(framerate);
 }