return FALSE;
return TRUE;
}
+
+/**
+ * gst_vaapi_display_get_rotation:
+ * @display: a #GstVaapiDisplay
+ *
+ * Returns the current VA @display rotation angle. If the VA driver
+ * does not support "rotation" display attribute, then the display is
+ * assumed to be un-rotated.
+ *
+ * Return value: the current #GstVaapiRotation value
+ */
+GstVaapiRotation
+gst_vaapi_display_get_rotation(GstVaapiDisplay *display)
+{
+ gint value;
+
+ g_return_val_if_fail(GST_VAAPI_IS_DISPLAY(display), GST_VAAPI_ROTATION_0);
+
+ if (!get_attribute(display, VADisplayAttribRotation, &value))
+ value = VA_ROTATION_NONE;
+ return to_GstVaapiRotation(value);
+}
+
+/**
+ * gst_vaapi_display_set_rotation:
+ * @display: a #GstVaapiDisplay
+ * @rotation: the #GstVaapiRotation value to set
+ *
+ * Sets the VA @display rotation angle to the supplied @rotation
+ * value. This function returns %FALSE if the rotation angle could not
+ * be set, e.g. the VA driver does not allow to change the display
+ * rotation angle.
+ *
+ * Return value: %TRUE if VA @display rotation angle could be changed
+ * to the requested value
+ */
+gboolean
+gst_vaapi_display_set_rotation(
+ GstVaapiDisplay *display,
+ GstVaapiRotation rotation
+)
+{
+ guint value;
+
+ g_return_val_if_fail(GST_VAAPI_IS_DISPLAY(display), FALSE);
+
+ value = from_GstVaapiRotation(rotation);
+ if (!set_attribute(display, VADisplayAttribRotation, value))
+ return FALSE;
+ return TRUE;
+}
GstVaapiRenderMode mode
);
+GstVaapiRotation
+gst_vaapi_display_get_rotation(GstVaapiDisplay *display);
+
+gboolean
+gst_vaapi_display_set_rotation(
+ GstVaapiDisplay *display,
+ GstVaapiRotation rotation
+);
+
G_END_DECLS
#endif /* GST_VAAPI_DISPLAY_H */
GST_VAAPI_RENDER_MODE_TEXTURE
};
+/**
+ * GstVaapiRotation:
+ * @GST_VAAPI_ROTATION_0: the VA display is not rotated.
+ * @GST_VAAPI_ROTATION_90: the VA display is rotated by 90°, clockwise.
+ * @GST_VAAPI_ROTATION_180: the VA display is rotated by 180°, clockwise.
+ * @GST_VAAPI_ROTATION_270: the VA display is rotated by 270°, clockwise.
+ */
+typedef enum _GstVaapiRotation GstVaapiRotation;
+enum _GstVaapiRotation {
+ GST_VAAPI_ROTATION_0 = 0,
+ GST_VAAPI_ROTATION_90 = 90,
+ GST_VAAPI_ROTATION_180 = 180,
+ GST_VAAPI_ROTATION_270 = 270,
+};
+
G_END_DECLS
#endif /* GST_VAAPI_TYPES_H */
#endif
return flags;
}
+
+/* Translate GstVaapiRotation value to VA-API rotation value */
+guint
+from_GstVaapiRotation(guint value)
+{
+ switch (value) {
+ case GST_VAAPI_ROTATION_0: return VA_ROTATION_NONE;
+ case GST_VAAPI_ROTATION_90: return VA_ROTATION_90;
+ case GST_VAAPI_ROTATION_180: return VA_ROTATION_180;
+ case GST_VAAPI_ROTATION_270: return VA_ROTATION_270;
+ }
+ GST_ERROR("unsupported GstVaapiRotation value %d", value);
+ return VA_ROTATION_NONE;
+}
+
+/* Translate VA-API rotation value to GstVaapiRotation value */
+guint
+to_GstVaapiRotation(guint value)
+{
+ switch (value) {
+ case VA_ROTATION_NONE: return GST_VAAPI_ROTATION_0;
+ case VA_ROTATION_90: return GST_VAAPI_ROTATION_90;
+ case VA_ROTATION_180: return GST_VAAPI_ROTATION_180;
+ case VA_ROTATION_270: return GST_VAAPI_ROTATION_270;
+ }
+ GST_ERROR("unsupported VA-API rotation value %d", value);
+ return GST_VAAPI_ROTATION_0;
+}
guint
to_GstVaapiSurfaceStatus(guint va_flags);
+G_GNUC_INTERNAL
+guint
+from_GstVaapiRotation(guint value);
+
+G_GNUC_INTERNAL
+guint
+to_GstVaapiRotation(guint value);
+
#endif /* GST_VAAPI_UTILS_H */
}
return render_mode_type;
}
+
+/* --- GstVaapiRotation --- */
+
+GType
+gst_vaapi_rotation_get_type(void)
+{
+ static GType g_type = 0;
+
+ static const GEnumValue rotation_values[] = {
+ { GST_VAAPI_ROTATION_0,
+ "Unrotated mode", "0" },
+ { GST_VAAPI_ROTATION_90,
+ "Rotated by 90°, clockwise", "90" },
+ { GST_VAAPI_ROTATION_180,
+ "Rotated by 180°, clockwise", "180" },
+ { GST_VAAPI_ROTATION_270,
+ "Rotated by 270°, clockwise", "270" },
+ };
+
+ if (!g_type)
+ g_type = g_enum_register_static("GstVaapiRotation", rotation_values);
+ return g_type;
+}
*/
#define GST_VAAPI_TYPE_RENDER_MODE gst_vaapi_render_mode_get_type()
+/**
+ * GST_VAAPI_TYPE_ROTATION:
+ *
+ * A type that represents the VA display rotation.
+ *
+ * Return value: the #GType of GstVaapiRotation
+ */
+#define GST_VAAPI_TYPE_ROTATION gst_vaapi_rotation_get_type()
+
GType
gst_vaapi_id_get_type(void) G_GNUC_CONST;
GType
gst_vaapi_render_mode_get_type(void) G_GNUC_CONST;
+GType
+gst_vaapi_rotation_get_type(void) G_GNUC_CONST;
+
G_END_DECLS
#endif /* GST_VAAPI_VALUE_H */