gstvaapisurfacepool.c \
gstvaapisurfaceproxy.c \
gstvaapiutils.c \
+ gstvaapiutils_core.c \
gstvaapiutils_h264.c \
gstvaapiutils_mpeg2.c \
gstvaapivalue.c \
gstvaapisurface_priv.h \
gstvaapisurfaceproxy_priv.h \
gstvaapiutils.h \
+ gstvaapiutils_core.h \
gstvaapiutils_h264_priv.h \
gstvaapiutils_mpeg2_priv.h \
gstvaapiversion.h \
#include "gstvaapisurfaceproxy.h"
#include "gstvaapivideopool_priv.h"
#include "gstvaapiutils.h"
+#include "gstvaapiutils_core.h"
#define DEBUG 1
#include "gstvaapidebug.h"
gst_vaapi_object_unref (surface);
}
+static inline gboolean
+context_get_attribute (GstVaapiContext * context, VAConfigAttribType type,
+ guint * out_value_ptr)
+{
+ return gst_vaapi_get_config_attribute (GST_VAAPI_OBJECT_DISPLAY (context),
+ context->va_profile, context->va_entrypoint, type, out_value_ptr);
+}
+
static void
context_destroy_surfaces (GstVaapiContext * context)
{
/* Validate VA surface format */
attrib->type = VAConfigAttribRTFormat;
- if (!gst_vaapi_context_get_attribute (context, attrib->type, &value))
+ if (!context_get_attribute (context, attrib->type, &value))
goto cleanup;
if (!(value & VA_RT_FORMAT_YUV420))
goto cleanup;
/* Rate control */
attrib->type = VAConfigAttribRateControl;
- if (!gst_vaapi_context_get_attribute (context, attrib->type, &value))
+ if (!context_get_attribute (context, attrib->type, &value))
goto cleanup;
va_rate_control = from_GstVaapiRateControl (config->rc_mode);
/* Packed headers */
if (config->packed_headers) {
attrib->type = VAConfigAttribEncPackedHeaders;
- if (!gst_vaapi_context_get_attribute (context, attrib->type, &value))
+ if (!context_get_attribute (context, attrib->type, &value))
goto cleanup;
if ((value & config->packed_headers) != config->packed_headers) {
return gst_vaapi_video_pool_get_size (context->surfaces_pool);
}
-
-/**
- * gst_vaapi_context_get_attribute:
- * @context: a #GstVaapiContext
- * @type: a VA config attribute type
- * @out_value_ptr: return location for the config attribute value
- *
- * Determines the value for the VA config attribute @type.
- *
- * Note: this function only returns success if the VA driver does
- * actually know about this config attribute type and that it returned
- * a valid value for it.
- *
- * Return value: %TRUE if the VA driver knows about the requested
- * config attribute and returned a valid value, %FALSE otherwise
- */
-gboolean
-gst_vaapi_context_get_attribute (GstVaapiContext * context,
- VAConfigAttribType type, guint * out_value_ptr)
-{
- VAConfigAttrib attrib;
- VAStatus status;
-
- g_return_val_if_fail (context != NULL, FALSE);
-
- GST_VAAPI_OBJECT_LOCK_DISPLAY (context);
- attrib.type = type;
- status = vaGetConfigAttributes (GST_VAAPI_OBJECT_VADISPLAY (context),
- context->va_profile, context->va_entrypoint, &attrib, 1);
- GST_VAAPI_OBJECT_UNLOCK_DISPLAY (context);
- if (!vaapi_check_status (status, "vaGetConfigAttributes()"))
- return FALSE;
- if (attrib.value == VA_ATTRIB_NOT_SUPPORTED)
- return FALSE;
-
- if (out_value_ptr)
- *out_value_ptr = attrib.value;
- return TRUE;
-}
guint
gst_vaapi_context_get_surface_count (GstVaapiContext * context);
-G_GNUC_INTERNAL
-gboolean
-gst_vaapi_context_get_attribute (GstVaapiContext * context,
- VAConfigAttribType type, guint * out_value_ptr);
-
G_END_DECLS
#endif /* GST_VAAPI_CONTEXT_H */
#include "gstvaapicontext.h"
#include "gstvaapidisplay_priv.h"
#include "gstvaapiutils.h"
+#include "gstvaapiutils_core.h"
#include "gstvaapivalue.h"
#define DEBUG 1
/* Gets config attribute for the supplied profile */
static gboolean
get_config_attribute (GstVaapiEncoder * encoder, VAConfigAttribType type,
- guint32 * out_value_ptr)
+ guint * out_value_ptr)
{
GstVaapiProfile profile;
- VAConfigAttrib attrib;
- VAStatus status;
+ VAProfile va_profile;
profile = get_profile (encoder);
if (!profile)
return FALSE;
- GST_VAAPI_DISPLAY_LOCK (encoder->display);
- attrib.type = type;
- status =
- vaGetConfigAttributes (GST_VAAPI_DISPLAY_VADISPLAY (encoder->display),
- gst_vaapi_profile_get_va_profile (profile), VAEntrypointEncSlice,
- &attrib, 1);
- GST_VAAPI_DISPLAY_UNLOCK (encoder->display);
- if (!vaapi_check_status (status, "vaGetConfigAttributes()"))
- return FALSE;
- if (attrib.value == VA_ATTRIB_NOT_SUPPORTED)
- return FALSE;
-
- if (out_value_ptr)
- *out_value_ptr = attrib.value;
- return TRUE;
+ va_profile = gst_vaapi_profile_get_va_profile (profile);
+ return gst_vaapi_get_config_attribute (encoder->display, va_profile,
+ VAEntrypointEncSlice, type, out_value_ptr);
}
/* Determines the set of supported packed headers */
}
/* Determine the supported rate control modes */
-static guint32
+static guint
get_rate_control_mask (GstVaapiEncoder * encoder)
{
const GstVaapiEncoderClassData *const cdata =
--- /dev/null
+/*
+ * gstvaapiutils_core.c - VA-API utilities (Core, MT-safe)
+ *
+ * Copyright (C) 2010-2011 Splitted-Desktop Systems
+ * Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
+ * Copyright (C) 2011-2014 Intel Corporation
+ * Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#include "sysdeps.h"
+#include "gstvaapicompat.h"
+#include "gstvaapiutils.h"
+#include "gstvaapiutils_core.h"
+#include "gstvaapidisplay_priv.h"
+
+#define DEBUG 1
+#include "gstvaapidebug.h"
+
+/**
+ * gst_vaapi_get_config_attribute:
+ * @display: a #GstVaapiDisplay
+ * @profile: a VA profile
+ * @entrypoint: a VA entrypoint
+ * @type: a VA config attribute type
+ * @out_value_ptr: return location for the config attribute value
+ *
+ * Determines the value for the VA config attribute @type and the
+ * given @profile/@entrypoint pair. If @out_value_ptr is %NULL, then
+ * this functions acts as a way to query whether the underlying VA
+ * driver supports the specified attribute @type, no matter the
+ * returned value.
+ *
+ * Note: this function only returns success if the VA driver does
+ * actually know about this config attribute type and that it returned
+ * a valid value for it.
+ *
+ * Return value: %TRUE if the VA driver knows about the requested
+ * config attribute and returned a valid value, %FALSE otherwise
+ */
+gboolean
+gst_vaapi_get_config_attribute (GstVaapiDisplay * display, VAProfile profile,
+ VAEntrypoint entrypoint, VAConfigAttribType type, guint * out_value_ptr)
+{
+ VAConfigAttrib attrib;
+ VAStatus status;
+
+ g_return_val_if_fail (display != NULL, FALSE);
+
+ GST_VAAPI_DISPLAY_LOCK (display);
+ attrib.type = type;
+ status = vaGetConfigAttributes (GST_VAAPI_DISPLAY_VADISPLAY (display),
+ profile, entrypoint, &attrib, 1);
+ GST_VAAPI_DISPLAY_UNLOCK (display);
+ if (!vaapi_check_status (status, "vaGetConfigAttributes()"))
+ return FALSE;
+ if (attrib.value == VA_ATTRIB_NOT_SUPPORTED)
+ return FALSE;
+
+ if (out_value_ptr)
+ *out_value_ptr = attrib.value;
+ return TRUE;
+}
--- /dev/null
+/*
+ * gstvaapiutils_core.h - VA-API utilities (Core, MT-safe)
+ *
+ * Copyright (C) 2010-2011 Splitted-Desktop Systems
+ * Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
+ * Copyright (C) 2011-2013 Intel Corporation
+ * Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifndef GST_VAAPI_UTILS_CORE_H
+#define GST_VAAPI_UTILS_CORE_H
+
+#include <gst/vaapi/gstvaapidisplay.h>
+
+G_BEGIN_DECLS
+
+/* Gets attribute value for the supplied profile/entrypoint pair (MT-safe) */
+G_GNUC_INTERNAL
+gboolean
+gst_vaapi_get_config_attribute (GstVaapiDisplay * display, VAProfile profile,
+ VAEntrypoint entrypoint, VAConfigAttribType type, guint * out_value_ptr);
+
+G_END_DECLS
+
+#endif /* GST_VAAPI_UTILS_CORE_H */