summaryrefslogtreecommitdiff
path: root/gst-libs/gst
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-08-28 10:55:59 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-08-28 16:28:49 +0200
commit9c714cf7a0fdec91d79090a7e7b83073228a43c1 (patch)
tree765f4c56e1784dc8f105b4345dc91976e9a65658 /gst-libs/gst
parentfe4ad408dce29cfbbec20d9871b8f71cced1d5c3 (diff)
display: expose display attributes as GObject properties.
Expose VA display "render-mode" and "rotation" attributes as standard GObject properties.
Diffstat (limited to 'gst-libs/gst')
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay.c54
-rw-r--r--gst-libs/gst/vaapi/gstvaapidisplay.h8
2 files changed, 57 insertions, 5 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay.c b/gst-libs/gst/vaapi/gstvaapidisplay.c
index ae52b867..7abda6d1 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay.c
+++ b/gst-libs/gst/vaapi/gstvaapidisplay.c
@@ -28,6 +28,7 @@
#include "sysdeps.h"
#include <string.h>
#include "gstvaapiutils.h"
+#include "gstvaapivalue.h"
#include "gstvaapidisplay.h"
#include "gstvaapidisplay_priv.h"
#include "gstvaapiworkarounds.h"
@@ -51,9 +52,8 @@ struct _GstVaapiProperty {
VADisplayAttribute attribute;
};
-/* XXX: export property names when the API is stable enough */
-#define GST_VAAPI_DISPLAY_PROP_RENDER_MODE "render-mode"
-#define GST_VAAPI_DISPLAY_PROP_ROTATION "rotation"
+#define DEFAULT_RENDER_MODE GST_VAAPI_RENDER_MODE_TEXTURE
+#define DEFAULT_ROTATION GST_VAAPI_ROTATION_0
enum {
PROP_0,
@@ -62,6 +62,8 @@ enum {
PROP_DISPLAY_TYPE,
PROP_WIDTH,
PROP_HEIGHT,
+ PROP_RENDER_MODE,
+ PROP_ROTATION,
N_PROPERTIES
};
@@ -713,6 +715,12 @@ gst_vaapi_display_set_property(
case PROP_DISPLAY_TYPE:
display->priv->display_type = g_value_get_enum(value);
break;
+ case PROP_RENDER_MODE:
+ gst_vaapi_display_set_render_mode(display, g_value_get_enum(value));
+ break;
+ case PROP_ROTATION:
+ gst_vaapi_display_set_rotation(display, g_value_get_enum(value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -742,6 +750,16 @@ gst_vaapi_display_get_property(
case PROP_HEIGHT:
g_value_set_uint(value, gst_vaapi_display_get_height(display));
break;
+ case PROP_RENDER_MODE: {
+ GstVaapiRenderMode mode;
+ if (!gst_vaapi_display_get_render_mode(display, &mode))
+ mode = DEFAULT_RENDER_MODE;
+ g_value_set_enum(value, mode);
+ break;
+ }
+ case PROP_ROTATION:
+ g_value_set_enum(value, gst_vaapi_display_get_rotation(display));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
@@ -809,6 +827,32 @@ gst_vaapi_display_class_init(GstVaapiDisplayClass *klass)
1, G_MAXUINT32, 1,
G_PARAM_READABLE);
+ /**
+ * GstVaapiDisplay:render-mode:
+ *
+ * The VA display rendering mode, expressed as a #GstVaapiRenderMode.
+ */
+ g_properties[PROP_RENDER_MODE] =
+ g_param_spec_enum(GST_VAAPI_DISPLAY_PROP_RENDER_MODE,
+ "render mode",
+ "The display rendering mode",
+ GST_VAAPI_TYPE_RENDER_MODE,
+ DEFAULT_RENDER_MODE,
+ G_PARAM_READWRITE);
+
+ /**
+ * GstVaapiDisplay:rotation:
+ *
+ * The VA display rotation mode, expressed as a #GstVaapiRotation.
+ */
+ g_properties[PROP_ROTATION] =
+ g_param_spec_enum(GST_VAAPI_DISPLAY_PROP_ROTATION,
+ "rotation",
+ "The display rotation mode",
+ GST_VAAPI_TYPE_ROTATION,
+ DEFAULT_ROTATION,
+ G_PARAM_READWRITE);
+
g_object_class_install_properties(object_class, N_PROPERTIES, g_properties);
}
@@ -1348,7 +1392,7 @@ get_render_mode_default(
#endif
default:
/* This includes VA/X11 and VA/GLX modes */
- *pmode = GST_VAAPI_RENDER_MODE_TEXTURE;
+ *pmode = DEFAULT_RENDER_MODE;
break;
}
return TRUE;
@@ -1445,7 +1489,7 @@ gst_vaapi_display_get_rotation(GstVaapiDisplay *display)
{
gint value;
- g_return_val_if_fail(GST_VAAPI_IS_DISPLAY(display), GST_VAAPI_ROTATION_0);
+ g_return_val_if_fail(GST_VAAPI_IS_DISPLAY(display), DEFAULT_ROTATION);
if (!get_attribute(display, VADisplayAttribRotation, &value))
value = VA_ROTATION_NONE;
diff --git a/gst-libs/gst/vaapi/gstvaapidisplay.h b/gst-libs/gst/vaapi/gstvaapidisplay.h
index 6dac4c5f..a855aee5 100644
--- a/gst-libs/gst/vaapi/gstvaapidisplay.h
+++ b/gst-libs/gst/vaapi/gstvaapidisplay.h
@@ -97,6 +97,14 @@ struct _GstVaapiDisplayInfo {
};
/**
+ * GstVaapiDisplayProperties:
+ * @GST_VAAPI_DISPLAY_PROP_RENDER_MODE: rendering mode (#GstVaapiRenderMode).
+ * @GST_VAAPI_DISPLAY_PROP_ROTATION: rotation angle (#GstVaapiRotation).
+ */
+#define GST_VAAPI_DISPLAY_PROP_RENDER_MODE "render-mode"
+#define GST_VAAPI_DISPLAY_PROP_ROTATION "rotation"
+
+/**
* GstVaapiDisplay:
*
* Base class for VA displays.