Changeset e259db6fefa6941b1a9cc2c01de8536c53b3ec01
- Timestamp:
- 06/04/08 13:14:12 (3 months ago)
- git-parent:
- Files:
-
- include/vlc_osd.h (modified) (1 diff)
- src/misc/filter_chain.c (modified) (1 diff)
- src/video_output/vout_subpictures.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
include/vlc_osd.h
r9d85c35 re259db6 78 78 79 79 /* Supciture filters */ 80 filter_t *pp_filter[10]; 81 int i_filter; 80 filter_chain_t *p_chain; 82 81 }; 83 82 src/misc/filter_chain.c
r57d88c8 re259db6 306 306 } 307 307 308 #include <vlc_osd.h> 309 308 310 void filter_chain_SubFilter( filter_chain_t *p_chain, 309 311 mtime_t display_date ) src/video_output/vout_subpictures.c
rd666030 re259db6 59 59 vlc_value_t, vlc_value_t, void * ); 60 60 61 static int sub_filter_allocation_init( filter_t *, void * ); 62 static void sub_filter_allocation_clear( filter_t * ); 61 63 struct filter_owner_sys_t 62 64 { … … 70 72 SCALE_SIZE 71 73 }; 74 72 75 /** 73 76 * Creates the subpicture unit … … 89 92 p_spu->p_text = NULL; 90 93 p_spu->p_scale = NULL; 91 p_spu->i_filter = 0;92 94 p_spu->pf_control = spu_vaControlDefault; 93 95 … … 99 101 vlc_object_attach( p_spu, p_this ); 100 102 103 p_spu->p_chain = filter_chain_New( p_spu, "sub filter", false, 104 sub_filter_allocation_init, 105 sub_filter_allocation_clear, 106 p_spu ); 101 107 return p_spu; 102 108 } … … 126 132 int spu_ParseChain( spu_t *p_spu ) 127 133 { 128 char *psz_parser; 129 vlc_value_t val; 130 var_Get( p_spu, "sub-filter", &val ); 131 psz_parser = val.psz_string; 132 133 while( psz_parser && *psz_parser ) 134 { 135 config_chain_t *p_cfg; 136 char *psz_name; 137 138 psz_parser = config_ChainCreate( &psz_name, &p_cfg, psz_parser ); 139 140 msg_Dbg( p_spu, "adding sub-filter: %s", psz_name ); 141 142 p_spu->pp_filter[p_spu->i_filter] = 143 vlc_object_create( p_spu, VLC_OBJECT_FILTER ); 144 vlc_object_attach( p_spu->pp_filter[p_spu->i_filter], p_spu ); 145 p_spu->pp_filter[p_spu->i_filter]->pf_sub_buffer_new = sub_new_buffer; 146 p_spu->pp_filter[p_spu->i_filter]->pf_sub_buffer_del = sub_del_buffer; 147 p_spu->pp_filter[p_spu->i_filter]->p_cfg = p_cfg; 148 p_spu->pp_filter[p_spu->i_filter]->p_module = 149 module_Need( p_spu->pp_filter[p_spu->i_filter], 150 "sub filter", psz_name, true ); 151 free( psz_name ); 152 153 if( p_spu->pp_filter[p_spu->i_filter]->p_module ) 154 { 155 filter_owner_sys_t *p_sys = malloc( sizeof(filter_owner_sys_t) ); 156 if( p_sys ) 157 { 158 p_spu->pp_filter[p_spu->i_filter]->p_owner = p_sys; 159 spu_Control( p_spu, SPU_CHANNEL_REGISTER, &p_sys->i_channel ); 160 p_sys->p_spu = p_spu; 161 p_spu->i_filter++; 162 } 163 } 164 else 165 { 166 msg_Dbg( p_spu, "no sub filter found" ); 167 config_ChainDestroy( p_spu->pp_filter[p_spu->i_filter]->p_cfg ); 168 vlc_object_detach( p_spu->pp_filter[p_spu->i_filter] ); 169 vlc_object_release( p_spu->pp_filter[p_spu->i_filter] ); 170 } 171 172 if( p_spu->i_filter >= 10 ) 173 { 174 msg_Dbg( p_spu, "can't add anymore filters" ); 175 break; 176 } 177 178 } 179 free( val.psz_string ); 180 134 char *psz_parser = var_GetString( p_spu, "sub-filter" ); 135 if( filter_chain_AppendFromString( p_spu->p_chain, psz_parser ) < 0 ) 136 { 137 free( psz_parser ); 138 return VLC_EGENERIC; 139 } 140 141 free( psz_parser ); 181 142 return VLC_SUCCESS; 182 143 } … … 237 198 static void spu_DeleteChain( spu_t *p_spu ) 238 199 { 239 if( p_spu->i_filter ) 240 while( p_spu->i_filter ) 241 { 242 p_spu->i_filter--; 243 module_Unneed( p_spu->pp_filter[p_spu->i_filter], 244 p_spu->pp_filter[p_spu->i_filter]->p_module ); 245 free( p_spu->pp_filter[p_spu->i_filter]->p_owner ); 246 config_ChainDestroy( p_spu->pp_filter[p_spu->i_filter]->p_cfg ); 247 vlc_object_detach( p_spu->pp_filter[p_spu->i_filter] ); 248 vlc_object_release( p_spu->pp_filter[p_spu->i_filter] ); 249 } 200 filter_chain_Delete( p_spu->p_chain ); 250 201 } 251 202 … … 1117 1068 1118 1069 /* Run subpicture filters */ 1119 for( i_index = 0; i_index < p_spu->i_filter; i_index++ ) 1120 { 1121 subpicture_t *p_subpic_filter; 1122 p_subpic_filter = p_spu->pp_filter[i_index]-> 1123 pf_sub_filter( p_spu->pp_filter[i_index], display_date ); 1124 if( p_subpic_filter ) 1125 { 1126 spu_DisplaySubpicture( p_spu, p_subpic_filter ); 1127 } 1128 } 1070 filter_chain_SubFilter( p_spu->p_chain, display_date ); 1129 1071 1130 1072 /* We get an easily parsable chained list of subpictures which … … 1409 1351 return VLC_SUCCESS; 1410 1352 } 1353 1354 static int sub_filter_allocation_init( filter_t *p_filter, void *p_data ) 1355 { 1356 spu_t *p_spu = (spu_t *)p_data; 1357 1358 p_filter->pf_sub_buffer_new = sub_new_buffer; 1359 p_filter->pf_sub_buffer_del = sub_del_buffer; 1360 1361 filter_owner_sys_t *p_sys = malloc( sizeof(filter_owner_sys_t) ); 1362 if( !p_sys ) return VLC_EGENERIC; 1363 1364 p_filter->p_owner = p_sys; 1365 spu_Control( p_spu, SPU_CHANNEL_REGISTER, &p_sys->i_channel ); 1366 p_sys->p_spu = p_spu; 1367 1368 return VLC_SUCCESS; 1369 } 1370 1371 static void sub_filter_allocation_clear( filter_t *p_filter ) 1372 { 1373 free( p_filter->p_owner ); 1374 }
