subdir('vulkan')
subdir('wayland')
subdir('webrtc')
+subdir('va')
#endif
#include "gstvadisplay.h"
-#include "gstvaprofile.h"
-#include "gstvavideoformat.h"
+#include <va/va.h>
GST_DEBUG_CATEGORY (gst_va_display_debug);
#define GST_CAT_DEFAULT gst_va_display_debug
priv->impl = GST_VA_IMPLEMENTATION_INVALID;
}
+/**
+ * gst_va_display_lock:
+ * @self: a #GstVaDisplay
+ *
+ * Lock the display. It will be used before we call the
+ * VA API functions to serialize the VA commands.
+ *
+ * Since: 1.20
+ **/
void
gst_va_display_lock (GstVaDisplay * self)
{
g_rec_mutex_lock (&priv->lock);
}
+/**
+ * gst_va_display_unlock:
+ * @self: a #GstVaDisplay
+ *
+ * Unlock the display. It will be used after we call the
+ * VA API functions.
+ *
+ * Since: 1.20
+ **/
void
gst_va_display_unlock (GstVaDisplay * self)
{
*
* Returns: %TRUE if the VA driver can be initialized; %FALSE
* otherwise
+ *
+ * Since: 1.20
**/
gboolean
gst_va_display_initialize (GstVaDisplay * self)
return TRUE;
}
-VADisplay
+/**
+ * gst_va_display_get_va_dpy:
+ * @self: a #GstVaDisplay type display.
+ *
+ * Get the VA display handle of the @self.
+ *
+ * Returns: the VA display handle.
+ *
+ * Since: 1.20
+ */
+gpointer
gst_va_display_get_va_dpy (GstVaDisplay * self)
{
- VADisplay dpy = 0;
-
- g_return_val_if_fail (GST_IS_VA_DISPLAY (self), 0);
-
- g_object_get (self, "va-display", &dpy, NULL);
- return dpy;
-}
-
-GArray *
-gst_va_display_get_profiles (GstVaDisplay * self, guint32 codec,
- VAEntrypoint entrypoint)
-{
- GArray *ret = NULL;
VADisplay dpy;
- VAEntrypoint *entrypoints;
- VAProfile *profiles;
- VAStatus status;
- gint i, j, num_entrypoints = 0, num_profiles = 0;
g_return_val_if_fail (GST_IS_VA_DISPLAY (self), NULL);
- dpy = gst_va_display_get_va_dpy (self);
-
- gst_va_display_lock (self);
- num_profiles = vaMaxNumProfiles (dpy);
- num_entrypoints = vaMaxNumEntrypoints (dpy);
- gst_va_display_unlock (self);
-
- profiles = g_new (VAProfile, num_profiles);
- entrypoints = g_new (VAEntrypoint, num_entrypoints);
-
- gst_va_display_lock (self);
- status = vaQueryConfigProfiles (dpy, profiles, &num_profiles);
- gst_va_display_unlock (self);
- if (status != VA_STATUS_SUCCESS) {
- GST_ERROR ("vaQueryConfigProfile: %s", vaErrorStr (status));
- goto bail;
- }
-
- for (i = 0; i < num_profiles; i++) {
- if (codec != gst_va_profile_codec (profiles[i]))
- continue;
-
- gst_va_display_lock (self);
- status = vaQueryConfigEntrypoints (dpy, profiles[i], entrypoints,
- &num_entrypoints);
- gst_va_display_unlock (self);
- if (status != VA_STATUS_SUCCESS) {
- GST_ERROR ("vaQueryConfigEntrypoints: %s", vaErrorStr (status));
- goto bail;
- }
-
- for (j = 0; j < num_entrypoints; j++) {
- if (entrypoints[j] == entrypoint) {
- if (!ret)
- ret = g_array_new (FALSE, FALSE, sizeof (VAProfile));
- g_array_append_val (ret, profiles[i]);
- break;
- }
- }
- }
-
-bail:
- g_free (entrypoints);
- g_free (profiles);
- return ret;
-}
-
-GArray *
-gst_va_display_get_image_formats (GstVaDisplay * self)
-{
- GArray *ret = NULL;
- GstVideoFormat format;
- VADisplay dpy;
- VAImageFormat *va_formats;
- VAStatus status;
- int i, max, num = 0;
-
- g_return_val_if_fail (GST_IS_VA_DISPLAY (self), NULL);
-
- dpy = gst_va_display_get_va_dpy (self);
-
- gst_va_display_lock (self);
- max = vaMaxNumImageFormats (dpy);
- gst_va_display_unlock (self);
- if (max == 0)
- return NULL;
-
- va_formats = g_new (VAImageFormat, max);
-
- gst_va_display_lock (self);
- status = vaQueryImageFormats (dpy, va_formats, &num);
- gst_va_display_unlock (self);
-
- gst_va_video_format_fix_map (va_formats, num);
-
- if (status != VA_STATUS_SUCCESS) {
- GST_ERROR ("vaQueryImageFormats: %s", vaErrorStr (status));
- goto bail;
- }
-
- ret = g_array_sized_new (FALSE, FALSE, sizeof (GstVideoFormat), num);
- for (i = 0; i < num; i++) {
- format = gst_va_video_format_from_va_image_format (&va_formats[i]);
- if (format != GST_VIDEO_FORMAT_UNKNOWN)
- g_array_append_val (ret, format);
- }
-
- if (ret->len == 0) {
- g_array_unref (ret);
- ret = NULL;
- }
-
-bail:
- g_free (va_formats);
- return ret;
+ g_object_get (self, "va-display", &dpy, NULL);
+ return dpy;
}
+/**
+ * gst_va_display_get_implementation:
+ * @self: a #GstVaDisplay type display.
+ *
+ * Get the the #GstVaImplementation type of @self.
+ *
+ * Returns: #GstVaImplementation.
+ *
+ * Since: 1.20
+ */
GstVaImplementation
gst_va_display_get_implementation (GstVaDisplay * self)
{
--- /dev/null
+/* GStreamer
+ * Copyright (C) 2020 Igalia, S.L.
+ * Author: Víctor Jáquez <vjaquez@igalia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#include <gst/va/va_fwd.h>
+#include <gst/va/va-prelude.h>
+#include <gst/gst.h>
+
+G_BEGIN_DECLS
+
+/**
+ * GstVaImplementation:
+ * @GST_VA_IMPLEMENTATION_MESA_GALLIUM: The mesa gallium implementation.
+ * @GST_VA_IMPLEMENTATION_INTEL_I965: The legacy i965 intel implementation.
+ * @GST_VA_IMPLEMENTATION_INTEL_IHD: The iHD intel implementation.
+ * @GST_VA_IMPLEMENTATION_OTHER: Other implementation.
+ * @GST_VA_IMPLEMENTATION_INVALID: Invalid implementation.
+ *
+ * Types of different VA API implemented drivers. These are the typical and
+ * the most widely used VA drivers.
+ *
+ * Since: 1.20
+ */
+typedef enum
+{
+ GST_VA_IMPLEMENTATION_MESA_GALLIUM,
+ GST_VA_IMPLEMENTATION_INTEL_I965,
+ GST_VA_IMPLEMENTATION_INTEL_IHD,
+ GST_VA_IMPLEMENTATION_OTHER,
+ GST_VA_IMPLEMENTATION_INVALID,
+} GstVaImplementation;
+
+/**
+ * GST_VA_DISPLAY_HANDLE_CONTEXT_TYPE_STR:
+ *
+ * Since: 1.20
+ */
+#define GST_VA_DISPLAY_HANDLE_CONTEXT_TYPE_STR "gst.va.display.handle"
+
+/**
+ * GST_VA_DISPLAY_IS_IMPLEMENTATION: (skip)
+ *
+ * Check whether the display is the implementation of the specified
+ * #GstVaImplementation type.
+ */
+#define GST_VA_DISPLAY_IS_IMPLEMENTATION(display, impl) \
+ (gst_va_display_is_implementation (display, G_PASTE (GST_VA_IMPLEMENTATION_, impl)))
+
+#define GST_TYPE_VA_DISPLAY (gst_va_display_get_type())
+#define GST_VA_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_VA_DISPLAY, GstVaDisplay))
+#define GST_VA_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_VA_DISPLAY, GstVaDisplayClass))
+#define GST_IS_VA_DISPLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VA_DISPLAY))
+#define GST_IS_VA_DISPLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VA_DISPLAY))
+#define GST_VA_DISPLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_VA_DISPLAY, GstVaDisplayClass))
+
+/**
+ * GstVaDisplay:
+ *
+ * The common VA display object structure.
+ *
+ * Since: 1.20
+ */
+struct _GstVaDisplay
+{
+ /*< private > */
+ GstObject parent;
+};
+
+/**
+ * GstVaDisplayClass:
+ *
+ * The common VA display object class structure.
+ * @create_va_display: The function to create the real VA display.
+ *
+ * Since: 1.20
+ */
+struct _GstVaDisplayClass
+{
+ /*< private > */
+ GstObjectClass parent_class;
+
+ /*< public > */
+ gpointer (*create_va_display) (GstVaDisplay * self);
+};
+
+GST_VA_API
+GType gst_va_display_get_type (void);
+GST_VA_API
+void gst_va_display_lock (GstVaDisplay * self);
+GST_VA_API
+void gst_va_display_unlock (GstVaDisplay * self);
+GST_VA_API
+gboolean gst_va_display_initialize (GstVaDisplay * self);
+GST_VA_API
+gpointer gst_va_display_get_va_dpy (GstVaDisplay * self);
+GST_VA_API
+GstVaImplementation gst_va_display_get_implementation (GstVaDisplay * self);
+
+/**
+ * gst_va_display_is_implementation:
+ * @display: the #GstVaDisplay to check.
+ * @impl: the specified #GstVaImplementation.
+ *
+ * Check whether the @display is the implementation of the @impl type.
+ *
+ * Returns: %TRUE if the @display is the implementation of the @impl type.
+ *
+ * Since: 1.20
+ */
+static inline gboolean
+gst_va_display_is_implementation (GstVaDisplay * display, GstVaImplementation impl)
+{
+ return (gst_va_display_get_implementation (display) == impl);
+}
+
+G_END_DECLS
gint fd;
};
+struct _GstVaDisplayDrmClass
+{
+ /*< private > */
+ GstVaDisplayClass parent_class;
+};
+
GST_DEBUG_CATEGORY_EXTERN (gst_va_display_debug);
#define GST_CAT_DEFAULT gst_va_display_debug
* Returns: a newly allocated #GstVaDisplay if the specified DRM
* render device could be opened and initialized; otherwise %NULL
* is returned.
+ *
+ * Since: 1.20
**/
GstVaDisplay *
gst_va_display_drm_new_from_path (const gchar * path)
--- /dev/null
+/* GStreamer
+ * Copyright (C) 2020 Igalia, S.L.
+ * Author: Víctor Jáquez <vjaquez@igalia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#include "gstvadisplay.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_VA_DISPLAY_DRM (gst_va_display_drm_get_type())
+#define GST_VA_DISPLAY_DRM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_VA_DISPLAY_DRM, GstVaDisplayDrm))
+#define GST_VA_DISPLAY_DRM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_VA_DISPLAY_DRM, GstVaDisplayDrmClass))
+#define GST_IS_VA_DISPLAY_DRM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VA_DISPLAY_DRM))
+#define GST_IS_VA_DISPLAY_DRM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VA_DISPLAY_DRM))
+#define GST_VA_DISPLAY_DRM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_VA_DISPLAY_DRM, GstVaDisplayDrmClass))
+
+GST_VA_API
+GType gst_va_display_drm_get_type (void);
+GST_VA_API
+GstVaDisplay * gst_va_display_drm_new_from_path (const gchar * path);
+
+G_END_DECLS
GstVaDisplay parent;
};
+struct _GstVaDisplayWrappedClass
+{
+ /*< private > */
+ GstVaDisplayClass parent_class;
+};
+
#define gst_va_display_wrapped_parent_class parent_class
G_DEFINE_TYPE (GstVaDisplayWrapped, gst_va_display_wrapped,
GST_TYPE_VA_DISPLAY);
* VADisplay.
*
* Returns: a new #GstVaDisplay if @handle is valid, Otherwise %NULL.
+ *
+ * Since: 1.20
**/
GstVaDisplay *
gst_va_display_wrapped_new (guintptr handle)
--- /dev/null
+/* GStreamer
+ * Copyright (C) 2020 Igalia, S.L.
+ * Author: Víctor Jáquez <vjaquez@igalia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#include "gstvadisplay.h"
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_VA_DISPLAY_WRAPPED (gst_va_display_wrapped_get_type())
+#define GST_VA_DISPLAY_WRAPPED(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_VA_DISPLAY_WRAPPED, GstVaDisplayWrapped))
+#define GST_VA_DISPLAY_WRAPPED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_VA_DISPLAY_WRAPPED, GstVaDisplayWrappedClass))
+#define GST_IS_VA_DISPLAY_WRAPPED(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VA_DISPLAY_WRAPPED))
+#define GST_IS_VA_DISPLAY_WRAPPED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VA_DISPLAY_WRAPPED))
+#define GST_VA_DISPLAY_WRAPPED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_VA_DISPLAY_WRAPPED, GstVaDisplayWrappedClass))
+
+GST_VA_API
+GType gst_va_display_wrapped_get_type (void);
+GST_VA_API
+GstVaDisplay * gst_va_display_wrapped_new (guintptr handle);
+
+G_END_DECLS
--- /dev/null
+va_sources = [
+ 'gstvadisplay.c',
+ 'gstvadisplay_drm.c',
+ 'gstvadisplay_wrapped.c',
+]
+
+va_headers = [
+ 'gstvadisplay.h',
+ 'gstvadisplay_drm.h',
+ 'gstvadisplay_wrapped.h',
+ 'va_fwd.h',
+ 'va-prelude.h',
+]
+
+gstva_dep = dependency('', required : false)
+
+have_va = false
+va_option = get_option('va')
+if va_option.disabled() or host_system != 'linux'
+ subdir_done()
+endif
+
+libva_req = ['>= 1.6']
+
+libva_dep = dependency('libva', version: libva_req, required: va_option)
+libva_drm_dep = dependency('libva-drm', version: libva_req, required: va_option)
+libgudev_dep = dependency('gudev-1.0', required: va_option)
+libdrm_dep = dependency('libdrm', required: false, fallback: ['libdrm', 'ext_libdrm'])
+
+have_va = libva_dep.found() and libva_drm_dep.found()
+if not (have_va and libgudev_dep.found())
+ if va_option.enabled()
+ error('The va lib was enabled explicity, but required dependencies were not found.')
+ endif
+ subdir_done()
+endif
+
+
+gstva = library('gstva-' + api_version,
+ va_sources,
+ c_args : gst_plugins_bad_args + ['-DGST_USE_UNSTABLE_API', '-DBUILDING_GST_VA'],
+ include_directories : [configinc, libsinc],
+ version : libversion,
+ soversion : soversion,
+ install : true,
+ dependencies : [gst_dep, libva_dep, libva_drm_dep, libgudev_dep, libdrm_dep],
+)
+
+pkgconfig.generate(gstva,
+ libraries : gst_dep,
+ variables : pkgconfig_variables,
+ subdirs : pkgconfig_subdirs,
+ name : 'gstreamer-va-1.0',
+ description : 'GStreamer VA support',
+)
+
+gstva_dep = declare_dependency(link_with : gstva,
+ include_directories : [libsinc],
+ dependencies : [gst_dep, libva_dep, libva_drm_dep, libgudev_dep, libdrm_dep])
+meson.override_dependency('gstreamer-va-1.0', gstva_dep)
--- /dev/null
+/* GStreamer
+ * Copyright (C) 2021 GStreamer developers
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#include <gst/gst.h>
+
+#ifndef GST_VA_API
+# ifdef BUILDING_GST_VA
+# define GST_VA_API GST_API_EXPORT /* from config.h */
+# else
+# define GST_VA_API GST_API_IMPORT
+# endif
+#endif
/* GStreamer
- * Copyright (C) 2020 Igalia, S.L.
- * Author: Víctor Jáquez <vjaquez@igalia.com>
+ * Copyright (C) 2021 GStreamer developers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
#pragma once
-#include "gstvadisplay.h"
+#include <gst/gst.h>
G_BEGIN_DECLS
-#define GST_TYPE_VA_DISPLAY_DRM (gst_va_display_drm_get_type())
-G_DECLARE_FINAL_TYPE (GstVaDisplayDrm, gst_va_display_drm, GST, VA_DISPLAY_DRM,
- GstVaDisplay)
+typedef struct _GstVaDisplay GstVaDisplay;
+typedef struct _GstVaDisplayClass GstVaDisplayClass;
-GstVaDisplay * gst_va_display_drm_new_from_path (const gchar * path);
+typedef struct _GstVaDisplayDrm GstVaDisplayDrm;
+typedef struct _GstVaDisplayDrmClass GstVaDisplayDrmClass;
+
+typedef struct _GstVaDisplayWrapped GstVaDisplayWrapped;
+typedef struct _GstVaDisplayWrappedClass GstVaDisplayWrappedClass;
G_END_DECLS
#pragma once
#include <gst/allocators/allocators.h>
+#include <gst/va/gstvadisplay.h>
#include <gst/video/video.h>
-
-#include "gstvadisplay.h"
+#include <va/va.h>
G_BEGIN_DECLS
#include <va/va_drmcommon.h>
-#include "gstvadisplay.h"
+#include "gstvadisplay_priv.h"
#include "gstvaprofile.h"
#include "gstvavideoformat.h"
-GST_DEBUG_CATEGORY_EXTERN (gst_va_display_debug);
-#define GST_CAT_DEFAULT gst_va_display_debug
+GST_DEBUG_CATEGORY_EXTERN (gstva_debug);
+#define GST_CAT_DEFAULT gstva_debug
static const guint va_rt_format_list[] = {
#define R(name) G_PASTE (VA_RT_FORMAT_, name)
#pragma once
-#include "gstvadisplay.h"
+#include <gst/va/gstvadisplay.h>
+#include <va/va.h>
G_BEGIN_DECLS
#include "gstvaallocator.h"
#include "gstvacaps.h"
-#include "gstvadisplay_wrapped.h"
+#include "gstvadisplay_priv.h"
#include "gstvavideoformat.h"
+#include <gst/va/gstvadisplay_wrapped.h>
struct _GstVaDecoder
{
#pragma once
-#include "gstvadisplay.h"
+#include <gst/va/gstvadisplay.h>
+#include <va/va.h>
G_BEGIN_DECLS
#include "gstvadevice.h"
#include <gudev/gudev.h>
-#include "gstvadisplay_drm.h"
#define GST_CAT_DEFAULT gstva_debug
GST_DEBUG_CATEGORY_EXTERN (gstva_debug);
G_BEGIN_DECLS
-#include "gstvadisplay.h"
+#include <gst/va/gstvadisplay_drm.h>
#define GST_TYPE_VA_DEVICE (gst_va_device_get_type())
#define GST_IS_VA_DEVICE(obj) (GST_IS_MINI_OBJECT_TYPE((obj), GST_TYPE_VA_DEVICE))
+++ /dev/null
-/* GStreamer
- * Copyright (C) 2020 Igalia, S.L.
- * Author: Víctor Jáquez <vjaquez@igalia.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#pragma once
-
-#include <gst/gst.h>
-#include <va/va.h>
-
-G_BEGIN_DECLS
-
-typedef enum
-{
- GST_VA_IMPLEMENTATION_MESA_GALLIUM,
- GST_VA_IMPLEMENTATION_INTEL_I965,
- GST_VA_IMPLEMENTATION_INTEL_IHD,
- GST_VA_IMPLEMENTATION_OTHER,
- GST_VA_IMPLEMENTATION_INVALID,
-} GstVaImplementation;
-
-#define GST_VA_DISPLAY_IS_IMPLEMENTATION(display, impl) \
- (gst_va_display_is_implementation (display, G_PASTE (GST_VA_IMPLEMENTATION_, impl)))
-
-#define GST_TYPE_VA_DISPLAY (gst_va_display_get_type())
-G_DECLARE_DERIVABLE_TYPE (GstVaDisplay, gst_va_display, GST, VA_DISPLAY, GstObject)
-
-struct _GstVaDisplayClass
-{
- /*< private > */
- GstObjectClass parent_class;
-
- /*< public > */
- gpointer (*create_va_display) (GstVaDisplay * self);
-};
-
-void gst_va_display_lock (GstVaDisplay * self);
-void gst_va_display_unlock (GstVaDisplay * self);
-gboolean gst_va_display_initialize (GstVaDisplay * self);
-VADisplay gst_va_display_get_va_dpy (GstVaDisplay * self);
-GArray * gst_va_display_get_profiles (GstVaDisplay * self,
- guint32 codec,
- VAEntrypoint entrypoint);
-GArray * gst_va_display_get_image_formats (GstVaDisplay * self);
-GstVaImplementation gst_va_display_get_implementation (GstVaDisplay * self);
-
-static inline gboolean
-gst_va_display_is_implementation (GstVaDisplay * self, GstVaImplementation impl)
-{
- return (gst_va_display_get_implementation (self) == impl);
-}
-
-G_END_DECLS
--- /dev/null
+/* GStreamer
+ * Copyright (C) 2020 Igalia, S.L.
+ * Author: Víctor Jáquez <vjaquez@igalia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstvadisplay_priv.h"
+#include "gstvaprofile.h"
+#include "gstvavideoformat.h"
+
+GArray *
+gst_va_display_get_profiles (GstVaDisplay * self, guint32 codec,
+ VAEntrypoint entrypoint)
+{
+ GArray *ret = NULL;
+ VADisplay dpy;
+ VAEntrypoint *entrypoints;
+ VAProfile *profiles;
+ VAStatus status;
+ gint i, j, num_entrypoints = 0, num_profiles = 0;
+
+ g_return_val_if_fail (GST_IS_VA_DISPLAY (self), NULL);
+
+ dpy = gst_va_display_get_va_dpy (self);
+
+ gst_va_display_lock (self);
+ num_profiles = vaMaxNumProfiles (dpy);
+ num_entrypoints = vaMaxNumEntrypoints (dpy);
+ gst_va_display_unlock (self);
+
+ profiles = g_new (VAProfile, num_profiles);
+ entrypoints = g_new (VAEntrypoint, num_entrypoints);
+
+ gst_va_display_lock (self);
+ status = vaQueryConfigProfiles (dpy, profiles, &num_profiles);
+ gst_va_display_unlock (self);
+ if (status != VA_STATUS_SUCCESS) {
+ GST_ERROR ("vaQueryConfigProfile: %s", vaErrorStr (status));
+ goto bail;
+ }
+
+ for (i = 0; i < num_profiles; i++) {
+ if (codec != gst_va_profile_codec (profiles[i]))
+ continue;
+
+ gst_va_display_lock (self);
+ status = vaQueryConfigEntrypoints (dpy, profiles[i], entrypoints,
+ &num_entrypoints);
+ gst_va_display_unlock (self);
+ if (status != VA_STATUS_SUCCESS) {
+ GST_ERROR ("vaQueryConfigEntrypoints: %s", vaErrorStr (status));
+ goto bail;
+ }
+
+ for (j = 0; j < num_entrypoints; j++) {
+ if (entrypoints[j] == entrypoint) {
+ if (!ret)
+ ret = g_array_new (FALSE, FALSE, sizeof (VAProfile));
+ g_array_append_val (ret, profiles[i]);
+ break;
+ }
+ }
+ }
+
+bail:
+ g_free (entrypoints);
+ g_free (profiles);
+ return ret;
+}
+
+GArray *
+gst_va_display_get_image_formats (GstVaDisplay * self)
+{
+ GArray *ret = NULL;
+ GstVideoFormat format;
+ VADisplay dpy;
+ VAImageFormat *va_formats;
+ VAStatus status;
+ int i, max, num = 0;
+
+ g_return_val_if_fail (GST_IS_VA_DISPLAY (self), NULL);
+
+ dpy = gst_va_display_get_va_dpy (self);
+
+ gst_va_display_lock (self);
+ max = vaMaxNumImageFormats (dpy);
+ gst_va_display_unlock (self);
+ if (max == 0)
+ return NULL;
+
+ va_formats = g_new (VAImageFormat, max);
+
+ gst_va_display_lock (self);
+ status = vaQueryImageFormats (dpy, va_formats, &num);
+ gst_va_display_unlock (self);
+
+ gst_va_video_format_fix_map (va_formats, num);
+
+ if (status != VA_STATUS_SUCCESS) {
+ GST_ERROR ("vaQueryImageFormats: %s", vaErrorStr (status));
+ goto bail;
+ }
+
+ ret = g_array_sized_new (FALSE, FALSE, sizeof (GstVideoFormat), num);
+ for (i = 0; i < num; i++) {
+ format = gst_va_video_format_from_va_image_format (&va_formats[i]);
+ if (format != GST_VIDEO_FORMAT_UNKNOWN)
+ g_array_append_val (ret, format);
+ }
+
+ if (ret->len == 0) {
+ g_array_unref (ret);
+ ret = NULL;
+ }
+
+bail:
+ g_free (va_formats);
+ return ret;
+}
#pragma once
-#include "gstvadisplay.h"
+#include <gst/va/gstvadisplay.h>
+#include <va/va.h>
G_BEGIN_DECLS
-
-#define GST_TYPE_VA_DISPLAY_WRAPPED gst_va_display_wrapped_get_type()
-G_DECLARE_FINAL_TYPE (GstVaDisplayWrapped, gst_va_display_wrapped, GST,
- VA_DISPLAY_WRAPPED, GstVaDisplay)
-
-GstVaDisplay * gst_va_display_wrapped_new (guintptr handle);
+GArray * gst_va_display_get_profiles (GstVaDisplay * self,
+ guint32 codec,
+ VAEntrypoint entrypoint);
+GArray * gst_va_display_get_image_formats (GstVaDisplay * self);
G_END_DECLS
#include "gstvaallocator.h"
#include "gstvacaps.h"
+#include "gstvadisplay_priv.h"
#include "gstvavideoformat.h"
struct _GstVaFilter
#pragma once
-#include "gstvadisplay.h"
-
+#include <gst/va/gstvadisplay.h>
#include <gst/video/video.h>
+#include <va/va.h>
#include <va/va_vpp.h>
G_BEGIN_DECLS
#include "config.h"
#endif
-#include "gstvadisplay_drm.h"
-#include "gstvadisplay_wrapped.h"
#include "gstvautils.h"
+#include <gst/va/gstvadisplay_drm.h>
+#include <gst/va/gstvadisplay_wrapped.h>
GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT);
_init_context_debug ();
- ctxt = gst_context_new ("gst.va.display.handle", TRUE);
+ ctxt = gst_context_new (GST_VA_DISPLAY_HANDLE_CONTEXT_TYPE_STR, TRUE);
gst_context_set_va_display (ctxt, display);
GST_CAT_INFO_OBJECT (GST_CAT_CONTEXT, element,
if (gst_va_display_found (element, g_atomic_pointer_get (display_ptr)))
goto done;
- _gst_context_query (element, "gst.va.display.handle");
+ _gst_context_query (element, GST_VA_DISPLAY_HANDLE_CONTEXT_TYPE_STR);
/* Neighbour found and it updated the display */
if (gst_va_display_found (element, g_atomic_pointer_get (display_ptr)))
context_type = gst_context_get_context_type (context);
- if (g_strcmp0 (context_type, "gst.va.display.handle") == 0) {
+ if (g_strcmp0 (context_type, GST_VA_DISPLAY_HANDLE_CONTEXT_TYPE_STR) == 0) {
type_name = G_OBJECT_TYPE_NAME (element);
if (!gst_context_get_va_display (context, type_name, render_device_path,
&display_replacement)) {
"handle context query %" GST_PTR_FORMAT, query);
gst_query_parse_context_type (query, &context_type);
- if (!display || g_strcmp0 (context_type, "gst.va.display.handle") != 0)
+ if (!display
+ || g_strcmp0 (context_type, GST_VA_DISPLAY_HANDLE_CONTEXT_TYPE_STR) != 0)
return FALSE;
gst_query_parse_context (query, &old_ctxt);
if (old_ctxt)
ctxt = gst_context_copy (old_ctxt);
else
- ctxt = gst_context_new ("gst.va.display.handle", TRUE);
+ ctxt = gst_context_new (GST_VA_DISPLAY_HANDLE_CONTEXT_TYPE_STR, TRUE);
gst_context_set_va_display (ctxt, display);
gst_query_set_context (query, ctxt);
#pragma once
-#include "gstvadisplay.h"
+#include <gst/va/gstvadisplay.h>
G_BEGIN_DECLS
#include "gstvaallocator.h"
#include "gstvacaps.h"
-#include "gstvadisplay_drm.h"
+#include "gstvadisplay_priv.h"
#include "gstvafilter.h"
#include "gstvapool.h"
#include "gstvautils.h"
'gstvabasedec.c',
'gstvacaps.c',
'gstvadecoder.c',
- 'gstvadisplay.c',
- 'gstvadisplay_drm.c',
- 'gstvadisplay_wrapped.c',
'gstvadevice.c',
+ 'gstvadisplay_priv.c',
'gstvafilter.c',
'gstvah264dec.c',
'gstvah265dec.c',
'gstvavpp.c'
]
-have_va = false
va_option = get_option('va')
if va_option.disabled() or host_system != 'linux'
subdir_done()
endif
-libva_req = ['>= 1.6']
-
-libva_dep = dependency('libva', version: libva_req, required: va_option)
-libva_drm_dep = dependency('libva-drm', version: libva_req, required: va_option)
-libgudev_dep = dependency('gudev-1.0', required: va_option)
-libdrm_dep = dependency('libdrm', required: false,
- fallback: ['libdrm', 'ext_libdrm'])
+if not gstva_dep.found()
+ if va_option.enabled()
+ error('The va plugin was enabled explicity, but required dependencies were not found.')
+ endif
+ subdir_done()
+endif
libva_av1_req = ['>= 1.8']
libva_av1_dep = dependency('libva', version: libva_av1_req, required: va_option)
va_sources += 'gstvaav1dec.c'
endif
-have_va = libva_dep.found() and libva_drm_dep.found()
-if not (have_va and libgudev_dep.found())
- if va_option.enabled()
- error('The va plugin was enabled explicity, but required dependencies were not found.')
- endif
- subdir_done()
-endif
-
cdata.set10('HAVE_LIBDRM', libdrm_dep.found())
driverdir = libva_dep.get_pkgconfig_variable('driverdir')
va_sources,
c_args : gst_plugins_bad_args + extra_c_args + gstva_cargs + ['-std=c99'],
include_directories : [configinc],
- dependencies : [gstbase_dep, gstvideo_dep, gstcodecs_dep, libva_dep, gstallocators_dep, libva_drm_dep, libgudev_dep, libdrm_dep] + extra_dep,
+ dependencies : [libva_dep, gstvideo_dep, gstcodecs_dep, gstallocators_dep, gstva_dep] + extra_dep,
install : true,
install_dir : plugins_install_dir,
)