Changeset 15006f7ba1072567a7397717279f4902d7f8ceda

Show
Ignore:
Timestamp:
05/06/05 19:05:20 (3 years ago)
Author:
Gildas Bazin <gbazin@videolan.org>
git-committer:
Gildas Bazin <gbazin@videolan.org> 1117991120 +0000
git-parent:

[55821eaca63a675630f001b612a3ded79a7457af]

git-author:
Gildas Bazin <gbazin@videolan.org> 1117991120 +0000
Message:

* modules/access/dvdnav.c, src/video_output/vout_subpictures.c: backport of #11304.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_spu.h

    rae42e9e r15006f7  
    4949 
    5050    int i_margin;                        /**< force position of a subpicture */ 
    51     vlc_bool_t b_force_alpha;         /**< force alpha palette of subpicture */ 
    52     uint8_t pi_alpha[4];                           /**< forced alpha palette */ 
     51    vlc_bool_t b_force_palette;             /**< force palette of subpicture */ 
     52    uint8_t palette[4][4];                               /**< forced palette */ 
    5353 
    5454    int ( *pf_control ) ( spu_t *, int, va_list ); 
  • modules/access/dvdnav.c

    r12f88f3 r15006f7  
    130130    event_thread_t *p_ev; 
    131131 
    132     /* FIXME */ 
    133     uint8_t     alpha[4]; 
    134     uint32_t    clut[16]; 
     132    /* palette for menus */ 
     133    uint32_t clut[16]; 
     134    uint8_t  palette[4][4]; 
    135135 
    136136    /* */ 
     
    150150static void DemuxTitles( demux_t * ); 
    151151static void ESSubtitleUpdate( demux_t * ); 
    152 static void ButtonUpdate( demux_t * ); 
     152static void ButtonUpdate( demux_t *, vlc_bool_t ); 
    153153 
    154154static void ESNew( demux_t *, int ); 
     
    321321    var_Create( p_sys->p_input, "y-end", VLC_VAR_INTEGER ); 
    322322    var_Create( p_sys->p_input, "color", VLC_VAR_ADDRESS ); 
    323     var_Create( p_sys->p_input, "menu-contrast", VLC_VAR_ADDRESS ); 
     323    var_Create( p_sys->p_input, "menu-palette", VLC_VAR_ADDRESS ); 
    324324    var_Create( p_sys->p_input, "highlight", VLC_VAR_BOOL ); 
    325325    var_Create( p_sys->p_input, "highlight-mutex", VLC_VAR_MUTEX ); 
     
    355355    var_Destroy( p_sys->p_input, "y-end" ); 
    356356    var_Destroy( p_sys->p_input, "color" ); 
    357     var_Destroy( p_sys->p_input, "menu-contrast" ); 
     357    var_Destroy( p_sys->p_input, "menu-palette" ); 
    358358 
    359359    vlc_object_release( p_sys->p_input ); 
     
    421421                if( p_sys->i_pgc_length > 0 ) 
    422422                { 
    423                     *pi64 = (int64_t) ( (double)p_sys->i_pgc_length / (double)len ) * (double) pos
     423                    *pi64 = p_sys->i_pgc_length * pos / len
    424424                    return VLC_SUCCESS; 
    425425                } 
     
    755755        msg_Dbg( p_demux, "     - display=%d", event->display ); 
    756756        msg_Dbg( p_demux, "     - buttonN=%d", event->buttonN ); 
    757         ButtonUpdate( p_demux ); 
     757        ButtonUpdate( p_demux, 0 ); 
    758758        break; 
    759759    } 
     
    880880 * Update functions: 
    881881 *****************************************************************************/ 
    882 static void ButtonUpdate( demux_t *p_demux
     882static void ButtonUpdate( demux_t *p_demux, vlc_bool_t b_mode
    883883{ 
    884884    demux_sys_t *p_sys = p_demux->p_sys; 
     
    903903        if( i_button > 0 && i_title ==  0 ) 
    904904        { 
     905            int i; 
    905906            pci_t *pci = dvdnav_get_current_nav_pci( p_sys->dvdnav ); 
    906907 
    907             dvdnav_get_highlight_area( pci, i_button, 1, &hl ); 
    908  
    909             /* I fear it is plain wrong */ 
    910             p_sys->alpha[0] = hl.palette&0x0f; 
    911             p_sys->alpha[1] = (hl.palette>>4)&0x0f; 
    912             p_sys->alpha[2] = (hl.palette>>8)&0x0f; 
    913             p_sys->alpha[3] = (hl.palette>>12)&0x0f; 
     908            dvdnav_get_highlight_area( pci, i_button, b_mode, &hl ); 
     909 
     910            for( i = 0; i < 4; i++ ) 
     911            { 
     912                uint32_t i_yuv = p_sys->clut[(hl.palette>>(16+i*4))&0x0f]; 
     913                uint8_t i_alpha = (hl.palette>>(i*4))&0x0f; 
     914                i_alpha = i_alpha == 0xf ? 0xff : i_alpha << 4; 
     915 
     916                p_sys->palette[i][0] = (i_yuv >> 16) & 0xff; 
     917                p_sys->palette[i][1] = (i_yuv >> 0) & 0xff; 
     918                p_sys->palette[i][2] = (i_yuv >> 8) & 0xff; 
     919                p_sys->palette[i][3] = i_alpha; 
     920            } 
    914921 
    915922            vlc_mutex_lock( p_mutex ); 
     
    919926            val.i_int = hl.ey; var_Set( p_sys->p_input, "y-end", val ); 
    920927 
    921             val.p_address = (void *)p_sys->alpha
    922             var_Set( p_sys->p_input, "menu-contrast", val ); 
     928            val.p_address = (void *)p_sys->palette
     929            var_Set( p_sys->p_input, "menu-palette", val ); 
    923930 
    924931            val.b_bool = VLC_TRUE; var_Set( p_sys->p_input, "highlight", val ); 
     
    947954    int32_t i_title, i_part; 
    948955 
    949     ButtonUpdate( p_demux ); 
     956    ButtonUpdate( p_demux, 0 ); 
    950957 
    951958    dvdnav_current_title_info( p_sys->dvdnav, &i_title, &i_part ); 
     
    11611168    tk->b_seen = VLC_TRUE; 
    11621169 
    1163     if( tk->fmt.i_cat == VIDEO_ES ) ButtonUpdate( p_demux ); 
     1170    if( tk->fmt.i_cat == VIDEO_ES ) ButtonUpdate( p_demux, 0 ); 
    11641171} 
    11651172 
     
    12281235                b_activated = VLC_TRUE; 
    12291236                dvdnav_button_activate( p_sys->dvdnav, pci ); 
     1237                ButtonUpdate( p_ev->p_demux, VLC_TRUE ); 
    12301238                break; 
    12311239            default: 
     
    12561264                dvdnav_mouse_activate( p_sys->dvdnav, pci, valx.i_int, 
    12571265                                       valy.i_int ); 
     1266                ButtonUpdate( p_ev->p_demux, VLC_TRUE ); 
    12581267            } 
    12591268 
  • src/video_output/vout_subpictures.c

    r477ffed r15006f7  
    600600 
    601601            /* Force palette if requested */ 
    602             if( p_spu->b_force_alpha && VLC_FOURCC('Y','U','V','P') == 
     602            if( p_spu->b_force_palette && VLC_FOURCC('Y','U','V','P') == 
    603603                p_region->fmt.i_chroma ) 
    604604            { 
    605                 p_region->fmt.p_palette->palette[0][3] = p_spu->pi_alpha[0]; 
    606                 p_region->fmt.p_palette->palette[1][3] = p_spu->pi_alpha[1]; 
    607                 p_region->fmt.p_palette->palette[2][3] = p_spu->pi_alpha[2]; 
    608                 p_region->fmt.p_palette->palette[3][3] = p_spu->pi_alpha[3]; 
     605                memcpy( p_region->fmt.p_palette->palette, 
     606                        p_spu->palette, 16 ); 
    609607            } 
    610608 
     
    965963    vlc_value_t val; 
    966964 
    967     p_spu->b_force_alpha = VLC_FALSE; 
     965    p_spu->b_force_palette = VLC_FALSE; 
    968966    p_spu->b_force_crop = VLC_FALSE; 
    969967 
     
    980978    p_spu->i_crop_height = val.i_int - p_spu->i_crop_y; 
    981979 
    982 #if 0 
    983     if( var_Get( p_object, "color", &val ) == VLC_SUCCESS ) 
    984     { 
    985         int i; 
    986         for( i = 0; i < 4; i++ ) 
    987         { 
    988             p_spu->pi_color[i] = ((uint8_t *)val.p_address)[i]; 
    989         } 
    990     } 
    991 #endif 
    992  
    993     if( var_Get( p_object, "menu-contrast", &val ) == VLC_SUCCESS ) 
    994     { 
    995         int i; 
    996         for( i = 0; i < 4; i++ ) 
    997         { 
    998             p_spu->pi_alpha[i] = ((uint8_t *)val.p_address)[i]; 
    999             p_spu->pi_alpha[i] = p_spu->pi_alpha[i] == 0xf ? 
    1000                 0xff : p_spu->pi_alpha[i] << 4; 
    1001         } 
    1002         p_spu->b_force_alpha = VLC_TRUE; 
    1003     } 
    1004  
    1005     msg_Dbg( p_object, "crop: %i,%i,%i,%i, alpha: %i", 
     980    if( var_Get( p_object, "menu-palette", &val ) == VLC_SUCCESS ) 
     981    { 
     982        memcpy( p_spu->palette, val.p_address, 16 ); 
     983        p_spu->b_force_palette = VLC_TRUE; 
     984    } 
     985 
     986    msg_Dbg( p_object, "crop: %i,%i,%i,%i, palette forced: %i", 
    1006987             p_spu->i_crop_x, p_spu->i_crop_y, 
    1007              p_spu->i_crop_width, p_spu->i_crop_height, p_spu->b_force_alpha ); 
     988             p_spu->i_crop_width, p_spu->i_crop_height, 
     989             p_spu->b_force_palette ); 
    1008990} 
    1009991