mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
vulkan: allow per feature registration
Split plugin into features including dynamic types which can be indiviually registered during a static build. More details here: https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199 https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661 Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2038>
This commit is contained in:
parent
9de8af0ac1
commit
efc1433892
11 changed files with 123 additions and 33 deletions
|
@ -36,50 +36,29 @@
|
||||||
#include "vkdownload.h"
|
#include "vkdownload.h"
|
||||||
#include "vkviewconvert.h"
|
#include "vkviewconvert.h"
|
||||||
#include "vkdeviceprovider.h"
|
#include "vkdeviceprovider.h"
|
||||||
|
#include "gstvulkanelements.h"
|
||||||
|
|
||||||
#define GST_CAT_DEFAULT gst_vulkan_debug
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
plugin_init (GstPlugin * plugin)
|
plugin_init (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_vulkan_debug, "vulkan", 0, "vulkan");
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
if (!gst_element_register (plugin, "vulkansink",
|
ret |= GST_DEVICE_PROVIDER_REGISTER (vulkandeviceprovider, plugin);
|
||||||
GST_RANK_NONE, GST_TYPE_VULKAN_SINK)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gst_element_register (plugin, "vulkanupload",
|
ret |= GST_ELEMENT_REGISTER (vulkansink, plugin);
|
||||||
GST_RANK_NONE, GST_TYPE_VULKAN_UPLOAD)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gst_element_register (plugin, "vulkandownload",
|
ret |= GST_ELEMENT_REGISTER (vulkanupload, plugin);
|
||||||
GST_RANK_NONE, GST_TYPE_VULKAN_DOWNLOAD)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gst_element_register (plugin, "vulkancolorconvert",
|
ret |= GST_ELEMENT_REGISTER (vulkandownload, plugin);
|
||||||
GST_RANK_NONE, GST_TYPE_VULKAN_COLOR_CONVERT)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gst_element_register (plugin, "vulkanimageidentity",
|
ret |= GST_ELEMENT_REGISTER (vulkancolorconvert, plugin);
|
||||||
GST_RANK_NONE, GST_TYPE_VULKAN_IMAGE_IDENTITY)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gst_element_register (plugin, "vulkanviewconvert",
|
ret |= GST_ELEMENT_REGISTER (vulkanimageidentity, plugin);
|
||||||
GST_RANK_NONE, GST_TYPE_VULKAN_VIEW_CONVERT)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!gst_device_provider_register (plugin, "vulkandeviceprovider",
|
ret |= GST_ELEMENT_REGISTER (vulkanviewconvert, plugin);
|
||||||
GST_RANK_MARGINAL, GST_TYPE_VULKAN_DEVICE_PROVIDER))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||||
|
|
46
ext/vulkan/gstvulkanelement.c
Normal file
46
ext/vulkan/gstvulkanelement.c
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* GStreamer
|
||||||
|
* Copyright (C) 2015 Matthew Waters <matthew@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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:plugin-vulkan
|
||||||
|
* @title: vulkan
|
||||||
|
*
|
||||||
|
* Cross-platform Vulkan plugin.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "gstvulkanelements.h"
|
||||||
|
|
||||||
|
#define GST_CAT_DEFAULT gst_vulkan_debug
|
||||||
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
|
||||||
|
|
||||||
|
void
|
||||||
|
vulkan_element_init (GstPlugin * plugin)
|
||||||
|
{
|
||||||
|
static gsize res = FALSE;
|
||||||
|
|
||||||
|
if (g_once_init_enter (&res)) {
|
||||||
|
GST_DEBUG_CATEGORY_INIT (gst_vulkan_debug, "vulkan", 0, "vulkan");
|
||||||
|
g_once_init_leave (&res, TRUE);
|
||||||
|
}
|
||||||
|
}
|
41
ext/vulkan/gstvulkanelements.h
Normal file
41
ext/vulkan/gstvulkanelements.h
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
/* GStreamer
|
||||||
|
* Copyright (C) <2020> The GStreamer Contributors.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __GST_VULKAN_ELEMENTS_H__
|
||||||
|
#define __GST_VULKAN_ELEMENTS_H__
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
void vulkan_element_init (GstPlugin * plugin);
|
||||||
|
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE (vulkancolorconvert);
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE (vulkandownload);
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE (vulkanimageidentity);
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE (vulkansink);
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE (vulkanupload);
|
||||||
|
GST_ELEMENT_REGISTER_DECLARE (vulkanviewconvert);
|
||||||
|
GST_DEVICE_PROVIDER_REGISTER_DECLARE (vulkandeviceprovider);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* __GST_VULKAN_ELEMENTS_H__ */
|
|
@ -17,6 +17,7 @@ subdir('shaders')
|
||||||
|
|
||||||
vulkan_sources = [
|
vulkan_sources = [
|
||||||
'gstvulkan.c',
|
'gstvulkan.c',
|
||||||
|
'gstvulkanelement.c',
|
||||||
'vkcolorconvert.c',
|
'vkcolorconvert.c',
|
||||||
'vkdownload.c',
|
'vkdownload.c',
|
||||||
'vkdeviceprovider.c',
|
'vkdeviceprovider.c',
|
||||||
|
|
|
@ -43,6 +43,8 @@
|
||||||
#include "shaders/rgb_to_yuy2.frag.h"
|
#include "shaders/rgb_to_yuy2.frag.h"
|
||||||
#include "shaders/rgb_to_nv12.frag.h"
|
#include "shaders/rgb_to_nv12.frag.h"
|
||||||
|
|
||||||
|
#include "gstvulkanelements.h"
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (gst_debug_vulkan_color_convert);
|
GST_DEBUG_CATEGORY (gst_debug_vulkan_color_convert);
|
||||||
#define GST_CAT_DEFAULT gst_debug_vulkan_color_convert
|
#define GST_CAT_DEFAULT gst_debug_vulkan_color_convert
|
||||||
|
|
||||||
|
@ -795,6 +797,8 @@ G_DEFINE_TYPE_WITH_CODE (GstVulkanColorConvert, gst_vulkan_color_convert,
|
||||||
GST_TYPE_VULKAN_VIDEO_FILTER,
|
GST_TYPE_VULKAN_VIDEO_FILTER,
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_debug_vulkan_color_convert,
|
GST_DEBUG_CATEGORY_INIT (gst_debug_vulkan_color_convert,
|
||||||
"vulkancolorconvert", 0, "Vulkan Color Convert"));
|
"vulkancolorconvert", 0, "Vulkan Color Convert"));
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (vulkancolorconvert, "vulkancolorconvert",
|
||||||
|
GST_RANK_NONE, GST_TYPE_VULKAN_COLOR_CONVERT, vulkan_element_init (plugin));
|
||||||
|
|
||||||
struct yuv_info
|
struct yuv_info
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "gstvulkanelements.h"
|
||||||
#include "vkdeviceprovider.h"
|
#include "vkdeviceprovider.h"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -39,7 +40,10 @@ static GstDevice *gst_vulkan_device_object_new (GstVulkanPhysicalDevice *
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (GstVulkanDeviceProvider, gst_vulkan_device_provider,
|
G_DEFINE_TYPE_WITH_CODE (GstVulkanDeviceProvider, gst_vulkan_device_provider,
|
||||||
GST_TYPE_DEVICE_PROVIDER, GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT,
|
GST_TYPE_DEVICE_PROVIDER, GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT,
|
||||||
"vulkandevice", 0, "Vulkan Device"););
|
"vulkandevice", 0, "Vulkan Device");
|
||||||
|
);
|
||||||
|
GST_DEVICE_PROVIDER_REGISTER_DEFINE (vulkandeviceprovider,
|
||||||
|
"vulkandeviceprovider", GST_RANK_MARGINAL, GST_TYPE_VULKAN_DEVICE_PROVIDER);
|
||||||
|
|
||||||
static void gst_vulkan_device_provider_finalize (GObject * object);
|
static void gst_vulkan_device_provider_finalize (GObject * object);
|
||||||
static void gst_vulkan_device_provider_set_property (GObject * object,
|
static void gst_vulkan_device_provider_set_property (GObject * object,
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "gstvulkanelements.h"
|
||||||
#include "vkdownload.h"
|
#include "vkdownload.h"
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (gst_debug_vulkan_download);
|
GST_DEBUG_CATEGORY (gst_debug_vulkan_download);
|
||||||
|
@ -470,6 +471,8 @@ enum
|
||||||
G_DEFINE_TYPE_WITH_CODE (GstVulkanDownload, gst_vulkan_download,
|
G_DEFINE_TYPE_WITH_CODE (GstVulkanDownload, gst_vulkan_download,
|
||||||
GST_TYPE_BASE_TRANSFORM, GST_DEBUG_CATEGORY_INIT (gst_debug_vulkan_download,
|
GST_TYPE_BASE_TRANSFORM, GST_DEBUG_CATEGORY_INIT (gst_debug_vulkan_download,
|
||||||
"vulkandownload", 0, "Vulkan Downloader"));
|
"vulkandownload", 0, "Vulkan Downloader"));
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (vulkandownload, "vulkandownload",
|
||||||
|
GST_RANK_NONE, GST_TYPE_VULKAN_DOWNLOAD, vulkan_element_init (plugin));
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_vulkan_download_class_init (GstVulkanDownloadClass * klass)
|
gst_vulkan_download_class_init (GstVulkanDownloadClass * klass)
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "gstvulkanelements.h"
|
||||||
#include "vkimageidentity.h"
|
#include "vkimageidentity.h"
|
||||||
|
|
||||||
#include "shaders/identity.vert.h"
|
#include "shaders/identity.vert.h"
|
||||||
|
@ -83,6 +84,9 @@ G_DEFINE_TYPE_WITH_CODE (GstVulkanImageIdentity, gst_vulkan_image_identity,
|
||||||
GST_TYPE_VULKAN_VIDEO_FILTER,
|
GST_TYPE_VULKAN_VIDEO_FILTER,
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_debug_vulkan_image_identity,
|
GST_DEBUG_CATEGORY_INIT (gst_debug_vulkan_image_identity,
|
||||||
"vulkanimageidentity", 0, "Vulkan Image identity"));
|
"vulkanimageidentity", 0, "Vulkan Image identity"));
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (vulkanimageidentity,
|
||||||
|
"vulkanimageidentity", GST_RANK_NONE, GST_TYPE_VULKAN_IMAGE_IDENTITY,
|
||||||
|
vulkan_element_init (plugin));
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_vulkan_image_identity_class_init (GstVulkanImageIdentityClass * klass)
|
gst_vulkan_image_identity_class_init (GstVulkanImageIdentityClass * klass)
|
||||||
|
|
|
@ -32,6 +32,7 @@
|
||||||
|
|
||||||
//#include <gst/video/videooverlay.h>
|
//#include <gst/video/videooverlay.h>
|
||||||
|
|
||||||
|
#include "gstvulkanelements.h"
|
||||||
#include "vksink.h"
|
#include "vksink.h"
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (gst_debug_vulkan_sink);
|
GST_DEBUG_CATEGORY (gst_debug_vulkan_sink);
|
||||||
|
@ -108,6 +109,8 @@ G_DEFINE_TYPE_WITH_CODE (GstVulkanSink, gst_vulkan_sink,
|
||||||
gst_vulkan_sink_video_overlay_init);
|
gst_vulkan_sink_video_overlay_init);
|
||||||
G_IMPLEMENT_INTERFACE (GST_TYPE_NAVIGATION,
|
G_IMPLEMENT_INTERFACE (GST_TYPE_NAVIGATION,
|
||||||
gst_vulkan_sink_navigation_interface_init));
|
gst_vulkan_sink_navigation_interface_init));
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (vulkansink, "vulkansink", GST_RANK_NONE,
|
||||||
|
GST_TYPE_VULKAN_SINK, vulkan_element_init (plugin));
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_vulkan_sink_class_init (GstVulkanSinkClass * klass)
|
gst_vulkan_sink_class_init (GstVulkanSinkClass * klass)
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include "gstvulkanelements.h"
|
||||||
#include "vkupload.h"
|
#include "vkupload.h"
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (gst_debug_vulkan_upload);
|
GST_DEBUG_CATEGORY (gst_debug_vulkan_upload);
|
||||||
|
@ -1164,6 +1164,8 @@ enum
|
||||||
G_DEFINE_TYPE_WITH_CODE (GstVulkanUpload, gst_vulkan_upload,
|
G_DEFINE_TYPE_WITH_CODE (GstVulkanUpload, gst_vulkan_upload,
|
||||||
GST_TYPE_BASE_TRANSFORM, GST_DEBUG_CATEGORY_INIT (gst_debug_vulkan_upload,
|
GST_TYPE_BASE_TRANSFORM, GST_DEBUG_CATEGORY_INIT (gst_debug_vulkan_upload,
|
||||||
"vulkanupload", 0, "Vulkan Uploader"));
|
"vulkanupload", 0, "Vulkan Uploader"));
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (vulkanupload, "vulkanupload",
|
||||||
|
GST_RANK_NONE, GST_TYPE_VULKAN_UPLOAD, vulkan_element_init (plugin));
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_vulkan_upload_class_init (GstVulkanUploadClass * klass)
|
gst_vulkan_upload_class_init (GstVulkanUploadClass * klass)
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "gstvulkanelements.h"
|
||||||
#include "vkviewconvert.h"
|
#include "vkviewconvert.h"
|
||||||
|
|
||||||
#include "shaders/identity.vert.h"
|
#include "shaders/identity.vert.h"
|
||||||
|
@ -561,6 +562,8 @@ G_DEFINE_TYPE_WITH_CODE (GstVulkanViewConvert, gst_vulkan_view_convert,
|
||||||
GST_TYPE_VULKAN_VIDEO_FILTER,
|
GST_TYPE_VULKAN_VIDEO_FILTER,
|
||||||
GST_DEBUG_CATEGORY_INIT (gst_debug_vulkan_view_convert,
|
GST_DEBUG_CATEGORY_INIT (gst_debug_vulkan_view_convert,
|
||||||
"vulkanviewconvert", 0, "Vulkan View Convert"));
|
"vulkanviewconvert", 0, "Vulkan View Convert"));
|
||||||
|
GST_ELEMENT_REGISTER_DEFINE_WITH_CODE (vulkanviewconvert, "vulkanviewconvert",
|
||||||
|
GST_RANK_NONE, GST_TYPE_VULKAN_VIEW_CONVERT, vulkan_element_init (plugin));
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_vulkan_view_convert_class_init (GstVulkanViewConvertClass * klass)
|
gst_vulkan_view_convert_class_init (GstVulkanViewConvertClass * klass)
|
||||||
|
|
Loading…
Reference in a new issue