Changeset 15006f7ba1072567a7397717279f4902d7f8ceda
- 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
| rae42e9e |
r15006f7 |
|
| 49 | 49 | |
|---|
| 50 | 50 | 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 */ |
|---|
| 53 | 53 | |
|---|
| 54 | 54 | int ( *pf_control ) ( spu_t *, int, va_list ); |
|---|
| r12f88f3 |
r15006f7 |
|
| 130 | 130 | event_thread_t *p_ev; |
|---|
| 131 | 131 | |
|---|
| 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]; |
|---|
| 135 | 135 | |
|---|
| 136 | 136 | /* */ |
|---|
| … | … | |
| 150 | 150 | static void DemuxTitles( demux_t * ); |
|---|
| 151 | 151 | static void ESSubtitleUpdate( demux_t * ); |
|---|
| 152 | | static void ButtonUpdate( demux_t * ); |
|---|
| | 152 | static void ButtonUpdate( demux_t *, vlc_bool_t ); |
|---|
| 153 | 153 | |
|---|
| 154 | 154 | static void ESNew( demux_t *, int ); |
|---|
| … | … | |
| 321 | 321 | var_Create( p_sys->p_input, "y-end", VLC_VAR_INTEGER ); |
|---|
| 322 | 322 | 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 ); |
|---|
| 324 | 324 | var_Create( p_sys->p_input, "highlight", VLC_VAR_BOOL ); |
|---|
| 325 | 325 | var_Create( p_sys->p_input, "highlight-mutex", VLC_VAR_MUTEX ); |
|---|
| … | … | |
| 355 | 355 | var_Destroy( p_sys->p_input, "y-end" ); |
|---|
| 356 | 356 | 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" ); |
|---|
| 358 | 358 | |
|---|
| 359 | 359 | vlc_object_release( p_sys->p_input ); |
|---|
| … | … | |
| 421 | 421 | if( p_sys->i_pgc_length > 0 ) |
|---|
| 422 | 422 | { |
|---|
| 423 | | *pi64 = (int64_t) ( (double)p_sys->i_pgc_length / (double)len ) * (double) pos; |
|---|
| | 423 | *pi64 = p_sys->i_pgc_length * pos / len; |
|---|
| 424 | 424 | return VLC_SUCCESS; |
|---|
| 425 | 425 | } |
|---|
| … | … | |
| 755 | 755 | msg_Dbg( p_demux, " - display=%d", event->display ); |
|---|
| 756 | 756 | msg_Dbg( p_demux, " - buttonN=%d", event->buttonN ); |
|---|
| 757 | | ButtonUpdate( p_demux ); |
|---|
| | 757 | ButtonUpdate( p_demux, 0 ); |
|---|
| 758 | 758 | break; |
|---|
| 759 | 759 | } |
|---|
| … | … | |
| 880 | 880 | * Update functions: |
|---|
| 881 | 881 | *****************************************************************************/ |
|---|
| 882 | | static void ButtonUpdate( demux_t *p_demux ) |
|---|
| | 882 | static void ButtonUpdate( demux_t *p_demux, vlc_bool_t b_mode ) |
|---|
| 883 | 883 | { |
|---|
| 884 | 884 | demux_sys_t *p_sys = p_demux->p_sys; |
|---|
| … | … | |
| 903 | 903 | if( i_button > 0 && i_title == 0 ) |
|---|
| 904 | 904 | { |
|---|
| | 905 | int i; |
|---|
| 905 | 906 | pci_t *pci = dvdnav_get_current_nav_pci( p_sys->dvdnav ); |
|---|
| 906 | 907 | |
|---|
| 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 | } |
|---|
| 914 | 921 | |
|---|
| 915 | 922 | vlc_mutex_lock( p_mutex ); |
|---|
| … | … | |
| 919 | 926 | val.i_int = hl.ey; var_Set( p_sys->p_input, "y-end", val ); |
|---|
| 920 | 927 | |
|---|
| 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 ); |
|---|
| 923 | 930 | |
|---|
| 924 | 931 | val.b_bool = VLC_TRUE; var_Set( p_sys->p_input, "highlight", val ); |
|---|
| … | … | |
| 947 | 954 | int32_t i_title, i_part; |
|---|
| 948 | 955 | |
|---|
| 949 | | ButtonUpdate( p_demux ); |
|---|
| | 956 | ButtonUpdate( p_demux, 0 ); |
|---|
| 950 | 957 | |
|---|
| 951 | 958 | dvdnav_current_title_info( p_sys->dvdnav, &i_title, &i_part ); |
|---|
| … | … | |
| 1161 | 1168 | tk->b_seen = VLC_TRUE; |
|---|
| 1162 | 1169 | |
|---|
| 1163 | | if( tk->fmt.i_cat == VIDEO_ES ) ButtonUpdate( p_demux ); |
|---|
| | 1170 | if( tk->fmt.i_cat == VIDEO_ES ) ButtonUpdate( p_demux, 0 ); |
|---|
| 1164 | 1171 | } |
|---|
| 1165 | 1172 | |
|---|
| … | … | |
| 1228 | 1235 | b_activated = VLC_TRUE; |
|---|
| 1229 | 1236 | dvdnav_button_activate( p_sys->dvdnav, pci ); |
|---|
| | 1237 | ButtonUpdate( p_ev->p_demux, VLC_TRUE ); |
|---|
| 1230 | 1238 | break; |
|---|
| 1231 | 1239 | default: |
|---|
| … | … | |
| 1256 | 1264 | dvdnav_mouse_activate( p_sys->dvdnav, pci, valx.i_int, |
|---|
| 1257 | 1265 | valy.i_int ); |
|---|
| | 1266 | ButtonUpdate( p_ev->p_demux, VLC_TRUE ); |
|---|
| 1258 | 1267 | } |
|---|
| 1259 | 1268 | |
|---|
| r477ffed |
r15006f7 |
|
| 600 | 600 | |
|---|
| 601 | 601 | /* 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') == |
|---|
| 603 | 603 | p_region->fmt.i_chroma ) |
|---|
| 604 | 604 | { |
|---|
| 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 ); |
|---|
| 609 | 607 | } |
|---|
| 610 | 608 | |
|---|
| … | … | |
| 965 | 963 | vlc_value_t val; |
|---|
| 966 | 964 | |
|---|
| 967 | | p_spu->b_force_alpha = VLC_FALSE; |
|---|
| | 965 | p_spu->b_force_palette = VLC_FALSE; |
|---|
| 968 | 966 | p_spu->b_force_crop = VLC_FALSE; |
|---|
| 969 | 967 | |
|---|
| … | … | |
| 980 | 978 | p_spu->i_crop_height = val.i_int - p_spu->i_crop_y; |
|---|
| 981 | 979 | |
|---|
| 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", |
|---|
| 1006 | 987 | 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 ); |
|---|
| 1008 | 990 | } |
|---|
| 1009 | 991 | |
|---|