[Mplayer-cvslog] CVS: main demuxer.c,1.12,1.13 dec_video.c,1.11,1.12 mplayer.c,1.189,1.190

Arpi of Ize arpi at mplayer.dev.hu
Sat Jul 28 23:18:23 CEST 2001


Update of /cvsroot/mplayer/main
In directory mplayer:/var/tmp.root/cvs-serv16852

Modified Files:
	demuxer.c dec_video.c mplayer.c 
Log Message:
using sh_video->i_bps...

Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/demuxer.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- demuxer.c	21 Jul 2001 22:36:39 -0000	1.12
+++ demuxer.c	28 Jul 2001 21:18:21 -0000	1.13
@@ -313,8 +313,6 @@
 sh_audio_t *sh_audio=NULL;
 sh_video_t *sh_video=NULL;
 
-int avi_bitrate=0;
-
 //=============== Try to open as AVI file: =================
 if(file_format==DEMUXER_TYPE_UNKNOWN || file_format==DEMUXER_TYPE_AVI){
   stream_reset(stream);
@@ -495,18 +493,18 @@
   sh_video->fps=(float)sh_video->video.dwRate/(float)sh_video->video.dwScale;
   sh_video->frametime=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
   // calculating video bitrate:
-  avi_bitrate=demuxer->movi_end-demuxer->movi_start-demuxer->idx_size*8;
-  if(sh_audio) avi_bitrate-=sh_audio->audio.dwLength;
-  if(verbose) printf("AVI video length=%d\n",avi_bitrate);
-  avi_bitrate=((float)avi_bitrate/(float)sh_video->video.dwLength)*sh_video->fps;
+  sh_video->i_bps=demuxer->movi_end-demuxer->movi_start-demuxer->idx_size*8;
+  if(sh_audio) sh_video->i_bps-=sh_audio->audio.dwLength;
+  if(verbose) printf("AVI video length=%d\n",sh_video->i_bps);
+  sh_video->i_bps=((float)sh_video->i_bps/(float)sh_video->video.dwLength)*sh_video->fps;
   printf("VIDEO:  [%.4s]  %ldx%ld  %dbpp  %4.2f fps  %5.1f kbps (%4.1f kbyte/s)\n",
     (char *)&sh_video->bih->biCompression,
     sh_video->bih->biWidth,
     sh_video->bih->biHeight,
     sh_video->bih->biBitCount,
     sh_video->fps,
-    avi_bitrate*0.008f,
-    avi_bitrate/1024.0f );
+    sh_video->i_bps*0.008f,
+    sh_video->i_bps/1024.0f );
   break;
  }
  case DEMUXER_TYPE_ASF: {
@@ -530,6 +528,7 @@
       sh_video->bih->biWidth,
       sh_video->bih->biHeight,
       sh_video->bih->biBitCount);
+//      sh_video->i_bps=10*asf_packetsize; // FIXME!
   }
   if(audio_id!=-2){
     if(verbose) printf("ASF: Searching for audio stream (id:%d)\n",d_audio->id);

Index: dec_video.c
===================================================================
RCS file: /cvsroot/mplayer/main/dec_video.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- dec_video.c	21 Jul 2001 22:37:55 -0000	1.11
+++ dec_video.c	28 Jul 2001 21:18:21 -0000	1.12
@@ -510,6 +510,9 @@
    }
    sh_video->disp_w=picture->display_picture_width;
    sh_video->disp_h=picture->display_picture_height;
+   // bitrate:
+   if(picture->bitrate!=0x3FFFF) // unspecified/VBR ?
+       sh_video->i_bps=1000*picture->bitrate/16;
    // info:
    if(verbose) printf("mpeg bitrate: %d (%X)\n",picture->bitrate,picture->bitrate);
    printf("VIDEO:  %s  %dx%d  (aspect %d)  %4.2f fps  %5.1f kbps (%4.1f kbyte/s)\n",

Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -r1.189 -r1.190
--- mplayer.c	28 Jul 2001 20:33:51 -0000	1.189
+++ mplayer.c	28 Jul 2001 21:18:21 -0000	1.190
@@ -141,8 +141,6 @@
 
 #include "stheader.h"
 
-//static int avi_bitrate=0;
-
 char* encode_name=NULL;
 char* encode_index_name=NULL;
 int encode_bitrate=0;
@@ -1699,10 +1697,10 @@
   case DEMUXER_TYPE_MPEG_PS: {
   //================= seek in MPEG ==========================
         int newpos;
-        if(picture->bitrate==0x3FFFF) // unspecified?
+        if(!sh_video->i_bps) // unspecified?
           newpos=demuxer->filepos+2324*75*rel_seek_secs; // 174.3 kbyte/sec
         else
-          newpos=demuxer->filepos+(picture->bitrate*1000/16)*rel_seek_secs;
+          newpos=demuxer->filepos+(sh_video->i_bps*1000/16)*rel_seek_secs;
 
         if(newpos<seek_to_byte) newpos=seek_to_byte;
         newpos&=~(STREAM_BUFFER_SIZE-1);  /* sector boundary */




More information about the MPlayer-cvslog mailing list