changeset 1401:c11f2a77ff70

using sh_video->i_bps...
author arpi
date Sat, 28 Jul 2001 21:18:21 +0000
parents 2bf9c561b01d
children b62df5a81cba
files dec_video.c demuxer.c mplayer.c
diffstat 3 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/dec_video.c	Sat Jul 28 20:33:51 2001 +0000
+++ b/dec_video.c	Sat Jul 28 21:18:21 2001 +0000
@@ -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",
--- a/demuxer.c	Sat Jul 28 20:33:51 2001 +0000
+++ b/demuxer.c	Sat Jul 28 21:18:21 2001 +0000
@@ -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);
--- a/mplayer.c	Sat Jul 28 20:33:51 2001 +0000
+++ b/mplayer.c	Sat Jul 28 21:18:21 2001 +0000
@@ -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 */