diff options
author | Matthew Waters <matthew@centricular.com> | 2015-05-21 00:56:01 +1000 |
---|---|---|
committer | Matthew Waters <matthew@centricular.com> | 2015-05-21 01:04:38 +1000 |
commit | d1419afef1521777a227eb5c83d4be4ccc405ef2 (patch) | |
tree | f51874e03901e2065bcb21fb05444588d4da4edd | |
parent | 69c09c38cf7f086835c2d4c07531eed30b5ebfdf (diff) | |
download | gstreamer-plugins-bad-d1419afef1521777a227eb5c83d4be4ccc405ef2.tar.gz |
compositor/glvideomixer: fix up par handling
We were using the wrong formula
https://bugzilla.gnome.org/show_bug.cgi?id=749634
-rw-r--r-- | ext/gl/gstglvideomixer.c | 15 | ||||
-rw-r--r-- | gst/compositor/compositor.c | 15 |
2 files changed, 16 insertions, 14 deletions
diff --git a/ext/gl/gstglvideomixer.c b/ext/gl/gstglvideomixer.c index d27396f4c..148c70261 100644 --- a/ext/gl/gstglvideomixer.c +++ b/ext/gl/gstglvideomixer.c @@ -628,7 +628,7 @@ _mixer_pad_get_output_size (GstGLVideoMixer * mix, GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (mix); GstVideoAggregatorPad *vagg_pad = GST_VIDEO_AGGREGATOR_PAD (mix_pad); gint pad_width, pad_height; - gint dar_n, dar_d; + guint dar_n, dar_d; pad_width = mix_pad->width <= @@ -637,21 +637,22 @@ _mixer_pad_get_output_size (GstGLVideoMixer * mix, mix_pad->height <= 0 ? GST_VIDEO_INFO_HEIGHT (&vagg_pad->info) : mix_pad->height; - gst_util_fraction_multiply (GST_VIDEO_INFO_PAR_N (&vagg_pad->info), + gst_video_calculate_display_ratio (&dar_n, &dar_d, pad_width, pad_height, + GST_VIDEO_INFO_PAR_N (&vagg_pad->info), GST_VIDEO_INFO_PAR_D (&vagg_pad->info), - GST_VIDEO_INFO_PAR_D (&vagg->info), GST_VIDEO_INFO_PAR_N (&vagg->info), - &dar_n, &dar_d); + GST_VIDEO_INFO_PAR_N (&vagg->info), GST_VIDEO_INFO_PAR_D (&vagg->info) + ); GST_LOG_OBJECT (mix_pad, "scaling %ux%u by %u/%u (%u/%u / %u/%u)", pad_width, pad_height, dar_n, dar_d, GST_VIDEO_INFO_PAR_N (&vagg_pad->info), GST_VIDEO_INFO_PAR_D (&vagg_pad->info), GST_VIDEO_INFO_PAR_N (&vagg->info), GST_VIDEO_INFO_PAR_D (&vagg->info)); if (pad_height % dar_n == 0) { - pad_height = gst_util_uint64_scale_int (pad_width, dar_n, dar_d); + pad_width = gst_util_uint64_scale_int (pad_height, dar_n, dar_d); } else if (pad_width % dar_d == 0) { - pad_width = gst_util_uint64_scale_int (pad_height, dar_d, dar_n); + pad_height = gst_util_uint64_scale_int (pad_width, dar_d, dar_n); } else { - pad_height = gst_util_uint64_scale_int (pad_width, dar_n, dar_d); + pad_width = gst_util_uint64_scale_int (pad_height, dar_n, dar_d); } if (width) diff --git a/gst/compositor/compositor.c b/gst/compositor/compositor.c index 942c48036..dd1ba7071 100644 --- a/gst/compositor/compositor.c +++ b/gst/compositor/compositor.c @@ -221,7 +221,7 @@ _mixer_pad_get_output_size (GstCompositor * comp, GstVideoAggregator *vagg = GST_VIDEO_AGGREGATOR (comp); GstVideoAggregatorPad *vagg_pad = GST_VIDEO_AGGREGATOR_PAD (comp_pad); gint pad_width, pad_height; - gint dar_n, dar_d; + guint dar_n, dar_d; pad_width = comp_pad->width <= @@ -230,21 +230,22 @@ _mixer_pad_get_output_size (GstCompositor * comp, comp_pad->height <= 0 ? GST_VIDEO_INFO_HEIGHT (&vagg_pad->info) : comp_pad->height; - gst_util_fraction_multiply (GST_VIDEO_INFO_PAR_N (&vagg_pad->info), + gst_video_calculate_display_ratio (&dar_n, &dar_d, pad_width, pad_height, + GST_VIDEO_INFO_PAR_N (&vagg_pad->info), GST_VIDEO_INFO_PAR_D (&vagg_pad->info), - GST_VIDEO_INFO_PAR_D (&vagg->info), GST_VIDEO_INFO_PAR_N (&vagg->info), - &dar_n, &dar_d); + GST_VIDEO_INFO_PAR_N (&vagg->info), GST_VIDEO_INFO_PAR_D (&vagg->info) + ); GST_LOG_OBJECT (comp_pad, "scaling %ux%u by %u/%u (%u/%u / %u/%u)", pad_width, pad_height, dar_n, dar_d, GST_VIDEO_INFO_PAR_N (&vagg_pad->info), GST_VIDEO_INFO_PAR_D (&vagg_pad->info), GST_VIDEO_INFO_PAR_N (&vagg->info), GST_VIDEO_INFO_PAR_D (&vagg->info)); if (pad_height % dar_n == 0) { - pad_height = gst_util_uint64_scale_int (pad_width, dar_n, dar_d); + pad_width = gst_util_uint64_scale_int (pad_height, dar_n, dar_d); } else if (pad_width % dar_d == 0) { - pad_width = gst_util_uint64_scale_int (pad_height, dar_d, dar_n); + pad_height = gst_util_uint64_scale_int (pad_width, dar_d, dar_n); } else { - pad_height = gst_util_uint64_scale_int (pad_width, dar_n, dar_d); + pad_width = gst_util_uint64_scale_int (pad_height, dar_n, dar_d); } if (width) |