#define AUTOCROP_TEXT N_("Automatic cropping")
#define AUTOCROP_LONGTEXT N_("Automatically detect black borders and crop them.")
#define AUTOCROP_TEXT N_("Automatic cropping")
#define AUTOCROP_LONGTEXT N_("Automatically detect black borders and crop them.")
#ifdef BEST_AUTOCROP
#define RATIOMAX_TEXT N_("Ratio max (x 1000)")
#define RATIOMAX_LONGTEXT N_("Maximum image ratio. The crop plugin will never automatically crop to a higher ratio (ie, to a more \"flat\" image). The value is x1000: 1333 means 4/3.")
#ifdef BEST_AUTOCROP
#define RATIOMAX_TEXT N_("Ratio max (x 1000)")
#define RATIOMAX_LONGTEXT N_("Maximum image ratio. The crop plugin will never automatically crop to a higher ratio (ie, to a more \"flat\" image). The value is x1000: 1333 means 4/3.")
set_category( CAT_VIDEO )
set_subcategory( SUBCAT_VIDEO_VFILTER )
set_capability( "video filter", 0 )
add_string( "crop-geometry", NULL, NULL, GEOMETRY_TEXT,
GEOMETRY_LONGTEXT, false )
set_category( CAT_VIDEO )
set_subcategory( SUBCAT_VIDEO_VFILTER )
set_capability( "video filter", 0 )
add_string( "crop-geometry", NULL, NULL, GEOMETRY_TEXT,
GEOMETRY_LONGTEXT, false )
- add_bool( "autocrop", 0, NULL, AUTOCROP_TEXT,
+ add_bool( "autocrop", false, NULL, AUTOCROP_TEXT,
- config_GetInt( p_vout, "autocrop-non-black-pixels" );
- p_vout->p_sys->i_diff = config_GetInt( p_vout, "autocrop-diff" );
- p_vout->p_sys->i_time = config_GetInt( p_vout, "autocrop-time" );
+ var_InheritInteger( p_vout, "autocrop-non-black-pixels" );
+ p_vout->p_sys->i_diff =
+ var_InheritInteger( p_vout, "autocrop-diff" );
+ p_vout->p_sys->i_time =
+ var_InheritInteger( p_vout, "autocrop-time" );
var_SetString( p_vout, "ratio-crop", "0" );
if (p_vout->p_sys->b_autocrop)
p_vout->p_sys->i_ratio = 0;
else
{
var_SetString( p_vout, "ratio-crop", "0" );
if (p_vout->p_sys->b_autocrop)
p_vout->p_sys->i_ratio = 0;
else
{
// ratio < width / height => ratio = 0 (unchange ratio)
if (p_vout->p_sys->i_ratio < (p_vout->output.i_width * 1000) / p_vout->output.i_height)
p_vout->p_sys->i_ratio = 0;
// ratio < width / height => ratio = 0 (unchange ratio)
if (p_vout->p_sys->i_ratio < (p_vout->output.i_width * 1000) / p_vout->output.i_height)
p_vout->p_sys->i_ratio = 0;
p_vout->p_sys->i_x, p_vout->p_sys->i_y,
p_vout->p_sys->b_autocrop ? "" : "not " );
/* Set current output image properties */
p_vout->p_sys->i_x, p_vout->p_sys->i_y,
p_vout->p_sys->b_autocrop ? "" : "not " );
/* Set current output image properties */
- p_vout->p_sys->i_aspect = p_vout->fmt_out.i_aspect
- * p_vout->fmt_out.i_visible_height / p_vout->p_sys->i_height
- * p_vout->p_sys->i_width / p_vout->fmt_out.i_visible_width;
+ p_vout->p_sys->i_aspect = (int64_t)VOUT_ASPECT_FACTOR *
+ p_vout->fmt_out.i_sar_num * p_vout->p_sys->i_width /
+ (p_vout->fmt_out.i_sar_den * p_vout->p_sys->i_height);
fmt.i_height = fmt.i_visible_height = p_vout->p_sys->i_height;
fmt.i_x_offset = fmt.i_y_offset = 0;
fmt.i_chroma = p_vout->render.i_chroma;
fmt.i_height = fmt.i_visible_height = p_vout->p_sys->i_height;
fmt.i_x_offset = fmt.i_y_offset = 0;
fmt.i_chroma = p_vout->render.i_chroma;
- fmt.i_aspect = p_vout->p_sys->i_aspect;
- fmt.i_sar_num = p_vout->p_sys->i_aspect * fmt.i_height / fmt.i_width;
- fmt.i_sar_den = VOUT_ASPECT_FACTOR;
+ fmt.i_sar_num = p_vout->p_sys->i_aspect * fmt.i_height;
+ fmt.i_sar_den = VOUT_ASPECT_FACTOR * fmt.i_width;
/* Try to open the real video output */
p_vout->p_sys->p_vout = vout_Create( p_vout, &fmt );
if( p_vout->p_sys->p_vout == NULL )
{
msg_Err( p_vout, "failed to create vout" );
/* Try to open the real video output */
p_vout->p_sys->p_vout = vout_Create( p_vout, &fmt );
if( p_vout->p_sys->p_vout == NULL )
{
msg_Err( p_vout, "failed to create vout" );
var_AddCallback( p_vout, "ratio-crop", FilterCallback, NULL );
#endif
var_AddCallback( p_vout, "ratio-crop", FilterCallback, NULL );
#endif
fmt.i_height = fmt.i_visible_height = p_vout->p_sys->i_height;
fmt.i_x_offset = fmt.i_y_offset = 0;
fmt.i_chroma = p_vout->render.i_chroma;
fmt.i_height = fmt.i_visible_height = p_vout->p_sys->i_height;
fmt.i_x_offset = fmt.i_y_offset = 0;
fmt.i_chroma = p_vout->render.i_chroma;
fmt.i_sar_num = p_vout->p_sys->i_aspect * fmt.i_height / fmt.i_width;
fmt.i_sar_den = VOUT_ASPECT_FACTOR;
fmt.i_sar_num = p_vout->p_sys->i_aspect * fmt.i_height / fmt.i_width;
fmt.i_sar_den = VOUT_ASPECT_FACTOR;
if( p_vout->p_sys->p_vout == NULL )
{
msg_Err( p_vout, "failed to create vout" );
if( p_vout->p_sys->p_vout == NULL )
{
msg_Err( p_vout, "failed to create vout" );
- if( !strcmp( psz_var, "mouse-x" ) )
- newval.i_int += p_vout->p_sys->i_x;
- else if( !strcmp( psz_var, "mouse-y" ) )
- newval.i_int += p_vout->p_sys->i_y;
-
- return var_Set( p_vout, psz_var, newval );
+ newval.coords.x += p_vout->p_sys->i_x;
+ newval.coords.y += p_vout->p_sys->i_y;
+ return var_SetChecked( p_vout, psz_var, VLC_VAR_COORDS, newval );