Mercurial > mplayer.hg
diff libmpcodecs/ad_ffmpeg.c @ 11977:efb37725d616
flushing stuff after seeking (finally we can view MPEG without thouse blocks after seeking with -vc ffmpeg12)
| author | michael |
|---|---|
| date | Wed, 18 Feb 2004 15:23:41 +0000 |
| parents | 3b3b7b6fdb22 |
| children | 73261fb64be5 |
line wrap: on
line diff
--- a/libmpcodecs/ad_ffmpeg.c Wed Feb 18 13:34:41 2004 +0000 +++ b/libmpcodecs/ad_ffmpeg.c Wed Feb 18 15:23:41 2004 +0000 @@ -126,8 +126,13 @@ static int control(sh_audio_t *sh,int cmd,void* arg, ...) { - // TODO ??? - return CONTROL_UNKNOWN; + AVCodecContext *lavc_context = sh->context; + switch(cmd){ + case ADCTRL_RESYNC_STREAM: + avcodec_flush_buffers(lavc_context); + return CONTROL_TRUE; + } + return CONTROL_UNKNOWN; } static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int maxlen) @@ -139,6 +144,7 @@ int x=ds_get_packet(sh_audio->ds,&start); if(x<=0) break; // error y=avcodec_decode_audio(sh_audio->context,(INT16*)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; } if(y<x) sh_audio->ds->buffer_pos+=y-x; // put back data (HACK!) if(len2>0){
