2 * Copyright (C) 2013, Collabora Ltd.
3 * Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation
8 * version 2.1 of the License.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
27 #include "gstomxvp8dec.h"
29 GST_DEBUG_CATEGORY_STATIC (gst_omx_vp8_dec_debug_category);
30 #define GST_CAT_DEFAULT gst_omx_vp8_dec_debug_category
33 static gboolean gst_omx_vp8_dec_is_format_change (GstOMXVideoDec * dec,
34 GstOMXPort * port, GstVideoCodecState * state);
35 static gboolean gst_omx_vp8_dec_set_format (GstOMXVideoDec * dec,
36 GstOMXPort * port, GstVideoCodecState * state);
43 /* class initialization */
46 GST_DEBUG_CATEGORY_INIT (gst_omx_vp8_dec_debug_category, "omxvp8dec", 0, \
47 "debug category for gst-omx video decoder base class");
49 G_DEFINE_TYPE_WITH_CODE (GstOMXVP8Dec, gst_omx_vp8_dec,
50 GST_TYPE_OMX_VIDEO_DEC, DEBUG_INIT);
53 gst_omx_vp8_dec_class_init (GstOMXVP8DecClass * klass)
55 GstOMXVideoDecClass *videodec_class = GST_OMX_VIDEO_DEC_CLASS (klass);
56 GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
58 videodec_class->is_format_change =
59 GST_DEBUG_FUNCPTR (gst_omx_vp8_dec_is_format_change);
60 videodec_class->set_format = GST_DEBUG_FUNCPTR (gst_omx_vp8_dec_set_format);
62 videodec_class->cdata.default_sink_template_caps = "video/x-vp8, "
63 "width=(int) [1,MAX], " "height=(int) [1,MAX]";
65 gst_element_class_set_static_metadata (element_class,
66 "OpenMAX VP8 Video Decoder",
67 "Codec/Decoder/Video/Hardware",
68 "Decode VP8 video streams",
69 "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
71 gst_omx_set_default_role (&videodec_class->cdata, "video_decoder.vp8");
75 gst_omx_vp8_dec_init (GstOMXVP8Dec * self)
80 gst_omx_vp8_dec_is_format_change (GstOMXVideoDec * dec,
81 GstOMXPort * port, GstVideoCodecState * state)
87 gst_omx_vp8_dec_set_format (GstOMXVideoDec * dec, GstOMXPort * port,
88 GstVideoCodecState * state)
91 OMX_PARAM_PORTDEFINITIONTYPE port_def;
93 gst_omx_port_get_port_definition (port, &port_def);
94 port_def.format.video.eCompressionFormat =
95 (OMX_VIDEO_CODINGTYPE) OMX_VIDEO_CodingVP8;
96 ret = gst_omx_port_update_port_definition (port, &port_def) == OMX_ErrorNone;