Search
SailfishOS Open Build Service
>
Projects
>
home:sledge
:
branches:nemo:devel:hw:ti:omap4:common
>
gst-plugins-base
> 0002-stridetransform-skeletal-implementation-of-stridetra.patch
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File 0002-stridetransform-skeletal-implementation-of-stridetra.patch of Package gst-plugins-base
From 01101eae7eaeee80ca05ae5204cdc96a69be696e Mon Sep 17 00:00:00 2001 From: Rob Clark <rob@ti.com> Date: Thu, 30 Jul 2009 20:41:18 -0500 Subject: [PATCH 02/38] stridetransform: skeletal implementation of stridetransform element --- configure.ac | 2 + gst/stride/Makefile.am | 15 ++++ gst/stride/gststridetransform.c | 178 +++++++++++++++++++++++++++++++++++++++ gst/stride/gststridetransform.h | 66 ++++++++++++++ gst/stride/plugin.c | 45 ++++++++++ 5 files changed, 306 insertions(+), 0 deletions(-) create mode 100644 gst/stride/Makefile.am create mode 100644 gst/stride/gststridetransform.c create mode 100644 gst/stride/gststridetransform.h create mode 100644 gst/stride/plugin.c diff --git a/configure.ac b/configure.ac index 15de626..4a467d9 100644 --- a/configure.ac +++ b/configure.ac @@ -429,6 +429,7 @@ AG_GST_CHECK_PLUGIN(ffmpegcolorspace) AG_GST_CHECK_PLUGIN(gdp) AG_GST_CHECK_PLUGIN(playback) AG_GST_CHECK_PLUGIN(audioresample) +AG_GST_CHECK_PLUGIN(stride) AG_GST_CHECK_PLUGIN(subparse) AG_GST_CHECK_PLUGIN(tcp) AG_GST_CHECK_PLUGIN(typefind) @@ -930,6 +931,7 @@ gst/ffmpegcolorspace/Makefile gst/gdp/Makefile gst/playback/Makefile gst/audioresample/Makefile +gst/stride/Makefile gst/subparse/Makefile gst/tcp/Makefile gst/typefind/Makefile diff --git a/gst/stride/Makefile.am b/gst/stride/Makefile.am new file mode 100644 index 0000000..1adc197 --- /dev/null +++ b/gst/stride/Makefile.am @@ -0,0 +1,15 @@ +plugin_LTLIBRARIES = libgststridetransform.la + +libgststridetransform_la_SOURCES = \ + gststridetransform.c \ + plugin.c + +libgststridetransform_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) +libgststridetransform_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) +libgststridetransform_la_LIBADD = \ + $(top_builddir)/gst-libs/gst/video/libgstvideo-@GST_MAJORMINOR@.la \ + $(GST_BASE_LIBS) $(GST_LIBS) $(LIBM) +libgststridetransform_la_LIBTOOLFLAGS = --tag=disable-static + +noinst_HEADERS = \ + gststridetransform.h diff --git a/gst/stride/gststridetransform.c b/gst/stride/gststridetransform.c new file mode 100644 index 0000000..21f2d6e --- /dev/null +++ b/gst/stride/gststridetransform.c @@ -0,0 +1,178 @@ +/* GStreamer + * + * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ + * + * Description: V4L2 sink element + * Created on: Jul 30, 2009 + * Author: Rob Clark <rob@ti.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + + +/** + * SECTION:element-stridetransform + * + * stridetransform can be used to convert between video buffers + * with and without stride, or between buffers with differing + * stride + * + * <refsect2> + * <title>Example launch lines</title> + * |[ + * gst-launch ???? TODO + * ]| This pipeline ???? TODO + * </refsect2> + */ + + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "gststridetransform.h" +#include "gst/gst-i18n-plugin.h" + + +static const GstElementDetails stridetransform_details = +GST_ELEMENT_DETAILS ("Stride transform", + "Filter/Converter/Video", + "Convert between video buffers with and without stride, or with differing stride", + "Rob Clark <rob@ti.com>,"); + +GST_DEBUG_CATEGORY (stridetransform_debug); +#define GST_CAT_DEFAULT stridetransform_debug + +/* type functions */ +static void gst_stride_transform_dispose (GObject * obj); + +/* GstBaseTransform functions */ +static gboolean gst_stride_transform_get_unit_size (GstBaseTransform * base, + GstCaps * caps, guint * size); +static GstCaps *gst_stride_transform_transform_caps (GstBaseTransform * base, + GstPadDirection direction, GstCaps * caps); +static void gst_stride_transform_fixate_caps (GstBaseTransform * base, + GstPadDirection direction, GstCaps * caps, GstCaps * othercaps); +static gboolean gst_stride_transform_set_caps (GstBaseTransform * base, + GstCaps * incaps, GstCaps * outcaps); +static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base, + GstBuffer * inbuf, GstBuffer * outbuf); +static GstFlowReturn gst_stride_transform_transform_ip (GstBaseTransform * base, + GstBuffer * buf); + +GST_BOILERPLATE (GstStrideTransform, gst_stride_transform, GstVideoFilter, GST_TYPE_VIDEO_FILTER); + + +static void +gst_stride_transform_base_init (gpointer g_class) +{ + GstElementClass *gstelement_class = GST_ELEMENT_CLASS (g_class); + + GST_DEBUG_CATEGORY_INIT (stridetransform_debug, "stride", 0, "stride transform element"); + + gst_element_class_set_details (gstelement_class, &stridetransform_details); +} + +static void +gst_stride_transform_class_init (GstStrideTransformClass * klass) +{ + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GstBaseTransformClass *basetransform_class = GST_BASE_TRANSFORM_CLASS (klass); + + gobject_class->dispose = gst_stride_transform_dispose; + + basetransform_class->get_unit_size = + GST_DEBUG_FUNCPTR (gst_stride_transform_get_unit_size); + basetransform_class->transform_caps = + GST_DEBUG_FUNCPTR (gst_stride_transform_transform_caps); + basetransform_class->fixate_caps = + GST_DEBUG_FUNCPTR (gst_stride_transform_fixate_caps); + basetransform_class->set_caps = + GST_DEBUG_FUNCPTR (gst_stride_transform_set_caps); + basetransform_class->transform_ip = + GST_DEBUG_FUNCPTR (gst_stride_transform_transform_ip); + basetransform_class->transform = + GST_DEBUG_FUNCPTR (gst_stride_transform_transform); + + basetransform_class->passthrough_on_same_caps = TRUE; +} + +static void +gst_stride_transform_init (GstStrideTransform * self, GstStrideTransformClass * klass) +{ + GST_DEBUG_OBJECT (self, "not implemented"); +} + + +static void +gst_stride_transform_dispose (GObject * object) +{ + GstStrideTransform *self = GST_STRIDE_TRANSFORM (object); + GST_DEBUG_OBJECT (self, "not implemented"); + G_OBJECT_CLASS (parent_class)->dispose (object); +} + +static gboolean +gst_stride_transform_get_unit_size (GstBaseTransform * base, + GstCaps * caps, guint * size) +{ + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); + GST_DEBUG_OBJECT (self, "not implemented"); + return FALSE; +} + +static GstCaps * +gst_stride_transform_transform_caps (GstBaseTransform * base, + GstPadDirection direction, GstCaps * caps) +{ + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); + GST_DEBUG_OBJECT (self, "not implemented"); + return NULL; +} + +static void +gst_stride_transform_fixate_caps (GstBaseTransform * base, + GstPadDirection direction, GstCaps * caps, GstCaps * othercaps) +{ + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); + GST_DEBUG_OBJECT (self, "not implemented"); +} + +static gboolean +gst_stride_transform_set_caps (GstBaseTransform * base, + GstCaps * incaps, GstCaps * outcaps) +{ + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); + GST_DEBUG_OBJECT (self, "not implemented"); + return FALSE; +} + +static GstFlowReturn gst_stride_transform_transform (GstBaseTransform * base, + GstBuffer * inbuf, GstBuffer * outbuf) +{ + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); + GST_DEBUG_OBJECT (self, "not implemented"); + return GST_FLOW_ERROR; +} + +static GstFlowReturn +gst_stride_transform_transform_ip (GstBaseTransform * base, + GstBuffer * buf) +{ + GstStrideTransform *self = GST_STRIDE_TRANSFORM (base); + GST_DEBUG_OBJECT (self, "not implemented"); + return GST_FLOW_ERROR; +} diff --git a/gst/stride/gststridetransform.h b/gst/stride/gststridetransform.h new file mode 100644 index 0000000..b4f7d59 --- /dev/null +++ b/gst/stride/gststridetransform.h @@ -0,0 +1,66 @@ +/* GStreamer + * + * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ + * + * Description: V4L2 sink element + * Created on: Jul 2, 2009 + * Author: Rob Clark <rob@ti.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __GSTSTRIDETRANSFORM_H__ +#define __GSTSTRIDETRANSFORM_H__ + + +#include <gst/video/gstvideofilter.h> + +G_BEGIN_DECLS + +#define GST_TYPE_STRIDE_TRANSFORM \ + (gst_stride_transform_get_type()) +#define GST_STRIDE_TRANSFORM(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_STRIDE_TRANSFORM,GstStrideTransform)) +#define GST_STRIDE_TRANSFORM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_STRIDE_TRANSFORM,GstStrideTransformClass)) +#define GST_IS_STRIDE_TRANSFORM(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_STRIDE_TRANSFORM)) +#define GST_IS_STRIDE_TRANSFORM_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_STRIDE_TRANSFORM)) + +typedef struct _GstStrideTransform GstStrideTransform; +typedef struct _GstStrideTransformClass GstStrideTransformClass; + +/** + * GstStrideTransform: + * + * Opaque datastructure. + */ +struct _GstStrideTransform { + GstVideoFilter videofilter; + +}; + +struct _GstStrideTransformClass { + GstVideoFilterClass parent_class; +}; + +GType gst_stride_transform_get_type (void); + +G_END_DECLS + + +#endif /* __GSTSTRIDETRANSFORM_H__ */ diff --git a/gst/stride/plugin.c b/gst/stride/plugin.c new file mode 100644 index 0000000..7672bdc --- /dev/null +++ b/gst/stride/plugin.c @@ -0,0 +1,45 @@ +/* GStreamer + * + * Copyright (C) 2009 Texas Instruments, Inc - http://www.ti.com/ + * + * Description: V4L2 sink element + * Created on: Jul 30, 2009 + * Author: Rob Clark <rob@ti.com> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "gststridetransform.h" + +static gboolean +plugin_init (GstPlugin * plugin) +{ + if (!gst_element_register (plugin, "stridetransform", + GST_RANK_PRIMARY, gst_stride_transform_get_type ())) + return FALSE; + + return TRUE; +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "stridetransform", + "Convert video from strided to non-strided, or between different row-strides", + plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN) -- 1.7.5.4