mirror of
https://github.com/mpv-player/mpv
synced 2024-08-28 05:46:13 +02:00
flushing stuff after seeking (finally we can view MPEG without thouse blocks after seeking with -vc ffmpeg12)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11978 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
6f0edb4574
commit
14c5a7c333
@ -126,7 +126,12 @@ static void uninit(sh_audio_t *sh)
|
||||
|
||||
static int control(sh_audio_t *sh,int cmd,void* arg, ...)
|
||||
{
|
||||
// TODO ???
|
||||
AVCodecContext *lavc_context = sh->context;
|
||||
switch(cmd){
|
||||
case ADCTRL_RESYNC_STREAM:
|
||||
avcodec_flush_buffers(lavc_context);
|
||||
return CONTROL_TRUE;
|
||||
}
|
||||
return CONTROL_UNKNOWN;
|
||||
}
|
||||
|
||||
@ -139,6 +144,7 @@ static int decode_audio(sh_audio_t *sh_audio,unsigned char *buf,int minlen,int m
|
||||
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){
|
||||
|
@ -132,6 +132,11 @@ int set_rectangle(sh_video_t *sh_video,int param,int value)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void resync_video_stream(sh_video_t *sh_video)
|
||||
{
|
||||
if(mpvdec) mpvdec->control(sh_video, VDCTRL_RESYNC_STREAM, NULL);
|
||||
}
|
||||
|
||||
void uninit_video(sh_video_t *sh_video){
|
||||
if(!sh_video->inited) return;
|
||||
mp_msg(MSGT_DECVIDEO,MSGL_V,MSGTR_UninitVideoStr,sh_video->codec->drv);
|
||||
|
@ -18,5 +18,6 @@ extern void set_video_quality(sh_video_t *sh_video,int quality);
|
||||
extern int get_video_colors(sh_video_t *sh_video,char *item,int *value);
|
||||
extern int set_video_colors(sh_video_t *sh_video,char *item,int value);
|
||||
extern int set_rectangle(sh_video_t *sh_video,int param,int value);
|
||||
extern void resync_video_stream(sh_video_t *sh_video);
|
||||
|
||||
extern int divx_quality;
|
||||
|
@ -23,6 +23,7 @@ extern int vd_use_slices;
|
||||
#define VDCTRL_SET_PP_LEVEL 5 /* set postprocessing level */
|
||||
#define VDCTRL_SET_EQUALIZER 6 /* set color options (brightness,contrast etc) */
|
||||
#define VDCTRL_GET_EQUALIZER 7 /* get color options (brightness,contrast etc) */
|
||||
#define VDCTRL_RESYNC_STREAM 8 /* seeking */
|
||||
|
||||
// callbacks:
|
||||
int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int preferred_outfmt);
|
||||
|
@ -138,6 +138,10 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){
|
||||
}
|
||||
return CONTROL_FALSE;
|
||||
}
|
||||
break;
|
||||
case VDCTRL_RESYNC_STREAM:
|
||||
avcodec_flush_buffers(avctx);
|
||||
return CONTROL_TRUE;
|
||||
}
|
||||
return CONTROL_UNKNOWN;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user