Changeset 2ece18d460b0cc45527f3eaea9ba9d8fbcb9e3a5
- Timestamp:
- 07/04/07 22:17:12 (2 years ago)
- git-parent:
- Files:
-
- modules/video_filter/mosaic.c (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/video_filter/mosaic.c
r78fe0c6 r2ece18d 94 94 *****************************************************************************/ 95 95 #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. " \ 97 98 "0 means transparent, 255 opaque (default)." ) 98 99 … … 103 104 104 105 #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.") 106 108 #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 108 112 #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." ) 110 115 #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." ) 112 118 113 119 #define ALIGN_TEXT N_("Mosaic alignment" ) 114 120 #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).") 118 124 119 125 #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: " \ 121 128 "automatically choose the best number of rows and columns. " \ 122 129 "fixed: use the user-defined number of rows and columns. " \ … … 124 131 125 132 #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 " \ 127 135 "positionning method is set to \"fixed\")." ) 136 128 137 #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 " \ 130 140 "positionning method is set to \"fixed\"." ) 131 141 132 142 #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 " \ 134 145 "mosaic elements." ) 135 146 #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." ) 137 149 138 150 #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 " \ 140 153 "the mosaic. You must give a comma-separated list of picture ID(s)." \ 141 154 "These IDs are assigned in the \"mosaic-bridge\" module." ) 142 155 143 156 #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 " \ 146 160 "must give a comma-separated list of coordinates (eg: 10,10,150,10)." ) 147 161 148 162 #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 " \ 151 166 "values you will need to raise caching at input.") 152 167 153 168 #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)." ) 158 174 159 175 #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 " \ 161 178 "(in YUV values). From 0 to 255. Defaults to 120 for blue." ) 162 179 #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 " \ 164 182 "(in YUV values). From 0 to 255. Defaults to 90 for blue." ) 165 183 #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 " \ 167 186 "on color variations for the U plane. A value between 10 and 20 " \ 168 187 "seems sensible." ) 169 188 #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 " \ 171 191 "on color variations for the V plane. A value between 10 and 20 " \ 172 192 "seems sensible." ) … … 191 211 set_callbacks( CreateFilter, DestroyFilter ); 192 212 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); 197 223 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 ); 201 232 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 ); 203 235 add_deprecated( CFG_PREFIX "hborder", VLC_FALSE ); 204 236 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 ); 206 239 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 ); 213 255 214 256 add_integer( CFG_PREFIX "delay", 0, NULL, DELAY_TEXT, DELAY_LONGTEXT, 215 257 VLC_FALSE ); 216 258 259 set_section( N_("Bluescreen effect"), NULL ); 217 260 add_bool( CFG_PREFIX "bs", 0, NULL, BLUESCREEN_TEXT, 218 261 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 ); 227 272 228 273 var_Create( p_module->p_libvlc_global, "mosaic-lock", VLC_VAR_MUTEX ); … … 535 580 } 536 581 } 537 p_sys->i_rows = ((int)ceil(sqrt( (float)i_numpics )));582 p_sys->i_rows = ceil(sqrt( (double)i_numpics )); 538 583 p_sys->i_cols = ( i_numpics % p_sys->i_rows == 0 ? 539 584 i_numpics / p_sys->i_rows : … … 551 596 { 552 597 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; 554 599 picture_t *p_converted; 600 601 memset( &fmt_in, 0, sizeof( video_format_t ) ); 602 memset( &fmt_out, 0, sizeof( video_format_t ) ); 555 603 556 604 if ( p_es->b_empty ) … … 836 884 { 837 885 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" ) ) 839 889 { 840 890 vlc_mutex_lock( &p_sys->lock ); … … 844 894 vlc_mutex_unlock( &p_sys->lock ); 845 895 } 846 else if( !strcmp( psz_var, CFG_PREFIX"height" ) )896 else if( VAR_IS( "height" ) ) 847 897 { 848 898 vlc_mutex_lock( &p_sys->lock ); … … 852 902 vlc_mutex_unlock( &p_sys->lock ); 853 903 } 854 else if( !strcmp( psz_var, CFG_PREFIX"width" ) )904 else if( VAR_IS( "width" ) ) 855 905 { 856 906 vlc_mutex_lock( &p_sys->lock ); … … 860 910 vlc_mutex_unlock( &p_sys->lock ); 861 911 } 862 else if( !strcmp( psz_var, CFG_PREFIX"xoffset" ) )912 else if( VAR_IS( "xoffset" ) ) 863 913 { 864 914 vlc_mutex_lock( &p_sys->lock ); … … 868 918 vlc_mutex_unlock( &p_sys->lock ); 869 919 } 870 else if( !strcmp( psz_var, CFG_PREFIX"yoffset" ) )920 else if( VAR_IS( "yoffset" ) ) 871 921 { 872 922 vlc_mutex_lock( &p_sys->lock ); … … 876 926 vlc_mutex_unlock( &p_sys->lock ); 877 927 } 878 else if( !strcmp( psz_var, CFG_PREFIX"align" ) )928 else if( VAR_IS( "align" ) ) 879 929 { 880 930 int i_old = 0, i_new = 0; … … 891 941 vlc_mutex_unlock( &p_sys->lock ); 892 942 } 893 else if( !strcmp( psz_var, CFG_PREFIX"borderw" ) )943 else if( VAR_IS( "borderw" ) ) 894 944 { 895 945 vlc_mutex_lock( &p_sys->lock ); … … 899 949 vlc_mutex_unlock( &p_sys->lock ); 900 950 } 901 else if( !strcmp( psz_var, CFG_PREFIX"borderh" ) )951 else if( VAR_IS( "borderh" ) ) 902 952 { 903 953 vlc_mutex_lock( &p_sys->lock ); … … 907 957 vlc_mutex_unlock( &p_sys->lock ); 908 958 } 909 else if( !strcmp( psz_var, CFG_PREFIX"position" ) )959 else if( VAR_IS( "position" ) ) 910 960 { 911 961 if( newval.i_int > 1 || newval.i_int < 0 ) … … 917 967 vlc_mutex_lock( &p_sys->lock ); 918 968 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]); 921 971 p_sys->i_position = newval.i_int; 922 972 vlc_mutex_unlock( &p_sys->lock ); 923 973 } 924 974 } 925 else if( !strcmp( psz_var, CFG_PREFIX"rows" ) )975 else if( VAR_IS( "rows" ) ) 926 976 { 927 977 vlc_mutex_lock( &p_sys->lock ); … … 931 981 vlc_mutex_unlock( &p_sys->lock ); 932 982 } 933 else if( !strcmp( psz_var, CFG_PREFIX"cols" ) )983 else if( VAR_IS( "cols" ) ) 934 984 { 935 985 vlc_mutex_lock( &p_sys->lock ); … … 939 989 vlc_mutex_unlock( &p_sys->lock ); 940 990 } 941 else if( !strcmp( psz_var, CFG_PREFIX"order" ) )991 else if( VAR_IS( "order" ) ) 942 992 { 943 993 char *psz_order; … … 976 1026 vlc_mutex_unlock( &p_sys->lock ); 977 1027 } 978 else if( !strcmp( psz_var, CFG_PREFIX"offsets" ) )1028 else if( VAR_IS( "offsets" ) ) 979 1029 { 980 1030 vlc_mutex_lock( &p_sys->lock ); … … 992 1042 vlc_mutex_unlock( &p_sys->lock ); 993 1043 } 994 else if( !strcmp( psz_var, CFG_PREFIX"keep-aspect-ratio" ) )1044 else if( VAR_IS( "keep-aspect-ratio" ) ) 995 1045 { 996 1046 vlc_mutex_lock( &p_sys->lock ); … … 1007 1057 vlc_mutex_unlock( &p_sys->lock ); 1008 1058 } 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 } 1009 1089 return VLC_SUCCESS; 1010 1090 }
