Commit c6e6d111 authored by Antoine Cellerier's avatar Antoine Cellerier

Add the --custom-aspect-ratios and --custom-crop-ratios options which make it...

Add the --custom-aspect-ratios and --custom-crop-ratios options which make it possible to add custom values to the video menu's aspect ratio and crop lists.
parent 49d002c3
......@@ -322,6 +322,16 @@ static char *ppsz_align_descriptions[] =
"aspect, or a float value (1.25, 1.3333, etc.) expressing pixel " \
"squareness.")
#define CUSTOM_CROP_RATIOS_TEXT N_("Custom crop ratios list")
#define CUSTOM_CROP_RATIOS_LONGTEXT N_( \
"Comma seperated list of crop ratios which will be added in the " \
"interface's crop ratios list.")
#define CUSTOM_ASPECT_RATIOS_TEXT N_("Custom aspect ratios list")
#define CUSTOM_ASPECT_RATIOS_LONGTEXT N_( \
"Comma seperated list of aspect ratios which will be added in the " \
"interface's aspect ratio list.")
#define HDTV_FIX_TEXT N_("Fix HDTV height")
#define HDTV_FIX_LONGTEXT N_( \
"This allows proper handling of HDTV-1080 video format " \
......@@ -1205,10 +1215,12 @@ vlc_module_begin();
add_integer( "video-x", -1, NULL, VIDEOX_TEXT, VIDEOX_LONGTEXT, VLC_TRUE );
add_integer( "video-y", -1, NULL, VIDEOY_TEXT, VIDEOY_LONGTEXT, VLC_TRUE );
add_string( "crop", NULL, NULL, CROP_TEXT, CROP_LONGTEXT, VLC_FALSE );
add_string( "custom-crop-ratios", NULL, NULL, CUSTOM_CROP_RATIOS_TEXT,
CUSTOM_CROP_RATIOS_LONGTEXT, VLC_FALSE );
add_string( "aspect-ratio", NULL, NULL,
ASPECT_RATIO_TEXT, ASPECT_RATIO_LONGTEXT, VLC_FALSE );
add_string( "monitor-par", NULL, NULL,
MASPECT_RATIO_TEXT, MASPECT_RATIO_LONGTEXT, VLC_TRUE );
add_string( "custom-aspect-ratios", NULL, NULL, CUSTOM_ASPECT_RATIOS_TEXT,
CUSTOM_ASPECT_RATIOS_LONGTEXT, VLC_FALSE );
add_bool( "hdtv-fix", 1, NULL, HDTV_FIX_TEXT, HDTV_FIX_LONGTEXT, VLC_TRUE );
add_bool( "video-deco", 1, NULL, VIDEO_DECO_TEXT,
VIDEO_DECO_LONGTEXT, VLC_TRUE );
......
......@@ -181,6 +181,7 @@ void vout_IntfInit( vout_thread_t *p_vout )
{
vlc_value_t val, text, old_val;
vlc_bool_t b_force_par = VLC_FALSE;
char *psz_buf;
/* Create a few object variables we'll need later on */
var_Create( p_vout, "snapshot-path", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
......@@ -248,6 +249,30 @@ void vout_IntfInit( vout_thread_t *p_vout )
val.psz_string = "5:4"; text.psz_string = "5:4";
var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text );
/* Add custom crop ratios */
psz_buf = config_GetPsz( p_vout, "custom-crop-ratios" );
if( psz_buf && *psz_buf )
{
char *psz_cur = psz_buf;
char *psz_next;
while( psz_cur && *psz_cur )
{
psz_next = strchr( psz_cur, ',' );
if( psz_next )
{
*psz_next = '\0';
psz_next++;
}
val.psz_string = strdup( psz_cur );
text.psz_string = strdup( psz_cur );
var_Change( p_vout, "crop", VLC_VAR_ADDCHOICE, &val, &text);
free( val.psz_string );
free( text.psz_string );
psz_cur = psz_next;
}
}
if( psz_buf ) free( psz_buf );
var_AddCallback( p_vout, "crop", CropCallback, NULL );
var_Get( p_vout, "crop", &old_val );
if( old_val.psz_string && *old_val.psz_string )
......@@ -311,6 +336,30 @@ void vout_IntfInit( vout_thread_t *p_vout )
val.psz_string = "5:4"; text.psz_string = "5:4";
var_Change( p_vout, "aspect-ratio", VLC_VAR_ADDCHOICE, &val, &text );
/* Add custom aspect ratios */
psz_buf = config_GetPsz( p_vout, "custom-aspect-ratios" );
if( psz_buf && *psz_buf )
{
char *psz_cur = psz_buf;
char *psz_next;
while( psz_cur && *psz_cur )
{
psz_next = strchr( psz_cur, ',' );
if( psz_next )
{
*psz_next = '\0';
psz_next++;
}
val.psz_string = strdup( psz_cur );
text.psz_string = strdup( psz_cur );
var_Change( p_vout, "aspect-ratio", VLC_VAR_ADDCHOICE, &val, &text);
free( val.psz_string );
free( text.psz_string );
psz_cur = psz_next;
}
}
if( psz_buf ) free( psz_buf );
var_AddCallback( p_vout, "aspect-ratio", AspectCallback, NULL );
var_Get( p_vout, "aspect-ratio", &old_val );
if( (old_val.psz_string && *old_val.psz_string) || b_force_par )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment