Changeset 4684a91eafdc7a56414208681294ecccaac9b83c
- Timestamp:
- 24/07/03 00:01:25 (5 years ago)
- git-parent:
- Files:
-
- include/variables.h (modified) (2 diffs)
- src/input/input.c (modified) (3 diffs)
- src/input/input_programs.c (modified) (4 diffs)
- src/misc/variables.c (modified) (5 diffs)
- src/video_output/video_output.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
include/variables.h
r66815e2 r4684a91 3 3 ***************************************************************************** 4 4 * Copyright (C) 2002 VideoLAN 5 * $Id: variables.h,v 1.1 4 2003/05/24 23:40:11gbazin Exp $5 * $Id: variables.h,v 1.15 2003/07/23 22:01:25 gbazin Exp $ 6 6 * 7 7 * Authors: Samuel Hocevar <sam@zoy.org> … … 97 97 #define VLC_VAR_ISCONFIG 0x2000 98 98 99 /* Creation flag */ 100 #define VLC_VAR_DOINHERIT 0x8000 101 99 102 /***************************************************************************** 100 103 * Variable actions src/input/input.c
reb505a2 r4684a91 5 5 ***************************************************************************** 6 6 * Copyright (C) 1998-2002 VideoLAN 7 * $Id: input.c,v 1.23 4 2003/07/23 01:13:48gbazin Exp $7 * $Id: input.c,v 1.235 2003/07/23 22:01:25 gbazin Exp $ 8 8 * 9 9 * Authors: Christophe Massiot <massiot@via.ecp.fr> … … 87 87 } 88 88 89 /* Create a few object variables we'll need later */ 90 if( !var_Type( p_input, "sout" ) ) 91 { 92 var_Create( p_input, "sout", VLC_VAR_STRING ); 93 var_Change( p_input, "sout", VLC_VAR_INHERITVALUE, NULL, NULL ); 94 } 95 if( !var_Type( p_input, "sout-audio" ) ) 96 { 97 var_Create( p_input, "sout-audio", VLC_VAR_BOOL ); 98 var_Change( p_input, "sout-audio", VLC_VAR_INHERITVALUE, NULL, NULL ); 99 } 100 if( !var_Type( p_input, "sout-video" ) ) 101 { 102 var_Create( p_input, "sout-video", VLC_VAR_BOOL ); 103 var_Change( p_input, "sout-video", VLC_VAR_INHERITVALUE, NULL, NULL ); 104 } 89 /* Create a few object variables we'll need later on */ 90 var_Create( p_input, "video", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); 91 var_Create( p_input, "audio", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); 92 var_Create( p_input, "audio-channel", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT ); 93 var_Create( p_input, "spu-channel", VLC_VAR_INTEGER|VLC_VAR_DOINHERIT ); 94 95 var_Create( p_input, "sout", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); 96 var_Create( p_input, "sout-audio", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); 97 var_Create( p_input, "sout-video", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); 105 98 106 99 /* Initialize thread properties */ … … 548 541 /* Initialize optional stream output. */ 549 542 var_Get( p_input, "sout", &val ); 550 if ( val.psz_string != NULL )543 if( val.psz_string != NULL ) 551 544 { 552 545 if ( *val.psz_string && (p_input->stream.p_sout = src/input/input_programs.c
r3f65460 r4684a91 3 3 ***************************************************************************** 4 4 * Copyright (C) 1999-2002 VideoLAN 5 * $Id: input_programs.c,v 1.11 4 2003/05/18 23:16:57 fenrirExp $5 * $Id: input_programs.c,v 1.115 2003/07/23 22:01:25 gbazin Exp $ 6 6 * 7 7 * Authors: Christophe Massiot <massiot@via.ecp.fr> … … 428 428 } 429 429 } 430 430 431 /* Get the number of the required audio stream */ 431 if( config_GetInt( p_input, "audio" ) ) 432 var_Get( p_input, "audio", &val ); 433 if( val.b_bool ) 432 434 { 433 435 /* Default is the first one */ 434 i_required_audio_es = config_GetInt( p_input, "audio-channel" ); 436 var_Get( p_input, "audio-channel", &val ); 437 i_required_audio_es = val.i_int; 435 438 if( i_required_audio_es < 0 ) 436 439 { … … 444 447 445 448 /* Same thing for subtitles */ 446 if( config_GetInt( p_input, "video" ) ) 449 var_Get( p_input, "video", &val ); 450 if( val.b_bool ) 447 451 { 448 452 /* for spu, default is none */ 449 i_required_spu_es = config_GetInt( p_input, "spu-channel" ); 453 var_Get( p_input, "spu-channel", &val ); 454 i_required_spu_es = val.i_int; 450 455 if( i_required_spu_es < 0 ) 451 456 { … … 822 827 } 823 828 824 if( ((p_es->i_cat == VIDEO_ES) || (p_es->i_cat == SPU_ES)) 825 && !config_GetInt( p_input, "video" ) ) 826 { 827 msg_Dbg( p_input, 828 "video is disabled, not selecting ES 0x%x", p_es->i_id ); 829 return -1; 830 } 831 832 if( (p_es->i_cat == AUDIO_ES) && !config_GetInt( p_input, "audio" ) ) 833 { 834 msg_Dbg( p_input, 835 "audio is disabled, not selecting ES 0x%x", p_es->i_id ); 836 return -1; 829 if( p_es->i_cat == VIDEO_ES || p_es->i_cat == SPU_ES ) 830 { 831 var_Get( p_input, "video", &val ); 832 if( !val.b_bool ) 833 { 834 msg_Dbg( p_input, "video is disabled, not selecting ES 0x%x", 835 p_es->i_id ); 836 return -1; 837 } 838 } 839 840 if( p_es->i_cat == AUDIO_ES ) 841 { 842 var_Get( p_input, "audio", &val ); 843 if( !val.b_bool ) 844 { 845 msg_Dbg( p_input, "audio is disabled, not selecting ES 0x%x", 846 p_es->i_id ); 847 return -1; 848 } 837 849 } 838 850 src/misc/variables.c
r9a825a7 r4684a91 3 3 ***************************************************************************** 4 4 * Copyright (C) 2002 VideoLAN 5 * $Id: variables.c,v 1.2 7 2003/07/22 15:59:06gbazin Exp $5 * $Id: variables.c,v 1.28 2003/07/23 22:01:25 gbazin Exp $ 6 6 * 7 7 * Authors: Samuel Hocevar <sam@zoy.org> … … 160 160 { 161 161 /* If the types differ, variable creation failed. */ 162 if( i_type!= p_this->p_vars[i_new].i_type )162 if( (i_type & ~VLC_VAR_DOINHERIT) != p_this->p_vars[i_new].i_type ) 163 163 { 164 164 vlc_mutex_unlock( &p_this->var_lock ); … … 191 191 p_var->psz_text = NULL; 192 192 193 p_var->i_type = i_type ;193 p_var->i_type = i_type & ~VLC_VAR_DOINHERIT; 194 194 memset( &p_var->val, 0, sizeof(vlc_value_t) ); 195 195 … … 261 261 /* Duplicate the default data we stored. */ 262 262 p_var->pf_dup( &p_var->val ); 263 264 if( i_type & VLC_VAR_DOINHERIT ) 265 { 266 vlc_value_t val; 267 268 if( InheritValue( p_this, psz_name, &val, p_var->i_type ) 269 == VLC_SUCCESS ); 270 { 271 /* Free data if needed */ 272 p_var->pf_free( &p_var->val ); 273 /* Check boundaries and list */ 274 CheckValue( p_var, &val ); 275 /* Set the variable */ 276 p_var->val = val; 277 } 278 } 263 279 264 280 vlc_mutex_unlock( &p_this->var_lock ); … … 1143 1159 1144 1160 vlc_mutex_unlock( &p_this->p_parent->var_lock ); 1145 1146 1161 return VLC_SUCCESS; 1147 1162 } src/video_output/video_output.c
r14b3f0c r4684a91 6 6 ***************************************************************************** 7 7 * Copyright (C) 2000-2001 VideoLAN 8 * $Id: video_output.c,v 1.2 29 2003/07/14 21:32:59 sigmunauExp $8 * $Id: video_output.c,v 1.230 2003/07/23 22:01:25 gbazin Exp $ 9 9 * 10 10 * Authors: Vincent Seguin <seguin@via.ecp.fr> … … 217 217 } 218 218 219 var_Create( p_vout, "intf-change", VLC_VAR_BOOL );220 val.b_bool = VLC_TRUE;221 var_Set( p_vout, "intf-change", val );222 223 p_vout->b_override_aspect = VLC_FALSE;224 225 /* If the parent is not a VOUT object, that means we are at the start of226 * the video output pipe */227 if( p_parent->i_object_type != VLC_OBJECT_VOUT )228 {229 char *psz_aspect = config_GetPsz( p_parent, "aspect-ratio" );230 231 /* Check whether the user tried to override aspect ratio */232 if( psz_aspect )233 {234 unsigned int i_new_aspect = i_aspect;235 char *psz_parser = strchr( psz_aspect, ':' );236 237 if( psz_parser )238 {239 *psz_parser++ = '\0';240 i_new_aspect = atoi( psz_aspect ) * VOUT_ASPECT_FACTOR241 / atoi( psz_parser );242 }243 else244 {245 i_new_aspect = i_width * VOUT_ASPECT_FACTOR246 * atof( psz_aspect )247 / i_height;248 }249 250 free( psz_aspect );251 252 if( i_new_aspect && i_new_aspect != i_aspect )253 {254 int i_pgcd = ReduceHeight( i_new_aspect );255 256 msg_Dbg( p_vout, "overriding source aspect ratio to %i:%i",257 i_new_aspect / i_pgcd, VOUT_ASPECT_FACTOR / i_pgcd );258 259 i_aspect = i_new_aspect;260 261 p_vout->b_override_aspect = VLC_TRUE;262 }263 }264 265 /* Look for the default filter configuration */266 p_vout->psz_filter_chain = config_GetPsz( p_parent, "filter" );267 }268 else269 {270 /* continue the parent's filter chain */271 char *psz_end;272 273 psz_end = strchr( ((vout_thread_t *)p_parent)->psz_filter_chain, ':' );274 if( psz_end && *(psz_end+1) )275 p_vout->psz_filter_chain = strdup( psz_end+1 );276 else p_vout->psz_filter_chain = NULL;277 }278 279 /* Choose the video output module */280 if( !p_vout->psz_filter_chain || !*p_vout->psz_filter_chain )281 {282 psz_plugin = config_GetPsz( p_parent, "vout" );283 }284 else285 {286 /* the filter chain is a string list of filters separated by double287 * colons */288 char *psz_end;289 290 psz_end = strchr( p_vout->psz_filter_chain, ':' );291 if( psz_end )292 psz_plugin = strndup( p_vout->psz_filter_chain,293 psz_end - p_vout->psz_filter_chain );294 else psz_plugin = strdup( p_vout->psz_filter_chain );295 }296 297 219 /* Initialize pictures and subpictures - translation tables and functions 298 220 * will be initialized later in InitThread */ … … 359 281 var_Create( p_vout, "key-pressed", VLC_VAR_STRING ); 360 282 283 var_Create( p_vout, "intf-change", VLC_VAR_BOOL ); 284 val.b_bool = VLC_TRUE; 285 var_Set( p_vout, "intf-change", val ); 286 287 /* Initialize locks */ 288 vlc_mutex_init( p_vout, &p_vout->picture_lock ); 289 vlc_mutex_init( p_vout, &p_vout->subpicture_lock ); 290 vlc_mutex_init( p_vout, &p_vout->change_lock ); 291 292 /* Attach the new object now so we can use var inheritance below */ 293 vlc_object_attach( p_vout, p_parent ); 294 295 /* Create a few object variables we'll need later on */ 296 var_Create( p_vout, "aspect-ratio", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); 297 var_Create( p_vout, "width", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); 298 var_Create( p_vout, "height", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT ); 299 var_Create( p_vout, "zoom", VLC_VAR_FLOAT | VLC_VAR_DOINHERIT ); 300 301 p_vout->b_override_aspect = VLC_FALSE; 302 303 /* If the parent is not a VOUT object, that means we are at the start of 304 * the video output pipe */ 305 if( p_parent->i_object_type != VLC_OBJECT_VOUT ) 306 { 307 var_Get( p_vout, "aspect-ratio", &val ); 308 309 /* Check whether the user tried to override aspect ratio */ 310 if( val.psz_string ) 311 { 312 unsigned int i_new_aspect = i_aspect; 313 char *psz_parser = strchr( val.psz_string, ':' ); 314 315 if( psz_parser ) 316 { 317 *psz_parser++ = '\0'; 318 i_new_aspect = atoi( val.psz_string ) * VOUT_ASPECT_FACTOR 319 / atoi( psz_parser ); 320 } 321 else 322 { 323 i_new_aspect = i_width * VOUT_ASPECT_FACTOR 324 * atof( val.psz_string ) 325 / i_height; 326 } 327 328 free( val.psz_string ); 329 330 if( i_new_aspect && i_new_aspect != i_aspect ) 331 { 332 int i_pgcd = ReduceHeight( i_new_aspect ); 333 334 msg_Dbg( p_vout, "overriding source aspect ratio to %i:%i", 335 i_new_aspect / i_pgcd, VOUT_ASPECT_FACTOR / i_pgcd ); 336 337 p_vout->render.i_aspect = i_new_aspect; 338 339 p_vout->b_override_aspect = VLC_TRUE; 340 } 341 } 342 343 /* Look for the default filter configuration */ 344 var_Create( p_vout, "filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); 345 var_Get( p_vout, "filter", &val ); 346 p_vout->psz_filter_chain = val.psz_string; 347 } 348 else 349 { 350 /* continue the parent's filter chain */ 351 char *psz_end; 352 353 psz_end = strchr( ((vout_thread_t *)p_parent)->psz_filter_chain, ':' ); 354 if( psz_end && *(psz_end+1) ) 355 p_vout->psz_filter_chain = strdup( psz_end+1 ); 356 else p_vout->psz_filter_chain = NULL; 357 } 358 359 /* Choose the video output module */ 360 if( !p_vout->psz_filter_chain || !*p_vout->psz_filter_chain ) 361 { 362 var_Create( p_vout, "vout", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); 363 var_Get( p_vout, "vout", &val ); 364 psz_plugin = val.psz_string; 365 } 366 else 367 { 368 /* the filter chain is a string list of filters separated by double 369 * colons */ 370 char *psz_end; 371 372 psz_end = strchr( p_vout->psz_filter_chain, ':' ); 373 if( psz_end ) 374 psz_plugin = strndup( p_vout->psz_filter_chain, 375 psz_end - p_vout->psz_filter_chain ); 376 else psz_plugin = strdup( p_vout->psz_filter_chain ); 377 } 378 361 379 /* Initialize the dimensions of the video window */ 362 380 InitWindowSize( p_vout, &p_vout->i_window_width, 363 381 &p_vout->i_window_height ); 364 382 365 /* Create thread and set locks */ 366 vlc_mutex_init( p_vout, &p_vout->picture_lock ); 367 vlc_mutex_init( p_vout, &p_vout->subpicture_lock ); 368 vlc_mutex_init( p_vout, &p_vout->change_lock ); 369 370 vlc_object_attach( p_vout, p_parent ); 371 383 /* Create the vout thread */ 372 384 p_vout->p_module = module_Need( p_vout, 373 385 ( p_vout->psz_filter_chain && … … 1158 1170 int *pi_height ) 1159 1171 { 1172 vlc_value_t val; 1160 1173 int i_width, i_height; 1161 1174 uint64_t ll_zoom; … … 1163 1176 #define FP_FACTOR 1000 /* our fixed point factor */ 1164 1177 1165 i_width = config_GetInt( p_vout, "width" ); 1166 i_height = config_GetInt( p_vout, "height" ); 1167 ll_zoom = (uint64_t)( FP_FACTOR * config_GetFloat( p_vout, "zoom" ) ); 1178 var_Get( p_vout, "width", &val ); 1179 i_width = val.i_int; 1180 var_Get( p_vout, "height", &val ); 1181 i_height = val.i_int; 1182 var_Get( p_vout, "zoom", &val ); 1183 ll_zoom = (uint64_t)( FP_FACTOR * val.f_float ); 1168 1184 1169 1185 if( i_width > 0 && i_height > 0)
