va: Move the video format functions into gstlibva.
authorHe Junyan <junyan.he@intel.com>
Wed, 23 Feb 2022 07:25:08 +0000 (15:25 +0800)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 29 Mar 2022 19:48:30 +0000 (19:48 +0000)
Untabifying header file.

The logging category was moved from the plugin generic category to
the display category. It can argue that video formats hacks are
display dependant.

Added validations for input parameters.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2048>

subprojects/gst-plugins-bad/gst-libs/gst/va/gstvavideoformat.c [moved from subprojects/gst-plugins-bad/sys/va/gstvavideoformat.c with 98% similarity]
subprojects/gst-plugins-bad/gst-libs/gst/va/gstvavideoformat.h [moved from subprojects/gst-plugins-bad/sys/va/gstvavideoformat.h with 83% similarity]
subprojects/gst-plugins-bad/gst-libs/gst/va/meson.build
subprojects/gst-plugins-bad/sys/va/gstvaallocator.c
subprojects/gst-plugins-bad/sys/va/gstvabasedec.c
subprojects/gst-plugins-bad/sys/va/gstvacaps.c
subprojects/gst-plugins-bad/sys/va/gstvadecoder.c
subprojects/gst-plugins-bad/sys/va/gstvadisplay_priv.c
subprojects/gst-plugins-bad/sys/va/gstvafilter.c
subprojects/gst-plugins-bad/sys/va/meson.build
subprojects/gst-plugins-bad/sys/va/vasurfaceimage.c

@@ -24,7 +24,8 @@
 
 #include "gstvavideoformat.h"
 
-GST_DEBUG_CATEGORY_STATIC (gstva_debug);
+#define GST_CAT_DEFAULT gst_va_display_debug
+GST_DEBUG_CATEGORY_EXTERN (gst_va_display_debug);
 
 #define VA_NSB_FIRST 0          /* No Significant Bit  */
 
@@ -324,8 +325,6 @@ fix_map (gpointer data)
   struct FormatMap *map;
   guint i;
 
