changeset 5511:7a24a067f0af

vo_config_count now counts calls to vo->config()
author arpi
date Sun, 07 Apr 2002 02:12:15 +0000
parents f2c4cace6450
children 4ccfa77d8e86
files libmpcodecs/vf_vo.c libvo/video_out.c libvo/video_out.h mencoder.c mplayer.c
diffstat 5 files changed, 26 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf_vo.c	Sun Apr 07 02:11:10 2002 +0000
+++ b/libmpcodecs/vf_vo.c	Sun Apr 07 02:12:15 2002 +0000
@@ -19,6 +19,7 @@
 	unsigned int flags, unsigned int outfmt){
     if(video_out->config(width,height,d_width,d_height,flags,"MPlayer",outfmt,NULL))
 	return 0;
+    ++vo_config_count;
     return 1;
 }
 
@@ -34,12 +35,13 @@
 
 static void get_image(struct vf_instance_s* vf,
         mp_image_t *mpi){
-    if(vo_directrendering) 
+    if(vo_directrendering && vo_config_count)
 	video_out->control(VOCTRL_GET_IMAGE,mpi);
 }
 
 static void put_image(struct vf_instance_s* vf,
         mp_image_t *mpi){
+  if(!vo_config_count) return; // vo not configured?
   // first check, maybe the vo/vf plugin implements draw_image using mpi:
   if(video_out->control(VOCTRL_DRAW_IMAGE,mpi)==VO_TRUE) return; // done.
   // nope, fallback to old draw_frame/draw_slice:
@@ -54,6 +56,7 @@
 
 static void draw_slice(struct vf_instance_s* vf,
         unsigned char* src, int* stride, int w,int h, int x, int y){
+    if(!vo_config_count) return; // vo not configured?
     video_out->draw_slice(src,stride,w,h,x,y);
 }
 
--- a/libvo/video_out.c	Sun Apr 07 02:11:10 2002 +0000
+++ b/libvo/video_out.c	Sun Apr 07 02:12:15 2002 +0000
@@ -38,6 +38,8 @@
 int vo_screenwidth=0;
 int vo_screenheight=0;
 
+int vo_config_count=0;
+
 // requested resolution/bpp:  (-x -y -bpp options)
 int vo_dx=0;
 int vo_dy=0;
--- a/libvo/video_out.h	Sun Apr 07 02:11:10 2002 +0000
+++ b/libvo/video_out.h	Sun Apr 07 02:12:15 2002 +0000
@@ -191,6 +191,8 @@
 
 extern int vo_flags;
 
+extern int vo_config_count;
+
 // correct resolution/bpp on screen:  (should be autodetected by vo_init())
 extern int vo_depthonscreen;
 extern int vo_screenwidth;
--- a/mencoder.c	Sun Apr 07 02:11:10 2002 +0000
+++ b/mencoder.c	Sun Apr 07 02:12:15 2002 +0000
@@ -106,8 +106,9 @@
              Video accelerated architecture
 **************************************************************************/
 vo_vaa_t vo_vaa;
-int vo_doublebuffering;
-int vo_directrendering;
+int vo_doublebuffering=0;
+int vo_directrendering=0;
+int vo_config_count=0;
 
 //--------------------------
 
--- a/mplayer.c	Sun Apr 07 02:11:10 2002 +0000
+++ b/mplayer.c	Sun Apr 07 02:12:15 2002 +0000
@@ -310,7 +310,8 @@
   if(mask&INITED_VO){
     inited_flags&=~INITED_VO;
     current_module="uninit_vo";
-    video_out->uninit(); video_out=NULL;
+    video_out->uninit();
+    video_out=NULL;
   }
 
   if(mask&INITED_AO){
@@ -1210,6 +1211,7 @@
 
 current_module="preinit_libvo";
 
+vo_config_count=0;
 if((video_out->preinit(vo_subdevice))!=0){
     mp_msg(MSGT_CPLAYER,MSGL_FATAL,"Error opening/initializing the selected video_out (-vo) device!\n");
     goto goto_next_file; // exit_player(MSGTR_Exit_error);
@@ -1538,7 +1540,7 @@
     
 //------------------------ add OSD to frame contents ---------
     current_module="draw_osd";
-    video_out->draw_osd();
+    if(vo_config_count) video_out->draw_osd();
 
     current_module="av_sync";
 
@@ -1566,7 +1568,7 @@
 #ifdef HAVE_NEW_GUI
       if(use_gui) guiEventHandling();
 #endif
-      video_out->check_events(); // check events AST
+      if(vo_config_count) video_out->check_events(); // check events AST
     } else {
       // It's time to sleep...
       current_module="sleep";
@@ -1688,7 +1690,7 @@
 }
 
         current_module="flip_page";
-	video_out->check_events();
+	if(vo_config_count) video_out->check_events();
         if(blit_frame){
 	   unsigned int t2=GetTimer();
 	   double tt;
@@ -1703,7 +1705,7 @@
 		too_slow_frame_cnt++;
 		/* printf ("PANIC: too slow frame (%.3f)!\n", j); */
 
-	   video_out->flip_page();
+	   if(vo_config_count) video_out->flip_page();
 	   t2=GetTimer()-t2;
 	   tt = t2*0.000001f;
 	   vout_time_usage+=tt;
@@ -1865,7 +1867,7 @@
 #ifdef HAVE_NEW_GUI
       if(use_gui) guiGetEvent( guiCEvent,(char *)guiSetPause );
 #endif
-      if (video_out && sh_video)
+      if (video_out && sh_video && vo_config_count)
 	 video_out->control(VOCTRL_PAUSE, NULL);
 
       if (audio_out && sh_audio)
@@ -1895,7 +1897,7 @@
 #endif
              (use_stdin || getch2(20)<=0) && mplayer_get_key()<=0){
 #endif /* HAVE_NEW_INPUT */
-	     if(sh_video && video_out) video_out->check_events();
+	     if(sh_video && video_out && vo_config_count) video_out->check_events();
 #ifdef HAVE_NEW_GUI
              if(use_gui){
 		guiEventHandling();
@@ -1914,7 +1916,7 @@
          osd_function=OSD_PLAY;
       if (audio_out && sh_audio)
         audio_out->resume();	// resume audio
-      if (video_out && sh_video)
+      if (video_out && sh_video && vo_config_count)
         video_out->control(VOCTRL_RESUME, NULL);	// resume video
       (void)GetRelativeTime();	// keep TF around FT in next cycle
 #ifdef HAVE_NEW_GUI
@@ -2113,7 +2115,7 @@
     /* User wants to have screen shot */
     case 'S':
     case 's':
-		video_out->control(VOCTRL_SCREENSHOT, NULL);
+		if(vo_config_count) video_out->control(VOCTRL_SCREENSHOT, NULL);
 		break;
     // Contrast:
     case '1':
@@ -2253,7 +2255,7 @@
 #endif
 
     case 'f':
-	video_out->control(VOCTRL_FULLSCREEN, 0);
+	if(vo_config_count) video_out->control(VOCTRL_FULLSCREEN, 0);
      break;
   }
 } // keyboard event handler
@@ -2476,7 +2478,7 @@
      if ( use_gui ) guiGetEvent( guiIEvent,(char *)MP_CMD_GUI_FULLSCREEN );
       else
 #endif
-	if(video_out) video_out->control(VOCTRL_FULLSCREEN, 0);
+	if(video_out && vo_config_count) video_out->control(VOCTRL_FULLSCREEN, 0);
     } break;
     case MP_CMD_SUB_POS:
     {
@@ -2732,7 +2734,7 @@
 
       if(sh_video){
 	 current_module="seek_video_reset";
-         video_out->control(VOCTRL_RESET,NULL);
+         if(vo_config_count) video_out->control(VOCTRL_RESET,NULL);
       }
       
       if(sh_audio){
@@ -2879,7 +2881,7 @@
     packet.id=0x20; /* Subpic */
     while((packet.size=ds_get_packet_sub(d_dvdsub,&packet.data))>0){
       mp_msg(MSGT_CPLAYER,MSGL_V,"\rDVD sub: len=%d  v_pts=%5.3f  s_pts=%5.3f  \n",packet.size,d_video->pts,d_dvdsub->pts);
-      video_out->draw_frame(&pkg);
+      if(vo_config_count) video_out->draw_frame(&pkg);
     }
   }else if(vo_spudec){
     unsigned char* packet=NULL;