mirror of
https://github.com/mpv-player/mpv
synced 2025-04-08 02:22:47 +00:00
config vo only if aspect really changed and width&&height isn't changed (if w||h changes, we set it later)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@5458 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
08a6768fda
commit
e8236a8ab6
@ -32,7 +32,6 @@ LIBVD_EXTERN(ffmpeg)
|
|||||||
int avcodec_inited=0;
|
int avcodec_inited=0;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
AVCodec *lavc_codec;
|
|
||||||
AVCodecContext *avctx;
|
AVCodecContext *avctx;
|
||||||
int last_aspect;
|
int last_aspect;
|
||||||
} vd_ffmpeg_ctx;
|
} vd_ffmpeg_ctx;
|
||||||
@ -50,6 +49,7 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){
|
|||||||
static int init(sh_video_t *sh){
|
static int init(sh_video_t *sh){
|
||||||
AVCodecContext *avctx;
|
AVCodecContext *avctx;
|
||||||
vd_ffmpeg_ctx *ctx;
|
vd_ffmpeg_ctx *ctx;
|
||||||
|
AVCodec *lavc_codec;
|
||||||
|
|
||||||
if(!avcodec_inited){
|
if(!avcodec_inited){
|
||||||
avcodec_init();
|
avcodec_init();
|
||||||
@ -62,8 +62,8 @@ static int init(sh_video_t *sh){
|
|||||||
return(0);
|
return(0);
|
||||||
memset(ctx, 0, sizeof(vd_ffmpeg_ctx));
|
memset(ctx, 0, sizeof(vd_ffmpeg_ctx));
|
||||||
|
|
||||||
ctx->lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh->codec->dll);
|
lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh->codec->dll);
|
||||||
if(!ctx->lavc_codec){
|
if(!lavc_codec){
|
||||||
mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh->codec->dll);
|
mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh->codec->dll);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ static int init(sh_video_t *sh){
|
|||||||
if (sh->format == mmioFOURCC('R', 'V', '1', '3'))
|
if (sh->format == mmioFOURCC('R', 'V', '1', '3'))
|
||||||
avctx->sub_id = 3;
|
avctx->sub_id = 3;
|
||||||
/* open it */
|
/* open it */
|
||||||
if (avcodec_open(avctx, ctx->lavc_codec) < 0) {
|
if (avcodec_open(avctx, lavc_codec) < 0) {
|
||||||
mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantOpenCodec);
|
mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantOpenCodec);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -136,6 +136,10 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
|||||||
sh->aspect = 0.0;
|
sh->aspect = 0.0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* config only if width && height isn't changed */
|
||||||
|
/* else it will config twice */
|
||||||
|
if ((sh->aspect > 0.01) && (avctx->width == sh->disp_w) &&
|
||||||
|
(avctx->height == sh->disp_h))
|
||||||
if (mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12))
|
if (mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12))
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user