[vlc-commits] core/picture: use visible size in picture_Export
Thomas Guillem
git at videolan.org
Thu Dec 29 09:37:11 CET 2016
vlc/vlc-2.2 | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Dec 29 09:29:22 2016 +0100| [5d4e7f86f3935e5a6db0ba4ede5f5f8d54d00a38] | committer: Jean-Baptiste Kempf
core/picture: use visible size in picture_Export
Fix #16789
(cherry picked from commit 04335a2fdf70cd33995afe081c0cf004ef39d6cd)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=5d4e7f86f3935e5a6db0ba4ede5f5f8d54d00a38
---
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 d7cc482..59a3fa8 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -396,17 +396,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;
}
/* */
@@ -418,13 +427,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 );
More information about the vlc-commits
mailing list