[Mplayer-cvslog] CVS: main mplayer.c,1.119,1.120 cfg-mplayer.h,1.46,1.47

GEREOFFY arpi_esp at users.sourceforge.net
Mon May 14 11:35:53 CEST 2001


Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv22995

Modified Files:
	mplayer.c cfg-mplayer.h 
Log Message:
frame dropping...

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.119
retrieving revision 1.120
diff -C2 -r1.119 -r1.120
*** mplayer.c	2001/05/14 02:06:32	1.119
--- mplayer.c	2001/05/14 09:35:51	1.120
***************
*** 474,477 ****
--- 474,478 ----
  int pts_from_bps=0;
  #endif
+ int frame_dropping=0; // option  0=no drop  1= drop vo  2= drop decode
  char* title="MPlayer";
  // screen info:
***************
*** 1663,1667 ****
      
  //    if(!force_redraw && v_frame+0.1<a_frame) drop_frame=1; else drop_frame=0;
!     drop_frame_cnt+=drop_frame;
  
    //--------------------  Decode a frame: -----------------------
--- 1664,1668 ----
      
  //    if(!force_redraw && v_frame+0.1<a_frame) drop_frame=1; else drop_frame=0;
! //    if(drop_frame) ++drop_frame_cnt;
  
    //--------------------  Decode a frame: -----------------------
***************
*** 1701,1705 ****
      if(in_size>max_framesize) max_framesize=in_size;
  
!     DS_VideoDecoder_DecodeFrame(start, in_size, 0, !drop_frame);
      current_module="draw_frame";
  
--- 1702,1706 ----
      if(in_size>max_framesize) max_framesize=in_size;
  
!     if(drop_frame<2) DS_VideoDecoder_DecodeFrame(start, in_size, 0, !drop_frame);
      current_module="draw_frame";
  
***************
*** 1735,1739 ****
  //      ret = ICDecompress(avi_header.hic, ICDECOMPRESS_NOTKEYFRAME|(ICDECOMPRESS_HURRYUP|ICDECOMPRESS_PREROL), 
        ret = ICDecompress(sh_video->hic, ICDECOMPRESS_NOTKEYFRAME |
!                         ( drop_frame?(ICDECOMPRESS_HURRYUP|ICDECOMPRESS_PREROL):0 ) , 
                           sh_video->bih,   start,
                          &sh_video->o_bih,
--- 1736,1740 ----
  //      ret = ICDecompress(avi_header.hic, ICDECOMPRESS_NOTKEYFRAME|(ICDECOMPRESS_HURRYUP|ICDECOMPRESS_PREROL), 
        ret = ICDecompress(sh_video->hic, ICDECOMPRESS_NOTKEYFRAME |
!                         ( (drop_frame==2)?(ICDECOMPRESS_HURRYUP|ICDECOMPRESS_PREROL):0 ) , 
                           sh_video->bih,   start,
                          &sh_video->o_bih,
***************
*** 1839,1844 ****
      if(file_format==DEMUXER_TYPE_MPEG_PS) d_video->pts+=frame_time;
  
!     if(!drop_frame){
  
        // It's time to sleep...
        current_module="sleep";
--- 1840,1854 ----
      if(file_format==DEMUXER_TYPE_MPEG_PS) d_video->pts+=frame_time;
  
!     if(drop_frame){
  
+       if(has_audio){
+           int delay=get_audio_delay(audio_fd);
+           if(verbose>1)printf("delay=%d\n",delay);
+           time_frame=v_frame;
+           time_frame-=a_frame-(float)delay/(float)sh_audio->o_bps;
+ 	  if(time_frame>-0.1) drop_frame=0; // stop dropping frames
+       }
+ 
+     } else {
        // It's time to sleep...
        current_module="sleep";
***************
*** 1851,1858 ****
            time_frame=v_frame;
            time_frame-=a_frame-(float)delay/(float)sh_audio->o_bps;
        } else {
            if(time_frame<-0.1 || time_frame>0.1) time_frame=0;
        }
!     
        if(verbose>1)printf("sleep: %5.3f  a:%6.3f  v:%6.3f  \n",time_frame,a_frame,v_frame);
        
--- 1861,1873 ----
            time_frame=v_frame;
            time_frame-=a_frame-(float)delay/(float)sh_audio->o_bps;
+           // we are out of time... drop next frame!
+ 	  if(time_frame<-0.1){
+ 	      drop_frame=frame_dropping; // tricky!
+ 	      ++drop_frame_cnt;
+ 	  }
        } else {
            if(time_frame<-0.1 || time_frame>0.1) time_frame=0;
        }
! 
        if(verbose>1)printf("sleep: %5.3f  a:%6.3f  v:%6.3f  \n",time_frame,a_frame,v_frame);
        
***************
*** 1930,1939 ****
            max_pts_correction=sh_video->frametime*0.10; // +-10% of time
          a_frame+=x; c_total+=x;
!         printf("  ct:%7.3f  %3d  %2d%%  %2d%%  %3.1f%% \r",c_total,
          (int)num_frames,
          (v_frame>0.5)?(int)(100.0*video_time_usage/(double)v_frame):0,
          (v_frame>0.5)?(int)(100.0*vout_time_usage/(double)v_frame):0,
          (v_frame>0.5)?(100.0*audio_time_usage/(double)v_frame):0
! //        ,drop_frame_cnt
  //        dbg_es_sent-dbg_es_rcvd 
          );
--- 1945,1954 ----
            max_pts_correction=sh_video->frametime*0.10; // +-10% of time
          a_frame+=x; c_total+=x;
!         printf(" ct:%7.3f  %3d  %2d%% %2d%% %3.1f%% %d\r",c_total,
          (int)num_frames,
          (v_frame>0.5)?(int)(100.0*video_time_usage/(double)v_frame):0,
          (v_frame>0.5)?(int)(100.0*vout_time_usage/(double)v_frame):0,
          (v_frame>0.5)?(100.0*audio_time_usage/(double)v_frame):0
!         ,drop_frame_cnt
  //        dbg_es_sent-dbg_es_rcvd 
          );
***************
*** 2071,2076 ****
        break;
      case 'd':
!       drop_frame=!drop_frame;
!       printf("== drop: %d ==  \n",drop_frame);
        break;
    }
--- 2086,2091 ----
        break;
      case 'd':
!       frame_dropping=(frame_dropping+1)%3;
!       printf("== drop: %d ==  \n",frame_dropping);
        break;
    }

Index: cfg-mplayer.h
===================================================================
RCS file: /cvsroot/mplayer/main/cfg-mplayer.h,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -r1.46 -r1.47
*** cfg-mplayer.h	2001/05/12 01:56:31	1.46
--- cfg-mplayer.h	2001/05/14 09:35:51	1.47
***************
*** 77,80 ****
--- 77,84 ----
  	{"noni", &force_ni, CONF_TYPE_FLAG, 0, 1, 0},
  
+ 	{"framedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 0, 1},
+ 	{"hardframedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 0, 2},
+ 	{"no framedrop", &frame_dropping, CONF_TYPE_FLAG, 0, 1, 0},
+ 	
  	{"aid", &audio_id, CONF_TYPE_INT, CONF_RANGE, 0, 256},
  	{"vid", &video_id, CONF_TYPE_INT, CONF_RANGE, 0, 256},


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list