Commit b2262bc3 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

video plugins: use var_Inherit

parent cdf54698
...@@ -221,24 +221,27 @@ static int Init( vout_thread_t *p_vout ) ...@@ -221,24 +221,27 @@ static int Init( vout_thread_t *p_vout )
p_vout->fmt_out = p_vout->fmt_in; p_vout->fmt_out = p_vout->fmt_in;
/* Shall we use autocrop ? */ /* Shall we use autocrop ? */
p_vout->p_sys->b_autocrop = config_GetInt( p_vout, "autocrop" ); p_vout->p_sys->b_autocrop = var_InheritBool( p_vout, "autocrop" );
#ifdef BEST_AUTOCROP #ifdef BEST_AUTOCROP
p_vout->p_sys->i_ratio_max = config_GetInt( p_vout, "autocrop-ratio-max" ); p_vout->p_sys->i_ratio_max =
var_InheritInteger( p_vout, "autocrop-ratio-max" );
p_vout->p_sys->i_threshold = p_vout->p_sys->i_threshold =
config_GetInt( p_vout, "autocrop-luminance-threshold" ); var_InheritInteger( p_vout, "autocrop-luminance-threshold" );
p_vout->p_sys->i_skipPercent = p_vout->p_sys->i_skipPercent =
config_GetInt( p_vout, "autocrop-skip-percent" ); var_InheritInteger( p_vout, "autocrop-skip-percent" );
p_vout->p_sys->i_nonBlackPixel = p_vout->p_sys->i_nonBlackPixel =
config_GetInt( p_vout, "autocrop-non-black-pixels" ); var_InheritInteger( p_vout, "autocrop-non-black-pixels" );
p_vout->p_sys->i_diff = config_GetInt( p_vout, "autocrop-diff" ); p_vout->p_sys->i_diff =
p_vout->p_sys->i_time = config_GetInt( p_vout, "autocrop-time" ); 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" ); var_SetString( p_vout, "ratio-crop", "0" );
if (p_vout->p_sys->b_autocrop) if (p_vout->p_sys->b_autocrop)
p_vout->p_sys->i_ratio = 0; p_vout->p_sys->i_ratio = 0;
else else
{ {
p_vout->p_sys->i_ratio = config_GetInt( p_vout, "crop-ratio" ); p_vout->p_sys->i_ratio = var_InheritInteger( p_vout, "crop-ratio" );
// ratio < width / height => ratio = 0 (unchange ratio) // 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) 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_ratio = 0;
...@@ -247,7 +250,7 @@ static int Init( vout_thread_t *p_vout ) ...@@ -247,7 +250,7 @@ static int Init( vout_thread_t *p_vout )
/* Get geometry value from the user */ /* Get geometry value from the user */
psz_var = config_GetPsz( p_vout, "crop-geometry" ); psz_var = var_InheritString( p_vout, "crop-geometry" );
if( psz_var ) if( psz_var )
{ {
char *psz_parser, *psz_tmp; char *psz_parser, *psz_tmp;
......
...@@ -111,7 +111,7 @@ static int OpenFilter( vlc_object_t *p_this ) ...@@ -111,7 +111,7 @@ static int OpenFilter( vlc_object_t *p_this )
msg_Err( p_filter, "Could not set %s", VIDEO_FILTER_EVENT_VARIABLE); msg_Err( p_filter, "Could not set %s", VIDEO_FILTER_EVENT_VARIABLE);
//OpenCV init specific to this example //OpenCV init specific to this example
char* filename = config_GetPsz( p_filter, "opencv-haarcascade-file" ); char* filename = var_InheritString( p_filter, "opencv-haarcascade-file" );
p_filter->p_sys->p_cascade = (CvHaarClassifierCascade*)cvLoad( filename, 0, 0, 0 ); p_filter->p_sys->p_cascade = (CvHaarClassifierCascade*)cvLoad( filename, 0, 0, 0 );
p_filter->p_sys->p_storage = cvCreateMemStorage(0); p_filter->p_sys->p_storage = cvCreateMemStorage(0);
free( filename ); free( filename );
......
...@@ -207,7 +207,8 @@ static int Create( vlc_object_t *p_this ) ...@@ -207,7 +207,8 @@ static int Create( vlc_object_t *p_this )
p_vout->pf_control = Control; p_vout->pf_control = Control;
/* Retrieve and apply config */ /* Retrieve and apply config */
if( !(psz_chroma = config_GetPsz( p_vout, "opencv-chroma" )) ) psz_chroma = var_InheritString( p_vout, "opencv-chroma" );
if( psz_chroma == NULL )
{ {
msg_Err( p_vout, "configuration variable %s empty, using 'grey'", msg_Err( p_vout, "configuration variable %s empty, using 'grey'",
"opencv-chroma" ); "opencv-chroma" );
...@@ -229,7 +230,8 @@ static int Create( vlc_object_t *p_this ) ...@@ -229,7 +230,8 @@ static int Create( vlc_object_t *p_this )
} }
free( psz_chroma); free( psz_chroma);
if( !(psz_output = config_GetPsz( p_vout, "opencv-output" )) ) psz_output = var_InheritString( p_vout, "opencv-output" );
if( psz_output == NULL )
{ {
msg_Err( p_vout, "configuration variable %s empty, using 'input'", msg_Err( p_vout, "configuration variable %s empty, using 'input'",
"opencv-output" ); "opencv-output" );
...@@ -251,7 +253,8 @@ static int Create( vlc_object_t *p_this ) ...@@ -251,7 +253,8 @@ static int Create( vlc_object_t *p_this )
} }
free( psz_output); free( psz_output);
if( !(psz_verbosity = config_GetPsz( p_vout, "opencv-verbosity" )) ) psz_verbosity = var_InheritString( p_vout, "opencv-verbosity" );
iff( psz_verbosity == NULL )
{ {
msg_Err( p_vout, "configuration variable %s empty, using 'input'", msg_Err( p_vout, "configuration variable %s empty, using 'input'",
"opencv-verbosity" ); "opencv-verbosity" );
...@@ -273,10 +276,10 @@ static int Create( vlc_object_t *p_this ) ...@@ -273,10 +276,10 @@ static int Create( vlc_object_t *p_this )
} }
free( psz_verbosity); free( psz_verbosity);
p_vout->p_sys->psz_inner_name = config_GetPsz( p_vout, "opencv-filter-name" ); p_vout->p_sys->psz_inner_name =
var_InheritString( p_vout, "opencv-filter-name" );
p_vout->p_sys->f_scale = p_vout->p_sys->f_scale =
config_GetFloat( p_vout, "opencv-scale" ); var_InheritFloat( p_vout, "opencv-scale" );
if (p_vout->p_sys->i_verbosity > VERB_WARN) if (p_vout->p_sys->i_verbosity > VERB_WARN)
msg_Info(p_vout, "Configuration: opencv-scale: %f, opencv-chroma: %d, " msg_Info(p_vout, "Configuration: opencv-scale: %f, opencv-chroma: %d, "
......
...@@ -377,7 +377,7 @@ static int OpenDisplay( vout_thread_t *p_vout ) ...@@ -377,7 +377,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
} }
/* Open display */ /* Open display */
psz_display = config_GetPsz( p_vout, "ggi-display" ); psz_display = var_InheritString( p_vout, "ggi-display" );
p_vout->p_sys->p_display = ggiOpen( psz_display, NULL ); p_vout->p_sys->p_display = ggiOpen( psz_display, NULL );
free( psz_display ); free( psz_display );
...@@ -391,8 +391,8 @@ static int OpenDisplay( vout_thread_t *p_vout ) ...@@ -391,8 +391,8 @@ static int OpenDisplay( vout_thread_t *p_vout )
/* Find most appropriate mode */ /* Find most appropriate mode */
p_vout->p_sys->mode.frames = 2; /* 2 buffers */ p_vout->p_sys->mode.frames = 2; /* 2 buffers */
p_vout->p_sys->mode.visible.x = config_GetInt( p_vout, "width" ); p_vout->p_sys->mode.visible.x = var_InheritInteger( p_vout, "width" );
p_vout->p_sys->mode.visible.y = config_GetInt( p_vout, "height" ); p_vout->p_sys->mode.visible.y = var_InheritInteger( p_vout, "height" );
p_vout->p_sys->mode.virt.x = GGI_AUTO; p_vout->p_sys->mode.virt.x = GGI_AUTO;
p_vout->p_sys->mode.virt.y = GGI_AUTO; p_vout->p_sys->mode.virt.y = GGI_AUTO;
p_vout->p_sys->mode.size.x = GGI_AUTO; p_vout->p_sys->mode.size.x = GGI_AUTO;
......
...@@ -124,7 +124,7 @@ static int Open(vlc_object_t *object) ...@@ -124,7 +124,7 @@ static int Open(vlc_object_t *object)
if (!sys) if (!sys)
return VLC_ENOMEM; return VLC_ENOMEM;
char *chroma_fmt = config_GetPsz(vd, "vout-snapshot-chroma"); char *chroma_fmt = var_InheritString(vd, "vout-snapshot-chroma");
const vlc_fourcc_t chroma = vlc_fourcc_GetCodecFromString(VIDEO_ES, chroma_fmt); const vlc_fourcc_t chroma = vlc_fourcc_GetCodecFromString(VIDEO_ES, chroma_fmt);
free(chroma_fmt); free(chroma_fmt);
...@@ -134,8 +134,8 @@ static int Open(vlc_object_t *object) ...@@ -134,8 +134,8 @@ static int Open(vlc_object_t *object)
return VLC_EGENERIC; return VLC_EGENERIC;
} }
const int width = config_GetInt(vd, "vout-snapshot-width"); const int width = var_InheritInteger(vd, "vout-snapshot-width");
const int height = config_GetInt(vd, "vout-snapshot-height"); const int height = var_InheritInteger(vd, "vout-snapshot-height");
if (width <= 0 || height <= 0) { if (width <= 0 || height <= 0) {
msg_Err(vd, "snapshot-width/height are invalid"); msg_Err(vd, "snapshot-width/height are invalid");
free(sys); free(sys);
...@@ -172,7 +172,7 @@ static int Open(vlc_object_t *object) ...@@ -172,7 +172,7 @@ static int Open(vlc_object_t *object)
} }
sys->index = 0; sys->index = 0;
sys->count = config_GetInt(vd, "vout-snapshot-cache-size"); sys->count = var_InheritInteger(vd, "vout-snapshot-cache-size");
/* FIXME following code leaks in case of error */ /* FIXME following code leaks in case of error */
......
...@@ -129,8 +129,8 @@ int spectrum_Run(visual_effect_t * p_effect, vlc_object_t *p_aout, ...@@ -129,8 +129,8 @@ int spectrum_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
} }
p_buffs = p_s16_buff = p_data->p_prev_s16_buff; p_buffs = p_s16_buff = p_data->p_prev_s16_buff;
i_80_bands = config_GetInt ( p_aout, "visual-80-bands" ); i_80_bands = var_InheritInteger( p_aout, "visual-80-bands" );
i_peak = config_GetInt ( p_aout, "visual-peaks" ); i_peak = var_InheritInteger( p_aout, "visual-peaks" );
if( i_80_bands != 0) if( i_80_bands != 0)
{ {
...@@ -428,18 +428,18 @@ int spectrometer_Run(visual_effect_t * p_effect, vlc_object_t *p_aout, ...@@ -428,18 +428,18 @@ int spectrometer_Run(visual_effect_t * p_effect, vlc_object_t *p_aout,
} }
p_buffs = p_s16_buff = p_data->p_prev_s16_buff; p_buffs = p_s16_buff = p_data->p_prev_s16_buff;
i_original = config_GetInt ( p_aout, "spect-show-original" ); i_original = var_InheritInteger( p_aout, "spect-show-original" );
i_80_bands = config_GetInt ( p_aout, "spect-80-bands" ); i_80_bands = var_InheritInteger( p_aout, "spect-80-bands" );
i_separ = config_GetInt ( p_aout, "spect-separ" ); i_separ = var_InheritInteger( p_aout, "spect-separ" );
i_amp = config_GetInt ( p_aout, "spect-amp" ); i_amp = var_InheritInteger( p_aout, "spect-amp" );
i_peak = config_GetInt ( p_aout, "spect-show-peaks" ); i_peak = var_InheritInteger( p_aout, "spect-show-peaks" );
i_show_base = config_GetInt ( p_aout, "spect-show-base" ); i_show_base = var_InheritInteger( p_aout, "spect-show-base" );
i_show_bands = config_GetInt ( p_aout, "spect-show-bands" ); i_show_bands = var_InheritInteger( p_aout, "spect-show-bands" );
i_rad = config_GetInt ( p_aout, "spect-radius" ); i_rad = var_InheritInteger( p_aout, "spect-radius" );
i_sections = config_GetInt ( p_aout, "spect-sections" ); i_sections = var_InheritInteger( p_aout, "spect-sections" );
i_extra_width = config_GetInt ( p_aout, "spect-peak-width" ); i_extra_width = var_InheritInteger( p_aout, "spect-peak-width" );
i_peak_height = config_GetInt ( p_aout, "spect-peak-height" ); i_peak_height = var_InheritInteger( p_aout, "spect-peak-height" );
color1 = config_GetInt ( p_aout, "spect-color" ); color1 = var_InheritInteger( p_aout, "spect-color" );
if( i_80_bands != 0) if( i_80_bands != 0)
{ {
......
...@@ -200,8 +200,8 @@ static int Open( vlc_object_t *p_this ) ...@@ -200,8 +200,8 @@ static int Open( vlc_object_t *p_this )
if( p_sys == NULL ) if( p_sys == NULL )
return VLC_EGENERIC; return VLC_EGENERIC;
p_sys->i_height = config_GetInt( p_filter , "effect-height"); p_sys->i_height = var_InheritInteger( p_filter , "effect-height");
p_sys->i_width = config_GetInt( p_filter , "effect-width"); p_sys->i_width = var_InheritInteger( p_filter , "effect-width");
if( p_sys->i_height < 400 ) p_sys->i_height = 400; if( p_sys->i_height < 400 ) p_sys->i_height = 400;
if( p_sys->i_width < 532 ) p_sys->i_width = 532; if( p_sys->i_width < 532 ) p_sys->i_width = 532;
......
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