diff options
author | Leo Liu <leo.liu@amd.com> | 2020-03-22 11:05:57 -0400 |
---|---|---|
committer | Leo Liu <leo.liu@amd.com> | 2020-10-24 20:42:50 -0400 |
commit | 02cb743bca1c69793342edcb4209b6bd6c23ad6f (patch) | |
tree | 4b491bce2b3491288296d95ef3afef0bb47f7f37 | |
parent | 5c4bff4a433dff1c5d005edfceaf727b6214bb74 (diff) |
gstomxav1: add basic av1 support
Signed-off-by: Leo Liu <leo.liu@amd.com>
-rw-r--r-- | omx/Makefile.am | 2 | ||||
-rw-r--r-- | omx/gstomx.c | 2 | ||||
-rw-r--r-- | omx/gstomxav1dec.c | 92 | ||||
-rw-r--r-- | omx/gstomxav1dec.h | 56 |
4 files changed, 152 insertions, 0 deletions
diff --git a/omx/Makefile.am b/omx/Makefile.am index aa01a2f..86bce1b 100644 --- a/omx/Makefile.am +++ b/omx/Makefile.am @@ -18,6 +18,7 @@ libgstomx_la_SOURCES = \ gstomxmjpegdec.c \ gstomxmpeg4videodec.c \ gstomxmpeg2videodec.c \ + gstomxav1dec.c \ gstomxh265dec.c \ gstomxh264dec.c \ gstomxh263dec.c \ @@ -37,6 +38,7 @@ noinst_HEADERS = \ gstomxmjpegdec.h \ gstomxmpeg2videodec.h \ gstomxmpeg4videodec.h \ + gstomxav1dec.h \ gstomxh265dec.h \ gstomxh264dec.h \ gstomxh263dec.h \ diff --git a/omx/gstomx.c b/omx/gstomx.c index 0b4b05b..64988a8 100644 --- a/omx/gstomx.c +++ b/omx/gstomx.c @@ -31,6 +31,7 @@ #include "gstomxmjpegdec.h" #include "gstomxmpeg2videodec.h" #include "gstomxmpeg4videodec.h" +#include "gstomxav1dec.h" #include "gstomxh265dec.h" #include "gstomxh264dec.h" #include "gstomxh263dec.h" @@ -2318,6 +2319,7 @@ typedef GType (*GGetTypeFunction) (void); static const GGetTypeFunction types[] = { gst_omx_mpeg2_video_dec_get_type, gst_omx_mpeg4_video_dec_get_type, + gst_omx_av1_dec_get_type, gst_omx_h265_dec_get_type, gst_omx_h264_dec_get_type, gst_omx_h263_dec_get_type, gst_omx_wmv_dec_get_type, gst_omx_mpeg4_video_enc_get_type, diff --git a/omx/gstomxav1dec.c b/omx/gstomxav1dec.c new file mode 100644 index 0000000..9730b8c --- /dev/null +++ b/omx/gstomxav1dec.c @@ -0,0 +1,92 @@ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation + * version 2.1 of the License. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gst/gst.h> + +#include "gstomxav1dec.h" + +GST_DEBUG_CATEGORY_STATIC (gst_omx_av1_dec_debug_category); +#define GST_CAT_DEFAULT gst_omx_av1_dec_debug_category + +/* prototypes */ +static gboolean gst_omx_av1_dec_is_format_change (GstOMXVideoDec * dec, + GstOMXPort * port, GstVideoCodecState * state); +static gboolean gst_omx_av1_dec_set_format (GstOMXVideoDec * dec, + GstOMXPort * port, GstVideoCodecState * state); + +enum +{ + PROP_0 +}; + +/* class initialization */ + +#define DEBUG_INIT \ + GST_DEBUG_CATEGORY_INIT (gst_omx_av1_dec_debug_category, "omxav1dec", 0, \ + "debug category for gst-omx video decoder base class"); + +G_DEFINE_TYPE_WITH_CODE (GstOMXAV1Dec, gst_omx_av1_dec, + GST_TYPE_OMX_VIDEO_DEC, DEBUG_INIT); + +static void +gst_omx_av1_dec_class_init (GstOMXAV1DecClass * klass) +{ + GstOMXVideoDecClass *videodec_class = GST_OMX_VIDEO_DEC_CLASS (klass); + GstElementClass *element_class = GST_ELEMENT_CLASS (klass); + + videodec_class->is_format_change = + GST_DEBUG_FUNCPTR (gst_omx_av1_dec_is_format_change); + videodec_class->set_format = GST_DEBUG_FUNCPTR (gst_omx_av1_dec_set_format); + videodec_class->cdata.default_sink_template_caps = "video/x-av1 "; + + gst_element_class_set_static_metadata (element_class, + "OpenMAX AV1 Video Decoder", + "Codec/Decoder/Video", + "Decode AV1 video streams", + "OMX AV1 support"); + + gst_omx_set_default_role (&videodec_class->cdata, "video_decoder.av1"); +} + +static void +gst_omx_av1_dec_init (GstOMXAV1Dec * self) +{ +} + +static gboolean +gst_omx_av1_dec_is_format_change (GstOMXVideoDec * dec, + GstOMXPort * port, GstVideoCodecState * state) +{ + return FALSE; +} + +static gboolean +gst_omx_av1_dec_set_format (GstOMXVideoDec * dec, GstOMXPort * port, + GstVideoCodecState * state) +{ + gboolean ret; + OMX_PARAM_PORTDEFINITIONTYPE port_def; + + gst_omx_port_get_port_definition (port, &port_def); + ret = gst_omx_port_update_port_definition (port, &port_def) == OMX_ErrorNone; + + return ret; +} diff --git a/omx/gstomxav1dec.h b/omx/gstomxav1dec.h new file mode 100644 index 0000000..fca2620 --- /dev/null +++ b/omx/gstomxav1dec.h @@ -0,0 +1,56 @@ +/* + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation + * version 2.1 of the License. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef __GST_OMX_AV1_DEC_H__ +#define __GST_OMX_AV1_DEC_H__ + +#include <gst/gst.h> +#include "gstomxvideodec.h" + +G_BEGIN_DECLS + +#define GST_TYPE_OMX_AV1_DEC \ + (gst_omx_av1_dec_get_type()) +#define GST_OMX_AV1_DEC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OMX_AV1_DEC,GstOMXAV1Dec)) +#define GST_OMX_AV1_DEC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OMX_AV1_DEC,GstOMXAV1DecClass)) +#define GST_OMX_AV1_DEC_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_OMX_AV1_DEC,GstOMXAV1DecClass)) +#define GST_IS_OMX_AV1_DEC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OMX_AV1_DEC)) +#define GST_IS_OMX_AV1_DEC_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OMX_AV1_DEC)) + +typedef struct _GstOMXAV1Dec GstOMXAV1Dec; +typedef struct _GstOMXAV1DecClass GstOMXAV1DecClass; + +struct _GstOMXAV1Dec +{ + GstOMXVideoDec parent; +}; + +struct _GstOMXAV1DecClass +{ + GstOMXVideoDecClass parent_class; +}; + +GType gst_omx_av1_dec_get_type (void); + +G_END_DECLS + +#endif /* __GST_OMX_AV1_DEC_H__ */ |