diff options
author | Leo Liu <leo.liu@amd.com> | 2016-06-03 14:05:58 -0400 |
---|---|---|
committer | Leo Liu <leo.liu@amd.com> | 2016-08-31 09:26:03 -0400 |
commit | 413266fa69fdb47d85dee9cf5aeb871235938a02 (patch) | |
tree | 3e4e16d8e1f584af114e9b4a56143e1a82c306a8 | |
parent | 85afb6ee4298a8afcd9345b7b12b1db990dbca36 (diff) |
gstomxh265: add basic 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/gstomxh265dec.c | 97 | ||||
-rw-r--r-- | omx/gstomxh265dec.h | 56 |
4 files changed, 157 insertions, 0 deletions
diff --git a/omx/Makefile.am b/omx/Makefile.am index dbe2f54..aa01a2f 100644 --- a/omx/Makefile.am +++ b/omx/Makefile.am @@ -18,6 +18,7 @@ libgstomx_la_SOURCES = \ gstomxmjpegdec.c \ gstomxmpeg4videodec.c \ gstomxmpeg2videodec.c \ + gstomxh265dec.c \ gstomxh264dec.c \ gstomxh263dec.c \ gstomxwmvdec.c \ @@ -36,6 +37,7 @@ noinst_HEADERS = \ gstomxmjpegdec.h \ gstomxmpeg2videodec.h \ gstomxmpeg4videodec.h \ + gstomxh265dec.h \ gstomxh264dec.h \ gstomxh263dec.h \ gstomxwmvdec.h \ diff --git a/omx/gstomx.c b/omx/gstomx.c index b77c904..a5cf562 100644 --- a/omx/gstomx.c +++ b/omx/gstomx.c @@ -31,6 +31,7 @@ #include "gstomxmjpegdec.h" #include "gstomxmpeg2videodec.h" #include "gstomxmpeg4videodec.h" +#include "gstomxh265dec.h" #include "gstomxh264dec.h" #include "gstomxh263dec.h" #include "gstomxvp8dec.h" @@ -2317,6 +2318,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_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, gst_omx_h264_enc_get_type, gst_omx_h263_enc_get_type, diff --git a/omx/gstomxh265dec.c b/omx/gstomxh265dec.c new file mode 100644 index 0000000..2c2136d --- /dev/null +++ b/omx/gstomxh265dec.c @@ -0,0 +1,97 @@ +/* + * 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 "gstomxh265dec.h" + +GST_DEBUG_CATEGORY_STATIC (gst_omx_h265_dec_debug_category); +#define GST_CAT_DEFAULT gst_omx_h265_dec_debug_category + +/* prototypes */ +static gboolean gst_omx_h265_dec_is_format_change (GstOMXVideoDec * dec, + GstOMXPort * port, GstVideoCodecState * state); +static gboolean gst_omx_h265_dec_set_format (GstOMXVideoDec * dec, + GstOMXPort * port, GstVideoCodecState * state); + +enum +{ + PROP_0 +}; + +/* class initialization */ + +#define DEBUG_INIT \ + GST_DEBUG_CATEGORY_INIT (gst_omx_h265_dec_debug_category, "omxh265dec", 0, \ + "debug category for gst-omx video decoder base class"); + +G_DEFINE_TYPE_WITH_CODE (GstOMXH265Dec, gst_omx_h265_dec, + GST_TYPE_OMX_VIDEO_DEC, DEBUG_INIT); + +static void +gst_omx_h265_dec_class_init (GstOMXH265DecClass * 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_h265_dec_is_format_change); + videodec_class->set_format = GST_DEBUG_FUNCPTR (gst_omx_h265_dec_set_format); + + videodec_class->cdata.default_sink_template_caps = "video/x-h265, " + "parsed=(boolean) true, " + "alignment=(string) au, " + "stream-format=(string) byte-stream, " + "width=(int) [1,MAX], " "height=(int) [1,MAX]"; + + gst_element_class_set_static_metadata (element_class, + "OpenMAX H.265 Video Decoder", + "Codec/Decoder/Video", + "Decode H.265 video streams", + "OMX HEVC support"); + + gst_omx_set_default_role (&videodec_class->cdata, "video_decoder.hevc"); +} + +static void +gst_omx_h265_dec_init (GstOMXH265Dec * self) +{ +} + +static gboolean +gst_omx_h265_dec_is_format_change (GstOMXVideoDec * dec, + GstOMXPort * port, GstVideoCodecState * state) +{ + return FALSE; +} + +static gboolean +gst_omx_h265_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/gstomxh265dec.h b/omx/gstomxh265dec.h new file mode 100644 index 0000000..32e8f4b --- /dev/null +++ b/omx/gstomxh265dec.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_H265_DEC_H__ +#define __GST_OMX_H265_DEC_H__ + +#include <gst/gst.h> +#include "gstomxvideodec.h" + +G_BEGIN_DECLS + +#define GST_TYPE_OMX_H265_DEC \ + (gst_omx_h265_dec_get_type()) +#define GST_OMX_H265_DEC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OMX_H265_DEC,GstOMXH265Dec)) +#define GST_OMX_H265_DEC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OMX_H265_DEC,GstOMXH265DecClass)) +#define GST_OMX_H265_DEC_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_OMX_H265_DEC,GstOMXH265DecClass)) +#define GST_IS_OMX_H265_DEC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OMX_H265_DEC)) +#define GST_IS_OMX_H265_DEC_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OMX_H265_DEC)) + +typedef struct _GstOMXH265Dec GstOMXH265Dec; +typedef struct _GstOMXH265DecClass GstOMXH265DecClass; + +struct _GstOMXH265Dec +{ + GstOMXVideoDec parent; +}; + +struct _GstOMXH265DecClass +{ + GstOMXVideoDecClass parent_class; +}; + +GType gst_omx_h265_dec_get_type (void); + +G_END_DECLS + +#endif /* __GST_OMX_H265_DEC_H__ */ |