Update for gplay not set video-sink by default

MMFMWK-7883
- Add video-direction property in set-rotate
- Update get video-sink for autoplug video-sink case
- Add kmssink priority logic
- kmssink include gstimxcommon.h

Signed-off-by: Lyon Wang <lyon.wang@nxp.com>
diff --git a/gst-libs/gst/player/gstplayer.c b/gst-libs/gst/player/gstplayer.c
index c975561..438a916 100644
--- a/gst-libs/gst/player/gstplayer.c
+++ b/gst-libs/gst/player/gstplayer.c
@@ -4797,6 +4797,8 @@
     GST_WARNING_OBJECT (self, "No video-sink found");
     return NULL;
   }
+  if (TRUE != GST_IS_BIN((GstBin*) sink))
+     return sink;
   it = gst_bin_iterate_sinks ((GstBin *) sink);
   do {
     rc = gst_iterator_next (it, &item);
@@ -4848,6 +4850,9 @@
     g_object_set (G_OBJECT (video_sink), "reconfig", 1, NULL);
   } else if (g_object_class_find_property (gobjclass, "rotate-method")) {
     g_object_set (G_OBJECT (video_sink), "rotate-method", rotation / 90, NULL);
+  }  else if (g_object_class_find_property (gobjclass, "video-direction")) {
+    g_object_set (G_OBJECT (video_sink), "video-direction", rotation / 90, NULL);
+    g_object_set (G_OBJECT (video_sink), "reconfig", 1, NULL);
   } else {
     GST_INFO_OBJECT (self, "can't set rotation for current video sink %s'",
         gst_element_get_name (video_sink));
@@ -4885,6 +4890,9 @@
   } else if (g_object_class_find_property (gobjclass, "rotate-method")) {
     g_object_get (G_OBJECT (video_sink), "rotate-method", &rotation, NULL);
     rotation = rotation * 90;
+  }   else if (g_object_class_find_property (gobjclass, "video-direction")) {
+    g_object_get (G_OBJECT (video_sink), "video-direction", &rotation, NULL);
+    rotation = rotation * 90;
   }
 
   GST_DEBUG_OBJECT (self, "get rotation degree '%d'", rotation);
diff --git a/sys/kms/gstkmssink.c b/sys/kms/gstkmssink.c
index f842d71..457e7cd 100644
--- a/sys/kms/gstkmssink.c
+++ b/sys/kms/gstkmssink.c
@@ -59,6 +59,7 @@
 #include "gstkmsutils.h"
 #include "gstkmsbufferpool.h"
 #include "gstkmsallocator.h"
+#include "gstimxcommon.h"
 
 #include <gst/video/gstvideohdr10meta.h>
 
@@ -2106,7 +2107,16 @@
 static gboolean
 plugin_init (GstPlugin * plugin)
 {
-  if (!gst_element_register (plugin, GST_PLUGIN_NAME, GST_RANK_SECONDARY,
+  GstRank rank = GST_RANK_SECONDARY;
+
+  if (HAS_DPU()) {
+    if (HAS_VPU())
+      rank = IMX_GST_PLUGIN_RANK;
+  } else if (HAS_DCSS()) {
+    rank = IMX_GST_PLUGIN_RANK;
+  }
+
+  if (!gst_element_register (plugin, GST_PLUGIN_NAME, rank,
           GST_TYPE_KMS_SINK))
     return FALSE;