Changeset 2ece18d460b0cc45527f3eaea9ba9d8fbcb9e3a5

Show
Ignore:
Timestamp:
07/04/07 22:17:12 (2 years ago)
Author:
Antoine Cellerier <dionoea@videolan.org>
git-committer:
Antoine Cellerier <dionoea@videolan.org> 1175977032 +0000
git-parent:

[57c44625f78bb0876b95521dd44615839ed85655]

git-author:
Antoine Cellerier <dionoea@videolan.org> 1175977032 +0000
Message:

Mosaic:
Allow runtime changes of the bluescreen parameters
Cosmetics
Compilation warning fixes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/video_filter/mosaic.c

    r78fe0c6 r2ece18d  
    9494 *****************************************************************************/ 
    9595#define ALPHA_TEXT N_("Transparency") 
    96 #define ALPHA_LONGTEXT N_("Transparency of the mosaic foreground pictures. " \ 
     96#define ALPHA_LONGTEXT N_( \ 
     97        "Transparency of the mosaic foreground pictures. " \ 
    9798        "0 means transparent, 255 opaque (default)." ) 
    9899 
     
    103104 
    104105#define XOFFSET_TEXT N_("Top left corner X coordinate") 
    105 #define XOFFSET_LONGTEXT N_("X Coordinate of the top-left corner of the mosaic.") 
     106#define XOFFSET_LONGTEXT N_( \ 
     107        "X Coordinate of the top-left corner of the mosaic.") 
    106108#define YOFFSET_TEXT N_("Top left corner Y coordinate") 
    107 #define YOFFSET_LONGTEXT N_("Y Coordinate of the top-left corner of the mosaic.") 
     109#define YOFFSET_LONGTEXT N_( \ 
     110        "Y Coordinate of the top-left corner of the mosaic.") 
     111 
    108112#define BORDERW_TEXT N_("Border width") 
    109 #define BORDERW_LONGTEXT N_( "Width in pixels of the border between miniatures." ) 
     113#define BORDERW_LONGTEXT N_( \ 
     114        "Width in pixels of the border between miniatures." ) 
    110115#define BORDERH_TEXT N_("Border height") 
    111 #define BORDERH_LONGTEXT N_( "Height in pixels of the border between miniatures." ) 
     116#define BORDERH_LONGTEXT N_( \ 
     117        "Height in pixels of the border between miniatures." ) 
    112118 
    113119#define ALIGN_TEXT N_("Mosaic alignment" ) 
    114120#define ALIGN_LONGTEXT N_( \ 
    115   "You can enforce the mosaic alignment on the video " \ 
    116   "(0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \ 
    117   "also use combinations of these values, eg 6 = top-right).") 
     121        "You can enforce the mosaic alignment on the video " \ 
     122        "(0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \ 
     123        "also use combinations of these values, eg 6 = top-right).") 
    118124 
    119125#define POS_TEXT N_("Positioning method") 
    120 #define POS_LONGTEXT N_("Positioning method for the mosaic. auto: " \ 
     126#define POS_LONGTEXT N_( \ 
     127        "Positioning method for the mosaic. auto: " \ 
    121128        "automatically choose the best number of rows and columns. " \ 
    122129        "fixed: use the user-defined number of rows and columns. " \ 
     
    124131 
    125132#define ROWS_TEXT N_("Number of rows") 
    126 #define ROWS_LONGTEXT N_("Number of image rows in the mosaic (only used if "\ 
     133#define ROWS_LONGTEXT N_( \ 
     134        "Number of image rows in the mosaic (only used if " \ 
    127135        "positionning method is set to \"fixed\")." ) 
     136 
    128137#define COLS_TEXT N_("Number of columns") 
    129 #define COLS_LONGTEXT N_("Number of image columns in the mosaic (only used if "\ 
     138#define COLS_LONGTEXT N_( \ 
     139        "Number of image columns in the mosaic (only used if " \ 
    130140        "positionning method is set to \"fixed\"." ) 
    131141 
    132142#define AR_TEXT N_("Keep aspect ratio") 
    133 #define AR_LONGTEXT N_("Keep the original aspect ratio when resizing " \ 
     143#define AR_LONGTEXT N_( \ 
     144        "Keep the original aspect ratio when resizing " \ 
    134145        "mosaic elements." ) 
    135146#define KEEP_TEXT N_("Keep original size") 
    136 #define KEEP_LONGTEXT N_("Keep the original size of mosaic elements." ) 
     147#define KEEP_LONGTEXT N_( \ 
     148        "Keep the original size of mosaic elements." ) 
    137149 
    138150#define ORDER_TEXT N_("Elements order" ) 
    139 #define ORDER_LONGTEXT N_( "You can enforce the order of the elements on " \ 
     151#define ORDER_LONGTEXT N_( \ 
     152        "You can enforce the order of the elements on " \ 
    140153        "the mosaic. You must give a comma-separated list of picture ID(s)." \ 
    141154        "These IDs are assigned in the \"mosaic-bridge\" module." ) 
    142155 
    143156#define OFFSETS_TEXT N_("Offsets in order" ) 
    144 #define OFFSETS_LONGTEXT N_( "You can enforce the (x,y) offsets of the elements on " \ 
    145         "the mosaic (only used if positioning method is set to \"offsets\"). You " \ 
     157#define OFFSETS_LONGTEXT N_( \ 
     158        "You can enforce the (x,y) offsets of the elements on the mosaic " \ 
     159        "(only used if positioning method is set to \"offsets\"). You " \ 
    146160        "must give a comma-separated list of coordinates (eg: 10,10,150,10)." ) 
    147161 
    148162#define DELAY_TEXT N_("Delay") 
    149 #define DELAY_LONGTEXT N_("Pictures coming from the mosaic elements " \ 
    150         "will be delayed according to this value (in milliseconds). For high " \ 
     163#define DELAY_LONGTEXT N_( \ 
     164        "Pictures coming from the mosaic elements will be delayed " \ 
     165        "according to this value (in milliseconds). For high " \ 
    151166        "values you will need to raise caching at input.") 
    152167 
    153168#define BLUESCREEN_TEXT N_("Bluescreen" ) 
    154 #define BLUESCREEN_LONGTEXT N_( "This effect, also known as \"greenscreen\" "\ 
    155    "or \"chroma key\" blends the \"blue parts\" of the foreground images of " \ 
    156    "the mosaic on the background (like wheather forecast presenters). You " \ 
    157    "can choose the \"key\" color for blending (blue by default)." ) 
     169#define BLUESCREEN_LONGTEXT N_( \ 
     170        "This effect, also known as \"greenscreen\" or \"chroma key\" blends " \ 
     171        "the \"blue parts\" of the foreground images of the mosaic on the " \ 
     172        "background (like weather forecast). You can choose the \"key\" " \ 
     173        "color for blending (blue by default)." ) 
    158174 
    159175#define BLUESCREENU_TEXT N_("Bluescreen U value") 
    160 #define BLUESCREENU_LONGTEXT N_("\"U\" value for the bluescreen key color " \ 
     176#define BLUESCREENU_LONGTEXT N_( \ 
     177        "\"U\" value for the bluescreen key color " \ 
    161178        "(in YUV values). From 0 to 255. Defaults to 120 for blue." ) 
    162179#define BLUESCREENV_TEXT N_("Bluescreen V value") 
    163 #define BLUESCREENV_LONGTEXT N_("\"V\" value for the bluescreen key color " \ 
     180#define BLUESCREENV_LONGTEXT N_( \ 
     181        "\"V\" value for the bluescreen key color " \ 
    164182        "(in YUV values). From 0 to 255. Defaults to 90 for blue." ) 
    165183#define BLUESCREENUTOL_TEXT N_("Bluescreen U tolerance") 
    166 #define BLUESCREENUTOL_LONGTEXT N_("Tolerance of the bluescreen blender " \ 
     184#define BLUESCREENUTOL_LONGTEXT N_( \ 
     185        "Tolerance of the bluescreen blender " \ 
    167186        "on color variations for the U plane. A value between 10 and 20 " \ 
    168187        "seems sensible." ) 
    169188#define BLUESCREENVTOL_TEXT N_("Bluescreen V tolerance") 
    170 #define BLUESCREENVTOL_LONGTEXT N_("Tolerance of the bluescreen blender " \ 
     189#define BLUESCREENVTOL_LONGTEXT N_( \ 
     190        "Tolerance of the bluescreen blender " \ 
    171191        "on color variations for the V plane. A value between 10 and 20 " \ 
    172192        "seems sensible." ) 
     
    191211    set_callbacks( CreateFilter, DestroyFilter ); 
    192212 
    193     add_integer( CFG_PREFIX "alpha", 255, NULL, ALPHA_TEXT, ALPHA_LONGTEXT, VLC_FALSE ); 
    194     add_integer( CFG_PREFIX "height", 100, NULL, HEIGHT_TEXT, HEIGHT_LONGTEXT, VLC_FALSE ); 
    195     add_integer( CFG_PREFIX "width", 100, NULL, WIDTH_TEXT, WIDTH_LONGTEXT, VLC_FALSE ); 
    196     add_integer( CFG_PREFIX "align", 5, NULL, ALIGN_TEXT, ALIGN_LONGTEXT, VLC_TRUE); 
     213    add_integer( CFG_PREFIX "alpha", 255, NULL, 
     214                 ALPHA_TEXT, ALPHA_LONGTEXT, VLC_FALSE ); 
     215 
     216    add_integer( CFG_PREFIX "height", 100, NULL, 
     217                 HEIGHT_TEXT, HEIGHT_LONGTEXT, VLC_FALSE ); 
     218    add_integer( CFG_PREFIX "width", 100, NULL, 
     219                 WIDTH_TEXT, WIDTH_LONGTEXT, VLC_FALSE ); 
     220 
     221    add_integer( CFG_PREFIX "align", 5, NULL, 
     222                 ALIGN_TEXT, ALIGN_LONGTEXT, VLC_TRUE); 
    197223        change_integer_list( pi_align_values, ppsz_align_descriptions, 0 ); 
    198     add_integer( CFG_PREFIX "xoffset", 0, NULL, XOFFSET_TEXT, XOFFSET_LONGTEXT, VLC_TRUE ); 
    199     add_integer( CFG_PREFIX "yoffset", 0, NULL, YOFFSET_TEXT, YOFFSET_LONGTEXT, VLC_TRUE ); 
    200     add_integer( CFG_PREFIX "borderw", 0, NULL, BORDERW_TEXT, BORDERW_LONGTEXT, VLC_TRUE ); 
     224 
     225    add_integer( CFG_PREFIX "xoffset", 0, NULL, 
     226                 XOFFSET_TEXT, XOFFSET_LONGTEXT, VLC_TRUE ); 
     227    add_integer( CFG_PREFIX "yoffset", 0, NULL, 
     228                 YOFFSET_TEXT, YOFFSET_LONGTEXT, VLC_TRUE ); 
     229 
     230    add_integer( CFG_PREFIX "borderw", 0, NULL, 
     231                 BORDERW_TEXT, BORDERW_LONGTEXT, VLC_TRUE ); 
    201232        add_deprecated( CFG_PREFIX "vborder", VLC_FALSE ); 
    202     add_integer( CFG_PREFIX "borderh", 0, NULL, BORDERH_TEXT, BORDERH_LONGTEXT, VLC_TRUE ); 
     233    add_integer( CFG_PREFIX "borderh", 0, NULL, 
     234                 BORDERH_TEXT, BORDERH_LONGTEXT, VLC_TRUE ); 
    203235        add_deprecated( CFG_PREFIX "hborder", VLC_FALSE ); 
    204236 
    205     add_integer( CFG_PREFIX "position", 0, NULL, POS_TEXT, POS_LONGTEXT, VLC_FALSE ); 
     237    add_integer( CFG_PREFIX "position", 0, NULL, 
     238                 POS_TEXT, POS_LONGTEXT, VLC_FALSE ); 
    206239        change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 ); 
    207     add_integer( CFG_PREFIX "rows", 2, NULL, ROWS_TEXT, ROWS_LONGTEXT, VLC_FALSE ); 
    208     add_integer( CFG_PREFIX "cols", 2, NULL, COLS_TEXT, COLS_LONGTEXT, VLC_FALSE ); 
    209     add_bool( CFG_PREFIX "keep-aspect-ratio", 0, NULL, AR_TEXT, AR_LONGTEXT, VLC_FALSE ); 
    210     add_bool( CFG_PREFIX "keep-picture", 0, NULL, KEEP_TEXT, KEEP_LONGTEXT, VLC_FALSE ); 
    211     add_string( CFG_PREFIX "order", "", NULL, ORDER_TEXT, ORDER_LONGTEXT, VLC_FALSE ); 
    212     add_string( CFG_PREFIX "offsets", "", NULL, OFFSETS_TEXT, OFFSETS_LONGTEXT, VLC_FALSE ); 
     240    add_integer( CFG_PREFIX "rows", 2, NULL, 
     241                 ROWS_TEXT, ROWS_LONGTEXT, VLC_FALSE ); 
     242    add_integer( CFG_PREFIX "cols", 2, NULL, 
     243                 COLS_TEXT, COLS_LONGTEXT, VLC_FALSE ); 
     244 
     245    add_bool( CFG_PREFIX "keep-aspect-ratio", 0, NULL, 
     246              AR_TEXT, AR_LONGTEXT, VLC_FALSE ); 
     247    add_bool( CFG_PREFIX "keep-picture", 0, NULL, 
     248              KEEP_TEXT, KEEP_LONGTEXT, VLC_FALSE ); 
     249 
     250    add_string( CFG_PREFIX "order", "", NULL, 
     251                ORDER_TEXT, ORDER_LONGTEXT, VLC_FALSE ); 
     252 
     253    add_string( CFG_PREFIX "offsets", "", NULL, 
     254                OFFSETS_TEXT, OFFSETS_LONGTEXT, VLC_FALSE ); 
    213255 
    214256    add_integer( CFG_PREFIX "delay", 0, NULL, DELAY_TEXT, DELAY_LONGTEXT, 
    215257                 VLC_FALSE ); 
    216258 
     259    set_section( N_("Bluescreen effect"), NULL ); 
    217260    add_bool( CFG_PREFIX "bs", 0, NULL, BLUESCREEN_TEXT, 
    218261              BLUESCREEN_LONGTEXT, VLC_FALSE ); 
    219     add_integer( CFG_PREFIX "bsu", 120, NULL, BLUESCREENU_TEXT, 
    220                  BLUESCREENU_LONGTEXT, VLC_FALSE ); 
    221     add_integer( CFG_PREFIX "bsv", 90, NULL, BLUESCREENV_TEXT, 
    222                  BLUESCREENV_LONGTEXT, VLC_FALSE ); 
    223     add_integer( CFG_PREFIX "bsut", 17, NULL, BLUESCREENUTOL_TEXT, 
    224                  BLUESCREENUTOL_LONGTEXT, VLC_FALSE ); 
    225     add_integer( CFG_PREFIX "bsvt", 17, NULL, BLUESCREENVTOL_TEXT, 
    226                  BLUESCREENVTOL_LONGTEXT, VLC_FALSE ); 
     262    add_integer_with_range( CFG_PREFIX "bsu", 120, 0, 255, NULL, 
     263                            BLUESCREENU_TEXT, BLUESCREENU_LONGTEXT, VLC_FALSE ); 
     264    add_integer_with_range( CFG_PREFIX "bsv", 90, 0, 255, NULL, 
     265                            BLUESCREENV_TEXT, BLUESCREENV_LONGTEXT, VLC_FALSE ); 
     266    add_integer_with_range( CFG_PREFIX "bsut", 17, 0, 255, NULL, 
     267                            BLUESCREENUTOL_TEXT, BLUESCREENUTOL_LONGTEXT, 
     268                            VLC_FALSE ); 
     269    add_integer_with_range( CFG_PREFIX "bsvt", 17, 0, 255, NULL, 
     270                            BLUESCREENVTOL_TEXT, BLUESCREENVTOL_LONGTEXT, 
     271                            VLC_FALSE ); 
    227272 
    228273    var_Create( p_module->p_libvlc_global, "mosaic-lock", VLC_VAR_MUTEX ); 
     
    535580            } 
    536581        } 
    537         p_sys->i_rows = ((int)ceil(sqrt( (float)i_numpics ))); 
     582        p_sys->i_rows = ceil(sqrt( (double)i_numpics )); 
    538583        p_sys->i_cols = ( i_numpics % p_sys->i_rows == 0 ? 
    539584                            i_numpics / p_sys->i_rows : 
     
    551596    { 
    552597        bridged_es_t *p_es = p_bridge->pp_es[i_index]; 
    553         video_format_t fmt_in = {0}, fmt_out = {0}
     598        video_format_t fmt_in, fmt_out
    554599        picture_t *p_converted; 
     600 
     601        memset( &fmt_in, 0, sizeof( video_format_t ) ); 
     602        memset( &fmt_out, 0, sizeof( video_format_t ) ); 
    555603 
    556604        if ( p_es->b_empty ) 
     
    836884{ 
    837885    filter_sys_t *p_sys = (filter_sys_t *) p_data; 
    838     if( !strcmp( psz_var, CFG_PREFIX "alpha" ) ) 
     886 
     887#define VAR_IS( a ) !strcmp( psz_var, CFG_PREFIX a ) 
     888    if( VAR_IS( "alpha" ) ) 
    839889    { 
    840890        vlc_mutex_lock( &p_sys->lock ); 
     
    844894        vlc_mutex_unlock( &p_sys->lock ); 
    845895    } 
    846     else if( !strcmp( psz_var, CFG_PREFIX "height" ) ) 
     896    else if( VAR_IS( "height" ) ) 
    847897    { 
    848898        vlc_mutex_lock( &p_sys->lock ); 
     
    852902        vlc_mutex_unlock( &p_sys->lock ); 
    853903    } 
    854     else if( !strcmp( psz_var, CFG_PREFIX "width" ) ) 
     904    else if( VAR_IS( "width" ) ) 
    855905    { 
    856906        vlc_mutex_lock( &p_sys->lock ); 
     
    860910        vlc_mutex_unlock( &p_sys->lock ); 
    861911    } 
    862     else if( !strcmp( psz_var, CFG_PREFIX "xoffset" ) ) 
     912    else if( VAR_IS( "xoffset" ) ) 
    863913    { 
    864914        vlc_mutex_lock( &p_sys->lock ); 
     
    868918        vlc_mutex_unlock( &p_sys->lock ); 
    869919    } 
    870     else if( !strcmp( psz_var, CFG_PREFIX "yoffset" ) ) 
     920    else if( VAR_IS( "yoffset" ) ) 
    871921    { 
    872922        vlc_mutex_lock( &p_sys->lock ); 
     
    876926        vlc_mutex_unlock( &p_sys->lock ); 
    877927    } 
    878     else if( !strcmp( psz_var, CFG_PREFIX "align" ) ) 
     928    else if( VAR_IS( "align" ) ) 
    879929    { 
    880930        int i_old = 0, i_new = 0; 
     
    891941        vlc_mutex_unlock( &p_sys->lock ); 
    892942    } 
    893     else if( !strcmp( psz_var, CFG_PREFIX "borderw" ) ) 
     943    else if( VAR_IS( "borderw" ) ) 
    894944    { 
    895945        vlc_mutex_lock( &p_sys->lock ); 
     
    899949        vlc_mutex_unlock( &p_sys->lock ); 
    900950    } 
    901     else if( !strcmp( psz_var, CFG_PREFIX "borderh" ) ) 
     951    else if( VAR_IS( "borderh" ) ) 
    902952    { 
    903953        vlc_mutex_lock( &p_sys->lock ); 
     
    907957        vlc_mutex_unlock( &p_sys->lock ); 
    908958    } 
    909     else if( !strcmp( psz_var, CFG_PREFIX "position" ) ) 
     959    else if( VAR_IS( "position" ) ) 
    910960    { 
    911961        if( newval.i_int > 1 || newval.i_int < 0 ) 
     
    917967            vlc_mutex_lock( &p_sys->lock ); 
    918968            msg_Dbg( p_this, "changing position method from %d (%s) to %d (%s)", 
    919                              p_sys->i_position, ppsz_pos_descriptions[p_sys->i_position], 
    920                              newval.i_int, ppsz_pos_descriptions[newval.i_int]); 
     969                    p_sys->i_position, ppsz_pos_descriptions[p_sys->i_position], 
     970                    newval.i_int, ppsz_pos_descriptions[newval.i_int]); 
    921971            p_sys->i_position = newval.i_int; 
    922972            vlc_mutex_unlock( &p_sys->lock ); 
    923973        } 
    924974    } 
    925     else if( !strcmp( psz_var, CFG_PREFIX "rows" ) ) 
     975    else if( VAR_IS( "rows" ) ) 
    926976    { 
    927977        vlc_mutex_lock( &p_sys->lock ); 
     
    931981        vlc_mutex_unlock( &p_sys->lock ); 
    932982    } 
    933     else if( !strcmp( psz_var, CFG_PREFIX "cols" ) ) 
     983    else if( VAR_IS( "cols" ) ) 
    934984    { 
    935985        vlc_mutex_lock( &p_sys->lock ); 
     
    939989        vlc_mutex_unlock( &p_sys->lock ); 
    940990    } 
    941     else if( !strcmp( psz_var, CFG_PREFIX "order" ) ) 
     991    else if( VAR_IS( "order" ) ) 
    942992    { 
    943993        char *psz_order; 
     
    9761026        vlc_mutex_unlock( &p_sys->lock ); 
    9771027    } 
    978     else if( !strcmp( psz_var, CFG_PREFIX "offsets" ) ) 
     1028    else if( VAR_IS( "offsets" ) ) 
    9791029    { 
    9801030        vlc_mutex_lock( &p_sys->lock ); 
     
    9921042        vlc_mutex_unlock( &p_sys->lock ); 
    9931043    } 
    994     else if( !strcmp( psz_var, CFG_PREFIX "keep-aspect-ratio" ) ) 
     1044    else if( VAR_IS( "keep-aspect-ratio" ) ) 
    9951045    { 
    9961046        vlc_mutex_lock( &p_sys->lock ); 
     
    10071057        vlc_mutex_unlock( &p_sys->lock ); 
    10081058    } 
     1059    else if( VAR_IS( "bs" ) ) 
     1060    { 
     1061        vlc_mutex_lock( &p_sys->lock ); 
     1062        p_sys->b_bs = newval.b_bool; 
     1063        vlc_mutex_unlock( &p_sys->lock ); 
     1064    } 
     1065    else if( VAR_IS( "bsu" ) ) 
     1066    { 
     1067        vlc_mutex_lock( &p_sys->lock ); 
     1068        p_sys->i_bsu = __MAX( 0, __MIN( 255, newval.i_int ) ); 
     1069        vlc_mutex_unlock( &p_sys->lock ); 
     1070    } 
     1071    else if( VAR_IS( "bsv" ) ) 
     1072    { 
     1073        vlc_mutex_lock( &p_sys->lock ); 
     1074        p_sys->i_bsv = __MAX( 0, __MIN( 255, newval.i_int ) ); 
     1075        vlc_mutex_unlock( &p_sys->lock ); 
     1076    } 
     1077    else if( VAR_IS( "bsut" ) ) 
     1078    { 
     1079        vlc_mutex_lock( &p_sys->lock ); 
     1080        p_sys->i_bsut = __MAX( 0, __MIN( 255, newval.i_int ) ); 
     1081        vlc_mutex_unlock( &p_sys->lock ); 
     1082    } 
     1083    else if( VAR_IS( "bsvt" ) ) 
     1084    { 
     1085        vlc_mutex_lock( &p_sys->lock ); 
     1086        p_sys->i_bsvt = __MAX( 0, __MIN( 255, newval.i_int ) ); 
     1087        vlc_mutex_unlock( &p_sys->lock ); 
     1088    } 
    10091089    return VLC_SUCCESS; 
    10101090}