Changeset e67e5e4988eee2f83a0420b89debac5557caed43

Show
Ignore:
Timestamp:
18/09/07 14:45:03 (1 year ago)
Author:
Jean-Paul Saman <jpsaman@videolan.org>
git-committer:
Jean-Paul Saman <jpsaman@videolan.org> 1190119503 +0000
git-parent:

[fa6fe6ce21e31d2fcbb3f0e90280cf4f0b830e4b]

git-author:
Jean-Paul Saman <jpsaman@videolan.org> 1190119503 +0000
Message:

Let user change position of Teletext subtitles.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/codec/zvbi.c

    rd64fe89 re67e5e4  
    4545#include "vlc_bits.h" 
    4646#include "vlc_codec.h" 
     47#include "vlc_image.h" 
    4748 
    4849typedef enum { 
     
    7778#define OPAQUE_LONGTEXT N_("Setting vbi-opaque to false " \ 
    7879        "makes the boxed text transparent." ) 
     80 
     81#define POS_TEXT N_("Teletext alignment") 
     82#define POS_LONGTEXT N_( \ 
     83  "You can enforce the teletext position on the video " \ 
     84  "(0=center, 1=left, 2=right, 4=top, 8=bottom, you can " \ 
     85  "also use combinations of these values, eg. 6 = top-right).") 
     86 
     87static int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 }; 
     88static const char *ppsz_pos_descriptions[] = 
     89{ N_("Center"), N_("Left"), N_("Right"), N_("Top"), N_("Bottom"), 
     90  N_("Top-Left"), N_("Top-Right"), N_("Bottom-Left"), N_("Bottom-Right") }; 
    7991 
    8092vlc_module_begin(); 
     
    90102    add_bool( "vbi-opaque", VLC_TRUE, NULL, 
    91103                 OPAQUE_TEXT, OPAQUE_LONGTEXT, VLC_FALSE ); 
     104    add_integer( "vbi-position", 4, NULL, POS_TEXT, POS_LONGTEXT, VLC_FALSE ); 
     105        change_integer_list( pi_pos_values, ppsz_pos_descriptions, 0 ); 
    92106vlc_module_end(); 
    93107 
     
    98112struct decoder_sys_t 
    99113{ 
    100    vbi_decoder *           p_vbi_dec; 
    101    vbi_dvb_demux *         p_dvb_demux; 
    102    unsigned int            i_wanted_page; 
    103    unsigned int            i_last_page; 
    104    vlc_bool_t              b_update; 
    105    vlc_bool_t              b_opaque; 
     114    vbi_decoder *           p_vbi_dec; 
     115    vbi_dvb_demux *         p_dvb_demux; 
     116    unsigned int            i_wanted_page; 
     117    unsigned int            i_last_page; 
     118    vlc_bool_t              b_update; 
     119    vlc_bool_t              b_opaque; 
     120 
     121    /* Positioning of Teletext images */ 
     122    int                     i_align; 
    106123}; 
    107124 
     
    111128static int Opaque( vlc_object_t *p_this, char const *psz_cmd, 
    112129                   vlc_value_t oldval, vlc_value_t newval, void *p_data ); 
     130static int Position( vlc_object_t *p_this, char const *psz_cmd, 
     131                     vlc_value_t oldval, vlc_value_t newval, void *p_data ); 
    113132 
    114133/***************************************************************************** 
     
    160179    p_sys->b_opaque = var_CreateGetBool( p_dec, "vbi-opaque" ); 
    161180    var_AddCallback( p_dec, "vbi-opaque", Opaque, p_sys ); 
     181 
     182    p_sys->i_align = var_CreateGetInteger( p_dec, "vbi-position" ); 
     183    var_AddCallback( p_dec, "vbi-position", Position, p_sys ); 
     184 
    162185    return VLC_SUCCESS; 
    163186} 
     
    171194    decoder_sys_t *p_sys = p_dec->p_sys; 
    172195 
    173     if( p_sys->p_vbi_dec ) 
    174         vbi_decoder_delete( p_sys->p_vbi_dec ); 
    175     if( p_sys->p_dvb_demux ) 
    176         vbi_dvb_demux_delete( p_sys->p_dvb_demux ); 
     196    if( p_sys->p_vbi_dec ) vbi_decoder_delete( p_sys->p_vbi_dec ); 
     197    if( p_sys->p_dvb_demux ) vbi_dvb_demux_delete( p_sys->p_dvb_demux ); 
    177198    free( p_sys ); 
    178199} 
     
    191212    vlc_bool_t      b_cached = VLC_FALSE; 
    192213    vbi_page        p_page; 
    193     uint8_t         *p_pos; 
     214    const uint8_t   *p_pos; 
    194215    unsigned int    i_left; 
    195216 
     
    197218    uint32_t        *p_begin, *p_end; 
    198219    unsigned        int x = 0, y = 0; 
    199     vbi_opacity opacity; 
     220    vbi_opacity     opacity; 
    200221    /* end part of kludge */ 
    201222 
     
    267288    p_spu->p_region->i_x = 0; 
    268289    p_spu->p_region->i_y = 0; 
     290    p_spu->p_region->i_align = SUBPICTURE_ALIGN_TOP; 
    269291 
    270292    /* Normal text subs, easy markup */ 
     
    272294 
    273295    p_spu->i_start = p_block->i_pts; 
    274     p_spu->i_stop = 0; 
     296    p_spu->i_stop = (mtime_t) 0; 
    275297    p_spu->b_ephemer = VLC_TRUE; 
    276298    p_spu->b_absolute = VLC_FALSE; 
     
    350372} 
    351373 
    352 static void event_handler( vbi_event *ev, void *user_data
     374static void event_handler( vbi_event *ev, void *user_data
    353375{ 
    354376    decoder_t *p_dec        = (decoder_t *)user_data; 
     
    399421    return VLC_SUCCESS; 
    400422} 
     423 
     424static int Position( vlc_object_t *p_this, char const *psz_cmd, 
     425                     vlc_value_t oldval, vlc_value_t newval, void *p_data ) 
     426{ 
     427    decoder_sys_t *p_sys = p_data; 
     428 
     429    if( p_sys ) 
     430        p_sys->i_align = newval.i_int; 
     431    return VLC_SUCCESS; 
     432}