From 8e2fb7e98dc6fc4fd1ead64972de14746811694e Mon Sep 17 00:00:00 2001 From: arpi Date: Sat, 28 Jul 2001 21:18:21 +0000 Subject: [PATCH] using sh_video->i_bps... git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1402 b3059339-0415-0410-9bf9-f77b7e298cf2 --- dec_video.c | 3 +++ demuxer.c | 15 +++++++-------- mplayer.c | 6 ++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dec_video.c b/dec_video.c index 98c942b2cc..0709a2a061 100644 --- a/dec_video.c +++ b/dec_video.c @@ -510,6 +510,9 @@ switch(d_video->demuxer->file_format){ } 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", diff --git a/demuxer.c b/demuxer.c index 96ab17accd..dff646ac50 100644 --- a/demuxer.c +++ b/demuxer.c @@ -313,8 +313,6 @@ demux_stream_t *d_video=NULL; 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 @@ switch(file_format){ 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 @@ switch(file_format){ 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); diff --git a/mplayer.c b/mplayer.c index 8b03628083..cc38d7fab7 100644 --- a/mplayer.c +++ b/mplayer.c @@ -141,8 +141,6 @@ static int max_framesize=0; #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 @@ switch(file_format){ 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