mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
Add gst_vaapi_surface_query_status() wrapper.
This commit is contained in:
parent
35b6198d55
commit
a1dbe90077
5 changed files with 107 additions and 0 deletions
|
@ -308,6 +308,7 @@ GST_VAAPI_IMAGE_GET_CLASS
|
||||||
<SECTION>
|
<SECTION>
|
||||||
<FILE>gstvaapisurface</FILE>
|
<FILE>gstvaapisurface</FILE>
|
||||||
GstVaapiChromaType
|
GstVaapiChromaType
|
||||||
|
GstVaapiSurfaceStatus
|
||||||
GstVaapiSurfaceRenderFlags
|
GstVaapiSurfaceRenderFlags
|
||||||
<TITLE>GstVaapiSurface</TITLE>
|
<TITLE>GstVaapiSurface</TITLE>
|
||||||
GstVaapiSurface
|
GstVaapiSurface
|
||||||
|
@ -324,6 +325,7 @@ gst_vaapi_surface_put_image
|
||||||
gst_vaapi_surface_associate_subpicture
|
gst_vaapi_surface_associate_subpicture
|
||||||
gst_vaapi_surface_deassociate_subpicture
|
gst_vaapi_surface_deassociate_subpicture
|
||||||
gst_vaapi_surface_sync
|
gst_vaapi_surface_sync
|
||||||
|
gst_vaapi_surface_query_status
|
||||||
<SUBSECTION Standard>
|
<SUBSECTION Standard>
|
||||||
GST_VAAPI_SURFACE
|
GST_VAAPI_SURFACE
|
||||||
GST_VAAPI_IS_SURFACE
|
GST_VAAPI_IS_SURFACE
|
||||||
|
|
|
@ -753,3 +753,39 @@ gst_vaapi_surface_sync(GstVaapiSurface *surface)
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_vaapi_surface_query_status:
|
||||||
|
* @surface: a #GstVaapiSurface
|
||||||
|
* @pstatus: return location for the #GstVaapiSurfaceStatus
|
||||||
|
*
|
||||||
|
* Finds out any pending operations on the @surface. The
|
||||||
|
* #GstVaapiSurfaceStatus flags are returned into @pstatus.
|
||||||
|
*
|
||||||
|
* Return value: %TRUE on success
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gst_vaapi_surface_query_status(
|
||||||
|
GstVaapiSurface *surface,
|
||||||
|
GstVaapiSurfaceStatus *pstatus
|
||||||
|
)
|
||||||
|
{
|
||||||
|
VASurfaceStatus surface_status;
|
||||||
|
VAStatus status;
|
||||||
|
|
||||||
|
g_return_val_if_fail(GST_VAAPI_IS_SURFACE(surface), FALSE);
|
||||||
|
|
||||||
|
GST_VAAPI_OBJECT_LOCK_DISPLAY(surface);
|
||||||
|
status = vaQuerySurfaceStatus(
|
||||||
|
GST_VAAPI_OBJECT_VADISPLAY(surface),
|
||||||
|
GST_VAAPI_OBJECT_ID(surface),
|
||||||
|
&surface_status
|
||||||
|
);
|
||||||
|
GST_VAAPI_OBJECT_UNLOCK_DISPLAY(surface);
|
||||||
|
if (!vaapi_check_status(status, "vaQuerySurfaceStatus()"))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (pstatus)
|
||||||
|
*pstatus = to_GstVaapiSurfaceStatus(surface_status);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
typedef enum _GstVaapiChromaType GstVaapiChromaType;
|
typedef enum _GstVaapiChromaType GstVaapiChromaType;
|
||||||
|
typedef enum _GstVaapiSurfaceStatus GstVaapiSurfaceStatus;
|
||||||
typedef enum _GstVaapiSurfaceRenderFlags GstVaapiSurfaceRenderFlags;
|
typedef enum _GstVaapiSurfaceRenderFlags GstVaapiSurfaceRenderFlags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -45,6 +46,26 @@ enum _GstVaapiChromaType {
|
||||||
GST_VAAPI_CHROMA_TYPE_YUV444
|
GST_VAAPI_CHROMA_TYPE_YUV444
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstVaapiSurfaceStatus:
|
||||||
|
* @GST_VAAPI_SURFACE_STATUS_IDLE:
|
||||||
|
* the surface is not being rendered or displayed
|
||||||
|
* @GST_VAAPI_SURFACE_STATUS_RENDERING:
|
||||||
|
* the surface is used for rendering (decoding to the surface in progress)
|
||||||
|
* @GST_VAAPI_SURFACE_STATUS_DISPLAYING:
|
||||||
|
* the surface is being displayed to screen
|
||||||
|
* @GST_VAAPI_SURFACE_STATUS_SKIPPED:
|
||||||
|
* indicates a skipped frame during encode
|
||||||
|
*
|
||||||
|
* The set of all surface status for #GstVaapiSurface.
|
||||||
|
*/
|
||||||
|
enum _GstVaapiSurfaceStatus {
|
||||||
|
GST_VAAPI_SURFACE_STATUS_IDLE = 1 << 0,
|
||||||
|
GST_VAAPI_SURFACE_STATUS_RENDERING = 1 << 1,
|
||||||
|
GST_VAAPI_SURFACE_STATUS_DISPLAYING = 1 << 2,
|
||||||
|
GST_VAAPI_SURFACE_STATUS_SKIPPED = 1 << 3
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstVaapiSurfaceRenderFlags
|
* GstVaapiSurfaceRenderFlags
|
||||||
* @GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD:
|
* @GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD:
|
||||||
|
@ -178,6 +199,12 @@ gst_vaapi_surface_deassociate_subpicture(
|
||||||
gboolean
|
gboolean
|
||||||
gst_vaapi_surface_sync(GstVaapiSurface *surface);
|
gst_vaapi_surface_sync(GstVaapiSurface *surface);
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
gst_vaapi_surface_query_status(
|
||||||
|
GstVaapiSurface *surface,
|
||||||
|
GstVaapiSurfaceStatus *pstatus
|
||||||
|
);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* GST_VAAPI_SURFACE_H */
|
#endif /* GST_VAAPI_SURFACE_H */
|
||||||
|
|
|
@ -128,3 +128,42 @@ guint get_PutSurface_flags_from_GstVaapiSurfaceRenderFlags(guint flags)
|
||||||
|
|
||||||
return va_fields|va_csc;
|
return va_fields|va_csc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* to_GstVaapiSurfaceStatus:
|
||||||
|
* @flags: the #GstVaapiSurfaceStatus flags to translate
|
||||||
|
*
|
||||||
|
* Converts vaQuerySurfaceStatus() @flags to #GstVaapiSurfaceStatus
|
||||||
|
* flags.
|
||||||
|
*
|
||||||
|
* Return value: the #GstVaapiSurfaceStatus flags
|
||||||
|
*/
|
||||||
|
guint to_GstVaapiSurfaceStatus(guint va_flags)
|
||||||
|
{
|
||||||
|
guint flags;
|
||||||
|
const guint va_flags_mask = (VASurfaceReady|
|
||||||
|
VASurfaceRendering|
|
||||||
|
VASurfaceDisplaying);
|
||||||
|
|
||||||
|
/* Check for core status */
|
||||||
|
switch (va_flags & va_flags_mask) {
|
||||||
|
case VASurfaceReady:
|
||||||
|
flags = GST_VAAPI_SURFACE_STATUS_IDLE;
|
||||||
|
break;
|
||||||
|
case VASurfaceRendering:
|
||||||
|
flags = GST_VAAPI_SURFACE_STATUS_RENDERING;
|
||||||
|
break;
|
||||||
|
case VASurfaceDisplaying:
|
||||||
|
flags = GST_VAAPI_SURFACE_STATUS_DISPLAYING;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
flags = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for encoder status */
|
||||||
|
if (va_flags & VASurfaceSkipped)
|
||||||
|
flags |= GST_VAAPI_SURFACE_STATUS_SKIPPED;
|
||||||
|
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
|
@ -53,4 +53,7 @@ const char *string_of_VAEntrypoint(VAEntrypoint entrypoint)
|
||||||
guint get_PutSurface_flags_from_GstVaapiSurfaceRenderFlags(guint flags)
|
guint get_PutSurface_flags_from_GstVaapiSurfaceRenderFlags(guint flags)
|
||||||
attribute_hidden;
|
attribute_hidden;
|
||||||
|
|
||||||
|
guint to_GstVaapiSurfaceStatus(guint va_flags)
|
||||||
|
attribute_hidden;
|
||||||
|
|
||||||
#endif /* GST_VAAPI_UTILS_H */
|
#endif /* GST_VAAPI_UTILS_H */
|
||||||
|
|
Loading…
Reference in a new issue