Changeset e67e5e4988eee2f83a0420b89debac5557caed43
- 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
| rd64fe89 |
re67e5e4 |
|
| 45 | 45 | #include "vlc_bits.h" |
|---|
| 46 | 46 | #include "vlc_codec.h" |
|---|
| | 47 | #include "vlc_image.h" |
|---|
| 47 | 48 | |
|---|
| 48 | 49 | typedef enum { |
|---|
| … | … | |
| 77 | 78 | #define OPAQUE_LONGTEXT N_("Setting vbi-opaque to false " \ |
|---|
| 78 | 79 | "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 | |
|---|
| | 87 | static int pi_pos_values[] = { 0, 1, 2, 4, 8, 5, 6, 9, 10 }; |
|---|
| | 88 | static 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") }; |
|---|
| 79 | 91 | |
|---|
| 80 | 92 | vlc_module_begin(); |
|---|
| … | … | |
| 90 | 102 | add_bool( "vbi-opaque", VLC_TRUE, NULL, |
|---|
| 91 | 103 | 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 ); |
|---|
| 92 | 106 | vlc_module_end(); |
|---|
| 93 | 107 | |
|---|
| … | … | |
| 98 | 112 | struct decoder_sys_t |
|---|
| 99 | 113 | { |
|---|
| 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; |
|---|
| 106 | 123 | }; |
|---|
| 107 | 124 | |
|---|
| … | … | |
| 111 | 128 | static int Opaque( vlc_object_t *p_this, char const *psz_cmd, |
|---|
| 112 | 129 | vlc_value_t oldval, vlc_value_t newval, void *p_data ); |
|---|
| | 130 | static int Position( vlc_object_t *p_this, char const *psz_cmd, |
|---|
| | 131 | vlc_value_t oldval, vlc_value_t newval, void *p_data ); |
|---|
| 113 | 132 | |
|---|
| 114 | 133 | /***************************************************************************** |
|---|
| … | … | |
| 160 | 179 | p_sys->b_opaque = var_CreateGetBool( p_dec, "vbi-opaque" ); |
|---|
| 161 | 180 | 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 | |
|---|
| 162 | 185 | return VLC_SUCCESS; |
|---|
| 163 | 186 | } |
|---|
| … | … | |
| 171 | 194 | decoder_sys_t *p_sys = p_dec->p_sys; |
|---|
| 172 | 195 | |
|---|
| 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 ); |
|---|
| 177 | 198 | free( p_sys ); |
|---|
| 178 | 199 | } |
|---|
| … | … | |
| 191 | 212 | vlc_bool_t b_cached = VLC_FALSE; |
|---|
| 192 | 213 | vbi_page p_page; |
|---|
| 193 | | uint8_t *p_pos; |
|---|
| | 214 | const uint8_t *p_pos; |
|---|
| 194 | 215 | unsigned int i_left; |
|---|
| 195 | 216 | |
|---|
| … | … | |
| 197 | 218 | uint32_t *p_begin, *p_end; |
|---|
| 198 | 219 | unsigned int x = 0, y = 0; |
|---|
| 199 | | vbi_opacity opacity; |
|---|
| | 220 | vbi_opacity opacity; |
|---|
| 200 | 221 | /* end part of kludge */ |
|---|
| 201 | 222 | |
|---|
| … | … | |
| 267 | 288 | p_spu->p_region->i_x = 0; |
|---|
| 268 | 289 | p_spu->p_region->i_y = 0; |
|---|
| | 290 | p_spu->p_region->i_align = SUBPICTURE_ALIGN_TOP; |
|---|
| 269 | 291 | |
|---|
| 270 | 292 | /* Normal text subs, easy markup */ |
|---|
| … | … | |
| 272 | 294 | |
|---|
| 273 | 295 | p_spu->i_start = p_block->i_pts; |
|---|
| 274 | | p_spu->i_stop = 0; |
|---|
| | 296 | p_spu->i_stop = (mtime_t) 0; |
|---|
| 275 | 297 | p_spu->b_ephemer = VLC_TRUE; |
|---|
| 276 | 298 | p_spu->b_absolute = VLC_FALSE; |
|---|
| … | … | |
| 350 | 372 | } |
|---|
| 351 | 373 | |
|---|
| 352 | | static void event_handler( vbi_event *ev, void *user_data) |
|---|
| | 374 | static void event_handler( vbi_event *ev, void *user_data ) |
|---|
| 353 | 375 | { |
|---|
| 354 | 376 | decoder_t *p_dec = (decoder_t *)user_data; |
|---|
| … | … | |
| 399 | 421 | return VLC_SUCCESS; |
|---|
| 400 | 422 | } |
|---|
| | 423 | |
|---|
| | 424 | static 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 | } |
|---|