#include <stdio.h>
#include <stdlib.h> /* free() */
#include <sys/types.h> /* opendir() */
-#include <sys/stat.h>
#include <dirent.h> /* opendir() */
#include <assert.h>
#include <time.h> /* strftime */
static void AddCustomRatios( vout_thread_t *p_vout, const char *psz_var,
char *psz_list )
{
- if( psz_list && *psz_list )
+ assert( psz_list );
+
+ char *psz_cur = psz_list;
+ char *psz_next;
+ while( psz_cur && *psz_cur )
{
- char *psz_cur = psz_list;
- char *psz_next;
- while( psz_cur && *psz_cur )
+ vlc_value_t val, text;
+ psz_next = strchr( psz_cur, ',' );
+ if( psz_next )
{
- vlc_value_t val, text;
- psz_next = strchr( psz_cur, ',' );
- if( psz_next )
- {
- *psz_next = '\0';
- psz_next++;
- }
- val.psz_string = psz_cur;
- text.psz_string = psz_cur;
- var_Change( p_vout, psz_var, VLC_VAR_ADDCHOICE, &val, &text);
- psz_cur = psz_next;
+ *psz_next = '\0';
+ psz_next++;
}
+ val.psz_string = psz_cur;
+ text.psz_string = psz_cur;
+ var_Change( p_vout, psz_var, VLC_VAR_ADDCHOICE, &val, &text);
+ psz_cur = psz_next;
}
}
var_Create( p_vout, "crop-update", VLC_VAR_VOID );
/* Add custom crop ratios */
- psz_buf = config_GetPsz( p_vout, "custom-crop-ratios" );
- AddCustomRatios( p_vout, "crop", psz_buf );
- free( psz_buf );
+ psz_buf = var_CreateGetNonEmptyString( p_vout, "custom-crop-ratios" );
+ if( psz_buf )
+ {
+ AddCustomRatios( p_vout, "crop", psz_buf );
+ free( psz_buf );
+ }
var_AddCallback( p_vout, "crop", CropCallback, NULL );
var_Get( p_vout, "crop", &old_val );
}
/* Add custom aspect ratios */
- psz_buf = config_GetPsz( p_vout, "custom-aspect-ratios" );
- AddCustomRatios( p_vout, "aspect-ratio", psz_buf );
- free( psz_buf );
+ psz_buf = var_CreateGetNonEmptyString( p_vout, "custom-aspect-ratios" );
+ if( psz_buf )
+ {
+ AddCustomRatios( p_vout, "aspect-ratio", psz_buf );
+ free( psz_buf );
+ }
var_AddCallback( p_vout, "aspect-ratio", AspectCallback, NULL );
var_Get( p_vout, "aspect-ratio", &old_val );
static int ZoomCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
- vout_thread_t *p_vout = (vout_thread_t *)p_this;
- (void)psz_cmd; (void)oldval; (void)newval; (void)p_data;
- InitWindowSize( p_vout, &p_vout->i_window_width,
- &p_vout->i_window_height );
- vout_Control( p_vout, VOUT_SET_SIZE, p_vout->i_window_width,
- p_vout->i_window_height );
- return VLC_SUCCESS;
+ return var_SetFloat( p_this, "scale", newval.f_float );
}
static int CropCallback( vlc_object_t *p_this, char const *psz_cmd,
/* Restore defaults */
p_vout->fmt_in.i_sar_num = p_vout->fmt_render.i_sar_num;
p_vout->fmt_in.i_sar_den = p_vout->fmt_render.i_sar_den;
- p_vout->fmt_in.i_aspect = p_vout->fmt_render.i_aspect;
- p_vout->render.i_aspect = p_vout->fmt_render.i_aspect;
+ p_vout->render.i_aspect = (int64_t)p_vout->fmt_render.i_sar_num *
+ p_vout->fmt_render.i_width *
+ VOUT_ASPECT_FACTOR /
+ p_vout->fmt_render.i_sar_den / p_vout->fmt_render.i_height;
if( !psz_parser ) goto aspect_end;
vlc_ureduce( &i_sar_num, &i_sar_den, i_sar_num, i_sar_den, 0 );
p_vout->fmt_in.i_sar_num = i_sar_num;
p_vout->fmt_in.i_sar_den = i_sar_den;
- p_vout->fmt_in.i_aspect = i_aspect_num * VOUT_ASPECT_FACTOR / i_aspect_den;
- p_vout->render.i_aspect = p_vout->fmt_in.i_aspect;
+ p_vout->render.i_aspect = i_aspect_num * VOUT_ASPECT_FACTOR / i_aspect_den;
aspect_end:
if( p_vout->p->i_par_num && p_vout->p->i_par_den )
{
p_vout->fmt_in.i_sar_num *= p_vout->p->i_par_den;
p_vout->fmt_in.i_sar_den *= p_vout->p->i_par_num;
- p_vout->fmt_in.i_aspect = p_vout->fmt_in.i_aspect *
- p_vout->p->i_par_den / p_vout->p->i_par_num;
- p_vout->render.i_aspect = p_vout->fmt_in.i_aspect;
+ p_vout->render.i_aspect = (int64_t)p_vout->fmt_in.i_sar_num *
+ p_vout->fmt_in.i_width *
+ VOUT_ASPECT_FACTOR /
+ p_vout->fmt_in.i_sar_den /
+ p_vout->fmt_in.i_height;
}
p_vout->i_changes |= VOUT_ASPECT_CHANGE;
- vlc_ureduce( &i_aspect_num, &i_aspect_den,
- p_vout->fmt_in.i_aspect, VOUT_ASPECT_FACTOR, 0 );
msg_Dbg( p_vout, "new aspect-ratio %i:%i, sample aspect-ratio %i:%i",
- i_aspect_num, i_aspect_den,
+ p_vout->fmt_in.i_sar_num * p_vout->fmt_in.i_width,
+ p_vout->fmt_in.i_sar_den * p_vout->fmt_in.i_height,
p_vout->fmt_in.i_sar_num, p_vout->fmt_in.i_sar_den );
if( var_Get( p_vout, "crop", &val ) )