1 Commits

Author SHA1 Message Date
Rafał Dzięgiel
6f4cd930af WIP: plugin: Add VA memory GL-based importer 2022-05-07 13:47:23 +02:00
4 changed files with 163 additions and 2 deletions

View File

@@ -0,0 +1,83 @@
/*
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.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 "gstclappervaglimporter.h"
#include "gst/plugin/gstgdkformats.h"
#include <gst/va/gstva.h>
#define GST_CAT_DEFAULT gst_clapper_va_gl_importer_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
#define parent_class gst_clapper_va_gl_importer_parent_class
GST_CLAPPER_IMPORTER_DEFINE (GstClapperVAGLImporter, gst_clapper_va_gl_importer, GST_TYPE_CLAPPER_GL_BASE_IMPORTER);
static GdkTexture *
gst_clapper_va_gl_importer_generate_texture (GstClapperImporter *importer,
GstBuffer *buffer, GstVideoInfo *v_info)
{
return NULL;
}
static void
gst_clapper_va_gl_importer_init (GstClapperVAGLImporter *self)
{
}
static void
gst_clapper_va_gl_importer_class_init (GstClapperVAGLImporterClass *klass)
{
GstClapperImporterClass *importer_class = (GstClapperImporterClass *) klass;
GST_DEBUG_CATEGORY_INIT (GST_CAT_DEFAULT, "clappervaglimporter", 0,
"Clapper VA GL Importer");
importer_class->generate_texture = gst_clapper_va_gl_importer_generate_texture;
}
GstClapperImporter *
make_importer (void)
{
return g_object_new (GST_TYPE_CLAPPER_VA_GL_IMPORTER, NULL);
}
GstCaps *
make_caps (GstRank *rank, GStrv *context_types)
{
GstCaps *caps, *tmp;
*rank = GST_RANK_PRIMARY;
tmp = gst_caps_from_string (
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VA,
"{ " GST_GDK_GL_TEXTURE_FORMATS " }"));
caps = gst_caps_copy (tmp);
gst_caps_set_features_simple (caps, gst_caps_features_new (
GST_CAPS_FEATURE_MEMORY_VA,
GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION, NULL));
gst_caps_append (caps, tmp);
return caps;
}

View File

@@ -0,0 +1,36 @@
/*
* Copyright (C) 2022 Rafał Dzięgiel <rafostar.github@gmail.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.
*/
#pragma once
#include "gstclapperglbaseimporter.h"
G_BEGIN_DECLS
#define GST_TYPE_CLAPPER_VA_GL_IMPORTER (gst_clapper_va_gl_importer_get_type())
G_DECLARE_FINAL_TYPE (GstClapperVAGLImporter, gst_clapper_va_gl_importer, GST, CLAPPER_VA_GL_IMPORTER, GstClapperGLBaseImporter)
#define GST_CLAPPER_VA_GL_IMPORTER_CAST(obj) ((GstClapperVAGLImporter *)(obj))
struct _GstClapperVAGLImporter
{
GstClapperGLBaseImporter parent;
};
G_END_DECLS

View File

@@ -3,10 +3,12 @@ gst_clapper_gl_base_importer_dep = dependency('', required: false)
plugin_needs_gl_base = ( plugin_needs_gl_base = (
not get_option('glimporter').disabled() not get_option('glimporter').disabled()
or not get_option('gluploader').disabled() or not get_option('gluploader').disabled()
or not get_option('vaglimporter').disabled()
) )
plugin_gl_support_required = ( plugin_gl_support_required = (
get_option('glimporter').enabled() get_option('glimporter').enabled()
or get_option('gluploader').enabled() or get_option('gluploader').enabled()
or get_option('vaglimporter').enabled()
) )
gst_plugin_gl_deps = [gstgl_dep, gstglproto_dep] gst_plugin_gl_deps = [gstgl_dep, gstglproto_dep]
@@ -118,3 +120,38 @@ if build_rawimporter
install_dir: gst_clapper_importers_libdir, install_dir: gst_clapper_importers_libdir,
) )
endif endif
gst_va_dep = dependency('gstreamer-va-1.0',
version: gst_req,
required: false,
)
gst_clapper_va_gl_importer_deps = [
gst_clapper_gl_base_importer_dep,
gst_va_dep,
]
foreach dep : gst_clapper_va_gl_importer_deps
if not dep.found()
if get_option('vaglimporter').enabled()
error('VA GL-based importer was enabled, but required dependencies were not found')
endif
endif
endforeach
build_vaglimporter = (
not get_option('vaglimporter').disabled()
and gst_clapper_gl_base_importer_dep.found()
)
if build_vaglimporter
library(
'gstclappervaglimporter',
'gstclappervaglimporter.c',
dependencies: gst_clapper_va_gl_importer_deps,
include_directories: configinc,
c_args: gst_clapper_plugin_args,
install: true,
install_dir: gst_clapper_importers_libdir,
)
endif

View File

@@ -14,10 +14,10 @@ option('gst-plugin',
description: 'Build GStreamer plugin (includes GTK video sink element)' description: 'Build GStreamer plugin (includes GTK video sink element)'
) )
option('rawimporter', option('vaglimporter',
type: 'feature', type: 'feature',
value: 'auto', value: 'auto',
description: 'Build RAW system memory importer for clappersink' description: 'Build VA memory GL-based importer for clappersink'
) )
option('glimporter', option('glimporter',
type: 'feature', type: 'feature',
@@ -29,6 +29,11 @@ option('gluploader',
value: 'auto', value: 'auto',
description: 'Build GL uploader for clappersink' description: 'Build GL uploader for clappersink'
) )
option('rawimporter',
type: 'feature',
value: 'auto',
description: 'Build RAW system memory importer for clappersink'
)
option('devel-checks', option('devel-checks',
type: 'boolean', type: 'boolean',