summaryrefslogtreecommitdiff
path: root/sys/msdk/gstmsdkvpputil.c
diff options
context:
space:
mode:
authorU. Artie Eoff <ullysses.a.eoff@intel.com>2019-08-21 10:46:43 -0700
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2019-08-22 18:17:30 +0000
commitbd3caf0c04393905e7316aefff5df4134bebd63d (patch)
tree54db95ac63fc54e27adb5b01db9adb301a7ab935 /sys/msdk/gstmsdkvpputil.c
parentb43651cf99b3316d3c0d61a8f05ffa5dec7b3370 (diff)
downloadgstreamer-plugins-bad-bd3caf0c04393905e7316aefff5df4134bebd63d.tar.gz
msdk: vpp: rotate output frame
When vpp rotation is 90 or 270, the output frame should be rotated, too. Example: gst-launch-1.0 -vf videotestsrc \ ! video/x-raw,width=720,height=480 \ ! msdkvpp rotation=90 ! vaapisink
Diffstat (limited to 'sys/msdk/gstmsdkvpputil.c')
-rw-r--r--sys/msdk/gstmsdkvpputil.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/msdk/gstmsdkvpputil.c b/sys/msdk/gstmsdkvpputil.c
index eef85ed17..402aaeb2c 100644
--- a/sys/msdk/gstmsdkvpputil.c
+++ b/sys/msdk/gstmsdkvpputil.c
@@ -28,6 +28,10 @@
#include "gstmsdkvpputil.h"
#include "msdk-enums.h"
+#define SWAP_GINT(a, b) do { \
+ const gint t = a; a = b; b = t; \
+ } while (0)
+
gboolean
gst_msdkvpp_is_deinterlace_enabled (GstMsdkVPP * msdkvpp, GstVideoInfo * vip)
{
@@ -75,6 +79,12 @@ fixate_output_frame_size (GstMsdkVPP * thiz, GstVideoInfo * vinfo,
from_w = GST_VIDEO_INFO_WIDTH (vinfo);
from_h = GST_VIDEO_INFO_HEIGHT (vinfo);
+ /* compensate for rotation if needed */
+ if (thiz->rotation == 90 || thiz->rotation == 270) {
+ SWAP_GINT (from_w, from_h);
+ SWAP_GINT (from_par_n, from_par_d);
+ }
+
gst_structure_get_int (outs, "width", &w);
gst_structure_get_int (outs, "height", &h);