diff options
author | rtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-04-24 10:58:40 +0000 |
---|---|---|
committer | rtognimp <rtognimp@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-04-24 10:58:40 +0000 |
commit | 6c4d9bfe5127da2a4e2afbe1d6e585ebeb7c5949 (patch) | |
tree | 6057e1a4875492c40543d4ac2e43adbbd53afff2 /libmpcodecs/ad_ffmpeg.c | |
parent | 4b45ec30e4b8ced93aa10792aa18a8f96b3cd104 (diff) | |
download | mpv-6c4d9bfe5127da2a4e2afbe1d6e585ebeb7c5949.tar.bz2 mpv-6c4d9bfe5127da2a4e2afbe1d6e585ebeb7c5949.tar.xz |
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
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18243 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/ad_ffmpeg.c')
-rw-r--r-- | libmpcodecs/ad_ffmpeg.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c index 22cb72b8a5..f9fb0455a6 100644 --- a/libmpcodecs/ad_ffmpeg.c +++ b/libmpcodecs/ad_ffmpeg.c @@ -149,8 +149,13 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m 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 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m //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); } |