1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-18 12:55:16 +00:00

Avoid reinit of vo with the exactly same parameters over and over.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26009 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2008-02-16 14:31:34 +00:00
parent c19d8bdef2
commit 539ab7489e

View File

@ -32,6 +32,10 @@ typedef struct {
mpeg2dec_t *mpeg2dec;
int quant_store_idx;
char *quant_store[3];
int imgfmt;
int width;
int height;
double aspect;
} vd_libmpeg2_ctx_t;
// to set/get/query special features/parameters
@ -157,6 +161,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
int type, use_callback;
mp_image_t* mpi_new;
unsigned long pw, ph;
int imgfmt;
switch(state){
case STATE_BUFFER:
@ -176,15 +181,24 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
// video parameters initialized/changed, (re)init libvo:
if (info->sequence->width >> 1 == info->sequence->chroma_width &&
info->sequence->height >> 1 == info->sequence->chroma_height) {
if(!mpcodecs_config_vo(sh,
info->sequence->picture_width,
info->sequence->picture_height, IMGFMT_YV12)) return 0;
imgfmt = IMGFMT_YV12;
} else if (info->sequence->width >> 1 == info->sequence->chroma_width &&
info->sequence->height == info->sequence->chroma_height) {
if(!mpcodecs_config_vo(sh,
info->sequence->picture_width,
info->sequence->picture_height, IMGFMT_422P)) return 0;
imgfmt = IMGFMT_422P;
} else return 0;
if (imgfmt == context->imgfmt &&
info->sequence->picture_width == context->width &&
info->sequence->picture_height == context->height &&
sh->aspect == context->aspect)
break;
if(!mpcodecs_config_vo(sh,
info->sequence->picture_width,
info->sequence->picture_height, imgfmt))
return 0;
context->imgfmt = imgfmt;
context->width = info->sequence->picture_width;
context->height = info->sequence->picture_height;
context->aspect = sh->aspect;
break;
case STATE_PICTURE:
type=info->current_picture->flags&PIC_MASK_CODING_TYPE;