comparison mplayer.c @ 27343:5fe6a8adf569

Rename two GUI-related preprocessor directives: HAVE_NEW_GUI --> CONFIG_GUI, HAVE_GTK2_GUI --> CONFIG_GTK2
author diego
date Wed, 30 Jul 2008 13:44:59 +0000
parents e7c989f7a7c9
children b597fd2924b4
comparison
equal deleted inserted replaced
27342:3a174cb28d36 27343:5fe6a8adf569
74 #include "osdep/getch2.h" 74 #include "osdep/getch2.h"
75 #include "osdep/timer.h" 75 #include "osdep/timer.h"
76 76
77 #include "cpudetect.h" 77 #include "cpudetect.h"
78 78
79 #ifdef HAVE_NEW_GUI 79 #ifdef CONFIG_GUI
80 #include "gui/interface.h" 80 #include "gui/interface.h"
81 #endif 81 #endif
82 82
83 #include "input/input.h" 83 #include "input/input.h"
84 84
222 222
223 float playback_speed=1.0; 223 float playback_speed=1.0;
224 224
225 int use_gui=0; 225 int use_gui=0;
226 226
227 #ifdef HAVE_NEW_GUI 227 #ifdef CONFIG_GUI
228 int enqueue=0; 228 int enqueue=0;
229 #endif 229 #endif
230 230
231 static int list_properties = 0; 231 static int list_properties = 0;
232 232
586 586
587 if(mask&INITIALIZED_ACODEC){ 587 if(mask&INITIALIZED_ACODEC){
588 initialized_flags&=~INITIALIZED_ACODEC; 588 initialized_flags&=~INITIALIZED_ACODEC;
589 current_module="uninit_acodec"; 589 current_module="uninit_acodec";
590 if(mpctx->sh_audio) uninit_audio(mpctx->sh_audio); 590 if(mpctx->sh_audio) uninit_audio(mpctx->sh_audio);
591 #ifdef HAVE_NEW_GUI 591 #ifdef CONFIG_GUI
592 if (use_gui) guiGetEvent(guiSetAfilter, (char *)NULL); 592 if (use_gui) guiGetEvent(guiSetAfilter, (char *)NULL);
593 #endif 593 #endif
594 mpctx->sh_audio=NULL; 594 mpctx->sh_audio=NULL;
595 mpctx->mixer.afilter = NULL; 595 mpctx->mixer.afilter = NULL;
596 } 596 }
661 current_module="uninit_ao"; 661 current_module="uninit_ao";
662 if (mpctx->edl_muted) mixer_mute(&mpctx->mixer); 662 if (mpctx->edl_muted) mixer_mute(&mpctx->mixer);
663 mpctx->audio_out->uninit(mpctx->eof?0:1); mpctx->audio_out=NULL; 663 mpctx->audio_out->uninit(mpctx->eof?0:1); mpctx->audio_out=NULL;
664 } 664 }
665 665
666 #ifdef HAVE_NEW_GUI 666 #ifdef CONFIG_GUI
667 if(mask&INITIALIZED_GUI){ 667 if(mask&INITIALIZED_GUI){
668 initialized_flags&=~INITIALIZED_GUI; 668 initialized_flags&=~INITIALIZED_GUI;
669 current_module="uninit_gui"; 669 current_module="uninit_gui";
670 guiDone(); 670 guiDone();
671 } 671 }
690 uninit_player(INITIALIZED_ALL); 690 uninit_player(INITIALIZED_ALL);
691 #ifdef WIN32 691 #ifdef WIN32
692 timeEndPeriod(1); 692 timeEndPeriod(1);
693 #endif 693 #endif
694 #ifdef HAVE_X11 694 #ifdef HAVE_X11
695 #ifdef HAVE_NEW_GUI 695 #ifdef CONFIG_GUI
696 if ( !use_gui ) 696 if ( !use_gui )
697 #endif 697 #endif
698 vo_uninit(); // Close the X11 connection (if any is open). 698 vo_uninit(); // Close the X11 connection (if any is open).
699 #endif 699 #endif
700 700
978 978
979 static int playtree_add_playlist(play_tree_t* entry) 979 static int playtree_add_playlist(play_tree_t* entry)
980 { 980 {
981 play_tree_add_bpf(entry,filename); 981 play_tree_add_bpf(entry,filename);
982 982
983 #ifdef HAVE_NEW_GUI 983 #ifdef CONFIG_GUI
984 if (use_gui) { 984 if (use_gui) {
985 if (entry) { 985 if (entry) {
986 import_playtree_playlist_into_gui(entry, mconfig); 986 import_playtree_playlist_into_gui(entry, mconfig);
987 play_tree_free_list(entry,1); 987 play_tree_free_list(entry,1);
988 } 988 }
1294 { 1294 {
1295 int new_srate; 1295 int new_srate;
1296 int result; 1296 int result;
1297 if (!sh_audio) 1297 if (!sh_audio)
1298 { 1298 {
1299 #ifdef HAVE_NEW_GUI 1299 #ifdef CONFIG_GUI
1300 if (use_gui) guiGetEvent(guiSetAfilter, (char *)NULL); 1300 if (use_gui) guiGetEvent(guiSetAfilter, (char *)NULL);
1301 #endif 1301 #endif
1302 mpctx->mixer.afilter = NULL; 1302 mpctx->mixer.afilter = NULL;
1303 return 0; 1303 return 0;
1304 } 1304 }
1318 } 1318 }
1319 } 1319 }
1320 result = init_audio_filters(sh_audio, new_srate, 1320 result = init_audio_filters(sh_audio, new_srate,
1321 &ao_data->samplerate, &ao_data->channels, &ao_data->format); 1321 &ao_data->samplerate, &ao_data->channels, &ao_data->format);
1322 mpctx->mixer.afilter = sh_audio->afilter; 1322 mpctx->mixer.afilter = sh_audio->afilter;
1323 #ifdef HAVE_NEW_GUI 1323 #ifdef CONFIG_GUI
1324 if (use_gui) guiGetEvent(guiSetAfilter, (char *)sh_audio->afilter); 1324 if (use_gui) guiGetEvent(guiSetAfilter, (char *)sh_audio->afilter);
1325 #endif 1325 #endif
1326 return result; 1326 return result;
1327 } 1327 }
1328 1328
2340 update_osd_msg(); 2340 update_osd_msg();
2341 } else 2341 } else
2342 mp_msg(MSGT_CPLAYER,MSGL_STATUS,MSGTR_Paused); 2342 mp_msg(MSGT_CPLAYER,MSGL_STATUS,MSGTR_Paused);
2343 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_PAUSED\n"); 2343 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_PAUSED\n");
2344 } 2344 }
2345 #ifdef HAVE_NEW_GUI 2345 #ifdef CONFIG_GUI
2346 if (use_gui) 2346 if (use_gui)
2347 guiGetEvent(guiCEvent, (char *)guiSetPause); 2347 guiGetEvent(guiCEvent, (char *)guiSetPause);
2348 #endif 2348 #endif
2349 if (mpctx->video_out && mpctx->sh_video && vo_config_count) 2349 if (mpctx->video_out && mpctx->sh_video && vo_config_count)
2350 mpctx->video_out->control(VOCTRL_PAUSE, NULL); 2350 mpctx->video_out->control(VOCTRL_PAUSE, NULL);
2359 mp_cmd_free(cmd); 2359 mp_cmd_free(cmd);
2360 continue; 2360 continue;
2361 } 2361 }
2362 if (mpctx->sh_video && mpctx->video_out && vo_config_count) 2362 if (mpctx->sh_video && mpctx->video_out && vo_config_count)
2363 mpctx->video_out->check_events(); 2363 mpctx->video_out->check_events();
2364 #ifdef HAVE_NEW_GUI 2364 #ifdef CONFIG_GUI
2365 if (use_gui) { 2365 if (use_gui) {
2366 guiEventHandling(); 2366 guiEventHandling();
2367 guiGetEvent(guiReDraw, NULL); 2367 guiGetEvent(guiReDraw, NULL);
2368 if (guiIntfStruct.Playing!=2 || (rel_seek_secs || abs_seek_pos)) 2368 if (guiIntfStruct.Playing!=2 || (rel_seek_secs || abs_seek_pos))
2369 break; 2369 break;
2383 if (mpctx->audio_out && mpctx->sh_audio) 2383 if (mpctx->audio_out && mpctx->sh_audio)
2384 mpctx->audio_out->resume(); // resume audio 2384 mpctx->audio_out->resume(); // resume audio
2385 if (mpctx->video_out && mpctx->sh_video && vo_config_count) 2385 if (mpctx->video_out && mpctx->sh_video && vo_config_count)
2386 mpctx->video_out->control(VOCTRL_RESUME, NULL); // resume video 2386 mpctx->video_out->control(VOCTRL_RESUME, NULL); // resume video
2387 (void)GetRelativeTime(); // ignore time that passed during pause 2387 (void)GetRelativeTime(); // ignore time that passed during pause
2388 #ifdef HAVE_NEW_GUI 2388 #ifdef CONFIG_GUI
2389 if (use_gui) { 2389 if (use_gui) {
2390 if (guiIntfStruct.Playing == guiSetStop) 2390 if (guiIntfStruct.Playing == guiSetStop)
2391 mpctx->eof = 1; 2391 mpctx->eof = 1;
2392 else 2392 else
2393 guiGetEvent(guiCEvent, (char *)guiSetPlay); 2393 guiGetEvent(guiCEvent, (char *)guiSetPlay);
2593 use_gui=1; 2593 use_gui=1;
2594 } 2594 }
2595 2595
2596 parse_cfgfiles(mconfig); 2596 parse_cfgfiles(mconfig);
2597 2597
2598 #ifdef HAVE_NEW_GUI 2598 #ifdef CONFIG_GUI
2599 if ( use_gui ) cfg_read(); 2599 if ( use_gui ) cfg_read();
2600 #endif 2600 #endif
2601 2601
2602 mpctx->playtree = m_config_parse_mp_command_line(mconfig, argc, argv); 2602 mpctx->playtree = m_config_parse_mp_command_line(mconfig, argc, argv);
2603 if(mpctx->playtree == NULL) 2603 if(mpctx->playtree == NULL)
2614 filename = play_tree_iter_get_file(mpctx->playtree_iter,1); 2614 filename = play_tree_iter_get_file(mpctx->playtree_iter,1);
2615 } 2615 }
2616 } 2616 }
2617 } 2617 }
2618 2618
2619 #if defined(WIN32) && defined(HAVE_NEW_GUI) 2619 #if defined(WIN32) && defined(CONFIG_GUI)
2620 void *runningmplayer = FindWindow("MPlayer GUI for Windows", "MPlayer for Windows"); 2620 void *runningmplayer = FindWindow("MPlayer GUI for Windows", "MPlayer for Windows");
2621 if(runningmplayer && filename && use_gui){ 2621 if(runningmplayer && filename && use_gui){
2622 COPYDATASTRUCT csData; 2622 COPYDATASTRUCT csData;
2623 char file[MAX_PATH]; 2623 char file[MAX_PATH];
2624 char *filepart = filename; 2624 char *filepart = filename;
2643 mp_msg(MSGT_CPLAYER,MSGL_STATUS,"Setting process priority: %s\n", 2643 mp_msg(MSGT_CPLAYER,MSGL_STATUS,"Setting process priority: %s\n",
2644 priority_presets_defs[i].name); 2644 priority_presets_defs[i].name);
2645 SetPriorityClass(GetCurrentProcess(), priority_presets_defs[i].prio); 2645 SetPriorityClass(GetCurrentProcess(), priority_presets_defs[i].prio);
2646 } 2646 }
2647 #endif 2647 #endif
2648 #ifndef HAVE_NEW_GUI 2648 #ifndef CONFIG_GUI
2649 if(use_gui){ 2649 if(use_gui){
2650 mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_NoGui); 2650 mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_NoGui);
2651 use_gui=0; 2651 use_gui=0;
2652 } 2652 }
2653 #else 2653 #else
2670 play_tree_add_bpf(mpctx->playtree, cwd); 2670 play_tree_add_bpf(mpctx->playtree, cwd);
2671 } 2671 }
2672 // Import initital playtree into GUI. 2672 // Import initital playtree into GUI.
2673 import_initial_playtree_into_gui(mpctx->playtree, mconfig, enqueue); 2673 import_initial_playtree_into_gui(mpctx->playtree, mconfig, enqueue);
2674 } 2674 }
2675 #endif /* HAVE_NEW_GUI */ 2675 #endif /* CONFIG_GUI */
2676 2676
2677 if(video_driver_list && strcmp(video_driver_list[0],"help")==0){ 2677 if(video_driver_list && strcmp(video_driver_list[0],"help")==0){
2678 list_video_out(); 2678 list_video_out();
2679 opt_exit = 1; 2679 opt_exit = 1;
2680 } 2680 }
2838 rtc_fd = -1; 2838 rtc_fd = -1;
2839 } else 2839 } else
2840 mp_msg(MSGT_CPLAYER, MSGL_V, MSGTR_UsingRTCTiming, irqp); 2840 mp_msg(MSGT_CPLAYER, MSGL_V, MSGTR_UsingRTCTiming, irqp);
2841 } 2841 }
2842 } 2842 }
2843 #ifdef HAVE_NEW_GUI 2843 #ifdef CONFIG_GUI
2844 // breaks DGA and SVGAlib and VESA drivers: --A'rpi 2844 // breaks DGA and SVGAlib and VESA drivers: --A'rpi
2845 // and now ? -- Pontscho 2845 // and now ? -- Pontscho
2846 if(use_gui) setuid( getuid() ); // strongly test, please check this. 2846 if(use_gui) setuid( getuid() ); // strongly test, please check this.
2847 #endif 2847 #endif
2848 if(rtc_fd<0) 2848 if(rtc_fd<0)
2918 if (crash_debug) 2918 if (crash_debug)
2919 signal(SIGTRAP,exit_sighandler); 2919 signal(SIGTRAP,exit_sighandler);
2920 #endif 2920 #endif
2921 #endif 2921 #endif
2922 2922
2923 #ifdef HAVE_NEW_GUI 2923 #ifdef CONFIG_GUI
2924 if(use_gui){ 2924 if(use_gui){
2925 guiInit(); 2925 guiInit();
2926 guiGetEvent(guiSetContext, mpctx); 2926 guiGetEvent(guiSetContext, mpctx);
2927 initialized_flags|=INITIALIZED_GUI; 2927 initialized_flags|=INITIALIZED_GUI;
2928 guiGetEvent( guiCEvent,(char *)((gui_no_filename) ? 0 : 1) ); 2928 guiGetEvent( guiCEvent,(char *)((gui_no_filename) ? 0 : 1) );
2958 initialized_flags|=INITIALIZED_GETCH2; 2958 initialized_flags|=INITIALIZED_GETCH2;
2959 mp_msg(MSGT_CPLAYER,MSGL_DBG2,"\n[[[init getch2]]]\n"); 2959 mp_msg(MSGT_CPLAYER,MSGL_DBG2,"\n[[[init getch2]]]\n");
2960 } 2960 }
2961 2961
2962 // =================== GUI idle loop (STOP state) =========================== 2962 // =================== GUI idle loop (STOP state) ===========================
2963 #ifdef HAVE_NEW_GUI 2963 #ifdef CONFIG_GUI
2964 if ( use_gui ) { 2964 if ( use_gui ) {
2965 mpctx->file_format=DEMUXER_TYPE_UNKNOWN; 2965 mpctx->file_format=DEMUXER_TYPE_UNKNOWN;
2966 guiGetEvent( guiSetDefaults,0 ); 2966 guiGetEvent( guiSetDefaults,0 );
2967 while ( guiIntfStruct.Playing != 1 ) 2967 while ( guiIntfStruct.Playing != 1 )
2968 { 2968 {
2996 filename = play_tree_iter_get_file(mpctx->playtree_iter,1); 2996 filename = play_tree_iter_get_file(mpctx->playtree_iter,1);
2997 } 2997 }
2998 } 2998 }
2999 } 2999 }
3000 } 3000 }
3001 #endif /* HAVE_NEW_GUI */ 3001 #endif /* CONFIG_GUI */
3002 3002
3003 while (player_idle_mode && !filename) { 3003 while (player_idle_mode && !filename) {
3004 play_tree_t * entry = NULL; 3004 play_tree_t * entry = NULL;
3005 mp_cmd_t * cmd; 3005 mp_cmd_t * cmd;
3006 while (!(cmd = mp_input_get_cmd(0,1,0))) { // wait for command 3006 while (!(cmd = mp_input_get_cmd(0,1,0))) { // wait for command
3140 mpctx->eof = libmpdemux_was_interrupted(PT_NEXT_ENTRY); 3140 mpctx->eof = libmpdemux_was_interrupted(PT_NEXT_ENTRY);
3141 goto goto_next_file; 3141 goto goto_next_file;
3142 } 3142 }
3143 initialized_flags|=INITIALIZED_STREAM; 3143 initialized_flags|=INITIALIZED_STREAM;
3144 3144
3145 #ifdef HAVE_NEW_GUI 3145 #ifdef CONFIG_GUI
3146 if ( use_gui ) guiGetEvent( guiSetStream,(char *)mpctx->stream ); 3146 if ( use_gui ) guiGetEvent( guiSetStream,(char *)mpctx->stream );
3147 #endif 3147 #endif
3148 3148
3149 if(mpctx->file_format == DEMUXER_TYPE_PLAYLIST) { 3149 if(mpctx->file_format == DEMUXER_TYPE_PLAYLIST) {
3150 play_tree_t* entry; 3150 play_tree_t* entry;
3620 vo_fps = mpctx->sh_video->fps=force_fps; 3620 vo_fps = mpctx->sh_video->fps=force_fps;
3621 mpctx->sh_video->frametime=1.0f/mpctx->sh_video->fps; 3621 mpctx->sh_video->frametime=1.0f/mpctx->sh_video->fps;
3622 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_FPSforced,mpctx->sh_video->fps,mpctx->sh_video->frametime); 3622 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_FPSforced,mpctx->sh_video->fps,mpctx->sh_video->frametime);
3623 } 3623 }
3624 3624
3625 #ifdef HAVE_NEW_GUI 3625 #ifdef CONFIG_GUI
3626 if ( use_gui ) { 3626 if ( use_gui ) {
3627 if ( mpctx->sh_audio ) guiIntfStruct.AudioType=mpctx->sh_audio->channels; else guiIntfStruct.AudioType=0; 3627 if ( mpctx->sh_audio ) guiIntfStruct.AudioType=mpctx->sh_audio->channels; else guiIntfStruct.AudioType=0;
3628 if ( !mpctx->sh_video && mpctx->sh_audio ) guiGetEvent( guiSetAudioOnly,(char *)1 ); else guiGetEvent( guiSetAudioOnly,(char *)0 ); 3628 if ( !mpctx->sh_video && mpctx->sh_audio ) guiGetEvent( guiSetAudioOnly,(char *)1 ); else guiGetEvent( guiSetAudioOnly,(char *)0 );
3629 guiGetEvent( guiSetFileFormat,(char *)mpctx->demuxer->file_format ); 3629 guiGetEvent( guiSetFileFormat,(char *)mpctx->demuxer->file_format );
3630 if ( guiGetEvent( guiSetValues,(char *)mpctx->sh_video ) ) goto goto_next_file; 3630 if ( guiGetEvent( guiSetValues,(char *)mpctx->sh_video ) ) goto goto_next_file;
3736 // ========================================================================== 3736 // ==========================================================================
3737 3737
3738 // current_module="draw_osd"; 3738 // current_module="draw_osd";
3739 // if(vo_config_count) mpctx->video_out->draw_osd(); 3739 // if(vo_config_count) mpctx->video_out->draw_osd();
3740 3740
3741 #ifdef HAVE_NEW_GUI 3741 #ifdef CONFIG_GUI
3742 if(use_gui) guiEventHandling(); 3742 if(use_gui) guiEventHandling();
3743 #endif 3743 #endif
3744 3744
3745 current_module="vo_check_events"; 3745 current_module="vo_check_events";
3746 if (vo_config_count) mpctx->video_out->check_events(); 3746 if (vo_config_count) mpctx->video_out->check_events();
3885 abs_seek_pos=0; 3885 abs_seek_pos=0;
3886 loop_seek=0; 3886 loop_seek=0;
3887 edl_decision = 0; 3887 edl_decision = 0;
3888 } 3888 }
3889 3889
3890 #ifdef HAVE_NEW_GUI 3890 #ifdef CONFIG_GUI
3891 if(use_gui){ 3891 if(use_gui){
3892 guiEventHandling(); 3892 guiEventHandling();
3893 if(mpctx->demuxer->file_format==DEMUXER_TYPE_AVI && mpctx->sh_video && mpctx->sh_video->video.dwLength>2){ 3893 if(mpctx->demuxer->file_format==DEMUXER_TYPE_AVI && mpctx->sh_video && mpctx->sh_video->video.dwLength>2){
3894 // get pos from frame number / total frames 3894 // get pos from frame number / total frames
3895 guiIntfStruct.Position=(float)mpctx->d_video->pack_no*100.0f/mpctx->sh_video->video.dwLength; 3895 guiIntfStruct.Position=(float)mpctx->d_video->pack_no*100.0f/mpctx->sh_video->video.dwLength;
3910 dvd_priv_t * dvdp = mpctx->stream->priv; 3910 dvd_priv_t * dvdp = mpctx->stream->priv;
3911 guiIntfStruct.DVD.current_chapter=dvd_chapter_from_cell(dvdp,guiIntfStruct.DVD.current_title-1, dvdp->cur_cell)+1; 3911 guiIntfStruct.DVD.current_chapter=dvd_chapter_from_cell(dvdp,guiIntfStruct.DVD.current_title-1, dvdp->cur_cell)+1;
3912 } 3912 }
3913 #endif 3913 #endif
3914 } 3914 }
3915 #endif /* HAVE_NEW_GUI */ 3915 #endif /* CONFIG_GUI */
3916 3916
3917 } // while(!mpctx->eof) 3917 } // while(!mpctx->eof)
3918 3918
3919 mp_msg(MSGT_GLOBAL,MSGL_V,"EOF code: %d \n",mpctx->eof); 3919 mp_msg(MSGT_GLOBAL,MSGL_V,"EOF code: %d \n",mpctx->eof);
3920 3920
4018 }; 4018 };
4019 } else 4019 } else
4020 break; 4020 break;
4021 } 4021 }
4022 4022
4023 #ifdef HAVE_NEW_GUI 4023 #ifdef CONFIG_GUI
4024 if(use_gui && !mpctx->playtree_iter) { 4024 if(use_gui && !mpctx->playtree_iter) {
4025 #ifdef CONFIG_DVDREAD 4025 #ifdef CONFIG_DVDREAD
4026 if(!guiIntfStruct.DiskChanged) 4026 if(!guiIntfStruct.DiskChanged)
4027 #endif 4027 #endif
4028 mplEnd(); 4028 mplEnd();