[vlc-devel] [PATCH 08/17] vulkan: platform_android: rework as vulkan platform

Romain Vimont rom1v at videolabs.io
Wed Apr 14 09:27:01 UTC 2021


On Mon, Apr 12, 2021 at 03:32:24PM +0200, Alexandre Janniaux wrote:
> 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    | 26 +++++++++++++++----
>  2 files changed, 22 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..6c87a9b644 100644
> --- a/modules/video_output/vulkan/platform_android.c
> +++ b/modules/video_output/vulkan/platform_android.c
> @@ -20,26 +20,32 @@
>   * 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 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;
>      return VLC_SUCCESS;

No platform_ops?
>  }
>  
> -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 +66,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
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list