mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
libs: re-indent all source code related to VA utilities.
This commit is contained in:
parent
84044f28f7
commit
449727ea31
11 changed files with 1069 additions and 1121 deletions
|
@ -47,182 +47,187 @@
|
||||||
|
|
||||||
/* Check VA status for success or print out an error */
|
/* Check VA status for success or print out an error */
|
||||||
gboolean
|
gboolean
|
||||||
vaapi_check_status(VAStatus status, const char *msg)
|
vaapi_check_status (VAStatus status, const gchar * msg)
|
||||||
{
|
{
|
||||||
if (status != VA_STATUS_SUCCESS) {
|
if (status != VA_STATUS_SUCCESS) {
|
||||||
GST_DEBUG("%s: %s", msg, vaErrorStr(status));
|
GST_DEBUG ("%s: %s", msg, vaErrorStr (status));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Maps VA buffer */
|
/* Maps VA buffer */
|
||||||
void *
|
gpointer
|
||||||
vaapi_map_buffer(VADisplay dpy, VABufferID buf_id)
|
vaapi_map_buffer (VADisplay dpy, VABufferID buf_id)
|
||||||
{
|
{
|
||||||
VAStatus status;
|
VAStatus status;
|
||||||
void *data = NULL;
|
gpointer data = NULL;
|
||||||
|
|
||||||
status = vaMapBuffer(dpy, buf_id, &data);
|
status = vaMapBuffer (dpy, buf_id, &data);
|
||||||
if (!vaapi_check_status(status, "vaMapBuffer()"))
|
if (!vaapi_check_status (status, "vaMapBuffer()"))
|
||||||
return NULL;
|
return NULL;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unmaps VA buffer */
|
/* Unmaps VA buffer */
|
||||||
void
|
void
|
||||||
vaapi_unmap_buffer(VADisplay dpy, VABufferID buf_id, void **pbuf)
|
vaapi_unmap_buffer (VADisplay dpy, VABufferID buf_id, gpointer * pbuf)
|
||||||
{
|
{
|
||||||
VAStatus status;
|
VAStatus status;
|
||||||
|
|
||||||
if (pbuf)
|
if (pbuf)
|
||||||
*pbuf = NULL;
|
*pbuf = NULL;
|
||||||
|
|
||||||
status = vaUnmapBuffer(dpy, buf_id);
|
status = vaUnmapBuffer (dpy, buf_id);
|
||||||
if (!vaapi_check_status(status, "vaUnmapBuffer()"))
|
if (!vaapi_check_status (status, "vaUnmapBuffer()"))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Creates and maps VA buffer */
|
/* Creates and maps VA buffer */
|
||||||
gboolean
|
gboolean
|
||||||
vaapi_create_buffer(
|
vaapi_create_buffer (VADisplay dpy, VAContextID ctx, int type, guint size,
|
||||||
VADisplay dpy,
|
gconstpointer buf, VABufferID * buf_id_ptr, gpointer * mapped_data)
|
||||||
VAContextID ctx,
|
|
||||||
int type,
|
|
||||||
unsigned int size,
|
|
||||||
gconstpointer buf,
|
|
||||||
VABufferID *buf_id_ptr,
|
|
||||||
gpointer *mapped_data
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
VABufferID buf_id;
|
VABufferID buf_id;
|
||||||
VAStatus status;
|
VAStatus status;
|
||||||
gpointer data = (gpointer)buf;
|
gpointer data = (gpointer) buf;
|
||||||
|
|
||||||
status = vaCreateBuffer(dpy, ctx, type, size, 1, data, &buf_id);
|
status = vaCreateBuffer (dpy, ctx, type, size, 1, data, &buf_id);
|
||||||
if (!vaapi_check_status(status, "vaCreateBuffer()"))
|
if (!vaapi_check_status (status, "vaCreateBuffer()"))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (mapped_data) {
|
if (mapped_data) {
|
||||||
data = vaapi_map_buffer(dpy, buf_id);
|
data = vaapi_map_buffer (dpy, buf_id);
|
||||||
if (!data)
|
if (!data)
|
||||||
goto error;
|
goto error;
|
||||||
*mapped_data = data;
|
*mapped_data = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
*buf_id_ptr = buf_id;
|
*buf_id_ptr = buf_id;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
vaapi_destroy_buffer(dpy, &buf_id);
|
vaapi_destroy_buffer (dpy, &buf_id);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Destroy VA buffer */
|
/* Destroy VA buffer */
|
||||||
void
|
void
|
||||||
vaapi_destroy_buffer(VADisplay dpy, VABufferID *buf_id_ptr)
|
vaapi_destroy_buffer (VADisplay dpy, VABufferID * buf_id_ptr)
|
||||||
{
|
{
|
||||||
if (!buf_id_ptr || *buf_id_ptr == VA_INVALID_ID)
|
if (!buf_id_ptr || *buf_id_ptr == VA_INVALID_ID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
vaDestroyBuffer(dpy, *buf_id_ptr);
|
vaDestroyBuffer (dpy, *buf_id_ptr);
|
||||||
*buf_id_ptr = VA_INVALID_ID;
|
*buf_id_ptr = VA_INVALID_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a string representation of a VAProfile */
|
/* Return a string representation of a VAProfile */
|
||||||
const char *string_of_VAProfile(VAProfile profile)
|
const gchar *
|
||||||
|
string_of_VAProfile (VAProfile profile)
|
||||||
{
|
{
|
||||||
switch (profile) {
|
switch (profile) {
|
||||||
#define MAP(profile) \
|
#define MAP(profile) \
|
||||||
STRCASEP(VAProfile, profile)
|
STRCASEP(VAProfile, profile)
|
||||||
MAP(MPEG2Simple);
|
MAP (MPEG2Simple);
|
||||||
MAP(MPEG2Main);
|
MAP (MPEG2Main);
|
||||||
MAP(MPEG4Simple);
|
MAP (MPEG4Simple);
|
||||||
MAP(MPEG4AdvancedSimple);
|
MAP (MPEG4AdvancedSimple);
|
||||||
MAP(MPEG4Main);
|
MAP (MPEG4Main);
|
||||||
#if VA_CHECK_VERSION(0,32,0)
|
#if VA_CHECK_VERSION(0,32,0)
|
||||||
MAP(JPEGBaseline);
|
MAP (JPEGBaseline);
|
||||||
MAP(H263Baseline);
|
MAP (H263Baseline);
|
||||||
MAP(H264ConstrainedBaseline);
|
MAP (H264ConstrainedBaseline);
|
||||||
#endif
|
#endif
|
||||||
MAP(H264Baseline);
|
MAP (H264Baseline);
|
||||||
MAP(H264Main);
|
MAP (H264Main);
|
||||||
MAP(H264High);
|
MAP (H264High);
|
||||||
MAP(VC1Simple);
|
MAP (VC1Simple);
|
||||||
MAP(VC1Main);
|
MAP (VC1Main);
|
||||||
MAP(VC1Advanced);
|
MAP (VC1Advanced);
|
||||||
#undef MAP
|
#undef MAP
|
||||||
default: break;
|
default:
|
||||||
}
|
break;
|
||||||
return "<unknown>";
|
}
|
||||||
|
return "<unknown>";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a string representation of a VAEntrypoint */
|
/* Return a string representation of a VAEntrypoint */
|
||||||
const char *string_of_VAEntrypoint(VAEntrypoint entrypoint)
|
const gchar *
|
||||||
|
string_of_VAEntrypoint (VAEntrypoint entrypoint)
|
||||||
{
|
{
|
||||||
switch (entrypoint) {
|
switch (entrypoint) {
|
||||||
#define MAP(entrypoint) \
|
#define MAP(entrypoint) \
|
||||||
STRCASEP(VAEntrypoint, entrypoint)
|
STRCASEP(VAEntrypoint, entrypoint)
|
||||||
MAP(VLD);
|
MAP (VLD);
|
||||||
MAP(IZZ);
|
MAP (IZZ);
|
||||||
MAP(IDCT);
|
MAP (IDCT);
|
||||||
MAP(MoComp);
|
MAP (MoComp);
|
||||||
MAP(Deblocking);
|
MAP (Deblocking);
|
||||||
#undef MAP
|
#undef MAP
|
||||||
default: break;
|
default:
|
||||||
}
|
break;
|
||||||
return "<unknown>";
|
}
|
||||||
|
return "<unknown>";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return a string representation of a VADisplayAttributeType */
|
/* Return a string representation of a VADisplayAttributeType */
|
||||||
const char *
|
const gchar *
|
||||||
string_of_VADisplayAttributeType(VADisplayAttribType attribute_type)
|
string_of_VADisplayAttributeType (VADisplayAttribType attribute_type)
|
||||||
{
|
{
|
||||||
switch (attribute_type) {
|
switch (attribute_type) {
|
||||||
#define MAP(attribute_type) \
|
#define MAP(attribute_type) \
|
||||||
STRCASEP(VADisplayAttrib, attribute_type)
|
STRCASEP(VADisplayAttrib, attribute_type)
|
||||||
MAP(Brightness);
|
MAP (Brightness);
|
||||||
MAP(Contrast);
|
MAP (Contrast);
|
||||||
MAP(Hue);
|
MAP (Hue);
|
||||||
MAP(Saturation);
|
MAP (Saturation);
|
||||||
MAP(BackgroundColor);
|
MAP (BackgroundColor);
|
||||||
#if !VA_CHECK_VERSION(0,34,0)
|
#if !VA_CHECK_VERSION(0,34,0)
|
||||||
MAP(DirectSurface);
|
MAP (DirectSurface);
|
||||||
#endif
|
#endif
|
||||||
MAP(Rotation);
|
MAP (Rotation);
|
||||||
MAP(OutofLoopDeblock);
|
MAP (OutofLoopDeblock);
|
||||||
#if VA_CHECK_VERSION(0,31,1) && !VA_CHECK_VERSION(0,34,0)
|
#if VA_CHECK_VERSION(0,31,1) && !VA_CHECK_VERSION(0,34,0)
|
||||||
MAP(BLEBlackMode);
|
MAP (BLEBlackMode);
|
||||||
MAP(BLEWhiteMode);
|
MAP (BLEWhiteMode);
|
||||||
MAP(BlueStretch);
|
MAP (BlueStretch);
|
||||||
MAP(SkinColorCorrection);
|
MAP (SkinColorCorrection);
|
||||||
#endif
|
#endif
|
||||||
MAP(CSCMatrix);
|
MAP (CSCMatrix);
|
||||||
MAP(BlendColor);
|
MAP (BlendColor);
|
||||||
MAP(OverlayAutoPaintColorKey);
|
MAP (OverlayAutoPaintColorKey);
|
||||||
MAP(OverlayColorKey);
|
MAP (OverlayColorKey);
|
||||||
MAP(RenderMode);
|
MAP (RenderMode);
|
||||||
MAP(RenderDevice);
|
MAP (RenderDevice);
|
||||||
MAP(RenderRect);
|
MAP (RenderRect);
|
||||||
#undef MAP
|
#undef MAP
|
||||||
default: break;
|
default:
|
||||||
}
|
break;
|
||||||
return "<unknown>";
|
}
|
||||||
|
return "<unknown>";
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const gchar *
|
||||||
string_of_VARateControl(guint rate_control)
|
string_of_VARateControl (guint rate_control)
|
||||||
{
|
{
|
||||||
switch (rate_control) {
|
switch (rate_control) {
|
||||||
case VA_RC_NONE: return "None";
|
case VA_RC_NONE:
|
||||||
case VA_RC_CQP: return "CQP";
|
return "None";
|
||||||
case VA_RC_CBR: return "CBR";
|
case VA_RC_CQP:
|
||||||
case VA_RC_VCM: return "VCM";
|
return "CQP";
|
||||||
case VA_RC_VBR: return "VBR";
|
case VA_RC_CBR:
|
||||||
case VA_RC_VBR_CONSTRAINED: return "VBR-Constrained";
|
return "CBR";
|
||||||
default: break;
|
case VA_RC_VCM:
|
||||||
}
|
return "VCM";
|
||||||
return "<unknown>";
|
case VA_RC_VBR:
|
||||||
|
return "VBR";
|
||||||
|
case VA_RC_VBR_CONSTRAINED:
|
||||||
|
return "VBR-Constrained";
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return "<unknown>";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -233,39 +238,39 @@ string_of_VARateControl(guint rate_control)
|
||||||
* vaCreateSurfaces().
|
* vaCreateSurfaces().
|
||||||
*/
|
*/
|
||||||
guint
|
guint
|
||||||
from_GstVaapiChromaType(guint chroma_type)
|
from_GstVaapiChromaType (guint chroma_type)
|
||||||
{
|
{
|
||||||
guint format;
|
guint format;
|
||||||
|
|
||||||
switch (chroma_type) {
|
switch (chroma_type) {
|
||||||
case GST_VAAPI_CHROMA_TYPE_YUV420:
|
case GST_VAAPI_CHROMA_TYPE_YUV420:
|
||||||
format = VA_RT_FORMAT_YUV420;
|
format = VA_RT_FORMAT_YUV420;
|
||||||
break;
|
break;
|
||||||
case GST_VAAPI_CHROMA_TYPE_YUV422:
|
case GST_VAAPI_CHROMA_TYPE_YUV422:
|
||||||
format = VA_RT_FORMAT_YUV422;
|
format = VA_RT_FORMAT_YUV422;
|
||||||
break;
|
break;
|
||||||
case GST_VAAPI_CHROMA_TYPE_YUV444:
|
case GST_VAAPI_CHROMA_TYPE_YUV444:
|
||||||
format = VA_RT_FORMAT_YUV444;
|
format = VA_RT_FORMAT_YUV444;
|
||||||
break;
|
break;
|
||||||
#if VA_CHECK_VERSION(0,34,0)
|
#if VA_CHECK_VERSION(0,34,0)
|
||||||
case GST_VAAPI_CHROMA_TYPE_YUV411:
|
case GST_VAAPI_CHROMA_TYPE_YUV411:
|
||||||
format = VA_RT_FORMAT_YUV411;
|
format = VA_RT_FORMAT_YUV411;
|
||||||
break;
|
break;
|
||||||
case GST_VAAPI_CHROMA_TYPE_YUV400:
|
case GST_VAAPI_CHROMA_TYPE_YUV400:
|
||||||
format = VA_RT_FORMAT_YUV400;
|
format = VA_RT_FORMAT_YUV400;
|
||||||
break;
|
break;
|
||||||
case GST_VAAPI_CHROMA_TYPE_RGB32:
|
case GST_VAAPI_CHROMA_TYPE_RGB32:
|
||||||
format = VA_RT_FORMAT_RGB32;
|
format = VA_RT_FORMAT_RGB32;
|
||||||
break;
|
break;
|
||||||
case GST_VAAPI_CHROMA_TYPE_RGB16:
|
case GST_VAAPI_CHROMA_TYPE_RGB16:
|
||||||
format = VA_RT_FORMAT_RGB16;
|
format = VA_RT_FORMAT_RGB16;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
format = 0;
|
format = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -276,17 +281,17 @@ from_GstVaapiChromaType(guint chroma_type)
|
||||||
* vaAssociateSubpicture().
|
* vaAssociateSubpicture().
|
||||||
*/
|
*/
|
||||||
guint
|
guint
|
||||||
from_GstVaapiSubpictureFlags(guint flags)
|
from_GstVaapiSubpictureFlags (guint flags)
|
||||||
{
|
{
|
||||||
guint va_flags = 0;
|
guint va_flags = 0;
|
||||||
|
|
||||||
if (flags & GST_VAAPI_SUBPICTURE_FLAG_GLOBAL_ALPHA)
|
if (flags & GST_VAAPI_SUBPICTURE_FLAG_GLOBAL_ALPHA)
|
||||||
va_flags |= VA_SUBPICTURE_GLOBAL_ALPHA;
|
va_flags |= VA_SUBPICTURE_GLOBAL_ALPHA;
|
||||||
#ifdef VA_SUBPICTURE_PREMULTIPLIED_ALPHA
|
#ifdef VA_SUBPICTURE_PREMULTIPLIED_ALPHA
|
||||||
if (flags & GST_VAAPI_SUBPICTURE_FLAG_PREMULTIPLIED_ALPHA)
|
if (flags & GST_VAAPI_SUBPICTURE_FLAG_PREMULTIPLIED_ALPHA)
|
||||||
flags |= VA_SUBPICTURE_PREMULTIPLIED_ALPHA;
|
flags |= VA_SUBPICTURE_PREMULTIPLIED_ALPHA;
|
||||||
#endif
|
#endif
|
||||||
return va_flags;
|
return va_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -299,17 +304,17 @@ from_GstVaapiSubpictureFlags(guint flags)
|
||||||
* Return value: the #GstVaapiSubpictureFlags flags
|
* Return value: the #GstVaapiSubpictureFlags flags
|
||||||
*/
|
*/
|
||||||
guint
|
guint
|
||||||
to_GstVaapiSubpictureFlags(guint va_flags)
|
to_GstVaapiSubpictureFlags (guint va_flags)
|
||||||
{
|
{
|
||||||
guint flags = 0;
|
guint flags = 0;
|
||||||
|
|
||||||
if (va_flags & VA_SUBPICTURE_GLOBAL_ALPHA)
|
if (va_flags & VA_SUBPICTURE_GLOBAL_ALPHA)
|
||||||
flags |= GST_VAAPI_SUBPICTURE_FLAG_GLOBAL_ALPHA;
|
flags |= GST_VAAPI_SUBPICTURE_FLAG_GLOBAL_ALPHA;
|
||||||
#ifdef VA_SUBPICTURE_PREMULTIPLIED_ALPHA
|
#ifdef VA_SUBPICTURE_PREMULTIPLIED_ALPHA
|
||||||
if (va_flags & VA_SUBPICTURE_PREMULTIPLIED_ALPHA)
|
if (va_flags & VA_SUBPICTURE_PREMULTIPLIED_ALPHA)
|
||||||
flags |= GST_VAAPI_SUBPICTURE_FLAG_PREMULTIPLIED_ALPHA;
|
flags |= GST_VAAPI_SUBPICTURE_FLAG_PREMULTIPLIED_ALPHA;
|
||||||
#endif
|
#endif
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -321,17 +326,17 @@ to_GstVaapiSubpictureFlags(guint va_flags)
|
||||||
* Return value: the #GstVaapiSubpictureFlags flags
|
* Return value: the #GstVaapiSubpictureFlags flags
|
||||||
*/
|
*/
|
||||||
guint
|
guint
|
||||||
from_GstVideoOverlayFormatFlags(guint ovl_flags)
|
from_GstVideoOverlayFormatFlags (guint ovl_flags)
|
||||||
{
|
{
|
||||||
guint flags = 0;
|
guint flags = 0;
|
||||||
|
|
||||||
#ifdef HAVE_GST_VIDEO_OVERLAY_HWCAPS
|
#ifdef HAVE_GST_VIDEO_OVERLAY_HWCAPS
|
||||||
if (ovl_flags & GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA)
|
if (ovl_flags & GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA)
|
||||||
flags |= GST_VAAPI_SUBPICTURE_FLAG_PREMULTIPLIED_ALPHA;
|
flags |= GST_VAAPI_SUBPICTURE_FLAG_PREMULTIPLIED_ALPHA;
|
||||||
if (ovl_flags & GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA)
|
if (ovl_flags & GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA)
|
||||||
flags |= GST_VAAPI_SUBPICTURE_FLAG_GLOBAL_ALPHA;
|
flags |= GST_VAAPI_SUBPICTURE_FLAG_GLOBAL_ALPHA;
|
||||||
#endif
|
#endif
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -343,17 +348,17 @@ from_GstVideoOverlayFormatFlags(guint ovl_flags)
|
||||||
* Return value: the #GstVideoOverlayFormatFlags flags
|
* Return value: the #GstVideoOverlayFormatFlags flags
|
||||||
*/
|
*/
|
||||||
guint
|
guint
|
||||||
to_GstVideoOverlayFormatFlags(guint flags)
|
to_GstVideoOverlayFormatFlags (guint flags)
|
||||||
{
|
{
|
||||||
guint ovl_flags = 0;
|
guint ovl_flags = 0;
|
||||||
|
|
||||||
#ifdef HAVE_GST_VIDEO_OVERLAY_HWCAPS
|
#ifdef HAVE_GST_VIDEO_OVERLAY_HWCAPS
|
||||||
if (flags & GST_VAAPI_SUBPICTURE_FLAG_PREMULTIPLIED_ALPHA)
|
if (flags & GST_VAAPI_SUBPICTURE_FLAG_PREMULTIPLIED_ALPHA)
|
||||||
ovl_flags |= GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA;
|
ovl_flags |= GST_VIDEO_OVERLAY_FORMAT_FLAG_PREMULTIPLIED_ALPHA;
|
||||||
if (flags & GST_VAAPI_SUBPICTURE_FLAG_GLOBAL_ALPHA)
|
if (flags & GST_VAAPI_SUBPICTURE_FLAG_GLOBAL_ALPHA)
|
||||||
ovl_flags |= GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA;
|
ovl_flags |= GST_VIDEO_OVERLAY_FORMAT_FLAG_GLOBAL_ALPHA;
|
||||||
#endif
|
#endif
|
||||||
return ovl_flags;
|
return ovl_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -364,45 +369,45 @@ to_GstVideoOverlayFormatFlags(guint flags)
|
||||||
* vaPutSurface().
|
* vaPutSurface().
|
||||||
*/
|
*/
|
||||||
guint
|
guint
|
||||||
from_GstVaapiSurfaceRenderFlags(guint flags)
|
from_GstVaapiSurfaceRenderFlags (guint flags)
|
||||||
{
|
{
|
||||||
guint va_fields, va_csc;
|
guint va_fields, va_csc;
|
||||||
|
|
||||||
/* Picture structure */
|
/* Picture structure */
|
||||||
switch (flags & GST_VAAPI_PICTURE_STRUCTURE_MASK) {
|
switch (flags & GST_VAAPI_PICTURE_STRUCTURE_MASK) {
|
||||||
case GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD:
|
case GST_VAAPI_PICTURE_STRUCTURE_TOP_FIELD:
|
||||||
va_fields = VA_TOP_FIELD;
|
va_fields = VA_TOP_FIELD;
|
||||||
break;
|
break;
|
||||||
case GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD:
|
case GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD:
|
||||||
va_fields = VA_BOTTOM_FIELD;
|
va_fields = VA_BOTTOM_FIELD;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
va_fields = VA_FRAME_PICTURE;
|
va_fields = VA_FRAME_PICTURE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Color standard */
|
/* Color standard */
|
||||||
switch (flags & GST_VAAPI_COLOR_STANDARD_MASK) {
|
switch (flags & GST_VAAPI_COLOR_STANDARD_MASK) {
|
||||||
#ifdef VA_SRC_BT601
|
#ifdef VA_SRC_BT601
|
||||||
case GST_VAAPI_COLOR_STANDARD_ITUR_BT_601:
|
case GST_VAAPI_COLOR_STANDARD_ITUR_BT_601:
|
||||||
va_csc = VA_SRC_BT601;
|
va_csc = VA_SRC_BT601;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef VA_SRC_BT709
|
#ifdef VA_SRC_BT709
|
||||||
case GST_VAAPI_COLOR_STANDARD_ITUR_BT_709:
|
case GST_VAAPI_COLOR_STANDARD_ITUR_BT_709:
|
||||||
va_csc = VA_SRC_BT709;
|
va_csc = VA_SRC_BT709;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef VA_SRC_SMPTE_240
|
#ifdef VA_SRC_SMPTE_240
|
||||||
case GST_VAAPI_COLOR_STANDARD_SMPTE_240M:
|
case GST_VAAPI_COLOR_STANDARD_SMPTE_240M:
|
||||||
va_csc = VA_SRC_SMPTE_240;
|
va_csc = VA_SRC_SMPTE_240;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
va_csc = 0;
|
va_csc = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return va_fields|va_csc;
|
return va_fields | va_csc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -415,132 +420,151 @@ from_GstVaapiSurfaceRenderFlags(guint flags)
|
||||||
* Return value: the #GstVaapiSurfaceStatus flags
|
* Return value: the #GstVaapiSurfaceStatus flags
|
||||||
*/
|
*/
|
||||||
guint
|
guint
|
||||||
to_GstVaapiSurfaceStatus(guint va_flags)
|
to_GstVaapiSurfaceStatus (guint va_flags)
|
||||||
{
|
{
|
||||||
guint flags;
|
guint flags;
|
||||||
const guint va_flags_mask = (VASurfaceReady|
|
const guint va_flags_mask = (VASurfaceReady |
|
||||||
VASurfaceRendering|
|
VASurfaceRendering | VASurfaceDisplaying);
|
||||||
VASurfaceDisplaying);
|
|
||||||
|
|
||||||
/* Check for core status */
|
/* Check for core status */
|
||||||
switch (va_flags & va_flags_mask) {
|
switch (va_flags & va_flags_mask) {
|
||||||
case VASurfaceReady:
|
case VASurfaceReady:
|
||||||
flags = GST_VAAPI_SURFACE_STATUS_IDLE;
|
flags = GST_VAAPI_SURFACE_STATUS_IDLE;
|
||||||
break;
|
break;
|
||||||
case VASurfaceRendering:
|
case VASurfaceRendering:
|
||||||
flags = GST_VAAPI_SURFACE_STATUS_RENDERING;
|
flags = GST_VAAPI_SURFACE_STATUS_RENDERING;
|
||||||
break;
|
break;
|
||||||
case VASurfaceDisplaying:
|
case VASurfaceDisplaying:
|
||||||
flags = GST_VAAPI_SURFACE_STATUS_DISPLAYING;
|
flags = GST_VAAPI_SURFACE_STATUS_DISPLAYING;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
flags = 0;
|
flags = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for encoder status */
|
/* Check for encoder status */
|
||||||
#if VA_CHECK_VERSION(0,30,0)
|
#if VA_CHECK_VERSION(0,30,0)
|
||||||
if (va_flags & VASurfaceSkipped)
|
if (va_flags & VASurfaceSkipped)
|
||||||
flags |= GST_VAAPI_SURFACE_STATUS_SKIPPED;
|
flags |= GST_VAAPI_SURFACE_STATUS_SKIPPED;
|
||||||
#endif
|
#endif
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Translate GstVaapiRotation value to VA-API rotation value */
|
/* Translate GstVaapiRotation value to VA-API rotation value */
|
||||||
guint
|
guint
|
||||||
from_GstVaapiRotation(guint value)
|
from_GstVaapiRotation (guint value)
|
||||||
{
|
{
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case GST_VAAPI_ROTATION_0: return VA_ROTATION_NONE;
|
case GST_VAAPI_ROTATION_0:
|
||||||
case GST_VAAPI_ROTATION_90: return VA_ROTATION_90;
|
return VA_ROTATION_NONE;
|
||||||
case GST_VAAPI_ROTATION_180: return VA_ROTATION_180;
|
case GST_VAAPI_ROTATION_90:
|
||||||
case GST_VAAPI_ROTATION_270: return VA_ROTATION_270;
|
return VA_ROTATION_90;
|
||||||
}
|
case GST_VAAPI_ROTATION_180:
|
||||||
GST_ERROR("unsupported GstVaapiRotation value %d", value);
|
return VA_ROTATION_180;
|
||||||
return VA_ROTATION_NONE;
|
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 */
|
/* Translate VA-API rotation value to GstVaapiRotation value */
|
||||||
guint
|
guint
|
||||||
to_GstVaapiRotation(guint value)
|
to_GstVaapiRotation (guint value)
|
||||||
{
|
{
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case VA_ROTATION_NONE: return GST_VAAPI_ROTATION_0;
|
case VA_ROTATION_NONE:
|
||||||
case VA_ROTATION_90: return GST_VAAPI_ROTATION_90;
|
return GST_VAAPI_ROTATION_0;
|
||||||
case VA_ROTATION_180: return GST_VAAPI_ROTATION_180;
|
case VA_ROTATION_90:
|
||||||
case VA_ROTATION_270: return GST_VAAPI_ROTATION_270;
|
return GST_VAAPI_ROTATION_90;
|
||||||
}
|
case VA_ROTATION_180:
|
||||||
GST_ERROR("unsupported VA-API rotation value %d", value);
|
return GST_VAAPI_ROTATION_180;
|
||||||
return GST_VAAPI_ROTATION_0;
|
case VA_ROTATION_270:
|
||||||
|
return GST_VAAPI_ROTATION_270;
|
||||||
|
}
|
||||||
|
GST_ERROR ("unsupported VA-API rotation value %d", value);
|
||||||
|
return GST_VAAPI_ROTATION_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
guint
|
||||||
from_GstVaapiRateControl(guint value)
|
from_GstVaapiRateControl (guint value)
|
||||||
{
|
{
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case GST_VAAPI_RATECONTROL_NONE: return VA_RC_NONE;
|
case GST_VAAPI_RATECONTROL_NONE:
|
||||||
case GST_VAAPI_RATECONTROL_CQP: return VA_RC_CQP;
|
return VA_RC_NONE;
|
||||||
case GST_VAAPI_RATECONTROL_CBR: return VA_RC_CBR;
|
case GST_VAAPI_RATECONTROL_CQP:
|
||||||
case GST_VAAPI_RATECONTROL_VCM: return VA_RC_VCM;
|
return VA_RC_CQP;
|
||||||
case GST_VAAPI_RATECONTROL_VBR: return VA_RC_VBR;
|
case GST_VAAPI_RATECONTROL_CBR:
|
||||||
case GST_VAAPI_RATECONTROL_VBR_CONSTRAINED: return VA_RC_VBR_CONSTRAINED;
|
return VA_RC_CBR;
|
||||||
}
|
case GST_VAAPI_RATECONTROL_VCM:
|
||||||
GST_ERROR("unsupported GstVaapiRateControl value %u", value);
|
return VA_RC_VCM;
|
||||||
return VA_RC_NONE;
|
case GST_VAAPI_RATECONTROL_VBR:
|
||||||
|
return VA_RC_VBR;
|
||||||
|
case GST_VAAPI_RATECONTROL_VBR_CONSTRAINED:
|
||||||
|
return VA_RC_VBR_CONSTRAINED;
|
||||||
|
}
|
||||||
|
GST_ERROR ("unsupported GstVaapiRateControl value %u", value);
|
||||||
|
return VA_RC_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
guint
|
guint
|
||||||
to_GstVaapiRateControl(guint value)
|
to_GstVaapiRateControl (guint value)
|
||||||
{
|
{
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case VA_RC_NONE: return GST_VAAPI_RATECONTROL_NONE;
|
case VA_RC_NONE:
|
||||||
case VA_RC_CQP: return GST_VAAPI_RATECONTROL_CQP;
|
return GST_VAAPI_RATECONTROL_NONE;
|
||||||
case VA_RC_CBR: return GST_VAAPI_RATECONTROL_CBR;
|
case VA_RC_CQP:
|
||||||
case VA_RC_VCM: return GST_VAAPI_RATECONTROL_VCM;
|
return GST_VAAPI_RATECONTROL_CQP;
|
||||||
case VA_RC_VBR: return GST_VAAPI_RATECONTROL_VBR;
|
case VA_RC_CBR:
|
||||||
case VA_RC_VBR_CONSTRAINED: return GST_VAAPI_RATECONTROL_VBR_CONSTRAINED;
|
return GST_VAAPI_RATECONTROL_CBR;
|
||||||
}
|
case VA_RC_VCM:
|
||||||
GST_ERROR("unsupported VA-API Rate Control value %u", value);
|
return GST_VAAPI_RATECONTROL_VCM;
|
||||||
return GST_VAAPI_RATECONTROL_NONE;
|
case VA_RC_VBR:
|
||||||
|
return GST_VAAPI_RATECONTROL_VBR;
|
||||||
|
case VA_RC_VBR_CONSTRAINED:
|
||||||
|
return GST_VAAPI_RATECONTROL_VBR_CONSTRAINED;
|
||||||
|
}
|
||||||
|
GST_ERROR ("unsupported VA-API Rate Control value %u", value);
|
||||||
|
return GST_VAAPI_RATECONTROL_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* VPP: translate GstVaapiDeinterlaceMethod to VA deinterlacing algorithm */
|
/* VPP: translate GstVaapiDeinterlaceMethod to VA deinterlacing algorithm */
|
||||||
guint
|
guint
|
||||||
from_GstVaapiDeinterlaceMethod(guint value)
|
from_GstVaapiDeinterlaceMethod (guint value)
|
||||||
{
|
{
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case GST_VAAPI_DEINTERLACE_METHOD_NONE:
|
case GST_VAAPI_DEINTERLACE_METHOD_NONE:
|
||||||
return 0;
|
return 0;
|
||||||
#if USE_VA_VPP
|
#if USE_VA_VPP
|
||||||
case GST_VAAPI_DEINTERLACE_METHOD_BOB:
|
case GST_VAAPI_DEINTERLACE_METHOD_BOB:
|
||||||
return VAProcDeinterlacingBob;
|
return VAProcDeinterlacingBob;
|
||||||
case GST_VAAPI_DEINTERLACE_METHOD_WEAVE:
|
case GST_VAAPI_DEINTERLACE_METHOD_WEAVE:
|
||||||
return VAProcDeinterlacingWeave;
|
return VAProcDeinterlacingWeave;
|
||||||
case GST_VAAPI_DEINTERLACE_METHOD_MOTION_ADAPTIVE:
|
case GST_VAAPI_DEINTERLACE_METHOD_MOTION_ADAPTIVE:
|
||||||
return VAProcDeinterlacingMotionAdaptive;
|
return VAProcDeinterlacingMotionAdaptive;
|
||||||
case GST_VAAPI_DEINTERLACE_METHOD_MOTION_COMPENSATED:
|
case GST_VAAPI_DEINTERLACE_METHOD_MOTION_COMPENSATED:
|
||||||
return VAProcDeinterlacingMotionCompensated;
|
return VAProcDeinterlacingMotionCompensated;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
GST_ERROR("unsupported GstVaapiDeinterlaceMethod value %d", value);
|
GST_ERROR ("unsupported GstVaapiDeinterlaceMethod value %d", value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* VPP: translate GstVaapiDeinterlaceFlags into VA deinterlacing flags */
|
/* VPP: translate GstVaapiDeinterlaceFlags into VA deinterlacing flags */
|
||||||
guint
|
guint
|
||||||
from_GstVaapiDeinterlaceFlags(guint flags)
|
from_GstVaapiDeinterlaceFlags (guint flags)
|
||||||
{
|
{
|
||||||
guint va_flags = 0;
|
guint va_flags = 0;
|
||||||
|
|
||||||
#if USE_VA_VPP
|
#if USE_VA_VPP
|
||||||
if (!(flags & GST_VAAPI_DEINTERLACE_FLAG_TFF))
|
if (!(flags & GST_VAAPI_DEINTERLACE_FLAG_TFF))
|
||||||
va_flags |= VA_DEINTERLACING_BOTTOM_FIELD_FIRST;
|
va_flags |= VA_DEINTERLACING_BOTTOM_FIELD_FIRST;
|
||||||
|
|
||||||
if (flags & GST_VAAPI_DEINTERLACE_FLAG_ONEFIELD)
|
if (flags & GST_VAAPI_DEINTERLACE_FLAG_ONEFIELD)
|
||||||
va_flags |= VA_DEINTERLACING_ONE_FIELD;
|
va_flags |= VA_DEINTERLACING_ONE_FIELD;
|
||||||
|
|
||||||
if (!(flags & GST_VAAPI_DEINTERLACE_FLAG_TOPFIELD))
|
if (!(flags & GST_VAAPI_DEINTERLACE_FLAG_TOPFIELD))
|
||||||
va_flags |= VA_DEINTERLACING_BOTTOM_FIELD;
|
va_flags |= VA_DEINTERLACING_BOTTOM_FIELD;
|
||||||
#endif
|
#endif
|
||||||
return va_flags;
|
return va_flags;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,103 +33,98 @@
|
||||||
/** Check VA status for success or print out an error */
|
/** Check VA status for success or print out an error */
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
vaapi_check_status(VAStatus status, const char *msg);
|
vaapi_check_status (VAStatus status, const gchar *msg);
|
||||||
|
|
||||||
/** Maps VA buffer */
|
/** Maps VA buffer */
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void *
|
gpointer
|
||||||
vaapi_map_buffer(VADisplay dpy, VABufferID buf_id);
|
vaapi_map_buffer (VADisplay dpy, VABufferID buf_id);
|
||||||
|
|
||||||
/** Unmaps VA buffer */
|
/** Unmaps VA buffer */
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void
|
void
|
||||||
vaapi_unmap_buffer(VADisplay dpy, VABufferID buf_id, void **pbuf);
|
vaapi_unmap_buffer (VADisplay dpy, VABufferID buf_id, void **pbuf);
|
||||||
|
|
||||||
/** Creates and maps VA buffer */
|
/** Creates and maps VA buffer */
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
vaapi_create_buffer(
|
vaapi_create_buffer (VADisplay dpy, VAContextID ctx, int type, guint size,
|
||||||
VADisplay dpy,
|
gconstpointer data, VABufferID * buf_id, gpointer * mapped_data);
|
||||||
VAContextID ctx,
|
|
||||||
int type,
|
|
||||||
unsigned int size,
|
|
||||||
gconstpointer data,
|
|
||||||
VABufferID *buf_id,
|
|
||||||
gpointer *mapped_data
|
|
||||||
);
|
|
||||||
|
|
||||||
/** Destroy VA buffer */
|
/** Destroy VA buffer */
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void
|
void
|
||||||
vaapi_destroy_buffer(VADisplay dpy, VABufferID *buf_id);
|
vaapi_destroy_buffer (VADisplay dpy, VABufferID * buf_id);
|
||||||
|
|
||||||
/** Return a string representation of a VAProfile */
|
/** Return a string representation of a VAProfile */
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
const char *string_of_VAProfile(VAProfile profile);
|
const gchar *
|
||||||
|
string_of_VAProfile (VAProfile profile);
|
||||||
|
|
||||||
/** Return a string representation of a VAEntrypoint */
|
/** Return a string representation of a VAEntrypoint */
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
const char *string_of_VAEntrypoint(VAEntrypoint entrypoint);
|
const gchar *
|
||||||
|
string_of_VAEntrypoint (VAEntrypoint entrypoint);
|
||||||
|
|
||||||
/* Return a string representation of a VADisplayAttributeType */
|
/* Return a string representation of a VADisplayAttributeType */
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
const char *
|
const gchar *
|
||||||
string_of_VADisplayAttributeType(VADisplayAttribType attribute_type);
|
string_of_VADisplayAttributeType (VADisplayAttribType attribute_type);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
const char *
|
const gchar *
|
||||||
string_of_VARateControl(guint rate_control);
|
string_of_VARateControl (guint rate_control);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
guint
|
guint
|
||||||
from_GstVaapiChromaType(guint chroma_type);
|
from_GstVaapiChromaType (guint chroma_type);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
guint
|
guint
|
||||||
from_GstVaapiSubpictureFlags(guint flags);
|
from_GstVaapiSubpictureFlags (guint flags);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
guint
|
guint
|
||||||
to_GstVaapiSubpictureFlags(guint va_flags);
|
to_GstVaapiSubpictureFlags (guint va_flags);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
guint
|
guint
|
||||||
from_GstVideoOverlayFormatFlags(guint ovl_flags);
|
from_GstVideoOverlayFormatFlags (guint ovl_flags);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
guint
|
guint
|
||||||
to_GstVideoOverlayFormatFlags(guint flags);
|
to_GstVideoOverlayFormatFlags (guint flags);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
guint
|
guint
|
||||||
from_GstVaapiSurfaceRenderFlags(guint flags);
|
from_GstVaapiSurfaceRenderFlags (guint flags);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
guint
|
guint
|
||||||
to_GstVaapiSurfaceStatus(guint va_flags);
|
to_GstVaapiSurfaceStatus (guint va_flags);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
guint
|
guint
|
||||||
from_GstVaapiRotation(guint value);
|
from_GstVaapiRotation (guint value);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
guint
|
guint
|
||||||
to_GstVaapiRotation(guint value);
|
to_GstVaapiRotation (guint value);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
guint
|
guint
|
||||||
from_GstVaapiRateControl(guint value);
|
from_GstVaapiRateControl (guint value);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
guint
|
guint
|
||||||
to_GstVaapiRateControl(guint value);
|
to_GstVaapiRateControl (guint value);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
guint
|
guint
|
||||||
from_GstVaapiDeinterlaceMethod(guint value);
|
from_GstVaapiDeinterlaceMethod (guint value);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
guint
|
guint
|
||||||
from_GstVaapiDeinterlaceFlags(guint flags);
|
from_GstVaapiDeinterlaceFlags (guint flags);
|
||||||
|
|
||||||
#endif /* GST_VAAPI_UTILS_H */
|
#endif /* GST_VAAPI_UTILS_H */
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -34,15 +34,17 @@
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
|
||||||
#if GLX_GLXEXT_VERSION < 18
|
#if GLX_GLXEXT_VERSION < 18
|
||||||
typedef void (*PFNGLXBINDTEXIMAGEEXTPROC)(Display *, GLXDrawable, int, const int *);
|
typedef void (*PFNGLXBINDTEXIMAGEEXTPROC) (Display *, GLXDrawable, int,
|
||||||
typedef void (*PFNGLXRELEASETEXIMAGEEXTPROC)(Display *, GLXDrawable, int);
|
const int *);
|
||||||
|
typedef void (*PFNGLXRELEASETEXIMAGEEXTPROC) (Display *, GLXDrawable, int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GLX_GLXEXT_VERSION < 27
|
#if GLX_GLXEXT_VERSION < 27
|
||||||
/* XXX: this is not exactly that version but this is the only means to
|
/* XXX: this is not exactly that version but this is the only means to
|
||||||
make sure we have the correct <GL/glx.h> with those signatures */
|
make sure we have the correct <GL/glx.h> with those signatures */
|
||||||
typedef GLXPixmap (*PFNGLXCREATEPIXMAPPROC)(Display *, GLXFBConfig, Pixmap, const int *);
|
typedef GLXPixmap (*PFNGLXCREATEPIXMAPPROC) (Display *, GLXFBConfig, Pixmap,
|
||||||
typedef void (*PFNGLXDESTROYPIXMAPPROC)(Display *, GLXPixmap);
|
const int *);
|
||||||
|
typedef void (*PFNGLXDESTROYPIXMAPPROC) (Display *, GLXPixmap);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GL_FRAMEBUFFER_BINDING
|
#ifndef GL_FRAMEBUFFER_BINDING
|
||||||
|
@ -50,163 +52,164 @@ typedef void (*PFNGLXDESTROYPIXMAPPROC)(Display *, GLXPixmap);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
const char *
|
const gchar *
|
||||||
gl_get_error_string(GLenum error);
|
gl_get_error_string (GLenum error);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void
|
void
|
||||||
gl_purge_errors(void);
|
gl_purge_errors (void);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
gl_check_error(void);
|
gl_check_error (void);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
gl_get_param(GLenum param, guint *pval);
|
gl_get_param (GLenum param, guint * pval);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
gl_get_texture_param(GLenum target, GLenum param, guint *pval);
|
gl_get_texture_param (GLenum target, GLenum param, guint * pval);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void
|
void
|
||||||
gl_set_bgcolor(guint32 color);
|
gl_set_bgcolor (guint32 color);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void
|
void
|
||||||
gl_resize(guint width, guint height);
|
gl_resize (guint width, guint height);
|
||||||
|
|
||||||
typedef struct _GLContextState GLContextState;
|
typedef struct _GLContextState GLContextState;
|
||||||
struct _GLContextState {
|
struct _GLContextState
|
||||||
Display *display;
|
{
|
||||||
Window window;
|
Display *display;
|
||||||
XVisualInfo *visual;
|
Window window;
|
||||||
GLXContext context;
|
XVisualInfo *visual;
|
||||||
guint swapped_buffers : 1;
|
GLXContext context;
|
||||||
|
guint swapped_buffers:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
GLContextState *
|
GLContextState *
|
||||||
gl_create_context(Display *dpy, int screen, GLContextState *parent);
|
gl_create_context (Display * dpy, int screen, GLContextState * parent);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void
|
void
|
||||||
gl_destroy_context(GLContextState *cs);
|
gl_destroy_context (GLContextState * cs);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void
|
void
|
||||||
gl_get_current_context(GLContextState *cs);
|
gl_get_current_context (GLContextState * cs);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
gl_set_current_context(GLContextState *new_cs, GLContextState *old_cs);
|
gl_set_current_context (GLContextState * new_cs, GLContextState * old_cs);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void
|
void
|
||||||
gl_swap_buffers(GLContextState *cs);
|
gl_swap_buffers (GLContextState * cs);
|
||||||
|
|
||||||
typedef struct _GLTextureState GLTextureState;
|
typedef struct _GLTextureState GLTextureState;
|
||||||
struct _GLTextureState {
|
struct _GLTextureState
|
||||||
GLenum target;
|
{
|
||||||
GLuint old_texture;
|
GLenum target;
|
||||||
guint was_enabled : 1;
|
GLuint old_texture;
|
||||||
guint was_bound : 1;
|
guint was_enabled:1;
|
||||||
|
guint was_bound:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
gl_bind_texture(GLTextureState *ts, GLenum target, GLuint texture);
|
gl_bind_texture (GLTextureState * ts, GLenum target, GLuint texture);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void
|
void
|
||||||
gl_unbind_texture(GLTextureState *ts);
|
gl_unbind_texture (GLTextureState * ts);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
GLuint
|
GLuint
|
||||||
gl_create_texture(GLenum target, GLenum format, guint width, guint height);
|
gl_create_texture (GLenum target, GLenum format, guint width, guint height);
|
||||||
|
|
||||||
typedef struct _GLVTable GLVTable;
|
typedef struct _GLVTable GLVTable;
|
||||||
struct _GLVTable {
|
struct _GLVTable
|
||||||
PFNGLXCREATEPIXMAPPROC glx_create_pixmap;
|
{
|
||||||
PFNGLXDESTROYPIXMAPPROC glx_destroy_pixmap;
|
PFNGLXCREATEPIXMAPPROC glx_create_pixmap;
|
||||||
PFNGLXBINDTEXIMAGEEXTPROC glx_bind_tex_image;
|
PFNGLXDESTROYPIXMAPPROC glx_destroy_pixmap;
|
||||||
PFNGLXRELEASETEXIMAGEEXTPROC glx_release_tex_image;
|
PFNGLXBINDTEXIMAGEEXTPROC glx_bind_tex_image;
|
||||||
PFNGLGENFRAMEBUFFERSEXTPROC gl_gen_framebuffers;
|
PFNGLXRELEASETEXIMAGEEXTPROC glx_release_tex_image;
|
||||||
PFNGLDELETEFRAMEBUFFERSEXTPROC gl_delete_framebuffers;
|
PFNGLGENFRAMEBUFFERSEXTPROC gl_gen_framebuffers;
|
||||||
PFNGLBINDFRAMEBUFFEREXTPROC gl_bind_framebuffer;
|
PFNGLDELETEFRAMEBUFFERSEXTPROC gl_delete_framebuffers;
|
||||||
PFNGLGENRENDERBUFFERSEXTPROC gl_gen_renderbuffers;
|
PFNGLBINDFRAMEBUFFEREXTPROC gl_bind_framebuffer;
|
||||||
PFNGLDELETERENDERBUFFERSEXTPROC gl_delete_renderbuffers;
|
PFNGLGENRENDERBUFFERSEXTPROC gl_gen_renderbuffers;
|
||||||
PFNGLBINDRENDERBUFFEREXTPROC gl_bind_renderbuffer;
|
PFNGLDELETERENDERBUFFERSEXTPROC gl_delete_renderbuffers;
|
||||||
PFNGLRENDERBUFFERSTORAGEEXTPROC gl_renderbuffer_storage;
|
PFNGLBINDRENDERBUFFEREXTPROC gl_bind_renderbuffer;
|
||||||
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC gl_framebuffer_renderbuffer;
|
PFNGLRENDERBUFFERSTORAGEEXTPROC gl_renderbuffer_storage;
|
||||||
PFNGLFRAMEBUFFERTEXTURE2DEXTPROC gl_framebuffer_texture_2d;
|
PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC gl_framebuffer_renderbuffer;
|
||||||
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC gl_check_framebuffer_status;
|
PFNGLFRAMEBUFFERTEXTURE2DEXTPROC gl_framebuffer_texture_2d;
|
||||||
guint has_texture_from_pixmap : 1;
|
PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC gl_check_framebuffer_status;
|
||||||
guint has_framebuffer_object : 1;
|
guint has_texture_from_pixmap:1;
|
||||||
|
guint has_framebuffer_object:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
GLVTable *
|
GLVTable *
|
||||||
gl_get_vtable(void);
|
gl_get_vtable (void);
|
||||||
|
|
||||||
typedef struct _GLPixmapObject GLPixmapObject;
|
typedef struct _GLPixmapObject GLPixmapObject;
|
||||||
struct _GLPixmapObject {
|
struct _GLPixmapObject
|
||||||
Display *dpy;
|
{
|
||||||
GLenum target;
|
Display *dpy;
|
||||||
GLuint texture;
|
GLenum target;
|
||||||
GLTextureState old_texture;
|
GLuint texture;
|
||||||
guint width;
|
GLTextureState old_texture;
|
||||||
guint height;
|
guint width;
|
||||||
Pixmap pixmap;
|
guint height;
|
||||||
GLXPixmap glx_pixmap;
|
Pixmap pixmap;
|
||||||
guint is_bound : 1;
|
GLXPixmap glx_pixmap;
|
||||||
|
guint is_bound:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
GLPixmapObject *
|
GLPixmapObject *
|
||||||
gl_create_pixmap_object(Display *dpy, guint width, guint height);
|
gl_create_pixmap_object (Display * dpy, guint width, guint height);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void
|
void
|
||||||
gl_destroy_pixmap_object(GLPixmapObject *pixo);
|
gl_destroy_pixmap_object (GLPixmapObject * pixo);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
gl_bind_pixmap_object(GLPixmapObject *pixo);
|
gl_bind_pixmap_object (GLPixmapObject * pixo);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
gl_unbind_pixmap_object(GLPixmapObject *pixo);
|
gl_unbind_pixmap_object (GLPixmapObject * pixo);
|
||||||
|
|
||||||
typedef struct _GLFramebufferObject GLFramebufferObject;
|
typedef struct _GLFramebufferObject GLFramebufferObject;
|
||||||
struct _GLFramebufferObject {
|
struct _GLFramebufferObject
|
||||||
guint width;
|
{
|
||||||
guint height;
|
guint width;
|
||||||
GLuint fbo;
|
guint height;
|
||||||
GLuint old_fbo;
|
GLuint fbo;
|
||||||
guint is_bound : 1;
|
GLuint old_fbo;
|
||||||
|
guint is_bound:1;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
GLFramebufferObject *
|
GLFramebufferObject *
|
||||||
gl_create_framebuffer_object(
|
gl_create_framebuffer_object (GLenum target,
|
||||||
GLenum target,
|
GLuint texture, guint width, guint height);
|
||||||
GLuint texture,
|
|
||||||
guint width,
|
|
||||||
guint height
|
|
||||||
);
|
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void
|
void
|
||||||
gl_destroy_framebuffer_object(GLFramebufferObject *fbo);
|
gl_destroy_framebuffer_object (GLFramebufferObject * fbo);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
gl_bind_framebuffer_object(GLFramebufferObject *fbo);
|
gl_bind_framebuffer_object (GLFramebufferObject * fbo);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
gl_unbind_framebuffer_object(GLFramebufferObject *fbo);
|
gl_unbind_framebuffer_object (GLFramebufferObject * fbo);
|
||||||
|
|
||||||
#endif /* GST_VAAPI_UTILS_GLX_H */
|
#endif /* GST_VAAPI_UTILS_GLX_H */
|
||||||
|
|
|
@ -276,7 +276,7 @@ guint8
|
||||||
gst_vaapi_utils_h264_get_level_idc (GstVaapiLevelH264 level)
|
gst_vaapi_utils_h264_get_level_idc (GstVaapiLevelH264 level)
|
||||||
{
|
{
|
||||||
const GstVaapiH264LevelLimits *const llp =
|
const GstVaapiH264LevelLimits *const llp =
|
||||||
gst_vaapi_utils_h264_get_level_limits (level);
|
gst_vaapi_utils_h264_get_level_limits (level);
|
||||||
|
|
||||||
return llp ? llp->level_idc : 0;
|
return llp ? llp->level_idc : 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,8 +50,7 @@ G_BEGIN_DECLS
|
||||||
*
|
*
|
||||||
* The set of all levels for #GstVaapiLevelH264.
|
* The set of all levels for #GstVaapiLevelH264.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
GST_VAAPI_LEVEL_H264_L1 = 1,
|
GST_VAAPI_LEVEL_H264_L1 = 1,
|
||||||
GST_VAAPI_LEVEL_H264_L1b,
|
GST_VAAPI_LEVEL_H264_L1b,
|
||||||
GST_VAAPI_LEVEL_H264_L1_1,
|
GST_VAAPI_LEVEL_H264_L1_1,
|
||||||
|
|
|
@ -40,8 +40,7 @@ G_BEGIN_DECLS
|
||||||
*
|
*
|
||||||
* The data structure that describes the limits of an H.264 level.
|
* The data structure that describes the limits of an H.264 level.
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
GstVaapiLevelH264 level;
|
GstVaapiLevelH264 level;
|
||||||
guint8 level_idc;
|
guint8 level_idc;
|
||||||
guint32 MaxMBPS;
|
guint32 MaxMBPS;
|
||||||
|
@ -79,7 +78,7 @@ gst_vaapi_utils_h264_get_level_limits (GstVaapiLevelH264 level);
|
||||||
/* Returns the Table A-1 specification */
|
/* Returns the Table A-1 specification */
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
const GstVaapiH264LevelLimits *
|
const GstVaapiH264LevelLimits *
|
||||||
gst_vaapi_utils_h264_get_level_limits_table (guint *out_length_ptr);
|
gst_vaapi_utils_h264_get_level_limits_table (guint * out_length_ptr);
|
||||||
|
|
||||||
/* Returns GstVaapiChromaType from H.264 chroma_format_idc value */
|
/* Returns GstVaapiChromaType from H.264 chroma_format_idc value */
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
|
|
|
@ -38,8 +38,7 @@ G_BEGIN_DECLS
|
||||||
*
|
*
|
||||||
* The set of all levels for #GstVaapiLevelMPEG2.
|
* The set of all levels for #GstVaapiLevelMPEG2.
|
||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum {
|
||||||
{
|
|
||||||
GST_VAAPI_LEVEL_MPEG2_LOW = 1,
|
GST_VAAPI_LEVEL_MPEG2_LOW = 1,
|
||||||
GST_VAAPI_LEVEL_MPEG2_MAIN,
|
GST_VAAPI_LEVEL_MPEG2_MAIN,
|
||||||
GST_VAAPI_LEVEL_MPEG2_HIGH_1440,
|
GST_VAAPI_LEVEL_MPEG2_HIGH_1440,
|
||||||
|
|
|
@ -41,8 +41,7 @@ G_BEGIN_DECLS
|
||||||
*
|
*
|
||||||
* The data structure that describes the limits of an MPEG-2 level.
|
* The data structure that describes the limits of an MPEG-2 level.
|
||||||
*/
|
*/
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
GstVaapiLevelMPEG2 level;
|
GstVaapiLevelMPEG2 level;
|
||||||
guint8 level_idc;
|
guint8 level_idc;
|
||||||
guint16 horizontal_size_value;
|
guint16 horizontal_size_value;
|
||||||
|
|
|
@ -29,35 +29,39 @@
|
||||||
|
|
||||||
// X error trap
|
// X error trap
|
||||||
static int x11_error_code = 0;
|
static int x11_error_code = 0;
|
||||||
static int (*old_error_handler)(Display *, XErrorEvent *);
|
static int (*old_error_handler) (Display *, XErrorEvent *);
|
||||||
|
|
||||||
static int error_handler(Display *dpy, XErrorEvent *error)
|
static int
|
||||||
|
error_handler (Display * dpy, XErrorEvent * error)
|
||||||
{
|
{
|
||||||
x11_error_code = error->error_code;
|
x11_error_code = error->error_code;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void x11_trap_errors(void)
|
void
|
||||||
|
x11_trap_errors (void)
|
||||||
{
|
{
|
||||||
x11_error_code = 0;
|
x11_error_code = 0;
|
||||||
old_error_handler = XSetErrorHandler(error_handler);
|
old_error_handler = XSetErrorHandler (error_handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
int x11_untrap_errors(void)
|
int
|
||||||
|
x11_untrap_errors (void)
|
||||||
{
|
{
|
||||||
XSetErrorHandler(old_error_handler);
|
XSetErrorHandler (old_error_handler);
|
||||||
return x11_error_code;
|
return x11_error_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
// X window management
|
// X window management
|
||||||
static const int x11_event_mask = (KeyPressMask |
|
static const int x11_event_mask =
|
||||||
KeyReleaseMask |
|
(KeyPressMask |
|
||||||
ButtonPressMask |
|
KeyReleaseMask |
|
||||||
ButtonReleaseMask |
|
ButtonPressMask |
|
||||||
PointerMotionMask |
|
ButtonReleaseMask |
|
||||||
EnterWindowMask |
|
PointerMotionMask |
|
||||||
ExposureMask |
|
EnterWindowMask |
|
||||||
StructureNotifyMask);
|
ExposureMask |
|
||||||
|
StructureNotifyMask);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* x11_create_window:
|
* x11_create_window:
|
||||||
|
@ -75,84 +79,68 @@ static const int x11_event_mask = (KeyPressMask |
|
||||||
* Return value: the newly created X #Window.
|
* Return value: the newly created X #Window.
|
||||||
*/
|
*/
|
||||||
Window
|
Window
|
||||||
x11_create_window(Display *dpy, guint w, guint h, Visual *vis, Colormap cmap)
|
x11_create_window (Display * dpy, guint w, guint h, Visual * vis, Colormap cmap)
|
||||||
{
|
{
|
||||||
Window rootwin, win;
|
Window rootwin, win;
|
||||||
int screen, depth;
|
int screen, depth;
|
||||||
XSetWindowAttributes xswa;
|
XSetWindowAttributes xswa;
|
||||||
unsigned long xswa_mask;
|
unsigned long xswa_mask;
|
||||||
XWindowAttributes wattr;
|
XWindowAttributes wattr;
|
||||||
unsigned long black_pixel;
|
unsigned long black_pixel;
|
||||||
|
|
||||||
screen = DefaultScreen(dpy);
|
screen = DefaultScreen (dpy);
|
||||||
rootwin = RootWindow(dpy, screen);
|
rootwin = RootWindow (dpy, screen);
|
||||||
black_pixel = BlackPixel(dpy, screen);
|
black_pixel = BlackPixel (dpy, screen);
|
||||||
|
|
||||||
if (!vis)
|
if (!vis)
|
||||||
vis = DefaultVisual(dpy, screen);
|
vis = DefaultVisual (dpy, screen);
|
||||||
|
|
||||||
XGetWindowAttributes(dpy, rootwin, &wattr);
|
XGetWindowAttributes (dpy, rootwin, &wattr);
|
||||||
depth = wattr.depth;
|
depth = wattr.depth;
|
||||||
if (depth != 15 && depth != 16 && depth != 24 && depth != 32)
|
if (depth != 15 && depth != 16 && depth != 24 && depth != 32)
|
||||||
depth = 24;
|
depth = 24;
|
||||||
|
|
||||||
xswa_mask = CWBorderPixel | CWBackPixel;
|
xswa_mask = CWBorderPixel | CWBackPixel;
|
||||||
xswa.border_pixel = black_pixel;
|
xswa.border_pixel = black_pixel;
|
||||||
xswa.background_pixel = black_pixel;
|
xswa.background_pixel = black_pixel;
|
||||||
|
|
||||||
if (cmap) {
|
if (cmap) {
|
||||||
xswa_mask |= CWColormap;
|
xswa_mask |= CWColormap;
|
||||||
xswa.colormap = cmap;
|
xswa.colormap = cmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
win = XCreateWindow(
|
win = XCreateWindow (dpy, rootwin, 0, 0, w, h, 0, depth, InputOutput, vis,
|
||||||
dpy,
|
xswa_mask, &xswa);
|
||||||
rootwin,
|
if (!win)
|
||||||
0, 0, w, h,
|
return None;
|
||||||
0,
|
|
||||||
depth,
|
|
||||||
InputOutput,
|
|
||||||
vis,
|
|
||||||
xswa_mask, &xswa
|
|
||||||
);
|
|
||||||
if (!win)
|
|
||||||
return None;
|
|
||||||
|
|
||||||
XSelectInput(dpy, win, x11_event_mask);
|
XSelectInput (dpy, win, x11_event_mask);
|
||||||
return win;
|
return win;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
x11_get_geometry(
|
x11_get_geometry (Display * dpy, Drawable drawable, gint * px, gint * py,
|
||||||
Display *dpy,
|
guint * pwidth, guint * pheight, guint * pdepth)
|
||||||
Drawable drawable,
|
|
||||||
gint *px,
|
|
||||||
gint *py,
|
|
||||||
guint *pwidth,
|
|
||||||
guint *pheight,
|
|
||||||
guint *pdepth
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
Window rootwin;
|
Window rootwin;
|
||||||
int x, y;
|
int x, y;
|
||||||
guint width, height, border_width, depth;
|
guint width, height, border_width, depth;
|
||||||
|
|
||||||
x11_trap_errors();
|
x11_trap_errors ();
|
||||||
XGetGeometry(
|
XGetGeometry (dpy, drawable, &rootwin, &x, &y, &width, &height,
|
||||||
dpy,
|
&border_width, &depth);
|
||||||
drawable,
|
if (x11_untrap_errors ())
|
||||||
&rootwin,
|
return FALSE;
|
||||||
&x, &y, &width, &height,
|
|
||||||
&border_width,
|
|
||||||
&depth
|
|
||||||
);
|
|
||||||
if (x11_untrap_errors())
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (px) *px = x;
|
if (px)
|
||||||
if (py) *py = y;
|
*px = x;
|
||||||
if (pwidth) *pwidth = width;
|
if (py)
|
||||||
if (pheight) *pheight = height;
|
*py = y;
|
||||||
if (pdepth) *pdepth = depth;
|
if (pwidth)
|
||||||
return TRUE;
|
*pwidth = width;
|
||||||
|
if (pheight)
|
||||||
|
*pheight = height;
|
||||||
|
if (pdepth)
|
||||||
|
*pdepth = depth;
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,26 +32,20 @@
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
void
|
void
|
||||||
x11_trap_errors(void);
|
x11_trap_errors (void);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
int
|
int
|
||||||
x11_untrap_errors(void);
|
x11_untrap_errors (void);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
Window
|
Window
|
||||||
x11_create_window(Display *dpy, guint w, guint h, Visual *vis, Colormap cmap);
|
x11_create_window (Display * dpy, guint w, guint h, Visual * vis,
|
||||||
|
Colormap cmap);
|
||||||
|
|
||||||
G_GNUC_INTERNAL
|
G_GNUC_INTERNAL
|
||||||
gboolean
|
gboolean
|
||||||
x11_get_geometry(
|
x11_get_geometry (Display * dpy, Drawable drawable, gint * px, gint * py,
|
||||||
Display *dpy,
|
guint * pwidth, guint * pheight, guint * pdepth);
|
||||||
Drawable drawable,
|
|
||||||
gint *px,
|
|
||||||
gint *py,
|
|
||||||
guint *pwidth,
|
|
||||||
guint *pheight,
|
|
||||||
guint *pdepth
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif /* GST_VAAPI_UTILS_X11_H */
|
#endif /* GST_VAAPI_UTILS_X11_H */
|
||||||
|
|
Loading…
Reference in a new issue