vlc | branch: master | Thomas Guillem <[email protected]> | Thu Dec 29 09:29:22 2016 +0100| [04335a2fdf70cd33995afe081c0cf004ef39d6cd] | committer: Thomas Guillem
core/picture: use visible size in picture_Export Fix #16789 > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=04335a2fdf70cd33995afe081c0cf004ef39d6cd --- src/misc/picture.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/src/misc/picture.c b/src/misc/picture.c index 43207ce..d0190cb 100644 --- a/src/misc/picture.c +++ b/src/misc/picture.c @@ -404,17 +404,26 @@ int picture_Export( vlc_object_t *p_obj, fmt_out.i_chroma = i_format; /* compute original width/height */ - unsigned int i_original_width; - unsigned int i_original_height; + unsigned int i_width, i_height, i_original_width, i_original_height; + if( fmt_in.i_visible_width > 0 && fmt_in.i_visible_height > 0 ) + { + i_width = fmt_in.i_visible_width; + i_height = fmt_in.i_visible_height; + } + else + { + i_width = fmt_in.i_width; + i_height = fmt_in.i_height; + } if( fmt_in.i_sar_num >= fmt_in.i_sar_den ) { - i_original_width = (int64_t)fmt_in.i_width * fmt_in.i_sar_num / fmt_in.i_sar_den; - i_original_height = fmt_in.i_height; + i_original_width = (int64_t)i_width * fmt_in.i_sar_num / fmt_in.i_sar_den; + i_original_height = i_height; } else { - i_original_width = fmt_in.i_width; - i_original_height = (int64_t)fmt_in.i_height * fmt_in.i_sar_den / fmt_in.i_sar_num; + i_original_width = i_width; + i_original_height = i_height * fmt_in.i_sar_den / fmt_in.i_sar_num; } /* */ @@ -426,13 +435,13 @@ int picture_Export( vlc_object_t *p_obj, /* scale if only one direction is provided */ if( fmt_out.i_height == 0 && fmt_out.i_width > 0 ) { - fmt_out.i_height = fmt_in.i_height * fmt_out.i_width - * fmt_in.i_sar_den / fmt_in.i_width / fmt_in.i_sar_num; + fmt_out.i_height = i_height * fmt_out.i_width + * fmt_in.i_sar_den / fmt_in.i_width / fmt_in.i_sar_num; } else if( fmt_out.i_width == 0 && fmt_out.i_height > 0 ) { - fmt_out.i_width = fmt_in.i_width * fmt_out.i_height - * fmt_in.i_sar_num / fmt_in.i_height / fmt_in.i_sar_den; + fmt_out.i_width = i_width * fmt_out.i_height + * fmt_in.i_sar_num / fmt_in.i_height / fmt_in.i_sar_den; } image_handler_t *p_image = image_HandlerCreate( p_obj ); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
