1
0
mirror of https://github.com/mpv-player/mpv synced 2025-05-04 01:00:14 +00:00

reinit the vo when aspect ratio changes; patch by C.E. Hoyos approved by Michael

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22295 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
nicodvb 2007-02-20 20:09:29 +00:00
parent 87cb56fa1f
commit e32cbbf7dc

View File

@ -39,7 +39,6 @@ typedef struct {
AVCodecContext *avctx; AVCodecContext *avctx;
AVFrame *pic; AVFrame *pic;
enum PixelFormat pix_fmt; enum PixelFormat pix_fmt;
float last_aspect;
int do_slices; int do_slices;
int do_dr1; int do_dr1;
int vo_inited; int vo_inited;
@ -51,6 +50,7 @@ typedef struct {
double inv_qp_sum; double inv_qp_sum;
int ip_count; int ip_count;
int b_count; int b_count;
AVRational last_sample_aspect_ratio;
} vd_ffmpeg_ctx; } vd_ffmpeg_ctx;
//#ifdef USE_LIBPOSTPROC //#ifdef USE_LIBPOSTPROC
@ -411,7 +411,6 @@ static int init(sh_video_t *sh){
return 0; return 0;
} }
mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: libavcodec init OK!\n"); mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: libavcodec init OK!\n");
ctx->last_aspect=-3;
return 1; //mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12); return 1; //mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12);
} }
@ -498,17 +497,15 @@ static int init_vo(sh_video_t *sh, enum PixelFormat pix_fmt){
// it is possible another vo buffers to be used after vo config() // it is possible another vo buffers to be used after vo config()
// lavc reset its buffers on width/heigh change but not on aspect change!!! // lavc reset its buffers on width/heigh change but not on aspect change!!!
if (// aspect != ctx->last_aspect || if (av_cmp_q(avctx->sample_aspect_ratio, ctx->last_sample_aspect_ratio) ||
width != sh->disp_w || width != sh->disp_w ||
height != sh->disp_h || height != sh->disp_h ||
pix_fmt != ctx->pix_fmt || pix_fmt != ctx->pix_fmt ||
!ctx->vo_inited) !ctx->vo_inited)
{ {
mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] aspect_ratio: %f\n", aspect); mp_msg(MSGT_DECVIDEO, MSGL_V, "[ffmpeg] aspect_ratio: %f\n", aspect);
ctx->last_aspect = aspect; ctx->last_sample_aspect_ratio = avctx->sample_aspect_ratio;
// if(ctx->last_aspect>=0.01 && ctx->last_aspect<100) sh->aspect = aspect;
if(sh->aspect==0.0)
sh->aspect = ctx->last_aspect;
sh->disp_w = width; sh->disp_w = width;
sh->disp_h = height; sh->disp_h = height;
ctx->pix_fmt = pix_fmt; ctx->pix_fmt = pix_fmt;