1
mirror of https://github.com/mpv-player/mpv synced 2024-10-30 04:46:41 +01:00

vivo A-V sync fixed

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3527 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2001-12-16 14:51:04 +00:00
parent f216d87ac8
commit f0a8c2a8a3
2 changed files with 15 additions and 1 deletions

View File

@ -290,6 +290,9 @@ int vivo_check_file(demuxer_t* demuxer){
return 1;
}
static audio_pos=0;
static audio_rate=0;
// return value:
// 0 = EOF or no stream found
// 1 = successfully read a packet
@ -348,6 +351,7 @@ int demux_vivo_fill_buffer(demuxer_t *demux){
else
len=40; /* 40kbps */
ds=demux->audio;
audio_pos+=len;
break;
case 0x40: // audio packet
if (prefix == 1)
@ -355,6 +359,7 @@ int demux_vivo_fill_buffer(demuxer_t *demux){
else
len=24; /* 24kbps */
ds=demux->audio;
audio_pos+=len;
break;
default:
mp_msg(MSGT_DEMUX,MSGL_WARN,"VIVO - unknown ID found: %02X at pos %lu contact author!\n",
@ -395,7 +400,7 @@ int demux_vivo_fill_buffer(demuxer_t *demux){
dp=new_demux_packet(len);
//memcpy(dp->buffer,data,len);
stream_read(demux->stream,dp->buffer,len);
// dp->pts=time*0.001f;
dp->pts=audio_rate?((float)audio_pos/(float)audio_rate):0;
// dp->flags=keyframe;
// if(ds==demux->video) printf("ASF time: %8d dur: %5d \n",time,dur);
dp->pos=demux->filepos;
@ -546,6 +551,8 @@ void demux_open_vivo(demuxer_t* demuxer){
return;
}
audio_pos=0;
h263_decode_picture_header(demuxer->video->buffer);
if (vivo_param_version != -1)
@ -693,6 +700,7 @@ if (demuxer->audio->id >= -1){
}
if (vivo_param_abitrate != -1)
sh->wf->nAvgBytesPerSec = vivo_param_abitrate;
audio_rate=sh->wf->nAvgBytesPerSec;
if (!priv->audio_bytesperblock)
{

View File

@ -237,6 +237,12 @@ int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,unsigned char**
if(demuxer->file_format==DEMUXER_TYPE_MOV && !force_fps){
// .MOV files has no fixed FPS - just frame durations!
frame_time=d_video->pts-pts1;
} else
if(demuxer->file_format==DEMUXER_TYPE_VIVO && !force_fps){
// .VIVO files has no fixed FPS - just frame durations!
if(d_video->pts-pts1>0)
frame_time=d_video->pts-pts1;
mp_msg(MSGT_CPLAYER,MSGL_V,"vivo frame_time=%5.3f \n",frame_time);
}
if(demuxer->file_format==DEMUXER_TYPE_MPEG_PS) d_video->pts+=frame_time;