va: Add Windows specific element type/feature naming support

Adapter LUID will be changed per boot. Use different naming rule on Windows

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4114>
This commit is contained in:
Seungha Yang 2023-03-08 22:44:42 +09:00 committed by GStreamer Marge Bot
parent c1946c0209
commit 7bc6ba63b2
16 changed files with 132 additions and 223 deletions

View file

@ -1107,22 +1107,9 @@ gst_va_av1_dec_register (GstPlugin * plugin, GstVaDevice * device,
type_info.class_data = cdata;
/* The first decoder to be registered should use a constant name,
* like vaav1dec, for any additional decoders, we create unique
* names, using inserting the render device name. */
if (device->index == 0) {
type_name = g_strdup ("GstVaAV1Dec");
feature_name = g_strdup ("vaav1dec");
} else {
gchar *basename = g_path_get_basename (device->render_device_path);
type_name = g_strdup_printf ("GstVa%sAV1Dec", basename);
feature_name = g_strdup_printf ("va%sav1dec", basename);
cdata->description = basename;
/* lower rank for non-first device */
if (rank > 0)
rank--;
}
gst_va_create_feature_name (device, "GstVaAV1Dec", "GstVa%sAV1Dec",
&type_name, "vaav1dec", "va%sav1dec", &feature_name,
&cdata->description, &rank);
g_once (&debug_once, _register_debug_category, NULL);

View file

@ -32,6 +32,7 @@
#include "gstvadecoder.h"
#include "gstvadevice.h"
#include "gstvaprofile.h"
#include "gstvapluginutils.h"
G_BEGIN_DECLS

View file

@ -1515,24 +1515,9 @@ gst_va_compositor_register (GstPlugin * plugin, GstVaDevice * device,
type_info.class_data = cdata;
type_name = g_strdup ("GstVaCompositor");
feature_name = g_strdup ("vacompositor");
/* The first compositor to be registered should use a constant
* name, like vacompositor, for any additional compositors, we
* create unique names, using the render device name. */
if (g_type_from_name (type_name)) {
gchar *basename = g_path_get_basename (device->render_device_path);
g_free (type_name);
g_free (feature_name);
type_name = g_strdup_printf ("GstVa%sCompositor", basename);
feature_name = g_strdup_printf ("va%scompositor", basename);
cdata->description = basename;
/* lower rank for non-first device */
if (rank > 0)
rank--;
}
gst_va_create_feature_name (device, "GstVaCompositor", "GstVa%sCompositor",
&type_name, "vacompositor", "va%scompositor", &feature_name,
&cdata->description, &rank);
g_once (&debug_once, _register_debug_category, NULL);

View file

@ -829,24 +829,9 @@ gst_va_deinterlace_register (GstPlugin * plugin, GstVaDevice * device,
type_info.class_data = cdata;
type_name = g_strdup ("GstVaDeinterlace");
feature_name = g_strdup ("vadeinterlace");
/* The first postprocessor to be registered should use a constant
* name, like vadeinterlace, for any additional postprocessors, we
* create unique names, using inserting the render device name. */
if (g_type_from_name (type_name)) {
gchar *basename = g_path_get_basename (device->render_device_path);
g_free (type_name);
g_free (feature_name);
type_name = g_strdup_printf ("GstVa%sDeinterlace", basename);
feature_name = g_strdup_printf ("va%sdeinterlace", basename);
cdata->description = basename;
/* lower rank for non-first device */
if (rank > 0)
rank--;
}
gst_va_create_feature_name (device, "GstVaDeinterlace", "GstVa%sDeinterlace",
&type_name, "vadeinterlace", "va%sdeinterlace", &feature_name,
&cdata->description, &rank);
g_once (&debug_once, _register_debug_category, NULL);

View file

@ -967,22 +967,9 @@ gst_va_h264_dec_register (GstPlugin * plugin, GstVaDevice * device,
type_info.class_data = cdata;
/* The first decoder to be registered should use a constant name,
* like vah264dec, for any additional decoders, we create unique
* names, using inserting the render device name. */
if (device->index == 0) {
type_name = g_strdup ("GstVaH264Dec");
feature_name = g_strdup ("vah264dec");
} else {
gchar *basename = g_path_get_basename (device->render_device_path);
type_name = g_strdup_printf ("GstVa%sH264Dec", basename);
feature_name = g_strdup_printf ("va%sh264dec", basename);
cdata->description = basename;
/* lower rank for non-first device */
if (rank > 0)
rank--;
}
gst_va_create_feature_name (device, "GstVaH264Dec", "GstVa%sH264Dec",
&type_name, "vah264dec", "va%sh264dec", &feature_name,
&cdata->description, &rank);
g_once (&debug_once, _register_debug_category, NULL);

View file

@ -3819,30 +3819,14 @@ gst_va_h264_enc_register (GstPlugin * plugin, GstVaDevice * device,
type_info.class_data = cdata;
/* The first encoder to be registered should use a constant name,
* like vah264enc, for any additional encoders, we create unique
* names, using inserting the render device name. */
if (device->index == 0) {
if (entrypoint == VAEntrypointEncSlice) {
type_name = g_strdup ("GstVaH264Enc");
feature_name = g_strdup ("vah264enc");
} else {
type_name = g_strdup ("GstVaH264LPEnc");
feature_name = g_strdup ("vah264lpenc");
}
if (entrypoint == VAEntrypointEncSlice) {
gst_va_create_feature_name (device, "GstVaH264Enc", "GstVa%sH264Enc",
&type_name, "vah264enc", "va%sh264enc", &feature_name,
&cdata->description, &rank);
} else {
gchar *basename = g_path_get_basename (device->render_device_path);
if (entrypoint == VAEntrypointEncSlice) {
type_name = g_strdup_printf ("GstVa%sH264Enc", basename);
feature_name = g_strdup_printf ("va%sh264enc", basename);
} else {
type_name = g_strdup_printf ("GstVa%sH264LPEnc", basename);
feature_name = g_strdup_printf ("va%sh264lpenc", basename);
}
cdata->description = basename;
/* lower rank for non-first device */
if (rank > 0)
rank--;
gst_va_create_feature_name (device, "GstVaH264LPEnc", "GstVa%sH264LPEnc",
&type_name, "vah264lpenc", "va%sh264lpenc", &feature_name,
&cdata->description, &rank);
}
g_once (&debug_once, _register_debug_category, NULL);

View file

@ -1323,22 +1323,9 @@ gst_va_h265_dec_register (GstPlugin * plugin, GstVaDevice * device,
type_info.class_data = cdata;
/* The first decoder to be registered should use a constant name,
* like vah265dec, for any additional decoders, we create unique
* names, using inserting the render device name. */
if (device->index == 0) {
type_name = g_strdup ("GstVaH265Dec");
feature_name = g_strdup ("vah265dec");
} else {
gchar *basename = g_path_get_basename (device->render_device_path);
type_name = g_strdup_printf ("GstVa%sH265Dec", basename);
feature_name = g_strdup_printf ("va%sh265dec", basename);
cdata->description = basename;
/* lower rank for non-first device */
if (rank > 0)
rank--;
}
gst_va_create_feature_name (device, "GstVaH265Dec", "GstVa%sH265Dec",
&type_name, "vah265dec", "va%sh265dec", &feature_name,
&cdata->description, &rank);
g_once (&debug_once, _register_debug_category, NULL);

View file

@ -5292,31 +5292,14 @@ gst_va_h265_enc_register (GstPlugin * plugin, GstVaDevice * device,
type_info.class_data = cdata;
/* The first encoder to be registered should use a constant name,
* like vah265enc, for any additional encoders, we create unique
* names, using inserting the render device name. */
if (device->index == 0) {
if (entrypoint == VAEntrypointEncSlice) {
type_name = g_strdup ("GstVaH265Enc");
feature_name = g_strdup ("vah265enc");
} else {
type_name = g_strdup ("GstVaH265LPEnc");
feature_name = g_strdup ("vah265lpenc");
}
if (entrypoint == VAEntrypointEncSlice) {
gst_va_create_feature_name (device, "GstVaH265Enc", "GstVa%sH265Enc",
&type_name, "vah265enc", "va%sh265enc", &feature_name,
&cdata->description, &rank);
} else {
gchar *basename = g_path_get_basename (device->render_device_path);
if (entrypoint == VAEntrypointEncSlice) {
type_name = g_strdup_printf ("GstVa%sH265Enc", basename);
feature_name = g_strdup_printf ("va%sh265enc", basename);
} else {
type_name = g_strdup_printf ("GstVa%sH265LPEnc", basename);
feature_name = g_strdup_printf ("va%sh265lpenc", basename);
}
cdata->description = basename;
/* lower rank for non-first device */
if (rank > 0)
rank--;
gst_va_create_feature_name (device, "GstVaH265LPEnc", "GstVa%sH265LPEnc",
&type_name, "vah265lpenc", "va%sh265lpenc", &feature_name,
&cdata->description, &rank);
}
g_once (&debug_once, _register_debug_category, NULL);

View file

@ -619,23 +619,9 @@ gst_va_jpeg_dec_register (GstPlugin * plugin, GstVaDevice * device,
type_info.class_data = cdata;
/* The first decoder to be registered should use a constant name,
* like vajpegdec, for any additional decoders, we create unique
* names, using inserting the render device name. */
if (device->index == 0) {
type_name = g_strdup ("GstVaJpegDec");
feature_name = g_strdup ("vajpegdec");
} else {
gchar *basename = g_path_get_basename (device->render_device_path);
type_name = g_strdup_printf ("GstVa%sJpegDec", basename);
feature_name = g_strdup_printf ("va%sjpegdec", basename);
cdata->description = basename;
/* lower rank for non-first device */
if (rank > 0)
rank--;
}
gst_va_create_feature_name (device, "GstVaJpegDec", "GstVa%sJpegDec",
&type_name, "vajpegdec", "va%sjpegdec", &feature_name,
&cdata->description, &rank);
g_once (&debug_once, _register_debug_category, NULL);

View file

@ -646,22 +646,9 @@ gst_va_mpeg2_dec_register (GstPlugin * plugin, GstVaDevice * device,
type_info.class_data = cdata;
/* The first decoder to be registered should use a constant name,
* like vampeg2dec, for any additional decoders, we create unique
* names, using inserting the render device name. */
if (device->index == 0) {
type_name = g_strdup ("GstVaMpeg2Dec");
feature_name = g_strdup ("vampeg2dec");
} else {
gchar *basename = g_path_get_basename (device->render_device_path);
type_name = g_strdup_printf ("GstVa%sMpeg2Dec", basename);
feature_name = g_strdup_printf ("va%smpeg2dec", basename);
cdata->description = basename;
/* lower rank for non-first device */
if (rank > 0)
rank--;
}
gst_va_create_feature_name (device, "GstVaMpeg2Dec", "GstVa%sMpeg2Dec",
&type_name, "vampeg2dec", "va%smpeg2dec", &feature_name,
&cdata->description, &rank);
g_once (&debug_once, _register_debug_category, NULL);

View file

@ -0,0 +1,74 @@
/* GStreamer
* Copyright (C) 2023 Seungha Yang <seungha@centricular.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 "gstvapluginutils.h"
GstVaDisplay *
gst_va_display_platform_new (const gchar * path)
{
#ifdef G_OS_WIN32
return gst_va_display_win32_new (path);
#else
return gst_va_display_drm_new_from_path (path);
#endif
}
void
gst_va_create_feature_name (GstVaDevice * device,
const gchar * type_name_default, const gchar * type_name_templ,
gchar ** type_name, const gchar * feature_name_default,
const gchar * feature_name_templ, gchar ** feature_name,
gchar ** desc, guint * rank)
{
gchar *basename;
/* The first element to be registered should use a constant name,
* like vah264dec, for any additional elements, we create unique
* names, using inserting the render device name. */
if (device->index == 0) {
*type_name = g_strdup (type_name_default);
*feature_name = g_strdup (feature_name_default);
#ifdef G_OS_WIN32
g_object_get (device->display, "description", desc, NULL);
#endif
return;
}
#ifdef G_OS_WIN32
basename = g_strdup_printf ("device%d", device->index);
#else
basename = g_path_get_basename (device->render_device_path);
#endif
*type_name = g_strdup_printf (type_name_templ, basename);
*feature_name = g_strdup_printf (feature_name_templ, basename);
#ifdef G_OS_WIN32
g_object_get (device->display, "description", desc, NULL);
g_free (basename);
#else
*desc = basename;
#endif
if (*rank > 0)
*rank -= 1;
}

View file

@ -21,6 +21,7 @@
#include <gst/gst.h>
#include <gst/va/gstva.h>
#include "gstvadevice.h"
G_BEGIN_DECLS
@ -30,14 +31,16 @@ G_BEGIN_DECLS
#define GST_IS_VA_DISPLAY_PLATFORM(dpy) GST_IS_VA_DISPLAY_DRM(dpy)
#endif
static GstVaDisplay *
gst_va_display_platform_new (const gchar * path)
{
#ifdef G_OS_WIN32
return gst_va_display_win32_new (path);
#else
return gst_va_display_drm_new_from_path (path);
#endif
}
GstVaDisplay * gst_va_display_platform_new (const gchar * path);
void gst_va_create_feature_name (GstVaDevice * device,
const gchar * type_name_default,
const gchar * type_name_templ,
gchar ** type_name,
const gchar * feature_name_default,
const gchar * feature_name_templ,
gchar ** feature_name,
gchar ** desc,
guint * rank);
G_END_DECLS

View file

@ -520,22 +520,9 @@ gst_va_vp8_dec_register (GstPlugin * plugin, GstVaDevice * device,
type_info.class_data = cdata;
/* The first decoder to be registered should use a constant name,
* like vavp8dec, for any additional decoders, we create unique
* names, using inserting the render device name. */
if (device->index == 0) {
type_name = g_strdup ("GstVaVp8Dec");
feature_name = g_strdup ("vavp8dec");
} else {
gchar *basename = g_path_get_basename (device->render_device_path);
type_name = g_strdup_printf ("GstVa%sVp8Dec", basename);
feature_name = g_strdup_printf ("va%svp8dec", basename);
cdata->description = basename;
/* lower rank for non-first device */
if (rank > 0)
rank--;
}
gst_va_create_feature_name (device, "GstVaVp8Dec", "GstVa%sVp8Dec",
&type_name, "vavp8dec", "va%svp8dec", &feature_name,
&cdata->description, &rank);
g_once (&debug_once, _register_debug_category, NULL);

View file

@ -718,22 +718,9 @@ gst_va_vp9_dec_register (GstPlugin * plugin, GstVaDevice * device,
type_info.class_data = cdata;
/* The first decoder to be registered should use a constant name,
* like vavp9dec, for any additional decoders, we create unique
* names, using inserting the render device name. */
if (device->index == 0) {
type_name = g_strdup ("GstVaVp9Dec");
feature_name = g_strdup ("vavp9dec");
} else {
gchar *basename = g_path_get_basename (device->render_device_path);
type_name = g_strdup_printf ("GstVa%sVp9Dec", basename);
feature_name = g_strdup_printf ("va%svp9dec", basename);
cdata->description = basename;
/* lower rank for non-first device */
if (rank > 0)
rank--;
}
gst_va_create_feature_name (device, "GstVaVp9Dec", "GstVa%sVp9Dec",
&type_name, "vavp9dec", "va%svp9dec", &feature_name,
&cdata->description, &rank);
g_once (&debug_once, _register_debug_category, NULL);

View file

@ -2321,24 +2321,9 @@ gst_va_vpp_register (GstPlugin * plugin, GstVaDevice * device,
type_info.class_data = cdata;
type_name = g_strdup ("GstVaPostProc");
feature_name = g_strdup ("vapostproc");
/* The first postprocessor to be registered should use a constant
* name, like vapostproc, for any additional postprocessors, we
* create unique names, using inserting the render device name. */
if (g_type_from_name (type_name)) {
gchar *basename = g_path_get_basename (device->render_device_path);
g_free (type_name);
g_free (feature_name);
type_name = g_strdup_printf ("GstVa%sPostProc", basename);
feature_name = g_strdup_printf ("va%spostproc", basename);
cdata->description = basename;
/* lower rank for non-first device */
if (rank > 0)
rank--;
}
gst_va_create_feature_name (device, "GstVaPostProc", "GstVa%sPostProc",
&type_name, "vapostproc", "va%spostproc", &feature_name,
&cdata->description, &rank);
g_once (&debug_once, _register_debug_category, NULL);

View file

@ -17,6 +17,7 @@ va_sources = [
'gstvah265enc.c',
'gstvajpegdec.c',
'gstvampeg2dec.c',
'gstvapluginutils.c',
'gstvaprofile.c',
'gstvavp8dec.c',
'gstvavp9dec.c',