diff options
author | Rob Clark <rob@ti.com> | 2010-11-26 13:59:17 -0600 |
---|---|---|
committer | Rob Clark <rob@ti.com> | 2010-11-27 09:22:12 -0600 |
commit | 17bedd4de5fce07d849d542601cdc7d6d89f7143 (patch) | |
tree | e42c875bbc6165671387d15e950d9ec682d86b5b | |
parent | 256fd55955679d7141ee477b52f28f22701eaf81 (diff) |
vp6dec: add On2 VP6 support
-rw-r--r-- | README | 10 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/gstducati.c | 4 | ||||
-rw-r--r-- | src/gstducatividdec.c | 6 | ||||
-rw-r--r-- | src/gstducativp6dec.c | 151 | ||||
-rw-r--r-- | src/gstducativp6dec.h | 55 |
6 files changed, 221 insertions, 7 deletions
@@ -12,9 +12,17 @@ An OpenMAX-like API is provided by TI along with modified gst-openmax plugins. So gst-ducati is not needed in that sense. But libdce and this was an interesting project for me to try on my free time. +TO BUILD: +--------- + +Install normal gstreamer and gst-plugins-base dev packages (or build them +yourself so you have the headers, etc). Then install the corresponding +syslink/tiler/d2c packages (matching your kernel version). And finally +libdce (https://github.com/robclark/libdce) matching your kernel version. + TODO ---- -+ vp6, vp7, realvideo ++ vp7, realvideo + fallbacks for sink elements not providing TILER buffers to decode into + search the code for XXX or TODO ;-) diff --git a/src/Makefile.am b/src/Makefile.am index bd44995..d985378 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,6 +2,7 @@ plugin_LTLIBRARIES = libgstducati.la # headers we need but don't want installed noinst_HEADERS = \ + gstducativp6dec.h \ gstducativc1dec.h \ gstducatimpeg4dec.h \ gstducatih264dec.h \ @@ -10,6 +11,7 @@ noinst_HEADERS = \ # sources used to compile this plug-in libgstducati_la_SOURCES = \ + gstducativp6dec.c \ gstducativc1dec.c \ gstducatimpeg4dec.c \ gstducatih264dec.c \ diff --git a/src/gstducati.c b/src/gstducati.c index 7ed7e69..5cb800b 100644 --- a/src/gstducati.c +++ b/src/gstducati.c @@ -26,6 +26,7 @@ #include "gstducatih264dec.h" #include "gstducatimpeg4dec.h" #include "gstducativc1dec.h" +#include "gstducativp6dec.h" GST_DEBUG_CATEGORY (gst_ducati_debug); @@ -39,7 +40,8 @@ plugin_init (GstPlugin * plugin) */ return gst_element_register (plugin, "ducatih264dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIH264DEC) && gst_element_register (plugin, "ducatimpeg4dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIMPEG4DEC) && - gst_element_register (plugin, "ducativc1dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIVC1DEC); + gst_element_register (plugin, "ducativc1dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIVC1DEC) && + gst_element_register (plugin, "ducativp6dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIVP6DEC); } void * diff --git a/src/gstducatividdec.c b/src/gstducatividdec.c index 53bc94c..0a71d7e 100644 --- a/src/gstducatividdec.c +++ b/src/gstducatividdec.c @@ -354,7 +354,7 @@ gst_ducati_viddec_allocate_params (GstDucatiVidDec * self, gint params_sz, self->params->maxFrameRate = 30000; self->params->maxBitRate = 10000000; - //vc6/vc7/rv?? + //rv?? self->params->dataEndianness = XDM_BYTE; self->params->forceChromaFormat = XDM_YUV_420SP; @@ -366,10 +366,6 @@ gst_ducati_viddec_allocate_params (GstDucatiVidDec * self, gint params_sz, self->params->numInputDataUnits = 0; self->params->numOutputDataUnits = 0; - //vp6, vp7: - //self->params->numInputDataUnits = 1; - //self->params->numOutputDataUnits = 1; - self->params->metadataType[0] = IVIDEO_METADATAPLANE_NONE; self->params->metadataType[1] = IVIDEO_METADATAPLANE_NONE; self->params->metadataType[2] = IVIDEO_METADATAPLANE_NONE; diff --git a/src/gstducativp6dec.c b/src/gstducativp6dec.c new file mode 100644 index 0000000..2d77114 --- /dev/null +++ b/src/gstducativp6dec.c @@ -0,0 +1,151 @@ +/* + * GStreamer + * Copyright (c) 2010, Texas Instruments Incorporated + * + * 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 + */ + +/** + * SECTION:element-ducativp6dec + * + * FIXME:Describe ducativp6dec here. + * + * <refsect2> + * <title>Example launch line</title> + * |[ + * gst-launch -v -m fakesrc ! ducativp6dec ! fakesink silent=TRUE + * ]| + * </refsect2> + */ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <gst/gst.h> +#include <gst/video/video.h> + +#include "gstducativp6dec.h" + + +#define PADX 48 +#define PADY 48 + + +GST_BOILERPLATE (GstDucatiVP6Dec, gst_ducati_vp6dec, GstDucatiVidDec, + GST_TYPE_DUCATIVIDDEC); + +static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("video/x-vp6, " + "width = (int)[ 16, 2048 ], " + "height = (int)[ 16, 2048 ], " + "framerate = (fraction)[ 0, max ];") + ); + +/* GstDucatiVidDec vmethod implementations */ + +static void +gst_ducati_vp6dec_update_buffer_size (GstDucatiVidDec * self) +{ + gint w = self->width; + gint h = self->height; + + /* calculate output buffer parameters: */ + self->padded_width = (w + (2 * PADX) + 0x7f) & ~0x7f; + self->padded_height = h + 2 * PADY; + self->min_buffers = 8; +} + +static gboolean +gst_ducati_vp6dec_allocate_params (GstDucatiVidDec * self, gint params_sz, + gint dynparams_sz, gint status_sz, gint inargs_sz, gint outargs_sz) +{ + gboolean ret = parent_class->allocate_params (self, + sizeof (Ivp6VDEC_Params), sizeof (Ivp6VDEC_DynamicParams), + sizeof (Ivp6VDEC_Status), sizeof (Ivp6VDEC_InArgs), + sizeof (Ivp6VDEC_OutArgs)); + + if (ret) { + Ivp6VDEC_Params *params = (Ivp6VDEC_Params *) self->params; + self->params->displayDelay = IVIDDEC3_DECODE_ORDER; + self->dynParams->newFrameFlag = FALSE; + self->dynParams->lateAcquireArg = -1; + self->params->numInputDataUnits = 1; + self->params->numOutputDataUnits = 1; + params->ivfFormat = FALSE; + } + + return ret; +} + +/* this should be unneeded in future codec versions: */ +static GstBuffer * +gst_ducati_vp6dec_push_input (GstDucatiVidDec * vdec, GstBuffer * buf) +{ + GstDucatiVP6Dec *self = GST_DUCATIVP6DEC (vdec); + guint32 sz; + + if (G_UNLIKELY (vdec->first_in_buffer) && vdec->codec_data) { + // XXX none of the vp6 clips I've seen have codec_data.. + } + + /* current codec version requires size prepended on input buffer: */ + sz = GST_BUFFER_SIZE (buf); + push_input (vdec, (guint8 *)&sz, 4); + + push_input (vdec, GST_BUFFER_DATA (buf), sz); + gst_buffer_unref (buf); + + return NULL; +} + + +/* GObject vmethod implementations */ + +static void +gst_ducati_vp6dec_base_init (gpointer gclass) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (gclass); + + gst_element_class_set_details_simple (element_class, + "DucatiVP6Dec", + "Codec/Decoder/Video", + "Decodes video in On2 VP6 format with ducati", + "Rob Clark <rob@ti.com>"); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&sink_factory)); +} + +static void +gst_ducati_vp6dec_class_init (GstDucatiVP6DecClass * klass) +{ + GstDucatiVidDecClass *bclass = GST_DUCATIVIDDEC_CLASS (klass); + bclass->codec_name = "ivahd_vp6dec"; + bclass->update_buffer_size = + GST_DEBUG_FUNCPTR (gst_ducati_vp6dec_update_buffer_size); + bclass->allocate_params = + GST_DEBUG_FUNCPTR (gst_ducati_vp6dec_allocate_params); + bclass->push_input = + GST_DEBUG_FUNCPTR (gst_ducati_vp6dec_push_input); +} + +static void +gst_ducati_vp6dec_init (GstDucatiVP6Dec * self, + GstDucatiVP6DecClass * gclass) +{ +} diff --git a/src/gstducativp6dec.h b/src/gstducativp6dec.h new file mode 100644 index 0000000..90c7930 --- /dev/null +++ b/src/gstducativp6dec.h @@ -0,0 +1,55 @@ +/* + * GStreamer + * Copyright (c) 2010, Texas Instruments Incorporated + * + * 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_DUCATIVP6DEC_H__ +#define __GST_DUCATIVP6DEC_H__ + +#include <gst/gst.h> + +#include "gstducatividdec.h" + +#include <ti/sdo/codecs/vp6dec/ivp6vdec.h> + + +G_BEGIN_DECLS + +#define GST_TYPE_DUCATIVP6DEC (gst_ducati_vp6dec_get_type()) +#define GST_DUCATIVP6DEC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DUCATIVP6DEC, GstDucatiVP6Dec)) +#define GST_DUCATIVP6DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DUCATIVP6DEC, GstDucatiVP6DecClass)) +#define GST_IS_DUCATIVP6DEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DUCATIVP6DEC)) +#define GST_IS_DUCATIVP6DEC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DUCATIVP6DEC)) + +typedef struct _GstDucatiVP6Dec GstDucatiVP6Dec; +typedef struct _GstDucatiVP6DecClass GstDucatiVP6DecClass; + +struct _GstDucatiVP6Dec +{ + GstDucatiVidDec parent; +}; + +struct _GstDucatiVP6DecClass +{ + GstDucatiVidDecClass parent_class; +}; + +GType gst_ducati_vp6dec_get_type (void); + +G_END_DECLS + +#endif /* __GST_DUCATIVP6DEC_H__ */ |