va: Move the video format functions into gstlibva.

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>
This commit is contained in:
He Junyan 2022-02-23 15:25:08 +08:00 committed by GStreamer Marge Bot
parent b7086a368f
commit 53783eab6c
11 changed files with 33 additions and 16 deletions

View file

@ -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),

View file

@ -20,19 +20,33 @@
#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

View 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)

View file

@ -24,12 +24,12 @@
#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

View file

@ -20,10 +20,11 @@
#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)

View file

@ -25,12 +25,12 @@
#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

View file

@ -24,11 +24,12 @@
#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
{

View file

@ -22,9 +22,10 @@
#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,

View file

@ -25,13 +25,13 @@
#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

View file

@ -15,7 +15,6 @@ va_sources = [
'gstvapool.c',
'gstvaprofile.c',
'gstvasurfacecopy.c',
'gstvavideoformat.c',
'gstvavp8dec.c',
'gstvavp9dec.c',
'gstvampeg2dec.c',

View file

@ -20,7 +20,7 @@
#include "vasurfaceimage.h"
#include "gstvavideoformat.h"
#include <gst/va/gstvavideoformat.h>
#include <va/va.h>
gboolean