]> git.sesse.net Git - vlc/commitdiff
video plugins: use var_Inherit
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 23 Jan 2010 17:27:45 +0000 (19:27 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 23 Jan 2010 18:04:54 +0000 (20:04 +0200)
modules/video_filter/crop.c
modules/video_filter/opencv_example.cpp
modules/video_filter/opencv_wrapper.c
modules/video_output/ggi.c
modules/video_output/snapshot.c
modules/visualization/visual/effects.c
modules/visualization/visual/visual.c

index fe89d9ec844176b1285eec6189746d4f85468174..b3342173143b1760d9008c5ada5b55f10b9a1202 100644 (file)
@@ -221,24 +221,27 @@ static int Init( vout_thread_t *p_vout )
     p_vout->fmt_out = p_vout->fmt_in;
 
     /* 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
-    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 =
-                    config_GetInt( p_vout, "autocrop-luminance-threshold" );
+        var_InheritInteger( p_vout, "autocrop-luminance-threshold" );
     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 =
-                    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
     {
-        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)
         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;
@@ -247,7 +250,7 @@ static int Init( vout_thread_t *p_vout )
 
 
     /* 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 )
     {
         char *psz_parser, *psz_tmp;
index 445e964f5dfa5ee50fd8ea765760eb7ae4fc3c2f..4f1f08751484f8b6af9ad7d19c90ba9e0dc64773 100644 (file)
@@ -111,7 +111,7 @@ static int OpenFilter( vlc_object_t *p_this )
         msg_Err( p_filter, "Could not set %s", VIDEO_FILTER_EVENT_VARIABLE);
 
     //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_storage = cvCreateMemStorage(0);
     free( filename );
index 2965683f43350be429dfa74b80353e1ad2caf073..766a490a0f589939f548e2b516de22ccb0612fb6 100644 (file)
@@ -207,7 +207,8 @@ static int Create( vlc_object_t *p_this )
     p_vout->pf_control = Control;
 
     /* 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'",
                          "opencv-chroma" );
@@ -229,7 +230,8 @@ static int Create( vlc_object_t *p_this )
     }
     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'",
                          "opencv-output" );
@@ -251,7 +253,8 @@ static int Create( vlc_object_t *p_this )
     }
     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'",
                          "opencv-verbosity" );
@@ -273,10 +276,10 @@ static int Create( vlc_object_t *p_this )
     }
     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 =
-        config_GetFloat( p_vout, "opencv-scale" );
+        var_InheritFloat( p_vout, "opencv-scale" );
 
     if (p_vout->p_sys->i_verbosity > VERB_WARN)
         msg_Info(p_vout, "Configuration: opencv-scale: %f, opencv-chroma: %d, "
index ad1137aa3a349b4aea7bc8a926b44e04d7f1116d..af88df0fbf0e510fa6aee657897f98f9ce35da1e 100644 (file)
@@ -377,7 +377,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
     }
 
     /* 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 );
     free( psz_display );
@@ -391,8 +391,8 @@ static int OpenDisplay( vout_thread_t *p_vout )
 
     /* Find most appropriate mode */
     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.y = config_GetInt( p_vout, "height" );
+    p_vout->p_sys->mode.visible.x = var_InheritInteger( p_vout, "width" );
+    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.y =    GGI_AUTO;
     p_vout->p_sys->mode.size.x =    GGI_AUTO;
index c17a5af917efc13538d3495cbcfa75b04e49c8e4..0d53e274b6d9f796e8cfd27d58c88b59a1460e90 100644 (file)
@@ -124,7 +124,7 @@ static int Open(vlc_object_t *object)
     if (!sys)
         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);
     free(chroma_fmt);
 
@@ -134,8 +134,8 @@ static int Open(vlc_object_t *object)
         return VLC_EGENERIC;
     }
 
-    const int width  = config_GetInt(vd, "vout-snapshot-width");
-    const int height = config_GetInt(vd, "vout-snapshot-height");
+    const int width  = var_InheritInteger(vd, "vout-snapshot-width");
+    const int height = var_InheritInteger(vd, "vout-snapshot-height");
     if (width <= 0 || height <= 0) {
         msg_Err(vd, "snapshot-width/height are invalid");
         free(sys);
@@ -172,7 +172,7 @@ static int Open(vlc_object_t *object)
     }
 
     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 */
 
index 7a6440f6396c2fd5758b19d097c724ef233a1383..023f82f6e6c7e0a58e311ad59ae2d5252246f4e6 100644 (file)
@@ -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;
 
-    i_80_bands = config_GetInt ( p_aout, "visual-80-bands" );
-    i_peak     = config_GetInt ( p_aout, "visual-peaks" );
+    i_80_bands = var_InheritInteger( p_aout, "visual-80-bands" );
+    i_peak     = var_InheritInteger( p_aout, "visual-peaks" );
 
     if( i_80_bands != 0)
     {
@@ -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;
 
-    i_original     = config_GetInt ( p_aout, "spect-show-original" );
-    i_80_bands     = config_GetInt ( p_aout, "spect-80-bands" );
-    i_separ        = config_GetInt ( p_aout, "spect-separ" );
-    i_amp          = config_GetInt ( p_aout, "spect-amp" );
-    i_peak         = config_GetInt ( p_aout, "spect-show-peaks" );
-    i_show_base    = config_GetInt ( p_aout, "spect-show-base" );
-    i_show_bands   = config_GetInt ( p_aout, "spect-show-bands" );
-    i_rad          = config_GetInt ( p_aout, "spect-radius" );
-    i_sections     = config_GetInt ( p_aout, "spect-sections" );
-    i_extra_width  = config_GetInt ( p_aout, "spect-peak-width" );
-    i_peak_height  = config_GetInt ( p_aout, "spect-peak-height" );
-    color1         = config_GetInt ( p_aout, "spect-color" );
+    i_original     = var_InheritInteger( p_aout, "spect-show-original" );
+    i_80_bands     = var_InheritInteger( p_aout, "spect-80-bands" );
+    i_separ        = var_InheritInteger( p_aout, "spect-separ" );
+    i_amp          = var_InheritInteger( p_aout, "spect-amp" );
+    i_peak         = var_InheritInteger( p_aout, "spect-show-peaks" );
+    i_show_base    = var_InheritInteger( p_aout, "spect-show-base" );
+    i_show_bands   = var_InheritInteger( p_aout, "spect-show-bands" );
+    i_rad          = var_InheritInteger( p_aout, "spect-radius" );
+    i_sections     = var_InheritInteger( p_aout, "spect-sections" );
+    i_extra_width  = var_InheritInteger( p_aout, "spect-peak-width" );
+    i_peak_height  = var_InheritInteger( p_aout, "spect-peak-height" );
+    color1         = var_InheritInteger( p_aout, "spect-color" );
 
     if( i_80_bands != 0)
     {
index 74bd03553d5cb103813c6c4f8a97f6561b927fa3..cf3c00ff5255b30f057c687ff3cdfe4e8eb2d390 100644 (file)
@@ -200,8 +200,8 @@ static int Open( vlc_object_t *p_this )
     if( p_sys == NULL )
         return VLC_EGENERIC;
 
-    p_sys->i_height = config_GetInt( p_filter , "effect-height");
-    p_sys->i_width  = config_GetInt( p_filter , "effect-width");
+    p_sys->i_height = var_InheritInteger( p_filter , "effect-height");
+    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_width  < 532 ) p_sys->i_width  = 532;