mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 03:19:40 +00:00
surfaceproxy: add "duration" property.
This commit is contained in:
parent
a10b3d3032
commit
e4d27fba6b
2 changed files with 73 additions and 0 deletions
|
@ -43,6 +43,7 @@ struct _GstVaapiSurfaceProxyPrivate {
|
|||
GstVaapiContext *context;
|
||||
GstVaapiSurface *surface;
|
||||
GstClockTime timestamp;
|
||||
GstClockTime duration;
|
||||
guint is_interlaced : 1;
|
||||
guint tff : 1;
|
||||
};
|
||||
|
@ -53,6 +54,7 @@ enum {
|
|||
PROP_CONTEXT,
|
||||
PROP_SURFACE,
|
||||
PROP_TIMESTAMP,
|
||||
PROP_DURATION,
|
||||
PROP_INTERLACED,
|
||||
PROP_TFF
|
||||
};
|
||||
|
@ -88,6 +90,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_DURATION:
|
||||
gst_vaapi_surface_proxy_set_duration(proxy, g_value_get_uint64(value));
|
||||
break;
|
||||
case PROP_INTERLACED:
|
||||
gst_vaapi_surface_proxy_set_interlaced(proxy, g_value_get_boolean(value));
|
||||
break;
|
||||
|
@ -120,6 +125,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_DURATION:
|
||||
g_value_set_uint64(value, gst_vaapi_surface_proxy_get_duration(proxy));
|
||||
break;
|
||||
case PROP_INTERLACED:
|
||||
g_value_set_boolean(value, gst_vaapi_surface_proxy_get_interlaced(proxy));
|
||||
break;
|
||||
|
@ -168,6 +176,15 @@ gst_vaapi_surface_proxy_class_init(GstVaapiSurfaceProxyClass *klass)
|
|||
0, G_MAXUINT64, GST_CLOCK_TIME_NONE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class,
|
||||
PROP_DURATION,
|
||||
g_param_spec_uint64("duration",
|
||||
"Duration",
|
||||
"The amount of time the surface is to be presented",
|
||||
0, G_MAXUINT64, GST_CLOCK_TIME_NONE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class,
|
||||
PROP_INTERLACED,
|
||||
|
@ -197,6 +214,7 @@ gst_vaapi_surface_proxy_init(GstVaapiSurfaceProxy *proxy)
|
|||
priv->context = NULL;
|
||||
priv->surface = NULL;
|
||||
priv->timestamp = GST_CLOCK_TIME_NONE;
|
||||
priv->duration = GST_CLOCK_TIME_NONE;
|
||||
priv->is_interlaced = FALSE;
|
||||
priv->tff = FALSE;
|
||||
}
|
||||
|
@ -366,6 +384,42 @@ gst_vaapi_surface_proxy_set_timestamp(
|
|||
proxy->priv->timestamp = timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vaapi_surface_proxy_get_duration:
|
||||
* @proxy: a #GstVaapiSurfaceProxy
|
||||
*
|
||||
* Returns the presentation duration of the #GstVaapiSurface held by @proxy.
|
||||
*
|
||||
* Return value: the presentation duration of the surface, or
|
||||
* %GST_CLOCK_TIME_NONE is none was set
|
||||
*/
|
||||
GstClockTime
|
||||
gst_vaapi_surface_proxy_get_duration(GstVaapiSurfaceProxy *proxy)
|
||||
{
|
||||
g_return_val_if_fail(GST_VAAPI_IS_SURFACE_PROXY(proxy),
|
||||
GST_CLOCK_TIME_NONE);
|
||||
|
||||
return proxy->priv->duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vaapi_surface_proxy_set_duration:
|
||||
* @proxy: a #GstVaapiSurfaceProxy
|
||||
* @duration: the presentation duration of this surface as a #GstClockTime
|
||||
*
|
||||
* Sets the presentation duration of the @proxy surface to @duration.
|
||||
*/
|
||||
void
|
||||
gst_vaapi_surface_proxy_set_duration(
|
||||
GstVaapiSurfaceProxy *proxy,
|
||||
GstClockTime duration
|
||||
)
|
||||
{
|
||||
g_return_if_fail(GST_VAAPI_IS_SURFACE_PROXY(proxy));
|
||||
|
||||
proxy->priv->duration = duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vaapi_surface_proxy_get_interlaced:
|
||||
* @proxy: a #GstVaapiSurfaceProxy
|
||||
|
|
|
@ -72,6 +72,16 @@ G_BEGIN_DECLS
|
|||
#define GST_VAAPI_SURFACE_PROXY_TIMESTAMP(surface) \
|
||||
gst_vaapi_surface_proxy_get_timestamp(surface)
|
||||
|
||||
/**
|
||||
* GST_VAAPI_SURFACE_PROXY_DURATION:
|
||||
* @surface: a #GstVaapiSurfaceProxy
|
||||
*
|
||||
* Macro that evaluates to the amount of time the @surface should be
|
||||
* displayed, or %GST_CLOCK_TIME_NONE if none was set.
|
||||
*/
|
||||
#define GST_VAAPI_SURFACE_PROXY_DURATION(surface) \
|
||||
gst_vaapi_surface_proxy_get_duration(surface)
|
||||
|
||||
/**
|
||||
* GST_VAAPI_SURFACE_PROXY_INTERLACED:
|
||||
* @surface: a #GstVaapiSurfaceProxy
|
||||
|
@ -152,6 +162,15 @@ gst_vaapi_surface_proxy_set_timestamp(
|
|||
GstClockTime timestamp
|
||||
);
|
||||
|
||||
GstClockTime
|
||||
gst_vaapi_surface_proxy_get_duration(GstVaapiSurfaceProxy *proxy);
|
||||
|
||||
void
|
||||
gst_vaapi_surface_proxy_set_duration(
|
||||
GstVaapiSurfaceProxy *proxy,
|
||||
GstClockTime duration
|
||||
);
|
||||
|
||||
gboolean
|
||||
gst_vaapi_surface_proxy_get_interlaced(GstVaapiSurfaceProxy *proxy);
|
||||
|
||||
|
|
Loading…
Reference in a new issue