vlc | branch: master | Maxim Bublis <[email protected]> | Fri Jan 24 18:08:51 2014 +0400| [e3b809c1e4d16d858732d467b5ecd10b81d16db8] | committer: Jean-Baptiste Kempf
misc/image: fixed overwriting of correct visible dimensions In some cases fmt_in already contains correct i_visible_width and i_visible_height values. This patch fixes incorrect overwriting of valid values. Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e3b809c1e4d16d858732d467b5ecd10b81d16db8 --- src/misc/image.c | 49 +++++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/src/misc/image.c b/src/misc/image.c index 6489259..c399b8b 100644 --- a/src/misc/image.c +++ b/src/misc/image.c @@ -707,34 +707,39 @@ static encoder_t *CreateEncoder( vlc_object_t *p_this, video_format_t *fmt_in, p_enc->p_module = NULL; es_format_Init( &p_enc->fmt_in, VIDEO_ES, fmt_in->i_chroma ); p_enc->fmt_in.video = *fmt_in; - if( fmt_out->i_width > 0 && fmt_out->i_height > 0 ) - { - p_enc->fmt_in.video.i_width = fmt_out->i_width; - p_enc->fmt_in.video.i_height = fmt_out->i_height; - if( fmt_out->i_visible_width > 0 && - fmt_out->i_visible_height > 0 ) + if( p_enc->fmt_in.video.i_visible_width == 0 || + p_enc->fmt_in.video.i_visible_height == 0 ) + { + if( fmt_out->i_width > 0 && fmt_out->i_height > 0 ) { - p_enc->fmt_in.video.i_visible_width = fmt_out->i_visible_width; - p_enc->fmt_in.video.i_visible_height = fmt_out->i_visible_height; + p_enc->fmt_in.video.i_width = fmt_out->i_width; + p_enc->fmt_in.video.i_height = fmt_out->i_height; + + if( fmt_out->i_visible_width > 0 && + fmt_out->i_visible_height > 0 ) + { + p_enc->fmt_in.video.i_visible_width = fmt_out->i_visible_width; + p_enc->fmt_in.video.i_visible_height = fmt_out->i_visible_height; + } + else + { + p_enc->fmt_in.video.i_visible_width = fmt_out->i_width; + p_enc->fmt_in.video.i_visible_height = fmt_out->i_height; + } } - else + else if( fmt_out->i_sar_num && fmt_out->i_sar_den && + fmt_out->i_sar_num * fmt_in->i_sar_den != + fmt_out->i_sar_den * fmt_in->i_sar_num ) { - p_enc->fmt_in.video.i_visible_width = fmt_out->i_width; - p_enc->fmt_in.video.i_visible_height = fmt_out->i_height; + p_enc->fmt_in.video.i_width = + fmt_in->i_sar_num * (int64_t)fmt_out->i_sar_den * fmt_in->i_width / + fmt_in->i_sar_den / fmt_out->i_sar_num; + p_enc->fmt_in.video.i_visible_width = + fmt_in->i_sar_num * (int64_t)fmt_out->i_sar_den * + fmt_in->i_visible_width / fmt_in->i_sar_den / fmt_out->i_sar_num; } } - else if( fmt_out->i_sar_num && fmt_out->i_sar_den && - fmt_out->i_sar_num * fmt_in->i_sar_den != - fmt_out->i_sar_den * fmt_in->i_sar_num ) - { - p_enc->fmt_in.video.i_width = - fmt_in->i_sar_num * (int64_t)fmt_out->i_sar_den * fmt_in->i_width / - fmt_in->i_sar_den / fmt_out->i_sar_num; - p_enc->fmt_in.video.i_visible_width = - fmt_in->i_sar_num * (int64_t)fmt_out->i_sar_den * - fmt_in->i_visible_width / fmt_in->i_sar_den / fmt_out->i_sar_num; - } p_enc->fmt_in.video.i_frame_rate = 25; p_enc->fmt_in.video.i_frame_rate_base = 1; _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
