Changeset e445caad6168b072f9d3f525f3fef3af639f67e5

Show
Ignore:
Timestamp:
04/22/08 23:36:45 (4 months ago)
Author:
Antoine Cellerier <dionoea@videolan.org>
git-committer:
Antoine Cellerier <dionoea@videolan.org> 1208900205 +0200
git-parent:

[722ab9f14ee31f8f0633cfc7a0b79401c47316fe]

git-author:
Antoine Cellerier <dionoea@videolan.org> 1208895622 +0200
Message:

Add picture specific alpha setting for mosaic pictures.
Add coordinates settings for mosaic pictures. (This kind of duplicates the --mosaic-offsets setting which I'm thinking about removing.)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/stream_out/mosaic_bridge.c

    r449fd28 re445caa  
    116116static void video_link_picture_decoder( decoder_t *, picture_t * ); 
    117117static 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 
     119static int HeightCallback( vlc_object_t *, char const *, 
     120                           vlc_value_t, vlc_value_t, void * ); 
     121static int WidthCallback( vlc_object_t *, char const *, 
     122                          vlc_value_t, vlc_value_t, void * ); 
     123static int alphaCallback( vlc_object_t *, char const *, 
     124                          vlc_value_t, vlc_value_t, void * ); 
     125static int xCallback( vlc_object_t *, char const *, 
     126                      vlc_value_t, vlc_value_t, void * ); 
     127static int yCallback( vlc_object_t *, char const *, 
     128                      vlc_value_t, vlc_value_t, void * ); 
    120129 
    121130/***************************************************************************** 
     
    144153    "Force the use of a specific chroma. Use YUVA if you're planning " \ 
    145154    "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." ) 
    146167 
    147168#define CFG_PREFIX "sout-mosaic-bridge-" 
     
    167188                     NULL, NULL, VFILTER_TEXT, VFILTER_LONGTEXT, false ); 
    168189 
     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 
    169195    set_callbacks( Open, Close ); 
    170196vlc_module_end(); 
    171197 
    172198static const char *ppsz_sout_options[] = { 
    173     "id", "width", "height", "sar", "vfilter", "chroma", NULL 
     199    "id", "width", "height", "sar", "vfilter", "chroma", "alpha", "x", "y", NULL 
    174200}; 
    175201 
     
    205231    p_sys->i_height = 
    206232        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 ); 
    209234 
    210235    p_sys->i_width = 
    211236        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 ); 
    214238 
    215239    var_Get( p_stream, CFG_PREFIX "sar", &val ); 
     
    246270        msg_Dbg( p_stream, "Forcing image chroma to 0x%.8x (%4.4s)", p_sys->i_chroma, (char*)&p_sys->i_chroma ); 
    247271    } 
     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 ) 
    248281 
    249282    p_stream->pf_add    = Add; 
     
    350383 
    351384    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" ); 
    352389 
    353390    //p_es->fmt = *p_fmt; 
     
    852889 * Callback to update (some) params on the fly 
    853890 **********************************************************************/ 
    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 ) 
     891static int HeightCallback( vlc_object_t *p_this, char const *psz_var, 
     892                           vlc_value_t oldval, vlc_value_t newval, 
     893                           void *p_data ) 
    857894{ 
    858895    VLC_UNUSED(p_this); VLC_UNUSED(oldval); 
    859896    sout_stream_t *p_stream = (sout_stream_t *)p_data; 
    860897    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 
     908static 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 
     925static 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 
     939static 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 
     953static 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  
    22 * mosaic.c : Mosaic video plugin for vlc 
    33 ***************************************************************************** 
    4  * Copyright (C) 2004-2007 the VideoLAN team 
     4 * Copyright (C) 2004-2008 the VideoLAN team 
    55 * $Id$ 
    66 * 
    7  * Authors: Antoine Cellerier <dionoea@via.ecp.fr
     7 * Authors: Antoine Cellerier <dionoea at videolan dot org
    88 *          Christophe Massiot <massiot@via.ecp.fr> 
    99 * 
     
    182182    set_callbacks( CreateFilter, DestroyFilter ); 
    183183 
    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 ); 
    186186 
    187187    add_integer( CFG_PREFIX "height", 100, NULL, 
     
    665665        } 
    666666 
    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 ) 
    668673        { 
    669674            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 
    677692                        + 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            } 
    709714        } 
    710715        p_region->i_align = p_sys->i_align; 
     716        p_region->i_alpha = p_es->i_alpha; 
    711717 
    712718        if( p_region_prev == NULL ) 
  • modules/video_filter/mosaic.h

    r449fd28 re445caa  
    3030    bool b_empty; 
    3131    char *psz_id; 
     32 
     33    int i_alpha; 
     34    int i_x; 
     35    int i_y; 
    3236} bridged_es_t; 
    3337