Changeset e445caad6168b072f9d3f525f3fef3af639f67e5
- Timestamp:
- 04/22/08 23:36:45 (4 months ago)
- git-parent:
- Files:
-
- modules/stream_out/mosaic_bridge.c (modified) (7 diffs)
- modules/video_filter/mosaic.c (modified) (3 diffs)
- modules/video_filter/mosaic.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/stream_out/mosaic_bridge.c
r449fd28 re445caa 116 116 static void video_link_picture_decoder( decoder_t *, picture_t * ); 117 117 static void video_unlink_picture_decoder( decoder_t *, picture_t * ); 118 static int MosaicBridgeCallback( vlc_object_t *, char const *, 119 vlc_value_t, vlc_value_t, void * ); 118 119 static int HeightCallback( vlc_object_t *, char const *, 120 vlc_value_t, vlc_value_t, void * ); 121 static int WidthCallback( vlc_object_t *, char const *, 122 vlc_value_t, vlc_value_t, void * ); 123 static int alphaCallback( vlc_object_t *, char const *, 124 vlc_value_t, vlc_value_t, void * ); 125 static int xCallback( vlc_object_t *, char const *, 126 vlc_value_t, vlc_value_t, void * ); 127 static int yCallback( vlc_object_t *, char const *, 128 vlc_value_t, vlc_value_t, void * ); 120 129 121 130 /***************************************************************************** … … 144 153 "Force the use of a specific chroma. Use YUVA if you're planning " \ 145 154 "to use the Alphamask or Bluescreen video filter." ) 155 156 #define ALPHA_TEXT N_("Transparency") 157 #define ALPHA_LONGTEXT N_( \ 158 "Transparency of the mosaic picture." ) 159 160 #define X_TEXT N_("X offset") 161 #define X_LONGTEXT N_( \ 162 "X coordinate of the upper left corner in the mosaic if non negative." ) 163 164 #define Y_TEXT N_("Y offset") 165 #define Y_LONGTEXT N_( \ 166 "Y coordinate of the upper left corner in the mosaic if non negative." ) 146 167 147 168 #define CFG_PREFIX "sout-mosaic-bridge-" … … 167 188 NULL, NULL, VFILTER_TEXT, VFILTER_LONGTEXT, false ); 168 189 190 add_integer_with_range( CFG_PREFIX "alpha", 255, 0, 255, NULL, 191 ALPHA_TEXT, ALPHA_LONGTEXT, false ); 192 add_integer( CFG_PREFIX "x", -1, NULL, X_TEXT, X_LONGTEXT, false ); 193 add_integer( CFG_PREFIX "y", -1, NULL, Y_TEXT, Y_LONGTEXT, false ); 194 169 195 set_callbacks( Open, Close ); 170 196 vlc_module_end(); 171 197 172 198 static const char *ppsz_sout_options[] = { 173 "id", "width", "height", "sar", "vfilter", "chroma", NULL199 "id", "width", "height", "sar", "vfilter", "chroma", "alpha", "x", "y", NULL 174 200 }; 175 201 … … 205 231 p_sys->i_height = 206 232 var_CreateGetIntegerCommand( p_stream, CFG_PREFIX "height" ); 207 var_AddCallback( p_stream, CFG_PREFIX "height", MosaicBridgeCallback, 208 p_stream ); 233 var_AddCallback( p_stream, CFG_PREFIX "height", HeightCallback, p_stream ); 209 234 210 235 p_sys->i_width = 211 236 var_CreateGetIntegerCommand( p_stream, CFG_PREFIX "width" ); 212 var_AddCallback( p_stream, CFG_PREFIX "width", MosaicBridgeCallback, 213 p_stream ); 237 var_AddCallback( p_stream, CFG_PREFIX "width", WidthCallback, p_stream ); 214 238 215 239 var_Get( p_stream, CFG_PREFIX "sar", &val ); … … 246 270 msg_Dbg( p_stream, "Forcing image chroma to 0x%.8x (%4.4s)", p_sys->i_chroma, (char*)&p_sys->i_chroma ); 247 271 } 272 273 #define INT_COMMAND( a ) \ 274 var_Create( p_stream, CFG_PREFIX #a, \ 275 VLC_VAR_INTEGER | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND ); \ 276 var_AddCallback( p_stream, CFG_PREFIX #a, a ## Callback, \ 277 p_stream ); 278 INT_COMMAND( alpha ) 279 INT_COMMAND( x ) 280 INT_COMMAND( y ) 248 281 249 282 p_stream->pf_add = Add; … … 350 383 351 384 p_sys->p_es = p_es = p_bridge->pp_es[i]; 385 386 p_es->i_alpha = var_GetInteger( p_stream, CFG_PREFIX "alpha" ); 387 p_es->i_x = var_GetInteger( p_stream, CFG_PREFIX "x" ); 388 p_es->i_y = var_GetInteger( p_stream, CFG_PREFIX "y" ); 352 389 353 390 //p_es->fmt = *p_fmt; … … 852 889 * Callback to update (some) params on the fly 853 890 **********************************************************************/ 854 static int MosaicBridgeCallback( vlc_object_t *p_this, char const *psz_var,855 vlc_value_t oldval, vlc_value_t newval,856 void *p_data )891 static int HeightCallback( vlc_object_t *p_this, char const *psz_var, 892 vlc_value_t oldval, vlc_value_t newval, 893 void *p_data ) 857 894 { 858 895 VLC_UNUSED(p_this); VLC_UNUSED(oldval); 859 896 sout_stream_t *p_stream = (sout_stream_t *)p_data; 860 897 sout_stream_sys_t *p_sys = p_stream->p_sys; 861 int i_ret = VLC_SUCCESS; 862 863 #define VAR_IS( a ) !strcmp( psz_var, CFG_PREFIX a ) 864 if( VAR_IS( "height" ) ) 865 { 866 /* We create the handler before updating the value in p_sys 867 * so we don't have to worry about locking */ 868 if( !p_sys->p_image && newval.i_int ) 869 p_sys->p_image = image_HandlerCreate( p_stream ); 870 p_sys->i_height = newval.i_int; 871 } 872 else if( VAR_IS( "width" ) ) 873 { 874 /* We create the handler before updating the value in p_sys 875 * so we don't have to worry about locking */ 876 if( !p_sys->p_image && newval.i_int ) 877 p_sys->p_image = image_HandlerCreate( p_stream ); 878 p_sys->i_width = newval.i_int; 879 } 880 #undef VAR_IS 881 882 return i_ret; 883 } 898 899 /* We create the handler before updating the value in p_sys 900 * so we don't have to worry about locking */ 901 if( !p_sys->p_image && newval.i_int ) 902 p_sys->p_image = image_HandlerCreate( p_stream ); 903 p_sys->i_height = newval.i_int; 904 905 return VLC_SUCCESS; 906 } 907 908 static int WidthCallback( vlc_object_t *p_this, char const *psz_var, 909 vlc_value_t oldval, vlc_value_t newval, 910 void *p_data ) 911 { 912 VLC_UNUSED(p_this); VLC_UNUSED(oldval); 913 sout_stream_t *p_stream = (sout_stream_t *)p_data; 914 sout_stream_sys_t *p_sys = p_stream->p_sys; 915 916 /* We create the handler before updating the value in p_sys 917 * so we don't have to worry about locking */ 918 if( !p_sys->p_image && newval.i_int ) 919 p_sys->p_image = image_HandlerCreate( p_stream ); 920 p_sys->i_width = newval.i_int; 921 922 return VLC_SUCCESS; 923 } 924 925 static int alphaCallback( vlc_object_t *p_this, char const *psz_var, 926 vlc_value_t oldval, vlc_value_t newval, 927 void *p_data ) 928 { 929 VLC_UNUSED(p_this); VLC_UNUSED(oldval); 930 sout_stream_t *p_stream = (sout_stream_t *)p_data; 931 sout_stream_sys_t *p_sys = p_stream->p_sys; 932 933 if( p_sys->p_es ) 934 p_sys->p_es->i_alpha = newval.i_int; 935 936 return VLC_SUCCESS; 937 } 938 939 static int xCallback( vlc_object_t *p_this, char const *psz_var, 940 vlc_value_t oldval, vlc_value_t newval, 941 void *p_data ) 942 { 943 VLC_UNUSED(p_this); VLC_UNUSED(oldval); 944 sout_stream_t *p_stream = (sout_stream_t *)p_data; 945 sout_stream_sys_t *p_sys = p_stream->p_sys; 946 947 if( p_sys->p_es ) 948 p_sys->p_es->i_x = newval.i_int; 949 950 return VLC_SUCCESS; 951 } 952 953 static int yCallback( vlc_object_t *p_this, char const *psz_var, 954 vlc_value_t oldval, vlc_value_t newval, 955 void *p_data ) 956 { 957 VLC_UNUSED(p_this); VLC_UNUSED(oldval); 958 sout_stream_t *p_stream = (sout_stream_t *)p_data; 959 sout_stream_sys_t *p_sys = p_stream->p_sys; 960 961 if( p_sys->p_es ) 962 p_sys->p_es->i_y = newval.i_int; 963 964 return VLC_SUCCESS; 965 } modules/video_filter/mosaic.c
r449fd28 re445caa 2 2 * mosaic.c : Mosaic video plugin for vlc 3 3 ***************************************************************************** 4 * Copyright (C) 2004-200 7the VideoLAN team4 * Copyright (C) 2004-2008 the VideoLAN team 5 5 * $Id$ 6 6 * 7 * Authors: Antoine Cellerier <dionoea @via.ecp.fr>7 * Authors: Antoine Cellerier <dionoea at videolan dot org> 8 8 * Christophe Massiot <massiot@via.ecp.fr> 9 9 * … … 182 182 set_callbacks( CreateFilter, DestroyFilter ); 183 183 184 add_integer ( CFG_PREFIX "alpha", 255, NULL,185 ALPHA_TEXT, ALPHA_LONGTEXT, false );184 add_integer_with_range( CFG_PREFIX "alpha", 255, 0, 255, NULL, 185 ALPHA_TEXT, ALPHA_LONGTEXT, false ); 186 186 187 187 add_integer( CFG_PREFIX "height", 100, NULL, … … 665 665 } 666 666 667 if( p_sys->i_position == position_offsets ) 667 if( p_es->i_x >= 0 && p_es->i_y >= 0 ) 668 { 669 p_region->i_x = p_es->i_x; 670 p_region->i_y = p_es->i_y; 671 } 672 else if( p_sys->i_position == position_offsets ) 668 673 { 669 674 p_region->i_x = p_sys->pi_x_offsets[i_real_index]; 670 } 671 else if( fmt_out.i_width > col_inner_width || 672 p_sys->b_ar || p_sys->b_keep ) 673 { 674 /* we don't have to center the video since it takes the 675 whole rectangle area or it's larger than the rectangle */ 676 p_region->i_x = p_sys->i_xoffset 675 p_region->i_y = p_sys->pi_y_offsets[i_real_index]; 676 } 677 else 678 { 679 if( fmt_out.i_width > col_inner_width || 680 p_sys->b_ar || p_sys->b_keep ) 681 { 682 /* we don't have to center the video since it takes the 683 whole rectangle area or it's larger than the rectangle */ 684 p_region->i_x = p_sys->i_xoffset 685 + i_col * ( p_sys->i_width / p_sys->i_cols ) 686 + ( i_col * p_sys->i_borderw ) / p_sys->i_cols; 687 } 688 else 689 { 690 /* center the video in the dedicated rectangle */ 691 p_region->i_x = p_sys->i_xoffset 677 692 + i_col * ( p_sys->i_width / p_sys->i_cols ) 678 + ( i_col * p_sys->i_borderw ) / p_sys->i_cols; 679 } 680 else 681 { 682 /* center the video in the dedicated rectangle */ 683 p_region->i_x = p_sys->i_xoffset 684 + i_col * ( p_sys->i_width / p_sys->i_cols ) 685 + ( i_col * p_sys->i_borderw ) / p_sys->i_cols 686 + ( col_inner_width - fmt_out.i_width ) / 2; 687 } 688 689 if( p_sys->i_position == position_offsets ) 690 { 691 p_region->i_y = p_sys->pi_y_offsets[i_real_index]; 692 } 693 else if( fmt_out.i_height > row_inner_height 694 || p_sys->b_ar || p_sys->b_keep ) 695 { 696 /* we don't have to center the video since it takes the 697 whole rectangle area or it's taller than the rectangle */ 698 p_region->i_y = p_sys->i_yoffset 699 + i_row * ( p_sys->i_height / p_sys->i_rows ) 700 + ( i_row * p_sys->i_borderh ) / p_sys->i_rows; 701 } 702 else 703 { 704 /* center the video in the dedicated rectangle */ 705 p_region->i_y = p_sys->i_yoffset 706 + i_row * ( p_sys->i_height / p_sys->i_rows ) 707 + ( i_row * p_sys->i_borderh ) / p_sys->i_rows 708 + ( row_inner_height - fmt_out.i_height ) / 2; 693 + ( i_col * p_sys->i_borderw ) / p_sys->i_cols 694 + ( col_inner_width - fmt_out.i_width ) / 2; 695 } 696 697 if( fmt_out.i_height > row_inner_height 698 || p_sys->b_ar || p_sys->b_keep ) 699 { 700 /* we don't have to center the video since it takes the 701 whole rectangle area or it's taller than the rectangle */ 702 p_region->i_y = p_sys->i_yoffset 703 + i_row * ( p_sys->i_height / p_sys->i_rows ) 704 + ( i_row * p_sys->i_borderh ) / p_sys->i_rows; 705 } 706 else 707 { 708 /* center the video in the dedicated rectangle */ 709 p_region->i_y = p_sys->i_yoffset 710 + i_row * ( p_sys->i_height / p_sys->i_rows ) 711 + ( i_row * p_sys->i_borderh ) / p_sys->i_rows 712 + ( row_inner_height - fmt_out.i_height ) / 2; 713 } 709 714 } 710 715 p_region->i_align = p_sys->i_align; 716 p_region->i_alpha = p_es->i_alpha; 711 717 712 718 if( p_region_prev == NULL ) modules/video_filter/mosaic.h
r449fd28 re445caa 30 30 bool b_empty; 31 31 char *psz_id; 32 33 int i_alpha; 34 int i_x; 35 int i_y; 32 36 } bridged_es_t; 33 37
