namespace ytLive.Models;
///
/// YouTube's published H.264 ingestion numbers for a tier, in Mbps — the floor a step-down may walk
/// to and the recommended rate a creator aims at.
///
/// Source: support.google.com/youtube/answer/2853702 (checked 2026-11-12): 1080p@60
/// 6 min / 17 recommended, 1080p@30 5/14, 720p@30 and @60 3/8. The same page specifies CBR, which is
/// why these numbers are a target the encoder actually holds (FfmpegArgs.AddRateControl).
///
/// Vertical is not a separate row. 1080×1920 has the same pixel count as 1920×1080, so a
/// portrait tier takes the band of its landscape pair — the frame rate alone decides which row.
///
public static class RateLadder
{
/// Minimum and recommended rates for a tier.
public readonly record struct Band(double Minimum, double Recommended);
public static Band For(int width, int height, int fps)
{
var is1080 = Math.Max(width, height) >= 1920;
return (is1080, fps > 30) switch
{
(true, true) => new Band(6.0, 17.0),
(true, false) => new Band(5.0, 14.0),
(_, _) => new Band(3.0, 8.0),
};
}
public static Band For(QualityOption tier) => For(tier.Width, tier.Height, tier.Fps);
}