[vlc-devel] [PATCH v3 08/16] vulkan: platform_android: rework as vulkan platform
Alexandre Janniaux
ajanni at videolabs.io
Wed Apr 21 08:04:42 UTC 2021
Instead of recompiling surface.c while implementing its public
functions, and so as to remove surface.c.
---
modules/video_output/vulkan/Makefile.am | 2 +-
.../video_output/vulkan/platform_android.c | 35 ++++++++++++++++---
2 files changed, 31 insertions(+), 6 deletions(-)
diff --git a/modules/video_output/vulkan/Makefile.am b/modules/video_output/vulkan/Makefile.am
index c6906bd422..98c573be20 100644
--- a/modules/video_output/vulkan/Makefile.am
+++ b/modules/video_output/vulkan/Makefile.am
@@ -23,7 +23,7 @@ libvk_win32_plugin_la_CFLAGS = $(AM_CFLAGS) $(VULKAN_COMMONCFLAGS) \
-DVK_USE_PLATFORM_WIN32_KHR -DPLATFORM_NAME=Win32
libvk_win32_plugin_la_LIBADD = $(VULKAN_COMMONLIBS)
-libvk_android_plugin_la_SOURCES = $(VULKAN_COMMONSOURCES) video_output/vulkan/surface.c \
+libvk_android_plugin_la_SOURCES = $(VULKAN_COMMONSOURCES) \
video_output/vulkan/platform_android.c
libvk_android_plugin_la_CFLAGS = $(AM_CFLAGS) $(VULKAN_COMMONCFLAGS) \
-DVK_USE_PLATFORM_ANDROID_KHR -DPLATFORM_NAME=Android
diff --git a/modules/video_output/vulkan/platform_android.c b/modules/video_output/vulkan/platform_android.c
index aebe6416c3..3bfeeaa3b5 100644
--- a/modules/video_output/vulkan/platform_android.c
+++ b/modules/video_output/vulkan/platform_android.c
@@ -20,26 +20,41 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+
#include "platform.h"
#include "../android/utils.h"
-int vlc_vk_InitPlatform(vlc_vk_t *vk)
+static void ClosePlatform(vlc_vk_t *vk);
+static int CreateSurface(vlc_vk_t *vk);
+static const struct vlc_vk_operations platform_ops =
+{
+ .close = ClosePlatform,
+ .create_surface = CreateSurface,
+};
+
+static int InitPlatform(vlc_vk_t *vk)
{
if (vk->window->type != VOUT_WINDOW_TYPE_ANDROID_NATIVE)
return VLC_EGENERIC;
+ vk->platform_ext = VK_KHR_ANDROID_SURFACE_EXTENSION_NAME;
+ vk->platform_ops = &platform_ops;
return VLC_SUCCESS;
}
-void vlc_vk_ClosePlatform(vlc_vk_t *vk)
+static void ClosePlatform(vlc_vk_t *vk)
{
AWindowHandler_releaseANativeWindow(vk->window->handle.anativewindow,
AWindow_Video);
}
-const char * const vlc_vk_PlatformExt = VK_KHR_ANDROID_SURFACE_EXTENSION_NAME;
-
-int vlc_vk_CreateSurface(vlc_vk_t *vk, VkInstance vkinst)
+static int CreateSurface(vlc_vk_t *vk, VkInstance vkinst)
{
ANativeWindow *anw =
AWindowHandler_getANativeWindow(vk->window->handle.anativewindow,
@@ -60,3 +75,13 @@ int vlc_vk_CreateSurface(vlc_vk_t *vk, VkInstance vkinst)
return VLC_SUCCESS;
}
+
+vlc_module_begin()
+ set_shortname("Vulkan Android")
+ set_description(N_("Android platform support for Vulkan"))
+ set_category(CAT_VIDEO)
+ set_subcategory(SUBCAT_VIDEO_VOUT)
+ set_capability("vulkan platform", 50)
+ set_callback(InitPlatform)
+ add_shortcut("vk_android")
+vlc_module_end()
--
2.31.1
More information about the vlc-devel
mailing list