Changeset ab2b5d14468b79665e97776c79d4f29109734e6d

Show
Ignore:
Timestamp:
23/07/08 00:32:30 (4 months ago)
Author:
Pierre d'Herbemont <pdherbemont@videolan.org>
git-committer:
Pierre d'Herbemont <pdherbemont@videolan.org> 1216765950 +0200
git-parent:

[9b035c3c4cf70b7416234188f94b3644b9773b05]

git-author:
Pierre d'Herbemont <pdherbemont@videolan.org> 1216765950 +0200
Message:

quartztext: Make default options settings.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/misc/quartztext.c

    rb674dab rab2b5d1  
    8282// override the fallback font selection used when this style information is 
    8383// absent. 
     84#define FONT_TEXT N_("Font") 
     85#define FONT_LONGTEXT N_("Name for the font you want to use") 
     86#define FONTSIZER_TEXT N_("Relative font size") 
     87#define FONTSIZER_LONGTEXT N_("This is the relative default size of the " \ 
     88    "fonts that will be rendered on the video. If absolute font size is set, "\ 
     89    "relative size will be overriden." ) 
     90#define COLOR_TEXT N_("Text default color") 
     91#define COLOR_LONGTEXT N_("The color of the text that will be rendered on "\ 
     92    "the video. This must be an hexadecimal (like HTML colors). The first two "\ 
     93    "chars are for red, then green, then blue. #000000 = black, #FF0000 = red,"\ 
     94    " #00FF00 = green, #FFFF00 = yellow (red + green), #FFFFFF = white" ) 
     95 
     96static const int pi_color_values[] = { 
     97  0x00000000, 0x00808080, 0x00C0C0C0, 0x00FFFFFF, 0x00800000, 
     98  0x00FF0000, 0x00FF00FF, 0x00FFFF00, 0x00808000, 0x00008000, 0x00008080, 
     99  0x0000FF00, 0x00800080, 0x00000080, 0x000000FF, 0x0000FFFF }; 
     100 
     101static const char *const ppsz_color_descriptions[] = { 
     102  N_("Black"), N_("Gray"), N_("Silver"), N_("White"), N_("Maroon"), 
     103  N_("Red"), N_("Fuchsia"), N_("Yellow"), N_("Olive"), N_("Green"), N_("Teal"), 
     104  N_("Lime"), N_("Purple"), N_("Navy"), N_("Blue"), N_("Aqua") }; 
     105 
     106static const int pi_sizes[] = { 20, 18, 16, 12, 6 }; 
     107static const char *const ppsz_sizes_text[] = { 
     108    N_("Smaller"), N_("Small"), N_("Normal"), N_("Large"), N_("Larger") }; 
     109 
    84110vlc_module_begin(); 
    85111    set_shortname( N_("Mac Text renderer")); 
     
    88114    set_subcategory( SUBCAT_VIDEO_SUBPIC ); 
    89115 
     116    add_string( "quartztext-font", DEFAULT_FONT, NULL, FONT_TEXT, FONT_LONGTEXT, 
     117              false ); 
     118    add_integer( "quartztext-rel-fontsize", DEFAULT_REL_FONT_SIZE, NULL, FONTSIZER_TEXT, 
     119                 FONTSIZER_LONGTEXT, false ); 
     120        change_integer_list( pi_sizes, ppsz_sizes_text, 0 ); 
     121    add_integer( "quartztext-color", 0x00FFFFFF, NULL, COLOR_TEXT, 
     122                 COLOR_LONGTEXT, false ); 
     123        change_integer_list( pi_color_values, ppsz_color_descriptions, 0 ); 
    90124    set_capability( "text renderer", 120 ); 
    91125    add_shortcut( "text" ); 
     
    144178    if( !p_sys ) 
    145179        return VLC_ENOMEM; 
    146     p_sys->psz_font_name  = strdup( DEFAULT_FONT ); 
     180    p_sys->psz_font_name  = var_CreateGetString( p_this, "quartztext-font" ); 
    147181    p_sys->i_font_opacity = 255; 
    148     p_sys->i_font_color   = DEFAULT_FONT_COLOR
     182    p_sys->i_font_color = __MAX( __MIN( var_CreateGetInteger( p_this, "quartztext-color" ) , 0xFFFFFF ), 0 )
    149183    p_sys->i_font_size    = GetFontSize( p_filter ); 
    150184 
     
    10651099static int GetFontSize( filter_t *p_filter ) 
    10661100{ 
    1067     return p_filter->fmt_out.video.i_height / DEFAULT_REL_FONT_SIZE
     1101    return p_filter->fmt_out.video.i_height / __MAX(1, var_CreateGetInteger( p_filter, "quartztext-rel-fontsize" ))
    10681102} 
    10691103