mirror of https://github.com/mpv-player/mpv
using sh_video->i_bps...
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1402 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
218f227765
commit
8e2fb7e98d
|
@ -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",
|
||||
|
|
15
demuxer.c
15
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);
|
||||
|
|
|
@ -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<seek_to_byte) newpos=seek_to_byte;
|
||||
newpos&=~(STREAM_BUFFER_SIZE-1); /* sector boundary */
|
||||
|
|
Loading…
Reference in New Issue