[vlc-devel] [vlc-commits] ytdl: improve format selection

Pierre Ynard linkfanel at yahoo.fr
Wed Sep 30 05:33:42 CEST 2020


> +    if (islessequal(h_a, pref_height)) {
> +        if (!islessequal(h_b, pref_height))
> +            return +1;
> +        if (h_a > h_b)
> +            return -1;
> +        if (h_a < h_b)
> +            return +1;
> +    } else {
> +        if (islessequal(h_b, pref_height))
> +            return -1;
> +        if (isless(h_a, h_b))
> +            return -1;
> +        if (isgreater(h_a, h_b))
> +            return +1;
> +    }
> +
> +    if (isgreater(abr_a, abr_b))
> +        return +1;
> +    if (isgreater(abr_b, abr_a))
> +        return -1;
> +
> +    return 0;
> +}

Great! I like this generic comparative approach. It works fine for me if
--preferred-resolution is unset or in between compared resolutions; but
if it is either lower or higher than both candidates, then the function
picks the wrong one.

-- 
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."


More information about the vlc-devel mailing list