-  GST_DEBUG_CATEGORY_GET (gstva_debug, "va");
-
   for (i = 0; i < args->len; i++) {
     image_format = &args->image_formats[i];
     if (!va_format_is_rgb (image_format))
@@ -341,7 +340,7 @@ fix_map (gpointer data)
 
     map->va_format = *image_format;
 
-    GST_CAT_INFO (gstva_debug, "GST_VIDEO_FORMAT_%s => { fourcc %"
+    GST_INFO ("GST_VIDEO_FORMAT_%s => { fourcc %"
         GST_FOURCC_FORMAT ", %s, bpp %d, depth %d, R %#010x, G %#010x, "
         "B %#010x, A %#010x }", gst_video_format_to_string (map->format),
         GST_FOURCC_ARGS (map->va_format.fourcc),
 
 #pragma once
 
+#include <gst/va/va_fwd.h>
+#include <gst/va/va-prelude.h>
 #include <gst/video/video.h>
 #include <va/va.h>
 
 G_BEGIN_DECLS
 
+GST_VA_API
 GstVideoFormat        gst_va_video_format_from_va_fourcc  (guint fourcc);
+
+GST_VA_API
 guint                 gst_va_fourcc_from_video_format     (GstVideoFormat format);
+
+GST_VA_API
 guint                 gst_va_chroma_from_video_format     (GstVideoFormat format);
+
+GST_VA_API
 const VAImageFormat * gst_va_image_format_from_video_format (GstVideoFormat format);
+
+GST_VA_API
 GstVideoFormat        gst_va_video_format_from_va_image_format (const VAImageFormat * va_format);
+
+GST_VA_API
 GstVideoFormat        gst_va_video_surface_format_from_image_format (GstVideoFormat image_format,
-                                                                    GArray * surface_formats);
+                                                                     GArray * surface_formats);
+GST_VA_API
 void                  gst_va_video_format_fix_map         (VAImageFormat * image_formats,
-                                                          gint num);
+                                                           gint num);
 
 G_END_DECLS
index 59054ce..bb2ad0f 100644 (file)
@@ -3,6 +3,7 @@ va_sources = [
   'gstvadisplay_drm.c',
   'gstvadisplay_wrapped.c',
   'gstvautils.c',
+  'gstvavideoformat.c',
 ]
 
 va_headers = [
@@ -11,6 +12,7 @@ va_headers = [
   'gstvadisplay_drm.h',
   'gstvadisplay_wrapped.h',
   'gstvautils.h',
+  'gstvavideoformat.h',
   'va_fwd.h',
   'va-prelude.h',
 ]
@@ -41,7 +43,7 @@ gstva = library('gstva-' + api_version,
   version : libversion,
   soversion : soversion,
   install : true,
-  dependencies : [gst_dep, libva_dep, libva_drm_dep, libdrm_dep],
+  dependencies : [gst_dep, gstbase_dep, gstvideo_dep, gstallocators_dep, libva_dep, libva_drm_dep, libdrm_dep],
 )
 
 pkg_name = 'gstreamer-va-' + api_version
@@ -49,5 +51,5 @@ libraries += [[pkg_name, {'lib': gstva}]]
 
 gstva_dep = declare_dependency(link_with : gstva,
   include_directories : [libsinc],
-  dependencies : [gst_dep, libva_dep, libva_drm_dep, libdrm_dep])
+  dependencies : [gst_dep, gstvideo_dep, libva_dep, libva_drm_dep, libdrm_dep])
 meson.override_dependency(pkg_name, gstva_dep)
index 1b4c1f2..337e3b9 100644 (file)
 
 #include "gstvaallocator.h"
 
+#include <gst/va/gstvavideoformat.h>
 #include <sys/types.h>
 #include <unistd.h>
 
 #include "gstvacaps.h"
 #include "gstvasurfacecopy.h"
-#include "gstvavideoformat.h"
 #include "vasurfaceimage.h"
 
 #define GST_CAT_DEFAULT gst_va_memory_debug
index a14258f..d59ff72 100644 (file)
 
 #include "gstvabasedec.h"
 
+#include <gst/va/gstvavideoformat.h>
+
 #include "gstvaallocator.h"
 #include "gstvacaps.h"
 #include "gstvapool.h"
-#include "gstvavideoformat.h"
 
 #define GST_CAT_DEFAULT (base->debug_category)
 #define GST_VA_BASE_DEC_GET_PARENT_CLASS(obj) (GST_VA_BASE_DEC_GET_CLASS(obj)->parent_decoder_class)
index 17ac0a0..e56b007 100644 (file)
 #include "gstvacaps.h"
 
 #include <gst/allocators/allocators.h>
+#include <gst/va/gstvavideoformat.h>
 
 #include <va/va_drmcommon.h>
 
 #include "gstvadisplay_priv.h"
 #include "gstvaprofile.h"
-#include "gstvavideoformat.h"
 
 GST_DEBUG_CATEGORY_EXTERN (gstva_debug);
 #define GST_CAT_DEFAULT gstva_debug
index aacf156..9330b9d 100644 (file)
 
 #include "gstvadecoder.h"
 
+#include <gst/va/gstvavideoformat.h>
+
 #include "gstvaallocator.h"
 #include "gstvacaps.h"
 #include "gstvadisplay_priv.h"
 #include "gstvaprofile.h"
-#include "gstvavideoformat.h"
 
 struct _GstVaDecoder
 {
index 1f64a88..bb10e54 100644 (file)
 #include "config.h"
 #endif
 
+#include <gst/va/gstvavideoformat.h>
+
 #include "gstvadisplay_priv.h"
 #include "gstvaprofile.h"
-#include "gstvavideoformat.h"
 
 GArray *
 gst_va_display_get_profiles (GstVaDisplay * self, guint32 codec,
index f74dc73..dc5c13e 100644 (file)
 #include "gstvafilter.h"
 
 #include <gst/video/video.h>
+#include <gst/va/gstvavideoformat.h>
 
 #include <va/va_drmcommon.h>
 
 #include "gstvaallocator.h"
 #include "gstvacaps.h"
 #include "gstvadisplay_priv.h"
-#include "gstvavideoformat.h"
 #include "vasurfaceimage.h"
 
 struct _GstVaFilter
index 6cf9a50..83cba95 100644 (file)
@@ -15,7 +15,6 @@ va_sources = [
   'gstvapool.c',
   'gstvaprofile.c',
   'gstvasurfacecopy.c',
-  'gstvavideoformat.c',
   'gstvavp8dec.c',
   'gstvavp9dec.c',
   'gstvampeg2dec.c',
index cb67a2e..695c5c4 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "vasurfaceimage.h"
 
-#include "gstvavideoformat.h"
+#include <gst/va/gstvavideoformat.h>
 #include <va/va.h>
 
 gboolean