diff options
author | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-12-30 00:53:08 +0200 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2009-12-30 00:56:10 +0200 |
commit | d46b86bc7c39082b26ec71aa16431f3275d836ff (patch) | |
tree | 035da87ed658f7d75c0eba5a5d4de5462a4c8ddd /libmpcodecs/ad_ffmpeg.c | |
parent | a06b32b64e91082c11f747e2910f10a4afd3dfa9 (diff) | |
parent | 3e8f2815c19703f5cb6f75db2910234d499d9676 (diff) | |
download | mpv-d46b86bc7c39082b26ec71aa16431f3275d836ff.tar.bz2 mpv-d46b86bc7c39082b26ec71aa16431f3275d836ff.tar.xz |
Merge svn changes up to r30136
Ignore another broken correct-pts change in 30134.
Diffstat (limited to 'libmpcodecs/ad_ffmpeg.c')
-rw-r--r-- | libmpcodecs/ad_ffmpeg.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c index 12bd6aef6a..217ec25ff1 100644 --- a/libmpcodecs/ad_ffmpeg.c +++ b/libmpcodecs/ad_ffmpeg.c @@ -167,7 +167,17 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m int len2=maxlen; double pts; int x=ds_get_packet_pts(sh_audio->ds,&start, &pts); - if(x<=0) break; // error + if(x<=0) { + start = NULL; + x = 0; + ds_parse(sh_audio->ds, &start, &x, MP_NOPTS_VALUE, 0); + if (x <= 0) + break; // error + } else { + int in_size = x; + int consumed = ds_parse(sh_audio->ds, &start, &x, pts, 0); + sh_audio->ds->buffer_pos -= in_size - consumed; + } av_init_packet(&pkt); pkt.data = start; pkt.size = x; @@ -178,7 +188,8 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m y=avcodec_decode_audio3(sh_audio->context,(int16_t*)buf,&len2,&pkt); //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; } - if(y<x) sh_audio->ds->buffer_pos+=y-x; // put back data (HACK!) + if(!sh_audio->needs_parsing && y<x) + sh_audio->ds->buffer_pos+=y-x; // put back data (HACK!) if(len2>0){ if (((AVCodecContext *)sh_audio->context)->channels >= 5) { int samplesize = av_get_bits_per_sample_format(((AVCodecContext *) |