mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
Introduce CODEC Alpha plugin
This plugin contains a set of utility elements allowing to extract, decode and combine CODEC (typically VP8/VP9) alpha stream. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2199>
This commit is contained in:
parent
4eeaa8f170
commit
f3114d4d7e
6 changed files with 201 additions and 1 deletions
106
gst/codecalpha/gstcodecalphademux.c
Normal file
106
gst/codecalpha/gstcodecalphademux.c
Normal file
|
@ -0,0 +1,106 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <2021> Collabora Ltd.
|
||||
* Author: Nicolas Dufresne <nicolas.dufresne@collabora.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:element-codecalphademux
|
||||
* @title: CODEC Alpha Demuxer
|
||||
*
|
||||
* Extract the CODEC (typically VP8/VP9) alpha stream stored at meta and
|
||||
* expose it as a stream. This element allow using single stream VP9 decoders
|
||||
* in order to decode both streams.
|
||||
*
|
||||
* ## Example launch line
|
||||
* |[
|
||||
* gst-launch-1.0 -v filesrc location=transparency.webm ! matroskademux !
|
||||
* codecalphademux name=d
|
||||
* d.video ! queue ! vp9dec ! autovideosink
|
||||
* d.alpha ! queue ! vp9dec ! autovideosink
|
||||
* ]| This pipeline splits and decode the video and the alpha stream, showing
|
||||
* the result on seperate window.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gst/video/video.h>
|
||||
#include "gstcodecalphademux.h"
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (codecalphademux_debug);
|
||||
#define GST_CAT_DEFAULT (codecalphademux_debug)
|
||||
|
||||
struct _GstCodecAlphaDemux
|
||||
{
|
||||
GstElement parent;
|
||||
};
|
||||
|
||||
#define gst_codec_alpha_demux_parent_class parent_class
|
||||
G_DEFINE_TYPE_WITH_CODE (GstCodecAlphaDemux, gst_codec_alpha_demux,
|
||||
GST_TYPE_ELEMENT,
|
||||
GST_DEBUG_CATEGORY_INIT (codecalphademux_debug, "codecalphademux", 0,
|
||||
"codecalphademux"));
|
||||
|
||||
GST_ELEMENT_REGISTER_DEFINE (codec_alpha_demux, "codecalphademux",
|
||||
GST_RANK_NONE, GST_TYPE_CODEC_ALPHA_DEMUX);
|
||||
|
||||
static GstStaticPadTemplate gst_codec_alpha_demux_sink_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("ANY")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_codec_alpha_demux_src_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("ANY")
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate gst_codec_alpha_demux_alpha_template =
|
||||
GST_STATIC_PAD_TEMPLATE ("alpha",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("ANY")
|
||||
);
|
||||
|
||||
static void
|
||||
gst_codec_alpha_demux_class_init (GstCodecAlphaDemuxClass * klass)
|
||||
{
|
||||
GstElementClass *element_class = (GstElementClass *) klass;
|
||||
|
||||
gst_element_class_set_static_metadata (element_class,
|
||||
"CODEC Alpha Demuxer", "Codec/Demuxer",
|
||||
"Extract and expose as a stream the CODEC alpha.",
|
||||
"Nicolas Dufresne <nicolas.dufresne@collabora.com>");
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class,
|
||||
&gst_codec_alpha_demux_sink_template);
|
||||
gst_element_class_add_static_pad_template (element_class,
|
||||
&gst_codec_alpha_demux_src_template);
|
||||
gst_element_class_add_static_pad_template (element_class,
|
||||
&gst_codec_alpha_demux_alpha_template);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_codec_alpha_demux_init (GstCodecAlphaDemux * demux)
|
||||
{
|
||||
}
|
35
gst/codecalpha/gstcodecalphademux.h
Normal file
35
gst/codecalpha/gstcodecalphademux.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <2021> Collabora Ltd.
|
||||
* Author: Nicolas Dufresne <nicolas.dufresne@collabora.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.
|
||||
*/
|
||||
|
||||
#ifndef __GST_CODEC_ALPHA_DEMUX_H__
|
||||
#define __GST_CODEC_ALPHA_DEMUX_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_CODEC_ALPHA_DEMUX (gst_codec_alpha_demux_get_type())
|
||||
G_DECLARE_FINAL_TYPE (GstCodecAlphaDemux,
|
||||
gst_codec_alpha_demux, GST, CODEC_ALPHA_DEMUX, GstElement);
|
||||
|
||||
GST_ELEMENT_REGISTER_DECLARE (codec_alpha_demux);
|
||||
|
||||
G_END_DECLS
|
||||
#endif
|
43
gst/codecalpha/gstplugin.c
Normal file
43
gst/codecalpha/gstplugin.c
Normal file
|
@ -0,0 +1,43 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) <2021> Collabora Ltd.
|
||||
* Author: Nicolas Dufresne <nicolas.dufresne@collabora.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 <gst/gst.h>
|
||||
|
||||
#include "gstcodecalphademux.h"
|
||||
|
||||
static gboolean
|
||||
plugin_init (GstPlugin * plugin)
|
||||
{
|
||||
gboolean ret = FALSE;
|
||||
|
||||
ret |= GST_ELEMENT_REGISTER (codec_alpha_demux, plugin);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
codecalpha,
|
||||
"CODEC Alpha Utilities",
|
||||
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|
15
gst/codecalpha/meson.build
Normal file
15
gst/codecalpha/meson.build
Normal file
|
@ -0,0 +1,15 @@
|
|||
codecalpha_sources = [
|
||||
'gstplugin.c',
|
||||
'gstcodecalphademux.c',
|
||||
]
|
||||
|
||||
gstcodecalpha = library('gstcodecalpha',
|
||||
codecalpha_sources,
|
||||
c_args : gst_plugins_bad_args,
|
||||
include_directories : [configinc],
|
||||
dependencies : [gstvideo_dep],
|
||||
install : true,
|
||||
install_dir : plugins_install_dir,
|
||||
)
|
||||
pkgconfig.generate(gstcodecalpha, install_dir : plugins_pkgconfig_install_dir)
|
||||
plugins += [gstcodecalpha]
|
|
@ -1,7 +1,7 @@
|
|||
foreach plugin : ['accurip', 'adpcmdec', 'adpcmenc', 'aiff', 'asfmux',
|
||||
'audiobuffersplit', 'audiofxbad', 'audiomixmatrix',
|
||||
'audiolatency', 'audiovisualizers', 'autoconvert', 'bayer',
|
||||
'camerabin2', 'coloreffects', 'debugutils', 'dvbsubenc',
|
||||
'camerabin2', 'codecalpha', 'coloreffects', 'debugutils', 'dvbsubenc',
|
||||
'dvbsuboverlay', 'dvdspu', 'faceoverlay', 'festival',
|
||||
'fieldanalysis', 'freeverb', 'frei0r', 'gaudieffects', 'gdp',
|
||||
'geometrictransform', 'id3tag', 'inter', 'interlace',
|
||||
|
|
|
@ -15,6 +15,7 @@ option('audiovisualizers', type : 'feature', value : 'auto')
|
|||
option('autoconvert', type : 'feature', value : 'auto')
|
||||
option('bayer', type : 'feature', value : 'auto')
|
||||
option('camerabin2', type : 'feature', value : 'auto')
|
||||
option('codecalpha', type : 'feature', value : 'auto')
|
||||
option('coloreffects', type : 'feature', value : 'auto')
|
||||
option('debugutils', type : 'feature', value : 'auto')
|
||||
option('dvbsubenc', type : 'feature', value : 'auto')
|
||||
|
|
Loading…
Reference in a new issue