[MPlayer-cvslog] CVS: main/libmpcodecs ad_faad.c, 1.24, 1.25 ad_ffmpeg.c, 1.24, 1.25 ad_libvorbis.c, 1.21, 1.22
Roberto Togni CVS
syncmail at mplayerhq.hu
Mon Apr 24 12:58:42 CEST 2006
CVS change done by Roberto Togni CVS
Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var2/tmp/cvs-serv7324/libmpcodecs
Modified Files:
ad_faad.c ad_ffmpeg.c ad_libvorbis.c
Log Message:
4 - Implement a better way to calculate current audio pts and use it for
audio decoded with ad_libvorbis, ad_ffmpeg and ad_faad.
Patch by Uoti Urpala
Index: ad_faad.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ad_faad.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- ad_faad.c 12 Jan 2006 20:04:34 -0000 1.24
+++ ad_faad.c 24 Apr 2006 10:58:39 -0000 1.25
@@ -253,8 +253,13 @@
} else {
// packetized (.mp4) aac stream:
unsigned char* bufptr=NULL;
- int buflen=ds_get_packet(sh->ds, &bufptr);
+ double pts;
+ int buflen=ds_get_packet_pts(sh->ds, &bufptr, &pts);
if(buflen<=0) break;
+ if (pts != MP_NOPTS_VALUE) {
+ sh->pts = pts;
+ sh->pts_bytes = 0;
+ }
faac_sample_buffer = faacDecDecode(faac_hdec, &faac_finfo, bufptr, buflen);
}
//for (j=0;j<faac_finfo.channels;j++) printf("%d:%d\n", j, faac_finfo.channel_position[j]);
@@ -271,6 +276,7 @@
memcpy(buf+len,faac_sample_buffer, sh->samplesize*faac_finfo.samples);
last_dec_len = sh->samplesize*faac_finfo.samples;
len += last_dec_len;
+ sh->pts_bytes += last_dec_len;
//printf("FAAD: buffer: %d bytes consumed: %d \n", k, faac_finfo.bytesconsumed);
}
}
Index: ad_ffmpeg.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ad_ffmpeg.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- ad_ffmpeg.c 19 Apr 2006 20:12:01 -0000 1.24
+++ ad_ffmpeg.c 24 Apr 2006 10:58:39 -0000 1.25
@@ -149,8 +149,13 @@
int y,len=-1;
while(len<minlen){
int len2=0;
- int x=ds_get_packet(sh_audio->ds,&start);
+ double pts;
+ int x=ds_get_packet_pts(sh_audio->ds,&start, &pts);
if(x<=0) break; // error
+ if (pts != MP_NOPTS_VALUE) {
+ sh_audio->pts = pts;
+ sh_audio->pts_bytes = 0;
+ }
y=avcodec_decode_audio(sh_audio->context,(int16_t*)buf,&len2,start,x);
//printf("return:%d samples_out:%d bitstream_in:%d sample_sum:%d\n", y, len2, x, len); fflush(stdout);
if(y<0){ mp_msg(MSGT_DECAUDIO,MSGL_V,"lavc_audio: error\n");break; }
@@ -159,6 +164,7 @@
//len=len2;break;
if(len<0) len=len2; else len+=len2;
buf+=len2;
+ sh_audio->pts_bytes += len2;
}
mp_dbg(MSGT_DECAUDIO,MSGL_DBG2,"Decoded %d -> %d \n",y,len2);
}
Index: ad_libvorbis.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ad_libvorbis.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- ad_libvorbis.c 12 Jan 2006 20:04:34 -0000 1.21
+++ ad_libvorbis.c 24 Apr 2006 10:58:39 -0000 1.22
@@ -229,9 +229,14 @@
while(len < minlen) {
while((samples=vorbis_synthesis_pcmout(&ov->vd,&pcm))<=0){
ogg_packet op;
+ double pts;
memset(&op,0,sizeof(op)); //op.b_o_s = op.e_o_s = 0;
- op.bytes = ds_get_packet(sh->ds,&op.packet);
+ op.bytes = ds_get_packet_pts(sh->ds,&op.packet, &pts);
if(op.bytes<=0) break;
+ if (pts != MP_NOPTS_VALUE) {
+ sh->pts = pts;
+ sh->pts_bytes = 0;
+ }
if(vorbis_synthesis(&ov->vb,&op)==0) /* test for success! */
vorbis_synthesis_blockin(&ov->vd,&ov->vb);
}
@@ -303,6 +308,7 @@
if(clipflag)
mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"Clipping in frame %ld\n",(long)(ov->vd.sequence));
len+=2*ov->vi.channels*bout;
+ sh->pts_bytes += 2*ov->vi.channels*bout;
mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"\n[decoded: %d / %d ]\n",bout,samples);
samples-=bout;
vorbis_synthesis_read(&ov->vd,bout); /* tell libvorbis how
More information about the MPlayer-cvslog
mailing list