xref: /OK3568_Linux_fs/external/gstreamer-rockchip/gst/rockchipmpp/gstmppvpxalphadecodebin.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* GStreamer
2*4882a593Smuzhiyun  * Copyright (C) <2021> Collabora Ltd.
3*4882a593Smuzhiyun  *   Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
4*4882a593Smuzhiyun  *   Author: Julian Bouzas <julian.bouzas@collabora.com>
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * This library is free software; you can redistribute it and/or
7*4882a593Smuzhiyun  * modify it under the terms of the GNU Library General Public
8*4882a593Smuzhiyun  * License as published by the Free Software Foundation; either
9*4882a593Smuzhiyun  * version 2 of the License, or (at your option) any later version.
10*4882a593Smuzhiyun  *
11*4882a593Smuzhiyun  * This library is distributed in the hope that it will be useful,
12*4882a593Smuzhiyun  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13*4882a593Smuzhiyun  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14*4882a593Smuzhiyun  * Library General Public License for more details.
15*4882a593Smuzhiyun  *
16*4882a593Smuzhiyun  * You should have received a copy of the GNU Library General Public
17*4882a593Smuzhiyun  * License along with this library; if not, write to the
18*4882a593Smuzhiyun  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19*4882a593Smuzhiyun  * Boston, MA 02110-1301, USA.
20*4882a593Smuzhiyun  */
21*4882a593Smuzhiyun 
22*4882a593Smuzhiyun /**
23*4882a593Smuzhiyun  * SECTION:element-mppvpxalphadecodebin
24*4882a593Smuzhiyun  * @title: Wrapper to decode MPP VP8/VP9 alpha using mppvideodec
25*4882a593Smuzhiyun  *
26*4882a593Smuzhiyun  * Use two `mppvideodec` instance in order to decode VP8/VP9 alpha channel.
27*4882a593Smuzhiyun  *
28*4882a593Smuzhiyun  * Since: 1.20
29*4882a593Smuzhiyun  */
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun #ifdef HAVE_CONFIG_H
32*4882a593Smuzhiyun #include "config.h"
33*4882a593Smuzhiyun #endif
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun #include "gstmppvpxalphadecodebin.h"
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
38*4882a593Smuzhiyun     GST_PAD_SINK,
39*4882a593Smuzhiyun     GST_PAD_ALWAYS,
40*4882a593Smuzhiyun     GST_STATIC_CAPS ("video/x-vp8, codec-alpha = (boolean) true; "
41*4882a593Smuzhiyun         "video/x-vp9, codec-alpha = (boolean) true"));
42*4882a593Smuzhiyun 
43*4882a593Smuzhiyun struct _GstMppVpxAlphaDecodeBin
44*4882a593Smuzhiyun {
45*4882a593Smuzhiyun   GstMppAlphaDecodeBin parent;
46*4882a593Smuzhiyun };
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun #define gst_mpp_vpx_alpha_decode_bin_parent_class parent_class
49*4882a593Smuzhiyun G_DEFINE_TYPE (GstMppVpxAlphaDecodeBin, gst_mpp_vpx_alpha_decode_bin,
50*4882a593Smuzhiyun     GST_TYPE_MPP_ALPHA_DECODE_BIN);
51*4882a593Smuzhiyun 
52*4882a593Smuzhiyun static void
gst_mpp_vpx_alpha_decode_bin_class_init(GstMppVpxAlphaDecodeBinClass * klass)53*4882a593Smuzhiyun gst_mpp_vpx_alpha_decode_bin_class_init (GstMppVpxAlphaDecodeBinClass * klass)
54*4882a593Smuzhiyun {
55*4882a593Smuzhiyun   GstMppAlphaDecodeBinClass *adbin_class = (GstMppAlphaDecodeBinClass *) klass;
56*4882a593Smuzhiyun   GstElementClass *element_class = (GstElementClass *) klass;
57*4882a593Smuzhiyun 
58*4882a593Smuzhiyun   adbin_class->decoder_name = "mppvideodec";
59*4882a593Smuzhiyun   gst_element_class_add_static_pad_template (element_class, &sink_template);
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun   gst_element_class_set_static_metadata (element_class,
62*4882a593Smuzhiyun       "VP8/VP9 Alpha Decoder", "Codec/Decoder/Video",
63*4882a593Smuzhiyun       "Wrapper bin to decode VP8/VP9 with alpha stream.",
64*4882a593Smuzhiyun       "Julian Bouzas <julian.bouzas@collabora.com>");
65*4882a593Smuzhiyun }
66*4882a593Smuzhiyun 
67*4882a593Smuzhiyun static void
gst_mpp_vpx_alpha_decode_bin_init(GstMppVpxAlphaDecodeBin * self)68*4882a593Smuzhiyun gst_mpp_vpx_alpha_decode_bin_init (GstMppVpxAlphaDecodeBin * self)
69*4882a593Smuzhiyun {
70*4882a593Smuzhiyun   (void) self;
71*4882a593Smuzhiyun }
72*4882a593Smuzhiyun 
73*4882a593Smuzhiyun gboolean
gst_mpp_vpx_alpha_decode_bin_register(GstPlugin * plugin,guint rank)74*4882a593Smuzhiyun gst_mpp_vpx_alpha_decode_bin_register (GstPlugin * plugin, guint rank)
75*4882a593Smuzhiyun {
76*4882a593Smuzhiyun   return gst_element_register (plugin, "mppvpxalphadecodebin", rank,
77*4882a593Smuzhiyun       gst_mpp_vpx_alpha_decode_bin_get_type ());
78*4882a593Smuzhiyun }
79