Mercurial > mplayer.hg
comparison Gui/interface.c @ 7009:98bed9e12087
- add dxr3 gui support (dialogbox, etc.)
- fix one small dvd playing bug ( dvd playing don't del the playlist)
- add some ifdef() check
author | pontscho |
---|---|
date | Wed, 14 Aug 2002 23:02:45 +0000 |
parents | 163f78ece9c2 |
children | e37a67d5e117 |
comparison
equal
deleted
inserted
replaced
7008:2af81c9ed167 | 7009:98bed9e12087 |
---|---|
141 wsXInit( (void *)mDisplay ); | 141 wsXInit( (void *)mDisplay ); |
142 | 142 |
143 cfg_read(); | 143 cfg_read(); |
144 appInit( (void*)mDisplay ); | 144 appInit( (void*)mDisplay ); |
145 | 145 |
146 if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name ); | 146 if ( plCurrent && !filename ) mplSetFileName( plCurrent->path,plCurrent->name,STREAMTYPE_FILE ); |
147 if ( sub_delay != 0.0f ) gtkSubDelay=sub_delay; | 147 if ( sub_delay != 0.0f ) gtkSubDelay=sub_delay; |
148 if ( sub_name ) guiSetFilename( guiIntfStruct.Subtitlename,sub_name ); | 148 if ( sub_name ) guiSetFilename( guiIntfStruct.Subtitlename,sub_name ); |
149 #if defined( USE_OSD ) || defined( USE_SUB ) | 149 #if defined( USE_OSD ) || defined( USE_SUB ) |
150 guiLoadFont(); | 150 guiLoadFont(); |
151 #endif | 151 #endif |
235 } | 235 } |
236 } | 236 } |
237 } | 237 } |
238 #endif | 238 #endif |
239 | 239 |
240 void guiGetEvent( int type,char * arg ) | 240 static void add_vop( char * str ) |
241 { | |
242 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[gui] add video filter: %s\n",str ); | |
243 if ( vo_plugin_args ) | |
244 { | |
245 int i = 0; | |
246 while ( vo_plugin_args[i] ) if ( !gstrcmp( vo_plugin_args[i++],str ) ) { i=-1; break; } | |
247 if ( i != -1 ) | |
248 { vo_plugin_args=realloc( vo_plugin_args,( i + 2 ) * sizeof( char * ) ); vo_plugin_args[i]=strdup( str ); vo_plugin_args[i+1]=NULL; } | |
249 } else { vo_plugin_args=malloc( 2 * sizeof( char * ) ); vo_plugin_args[0]=strdup( str ); vo_plugin_args[1]=NULL; } | |
250 } | |
251 | |
252 static void remove_vop( char * str ) | |
253 { | |
254 int n = 0; | |
255 | |
256 if ( !vo_plugin_args ) return; | |
257 | |
258 mp_msg( MSGT_GPLAYER,MSGL_STATUS,"[gui] remove video filter: %s\n",str ); | |
259 | |
260 while ( vo_plugin_args[n++] ); n--; | |
261 if ( n > -1 ) | |
262 { | |
263 int i = 0,m = -1; | |
264 while ( vo_plugin_args[i] ) if ( !gstrcmp( vo_plugin_args[i++],str ) ) { m=i - 1; break; } | |
265 i--; | |
266 if ( m > -1 ) | |
267 { | |
268 if ( n == 1 ) { free( vo_plugin_args[0] ); free( vo_plugin_args ); vo_plugin_args=NULL; } | |
269 else memcpy( &vo_plugin_args[i],&vo_plugin_args[i + 1],( n - i ) * sizeof( char * ) ); | |
270 } | |
271 } | |
272 } | |
273 | |
274 int guiGetEvent( int type,char * arg ) | |
241 { | 275 { |
242 stream_t * stream = (stream_t *) arg; | 276 stream_t * stream = (stream_t *) arg; |
243 #ifdef USE_DVDREAD | 277 #ifdef USE_DVDREAD |
244 dvd_priv_t * dvdp = (dvd_priv_t *) arg; | 278 dvd_priv_t * dvdp = (dvd_priv_t *) arg; |
245 #endif | 279 #endif |
264 case guiSetFileName: | 298 case guiSetFileName: |
265 if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg ); | 299 if ( arg ) guiSetFilename( guiIntfStruct.Filename,arg ); |
266 break; | 300 break; |
267 case guiSetAudioOnly: | 301 case guiSetAudioOnly: |
268 guiIntfStruct.AudioOnly=(int)arg; | 302 guiIntfStruct.AudioOnly=(int)arg; |
269 if ( (int)arg ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); | 303 if ( (int)arg ) { guiIntfStruct.NoWindow=True; wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); } |
270 else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); | 304 else wsVisibleWindow( &appMPlayer.subWindow,wsShowWindow ); |
271 break; | 305 break; |
272 case guiReDrawSubWindow: | 306 case guiReDrawSubWindow: |
273 wsPostRedisplay( &appMPlayer.subWindow ); | 307 wsPostRedisplay( &appMPlayer.subWindow ); |
274 break; | 308 break; |
349 else guiIntfStruct.Balance=50.0f; | 383 else guiIntfStruct.Balance=50.0f; |
350 btnModify( evSetVolume,guiIntfStruct.Volume ); | 384 btnModify( evSetVolume,guiIntfStruct.Volume ); |
351 btnModify( evSetBalance,guiIntfStruct.Balance ); | 385 btnModify( evSetBalance,guiIntfStruct.Balance ); |
352 } | 386 } |
353 break; | 387 break; |
388 case guiSetFileFormat: | |
389 guiIntfStruct.FileFormat=(int)arg; | |
390 break; | |
354 case guiSetValues: | 391 case guiSetValues: |
355 // -- video | 392 // -- video |
356 if ( arg ) | 393 if ( arg ) |
357 { | 394 { |
358 if ( vo_gamma_brightness == 1000 ) | 395 if ( vo_gamma_brightness == 1000 ) |
362 if ( vo_gamma_hue == 1000 ) | 399 if ( vo_gamma_hue == 1000 ) |
363 { vo_gamma_hue=0; get_video_colors( (void *)arg,"hue",&vo_gamma_hue ); } | 400 { vo_gamma_hue=0; get_video_colors( (void *)arg,"hue",&vo_gamma_hue ); } |
364 if ( vo_gamma_saturation == 1000 ) | 401 if ( vo_gamma_saturation == 1000 ) |
365 { vo_gamma_saturation=0; get_video_colors( (void *)arg,"saturation",&vo_gamma_saturation ); } | 402 { vo_gamma_saturation=0; get_video_colors( (void *)arg,"saturation",&vo_gamma_saturation ); } |
366 } | 403 } |
404 | |
405 if ( guiIntfStruct.NoWindow ) wsVisibleWindow( &appMPlayer.subWindow,wsHideWindow ); | |
406 | |
367 // -- audio | 407 // -- audio |
368 if ( audio_out ) | 408 if ( audio_out ) |
369 { | 409 { |
370 float l,r; | 410 float l,r; |
371 mixer_getvolume( &l,&r ); | 411 mixer_getvolume( &l,&r ); |
396 gtkSubFPS=sub_fps; | 436 gtkSubFPS=sub_fps; |
397 gtkSubPos=sub_pos; | 437 gtkSubPos=sub_pos; |
398 #ifdef USE_OSD | 438 #ifdef USE_OSD |
399 gtkSubFFactor=font_factor; | 439 gtkSubFFactor=font_factor; |
400 #endif | 440 #endif |
441 #ifdef HAVE_DXR3 | |
442 if ( !gstrcmp( gtkVODriver,"dxr3" ) && guiIntfStruct.FileFormat != DEMUXER_TYPE_MPEG_PS && !gtkVopLAVC && !gtkVopFAME ) | |
443 { | |
444 gtkMessageBox( GTK_MB_FATAL,MSGTR_NEEDLAVCFAME ); | |
445 guiIntfStruct.Playing=0; | |
446 return True; | |
447 } | |
448 #endif | |
401 break; | 449 break; |
402 case guiSetDefaults: | 450 case guiSetDefaults: |
403 if ( filename && !guiIntfStruct.Filename ) | 451 if ( filename && !guiIntfStruct.Filename ) |
404 { | 452 { |
405 gtkSet( gtkDelPl,0,NULL ); guiIntfStruct.StreamType=STREAMTYPE_FILE; | 453 gtkSet( gtkDelPl,0,NULL ); guiIntfStruct.StreamType=STREAMTYPE_FILE; |
406 guiSetFilename( guiIntfStruct.Filename,filename ); | 454 guiSetFilename( guiIntfStruct.Filename,filename ); |
407 } | 455 } |
408 | 456 |
409 guiIntfStruct.DiskChanged=0; | 457 guiIntfStruct.DiskChanged=0; |
410 | 458 |
411 // --- video opts | 459 // --- video opts |
412 if ( !gtkVODriver ) | 460 if ( !gtkVODriver ) |
413 { | 461 { |
414 int i = 0; | 462 int i = 0; |
415 if ( video_driver && !gtkVODriver ) | 463 if ( video_driver && !gtkVODriver ) |
416 { | 464 { |
431 } | 479 } |
432 } | 480 } |
433 | 481 |
434 if ( gtkVODriver ) { gfree( (void **)&video_driver ); video_driver=gstrdup( gtkVODriver ); } | 482 if ( gtkVODriver ) { gfree( (void **)&video_driver ); video_driver=gstrdup( gtkVODriver ); } |
435 else { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); } | 483 else { gtkMessageBox( GTK_MB_FATAL,MSGTR_IDFGCVD ); exit_player( "gui init" ); } |
436 | 484 |
437 if ( gtkVPP ) | 485 { |
438 { | 486 int i = 0; |
439 if ( vo_plugin_args ) | 487 guiIntfStruct.NoWindow=False; |
488 while ( video_out_drivers[i++] ) | |
489 if ( video_out_drivers[i - 1]->control( VOCTRL_GUISUPPORT,NULL ) == VO_TRUE ) | |
440 { | 490 { |
441 int i = 0; | 491 const vo_info_t *info = video_out_drivers[i - 1]->get_info(); |
442 while ( vo_plugin_args[i] ) if ( !gstrcmp( vo_plugin_args[i++],"pp" ) ) { i=-1; break; } | 492 if ( ( !gstrcmp( gtkVODriver,(char *)info->short_name ) )&&( video_out_drivers[i - 1]->control( VOCTRL_GUI_NOWINDOW,NULL ) == VO_TRUE ) ) |
443 if ( i != -1 ) | 493 { guiIntfStruct.NoWindow=True; break; } |
444 { vo_plugin_args=realloc( vo_plugin_args,( i + 2 ) * sizeof( char * ) ); vo_plugin_args[i]=strdup( "pp" ); vo_plugin_args[i+1]=NULL; } | 494 } |
445 } else { vo_plugin_args=malloc( 2 * sizeof( char * ) ); vo_plugin_args[0]=strdup( "pp" ); vo_plugin_args[1]=NULL; } | 495 } |
446 auto_quality=gtkVAutoq; | 496 |
447 } | 497 #ifdef HAVE_DXR3 |
448 else | 498 remove_vop( "lavc" ); |
449 if ( vo_plugin_args ) | 499 remove_vop( "fame" ); |
500 if ( !gstrcmp( gtkVODriver,"dxr3" ) ) | |
501 { | |
502 #warning workaround for this moment. | |
503 osd_level=0; | |
504 // --- | |
505 if ( ( guiIntfStruct.StreamType != STREAMTYPE_DVD)&&( guiIntfStruct.StreamType != STREAMTYPE_VCD ) ) | |
450 { | 506 { |
451 int n = 0; | 507 if ( gtkVopLAVC ) add_vop( "lavc" ); |
452 while ( vo_plugin_args[n++] ); n--; | 508 if ( gtkVopFAME ) add_vop( "fame" ); |
453 if ( n > -1 ) | |
454 { | |
455 int i = 0; | |
456 while ( vo_plugin_args[i] ) if ( !gstrcmp( vo_plugin_args[i++],"pp" ) ) break; i--; | |
457 if ( n == i ) | |
458 { | |
459 if ( n == 1 ) { free( vo_plugin_args[0] ); free( vo_plugin_args ); vo_plugin_args=NULL; } | |
460 else memcpy( &vo_plugin_args[i],&vo_plugin_args[i+1],( n - i ) * sizeof( char * ) ); | |
461 } | |
462 } | |
463 auto_quality=0; | |
464 } | 509 } |
510 } | |
511 #endif | |
512 // --- | |
513 if ( gtkVopPP ) { add_vop( "pp" ); auto_quality=gtkVAutoq; } | |
514 else { remove_vop( "pp" ); auto_quality=0; } | |
515 | |
465 vo_doublebuffering=gtkVODoubleBuffer; | 516 vo_doublebuffering=gtkVODoubleBuffer; |
466 vo_directrendering=gtkVODirectRendering; | 517 vo_directrendering=gtkVODirectRendering; |
467 frame_dropping=gtkVFrameDrop; | 518 frame_dropping=gtkVFrameDrop; |
468 if ( gtkVHardFrameDrop ) frame_dropping=gtkVHardFrameDrop; | 519 if ( gtkVHardFrameDrop ) frame_dropping=gtkVHardFrameDrop; |
469 flip=gtkVFlip; | 520 flip=gtkVFlip; |
514 else if ( guiIntfStruct.FilenameChanged ) audio_stream=NULL; | 565 else if ( guiIntfStruct.FilenameChanged ) audio_stream=NULL; |
515 index_mode=gtkVIndex; | 566 index_mode=gtkVIndex; |
516 | 567 |
517 break; | 568 break; |
518 } | 569 } |
570 return False; | |
519 } | 571 } |
520 | 572 |
521 extern unsigned int GetTimerMS( void ); | 573 extern unsigned int GetTimerMS( void ); |
522 extern int mplTimer; | 574 extern int mplTimer; |
523 | 575 |
524 void guiEventHandling( void ) | 576 void guiEventHandling( void ) |
525 { | 577 { |
526 if ( !guiIntfStruct.Playing || guiIntfStruct.AudioOnly ) wsHandleEvents(); | 578 if ( !guiIntfStruct.Playing || guiIntfStruct.NoWindow ) wsHandleEvents(); |
527 gtkEventHandling(); | 579 gtkEventHandling(); |
528 mplTimer=GetTimerMS() / 20; | 580 mplTimer=GetTimerMS() / 20; |
529 } | 581 } |
530 | 582 |
531 // --- | 583 // --- |
642 guiLoadFont(); | 694 guiLoadFont(); |
643 return NULL; | 695 return NULL; |
644 #endif | 696 #endif |
645 // --- misc | 697 // --- misc |
646 case gtkClearStruct: | 698 case gtkClearStruct: |
647 if ( (unsigned int)fparam & guiFilenames ) | 699 if ( (unsigned int)vparam & guiFilenames ) |
648 { | 700 { |
649 gfree( (void **)&guiIntfStruct.Filename ); | 701 gfree( (void **)&guiIntfStruct.Filename ); |
650 gfree( (void **)&guiIntfStruct.Subtitlename ); | 702 gfree( (void **)&guiIntfStruct.Subtitlename ); |
651 gfree( (void **)&guiIntfStruct.AudioFile ); | 703 gfree( (void **)&guiIntfStruct.AudioFile ); |
704 gtkSet( gtkDelPl,0,NULL ); | |
652 } | 705 } |
653 #ifdef USE_DVDREAD | 706 #ifdef USE_DVDREAD |
654 if ( (unsigned int)fparam & guiDVD ) memset( &guiIntfStruct.DVD,0,sizeof( guiDVDStruct ) ); | 707 if ( (unsigned int)vparam & guiDVD ) memset( &guiIntfStruct.DVD,0,sizeof( guiDVDStruct ) ); |
655 #endif | 708 #endif |
656 #ifdef HAVE_VCD | 709 #ifdef HAVE_VCD |
657 if ( (unsigned int)fparam & guiVCD ) guiIntfStruct.VCDTracks=0; | 710 if ( (unsigned int)vparam & guiVCD ) guiIntfStruct.VCDTracks=0; |
658 #endif | 711 #endif |
659 return NULL; | 712 return NULL; |
660 case gtkSetExtraStereo: | 713 case gtkSetExtraStereo: |
661 gtkAOExtraStereoMul=fparam; | 714 gtkAOExtraStereoMul=fparam; |
662 audio_plugin_extrastereo.control( AOCONTROL_PLUGIN_ES_SET,(int)>kAOExtraStereoMul ); | 715 audio_plugin_extrastereo.control( AOCONTROL_PLUGIN_ES_SET,(int)>kAOExtraStereoMul ); |