[Mplayer-cvslog] CVS: main demuxer.c,1.8,1.9 demuxer.h,1.3,1.4 mplayer.c,1.125,1.126
GEREOFFY
arpi_esp at users.sourceforge.net
Sun May 27 02:02:14 CEST 2001
Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv30257
Modified Files:
demuxer.c demuxer.h mplayer.c
Log Message:
AVI -bps desync problem solved
Index: demuxer.c
===================================================================
RCS file: /cvsroot/mplayer/main/demuxer.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** demuxer.c 2001/05/17 22:15:00 1.8
--- demuxer.c 2001/05/27 00:02:12 1.9
***************
*** 18,21 ****
--- 18,22 ----
ds->pos=0;
ds->dpos=0;
+ ds->pack_no=0;
//---------------
ds->packs=0;
***************
*** 122,125 ****
--- 123,127 ----
ds->pos=p->pos;
ds->dpos+=p->len; // !!!
+ ++ds->pack_no;
if(p->pts){
ds->pts=p->pts;
Index: demuxer.h
===================================================================
RCS file: /cvsroot/mplayer/main/demuxer.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** demuxer.h 2001/05/10 03:39:54 1.3
--- demuxer.h 2001/05/27 00:02:12 1.4
***************
*** 34,37 ****
--- 34,38 ----
int pos; // position in the input stream (file)
int dpos; // position in the demuxed stream
+ int pack_no; // serial number of packet
//---------------
int packs; // number of packets in buffer
Index: mplayer.c
===================================================================
RCS file: /cvsroot/mplayer/main/mplayer.c,v
retrieving revision 1.125
retrieving revision 1.126
diff -C2 -r1.125 -r1.126
*** mplayer.c 2001/05/24 01:30:51 1.125
--- mplayer.c 2001/05/27 00:02:12 1.126
***************
*** 1972,1975 ****
--- 1972,1977 ----
a_pts=(ds_tell(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->wf->nAvgBytesPerSec;
delay_corrected=1; // hack
+ v_pts=d_video->pack_no*(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
+ if(verbose)printf("%5.3f|",v_pts-d_video->pts);
} else {
if(!delay_corrected && d_audio->pts){
***************
*** 1986,1993 ****
a_pts=d_audio->pts;
a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps;
}
- v_pts=d_video->pts-frame_time;
-
if(verbose)printf("### A:%8.3f (%8.3f) V:%8.3f A-V:%7.4f \n",a_pts,a_pts-audio_delay-delay,v_pts,(a_pts-delay-audio_delay)-v_pts);
--- 1988,1994 ----
a_pts=d_audio->pts;
a_pts+=(ds_tell_pts(d_audio)-sh_audio->a_in_buffer_len)/(float)sh_audio->i_bps;
+ v_pts=d_video->pts-frame_time;
}
if(verbose)printf("### A:%8.3f (%8.3f) V:%8.3f A-V:%7.4f \n",a_pts,a_pts-audio_delay-delay,v_pts,(a_pts-delay-audio_delay)-v_pts);
***************
*** 2182,2187 ****
// if(d_video->pts) avi_video_pts=d_video->pts;
avi_audio_pts=0;
! d_video->pts=0;
! d_audio->pts=0;
// find video chunk pos:
--- 2183,2190 ----
// if(d_video->pts) avi_video_pts=d_video->pts;
avi_audio_pts=0;
!
! // Done by ds_free_packs():
! //d_video->pts=0;
! //d_audio->pts=0;
// find video chunk pos:
***************
*** 2211,2228 ****
}
}
! demuxer->idx_pos_a=demuxer->idx_pos_v=
! demuxer->idx_pos=video_chunk_pos;
// printf("%d frames skipped\n",skip_audio_bytes);
#if 1
// re-calc video pts:
! avi_video_pts=0;
for(i=0;i<video_chunk_pos;i++){
int id=((AVIINDEXENTRY *)demuxer->idx)[i].ckid;
! // if(LOWORD(id)==aviTWOCC('0','0')){ // video frame
! if(avi_stream_id(id)==d_video->id){ // video frame
! avi_video_pts+=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
! }
}
//printf("v-pts recalc! %5.3f -> %5.3f \n",v_pts,avi_video_pts);
//v_pts=avi_video_pts;
--- 2214,2229 ----
}
}
! demuxer->idx_pos_a=demuxer->idx_pos_v=demuxer->idx_pos=video_chunk_pos;
// printf("%d frames skipped\n",skip_audio_bytes);
#if 1
// re-calc video pts:
! d_video->pack_no=0;
for(i=0;i<video_chunk_pos;i++){
int id=((AVIINDEXENTRY *)demuxer->idx)[i].ckid;
! if(avi_stream_id(id)==d_video->id) ++d_video->pack_no;
}
+ avi_video_pts=d_video->pack_no*(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
+
//printf("v-pts recalc! %5.3f -> %5.3f \n",v_pts,avi_video_pts);
//v_pts=avi_video_pts;
***************
*** 2253,2260 ****
for(i=0;i<video_chunk_pos;i++){
int id=((AVIINDEXENTRY *)demuxer->idx)[i].ckid;
- //if(TWOCCFromFOURCC(id)==cktypeWAVEbytes){
if(avi_stream_id(id)==d_audio->id){
- int aid=StreamFromFOURCC(id);
- if(d_audio->id==aid || d_audio->id==-1){
len=((AVIINDEXENTRY *)demuxer->idx)[i].dwChunkLength;
last=i;
--- 2254,2258 ----
***************
*** 2264,2268 ****
}
apos+=len;
- }
}
}
--- 2262,2265 ----
***************
*** 2276,2281 ****
d_audio->pos=audio_chunk_pos;
d_audio->dpos=apos;
! demuxer->idx_pos_a=demuxer->idx_pos_v=
! demuxer->idx_pos=audio_chunk_pos;
if(!(sh_audio->codec->flags&CODECS_FLAG_SEEKABLE)){
--- 2273,2277 ----
d_audio->pos=audio_chunk_pos;
d_audio->dpos=apos;
! demuxer->idx_pos_a=demuxer->idx_pos_v=demuxer->idx_pos=audio_chunk_pos;
if(!(sh_audio->codec->flags&CODECS_FLAG_SEEKABLE)){
***************
*** 2299,2313 ****
// calc skip_video_frames & adjust video pts counter:
// i=last;
! i=demuxer->idx_pos;
! while(i<video_chunk_pos){
int id=((AVIINDEXENTRY *)demuxer->idx)[i].ckid;
! // if(LOWORD(id)==aviTWOCC('0','0')){ // video frame
! if(avi_stream_id(id)==d_video->id){ // video frame
! ++skip_video_frames;
! // requires for correct audio pts calculation (demuxer):
! avi_video_pts-=(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
! }
! ++i;
}
}
--- 2295,2304 ----
// calc skip_video_frames & adjust video pts counter:
// i=last;
! for(i=demuxer->idx_pos;i<video_chunk_pos;i++){
int id=((AVIINDEXENTRY *)demuxer->idx)[i].ckid;
! if(avi_stream_id(id)==d_video->id) ++skip_video_frames;
}
+ // requires for correct audio pts calculation (demuxer):
+ avi_video_pts-=skip_video_frames*(float)sh_video->video.dwScale/(float)sh_video->video.dwRate;
}
***************
*** 2376,2380 ****
if(skip_audio_bytes){
demux_read_data(d_audio,NULL,skip_audio_bytes);
! d_audio->pts=0; // PTS is outdated because of the raw data skipping
}
--- 2367,2371 ----
if(skip_audio_bytes){
demux_read_data(d_audio,NULL,skip_audio_bytes);
! //d_audio->pts=0; // PTS is outdated because of the raw data skipping
}
***************
*** 2415,2422 ****
}
- RESET_AUDIO(audio_fd);
-
current_module=NULL;
c_total=0; // kell ez?
printf("A:%6.1f V:%6.1f A-V:%7.3f",d_audio->pts,d_video->pts,0.0f);
--- 2406,2413 ----
}
current_module=NULL;
+ RESET_AUDIO(audio_fd);
+
c_total=0; // kell ez?
printf("A:%6.1f V:%6.1f A-V:%7.3f",d_audio->pts,d_video->pts,0.0f);
***************
*** 2427,2431 ****
max_pts_correction=0.1;
! frame_corr_num=-5; frame_correction=0;
force_redraw=5;
a_frame=-skip_audio_secs;
--- 2418,2423 ----
max_pts_correction=0.1;
! frame_corr_num=0; // -5
! frame_correction=0;
force_redraw=5;
a_frame=-skip_audio_secs;
_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog
More information about the MPlayer-cvslog
mailing list