[vlc-devel] [PATCH 1/4] Add option to select preferred video resolution

Rémi Denis-Courmont remi at remlab.net
Mon Sep 12 00:39:06 CEST 2011


   Hello,

On Monday 12 September 2011, Pierre Ynard wrote:
> This can be used right away in lua playlist scripts, and possibly in
> demuxers that support multiple video tracks
> 
> 
> diff --git a/src/libvlc-module.c b/src/libvlc-module.c
> index b104b62..2f13620 100644
> --- a/src/libvlc-module.c
> +++ b/src/libvlc-module.c
> @@ -733,6 +733,18 @@ static const char *const ppsz_clock_descriptions[] =
>  #define INPUT_SUBTRACK_ID_LONGTEXT N_( \
>      "Stream ID of the subtitle track to use.")
> 
> +#define INPUT_PREFERREDRESOLUTION_TEXT N_("Preferred video resolution")
> +#define INPUT_PREFERREDRESOLUTION_LONGTEXT N_( \
> +    "When several video formats are available, select one whose " \
> +    "resolution is closest to (but not higher than) this setting, " \
> +    "in number of lines. Use this option if you don't have enough CPU " \
> +    "power or network bandwith to play higher resolutions.")
> +static const int pi_prefres[] = { -1, 1080, 720, 576, 320 };
> +static const char *const ppsz_prefres[] = {
> +    N_("Best available"), N_("Full HD (1080p)"), N_("HD (720p)"),
> +    N_("Standard Definition"), N_("Low definition")

It's not obvious that SD is 576 and even less that Low is 320. Besides, 
websites offer 480 and 240 more often than 576 and 320 in my experience

> +};
> +
>  #define INPUT_REPEAT_TEXT N_("Input repetitions")
>  #define INPUT_REPEAT_LONGTEXT N_( \
>      "Number of time the same input will be repeated")
> @@ -1813,6 +1825,10 @@ vlc_module_begin ()
>      add_integer( "sub-track-id", -1,
>                   INPUT_SUBTRACK_ID_TEXT, INPUT_SUBTRACK_ID_LONGTEXT, true
> ) change_safe ()
> +    add_integer( "preferred-resolution", -1,
> INPUT_PREFERREDRESOLUTION_TEXT, +                
> INPUT_PREFERREDRESOLUTION_LONGTEXT, false )
> +        change_safe ()
> +        change_integer_list( pi_prefres, ppsz_prefres )

Picking the closest (or the largest no larger, or the smallest no smaller) 
resolution would be more flexible. Then best available should be the maximum 
value (16384, I guess), and 0 the lowest available.

-- 
Rémi Denis-Courmont
http://www.remlab.info



More information about the vlc-devel mailing list