From 8593fb619c970143ddcacc798f4b5a5384c569db Mon Sep 17 00:00:00 2001 From: Holger Kaelberer Date: Tue, 7 Feb 2012 15:54:15 +0100 Subject: [PATCH] surfaceproxy: add TFF property. Add TFF (top-field-first) property to GstVaapiSurfaceProxy. Signed-off-by: Gwenole Beauchesne --- docs/reference/libs/libs-sections.txt | 2 ++ gst-libs/gst/vaapi/gstvaapisurfaceproxy.c | 51 ++++++++++++++++++++++++++++++- gst-libs/gst/vaapi/gstvaapisurfaceproxy.h | 15 +++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/docs/reference/libs/libs-sections.txt b/docs/reference/libs/libs-sections.txt index b4fd513..29fa8c0 100644 --- a/docs/reference/libs/libs-sections.txt +++ b/docs/reference/libs/libs-sections.txt @@ -499,6 +499,8 @@ gst_vaapi_surface_proxy_get_surface_id gst_vaapi_surface_proxy_set_surface gst_vaapi_surface_proxy_get_timestamp gst_vaapi_surface_proxy_set_timestamp +gst_vaapi_surface_proxy_get_tff +gst_vaapi_surface_proxy_set_tff GST_VAAPI_SURFACE_PROXY GST_VAAPI_IS_SURFACE_PROXY diff --git a/gst-libs/gst/vaapi/gstvaapisurfaceproxy.c b/gst-libs/gst/vaapi/gstvaapisurfaceproxy.c index 404583c..9b01ac3 100644 --- a/gst-libs/gst/vaapi/gstvaapisurfaceproxy.c +++ b/gst-libs/gst/vaapi/gstvaapisurfaceproxy.c @@ -43,6 +43,7 @@ struct _GstVaapiSurfaceProxyPrivate { GstVaapiContext *context; GstVaapiSurface *surface; GstClockTime timestamp; + gboolean tff; }; enum { @@ -50,7 +51,8 @@ enum { PROP_CONTEXT, PROP_SURFACE, - PROP_TIMESTAMP + PROP_TIMESTAMP, + PROP_TFF }; static void @@ -84,6 +86,9 @@ gst_vaapi_surface_proxy_set_property( case PROP_TIMESTAMP: gst_vaapi_surface_proxy_set_timestamp(proxy, g_value_get_uint64(value)); break; + case PROP_TFF: + gst_vaapi_surface_proxy_set_tff(proxy, g_value_get_boolean(value)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -110,6 +115,9 @@ gst_vaapi_surface_proxy_get_property( case PROP_TIMESTAMP: g_value_set_uint64(value, gst_vaapi_surface_proxy_get_timestamp(proxy)); break; + case PROP_TFF: + g_value_set_boolean(value, gst_vaapi_surface_proxy_get_tff(proxy)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); break; @@ -151,6 +159,15 @@ gst_vaapi_surface_proxy_class_init(GstVaapiSurfaceProxyClass *klass) "The presentation time of the surface", 0, G_MAXUINT64, GST_CLOCK_TIME_NONE, G_PARAM_READWRITE)); + + g_object_class_install_property + (object_class, + PROP_TFF, + g_param_spec_boolean("tff", + "Top-Field-First", + "Flag indicating for interlaced surfaces whether Top Field is First", + FALSE, + G_PARAM_READWRITE)); } static void @@ -163,6 +180,7 @@ gst_vaapi_surface_proxy_init(GstVaapiSurfaceProxy *proxy) priv->context = NULL; priv->surface = NULL; priv->timestamp = GST_CLOCK_TIME_NONE; + priv->tff = FALSE; } /** @@ -332,3 +350,34 @@ gst_vaapi_surface_proxy_set_timestamp( proxy->priv->timestamp = timestamp; } + +/** + * gst_vaapi_surface_proxy_get_tff: + * @proxy: a #GstVaapiSurfaceProxy + * + * Returns the TFF flag of the #GstVaapiSurface held by @proxy. + * + * Return value: the TFF flag of the surface + */ +gboolean +gst_vaapi_surface_proxy_get_tff(GstVaapiSurfaceProxy *proxy) +{ + g_return_val_if_fail(GST_VAAPI_IS_SURFACE_PROXY(proxy), FALSE); + + return proxy->priv->tff; +} + +/** + * gst_vaapi_surface_proxy_set_tff: + * @proxy: a #GstVaapiSurfaceProxy + * @tff: the new value of the TFF flag + * + * Sets the TFF flag of the @proxy surface to @tff. + */ +void +gst_vaapi_surface_proxy_set_tff(GstVaapiSurfaceProxy *proxy, gboolean tff) +{ + g_return_if_fail(GST_VAAPI_IS_SURFACE_PROXY(proxy)); + + proxy->priv->tff = tff; +} diff --git a/gst-libs/gst/vaapi/gstvaapisurfaceproxy.h b/gst-libs/gst/vaapi/gstvaapisurfaceproxy.h index 6cc4dea..a6d9630 100644 --- a/gst-libs/gst/vaapi/gstvaapisurfaceproxy.h +++ b/gst-libs/gst/vaapi/gstvaapisurfaceproxy.h @@ -72,6 +72,15 @@ G_BEGIN_DECLS #define GST_VAAPI_SURFACE_PROXY_TIMESTAMP(surface) \ gst_vaapi_surface_proxy_get_timestamp(surface) +/** + * GST_VAAPI_SURFACE_PROXY_TFF: + * @surface: a #GstVaapiSurfaceProxy + * + * Macro that evaluates to the tff flag of the @surface + */ +#define GST_VAAPI_SURFACE_PROXY_TFF(surface) \ + gst_vaapi_surface_proxy_get_tff(surface) + typedef struct _GstVaapiSurfaceProxy GstVaapiSurfaceProxy; typedef struct _GstVaapiSurfaceProxyPrivate GstVaapiSurfaceProxyPrivate; typedef struct _GstVaapiSurfaceProxyClass GstVaapiSurfaceProxyClass; @@ -134,6 +143,12 @@ gst_vaapi_surface_proxy_set_timestamp( GstClockTime timestamp ); +gboolean +gst_vaapi_surface_proxy_get_tff(GstVaapiSurfaceProxy *proxy); + +void +gst_vaapi_surface_proxy_set_tff(GstVaapiSurfaceProxy *proxy, gboolean tff); + G_END_DECLS #endif /* GST_VAAPI_SURFACE_PROXY_H */ -- 2.7.4