diff options
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | configure.ac | 11 | ||||
-rw-r--r-- | ext/Makefile.am | 8 | ||||
-rw-r--r-- | ext/dirac/Makefile.am | 9 | ||||
-rw-r--r-- | ext/dirac/gstdirac.cc | 51 | ||||
-rw-r--r-- | ext/dirac/gstdiracdec.cc | 214 |
6 files changed, 300 insertions, 1 deletions
@@ -1,3 +1,11 @@ +2004-05-10 David Schleef <ds@schleef.org> + + * configure.ac: Add prototype Dirac support. + * ext/Makefile.am: + * ext/dirac/Makefile.am: + * ext/dirac/gstdirac.cc: + * ext/dirac/gstdiracdec.cc: + 2004-05-10 Ronald Bultje <rbultje@ronald.bitfreak.net> * gst/auparse/gstauparse.c: (gst_auparse_class_init), diff --git a/configure.ac b/configure.ac index 7027639d..d904f932 100644 --- a/configure.ac +++ b/configure.ac @@ -329,7 +329,7 @@ dnl =========================================================================== plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR" AC_SUBST(plugindir) -GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*' +GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '[_]*(gst_|Gst|GST_).*' $GST_LIBS" AC_SUBST(GST_PLUGIN_LDFLAGS) dnl these are all the gst plug-ins, compilable without additional libs @@ -751,6 +751,14 @@ dnl FIXME : add second check somehow if that is necessary dnl AC_CHECK_LIB(cdda_paranoia, paranoia_init, : , HAVE_CDPARANOIA=no, -lcdda_interface ) dnl AC_CHECK_HEADER(cdda_paranoia.h, :, HAVE_CDPARANOIA=no) +dnl *** dirac *** +translit(dnm, m, l) AM_CONDITIONAL(USE_DIRAC, true) +GST_CHECK_FEATURE(DIRAC, [dirac plug-ins], dirac, [ + PKG_CHECK_MODULES(DIRAC, dirac, HAVE_DIRAC="yes", HAVE_DIRAC="no") + AC_SUBST(DIRAC_CFLAGS) + AC_SUBST(DIRAC_LIBS) +]) + dnl *** DIVX *** translit(dnm, m, l) AM_CONDITIONAL(USE_DIVX, true) GST_CHECK_FEATURE(DIVX, [divx plugins], divx, [ @@ -1793,6 +1801,7 @@ ext/arts/Makefile ext/artsd/Makefile ext/audiofile/Makefile ext/cdparanoia/Makefile +ext/dirac/Makefile ext/divx/Makefile ext/dts/Makefile ext/dv/Makefile diff --git a/ext/Makefile.am b/ext/Makefile.am index 4ce5cc86..821f87e6 100644 --- a/ext/Makefile.am +++ b/ext/Makefile.am @@ -40,6 +40,12 @@ else CDPARANOIA_DIR= endif +if USE_DIRAC +DIRAC_DIR=dirac +else +DIRAC_DIR= +endif + if USE_DIVX DIVX_DIR=divx else @@ -342,6 +348,7 @@ SUBDIRS=\ $(ARTSC_DIR) \ $(AUDIOFILE_DIR) \ $(CDPARANOIA_DIR) \ + $(DIRAC_DIR) \ $(DIVX_DIR) \ $(DTS_DIR) \ $(DVDREAD_DIR) \ @@ -399,6 +406,7 @@ DIST_SUBDIRS=\ artsd \ audiofile \ cdparanoia \ + dirac \ divx \ dts \ dv \ diff --git a/ext/dirac/Makefile.am b/ext/dirac/Makefile.am new file mode 100644 index 00000000..f4928f17 --- /dev/null +++ b/ext/dirac/Makefile.am @@ -0,0 +1,9 @@ + +plugin_LTLIBRARIES = libgstdirac.la + +libgstdirac_la_SOURCES = gstdirac.cc gstdiracdec.cc +#gstdiracenc.c +libgstdirac_la_CXXFLAGS = $(GST_CFLAGS) $(DIRAC_CFLAGS) +libgstdirac_la_LIBADD = $(DIRAC_LIBS) +libgstdirac_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) + diff --git a/ext/dirac/gstdirac.cc b/ext/dirac/gstdirac.cc new file mode 100644 index 00000000..ba6fcac7 --- /dev/null +++ b/ext/dirac/gstdirac.cc @@ -0,0 +1,51 @@ +/* GStreamer + * Copyright (C) 2004 David A. Schleef <ds@schleef.org> + * + * 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 <gst/gst.h> + + +extern GType gst_diracdec_get_type (void); + +//extern GType gst_diracenc_get_type (void); + + +static gboolean +plugin_init (GstPlugin * plugin) +{ +#if 0 + if (!gst_element_register (plugin, "diracenc", GST_RANK_NONE, + gst_diracenc_get_type ())) { + return FALSE; + } +#endif + + if (!gst_element_register (plugin, "diracdec", GST_RANK_PRIMARY, + gst_diracdec_get_type ())) { + return FALSE; + } + + return TRUE; +} + +GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, + GST_VERSION_MINOR, + "dirac", + "Dirac plugin", plugin_init, VERSION, "LGPL", GST_PACKAGE, GST_ORIGIN) diff --git a/ext/dirac/gstdiracdec.cc b/ext/dirac/gstdiracdec.cc new file mode 100644 index 00000000..ae184183 --- /dev/null +++ b/ext/dirac/gstdiracdec.cc @@ -0,0 +1,214 @@ +/* GStreamer + * Copyright (C) 2004 David A. Schleef <ds@schleef.org> + * + * 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 <gst/gst.h> +#include <gst/video/video.h> + +#include <seq_decompress.h> +#include <pic_io.h> + +#define GST_TYPE_DIRACDEC \ + (gst_diracdec_get_type()) +#define GST_DIRACDEC(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DIRACDEC,GstDiracDec)) +#define GST_DIRACDEC_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DIRACDEC,GstDiracDec)) +#define GST_IS_DIRACDEC(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DIRACDEC)) +#define GST_IS_DIRACDEC_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DIRACDEC)) + +typedef struct _GstDiracDec GstDiracDec; +typedef struct _GstDiracDecClass GstDiracDecClass; + +struct _GstDiracDec +{ + GstElement element; + + /* pads */ + GstPad *sinkpad, *srcpad; + + SequenceDecompressor *decompress; + + PicOutput *output_image; + +}; + +struct _GstDiracDecClass +{ + GstElementClass parent_class; +}; + +GType gst_diracdec_get_type (void); + + +/* elementfactory information */ +GstElementDetails gst_diracdec_details = { + "Dirac stream decoder", + "Codec/Decoder", + "Decode DIRAC streams", + "David Schleef <ds@schleef.org>", +}; + +GST_DEBUG_CATEGORY (diracdec_debug); +#define GST_CAT_DEFAULT diracdec_debug + +enum +{ + /* FILL ME */ + LAST_SIGNAL +}; + +enum +{ + ARG_0, + /* FILL ME */ +}; + +static void gst_diracdec_base_init (gpointer g_class); +static void gst_diracdec_class_init (GstDiracDec * klass); +static void gst_diracdec_init (GstDiracDec * diracdec); + +static void gst_diracdec_chain (GstPad * pad, GstData * _data); +static GstPadLinkReturn gst_diracdec_link (GstPad * pad, const GstCaps * caps); + +static GstElementClass *parent_class = NULL; + +/*static guint gst_diracdec_signals[LAST_SIGNAL] = { 0 }; */ + +GType +gst_diracdec_get_type (void) +{ + static GType diracdec_type = 0; + + if (!diracdec_type) { + static const GTypeInfo diracdec_info = { + sizeof (GstDiracDec), + gst_diracdec_base_init, + NULL, + (GClassInitFunc) gst_diracdec_class_init, + NULL, + NULL, + sizeof (GstDiracDec), + 0, + (GInstanceInitFunc) gst_diracdec_init, + }; + + diracdec_type = + g_type_register_static (GST_TYPE_ELEMENT, "GstDiracDec", &diracdec_info, + (GTypeFlags) 0); + } + return diracdec_type; +} + +static GstStaticPadTemplate gst_diracdec_src_pad_template = +GST_STATIC_PAD_TEMPLATE ("src", + GST_PAD_SRC, + GST_PAD_ALWAYS, + GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420")) + ); + +static GstStaticPadTemplate gst_diracdec_sink_pad_template = +GST_STATIC_PAD_TEMPLATE ("sink", + GST_PAD_SINK, + GST_PAD_ALWAYS, + GST_STATIC_CAPS ("image/dirac, " + "width = (int) [ 16, 4096 ], " + "height = (int) [ 16, 4096 ], " "framerate = (double) [ 1, MAX ]") + ); + +static void +gst_diracdec_base_init (gpointer g_class) +{ + GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); + + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_diracdec_src_pad_template)); + gst_element_class_add_pad_template (element_class, + gst_static_pad_template_get (&gst_diracdec_sink_pad_template)); + gst_element_class_set_details (element_class, &gst_diracdec_details); +} + +static void +gst_diracdec_class_init (GstDiracDec * klass) +{ + GstElementClass *gstelement_class; + + gstelement_class = (GstElementClass *) klass; + + parent_class = GST_ELEMENT_CLASS (g_type_class_ref (GST_TYPE_ELEMENT)); + + GST_DEBUG_CATEGORY_INIT (diracdec_debug, "diracdec", 0, "DIRAC decoder"); +} + +static void +gst_diracdec_init (GstDiracDec * diracdec) +{ + GST_DEBUG ("gst_diracdec_init: initializing"); + /* create the sink and src pads */ + + diracdec->sinkpad = + gst_pad_new_from_template (gst_static_pad_template_get + (&gst_diracdec_sink_pad_template), "sink"); + gst_element_add_pad (GST_ELEMENT (diracdec), diracdec->sinkpad); + gst_pad_set_chain_function (diracdec->sinkpad, gst_diracdec_chain); + gst_pad_set_link_function (diracdec->sinkpad, gst_diracdec_link); + + diracdec->srcpad = + gst_pad_new_from_template (gst_static_pad_template_get + (&gst_diracdec_src_pad_template), "src"); + gst_pad_use_explicit_caps (diracdec->srcpad); + gst_element_add_pad (GST_ELEMENT (diracdec), diracdec->srcpad); + + diracdec->decompress = new SequenceDecompressor; + diracdec->output_image = new PicOutput; +} + +static GstPadLinkReturn +gst_diracdec_link (GstPad * pad, const GstCaps * caps) +{ + //GstDiracDec *diracdec = GST_DIRACDEC (gst_pad_get_parent (pad)); + GstStructure *structure; + + //GstCaps *srccaps; + + structure = gst_caps_get_structure (caps, 0); + + return GST_PAD_LINK_OK; +} + +static void +gst_diracdec_chain (GstPad * pad, GstData * _data) +{ + GstBuffer *buf = GST_BUFFER (_data); + GstDiracDec *diracdec; + + g_return_if_fail (pad != NULL); + g_return_if_fail (GST_IS_PAD (pad)); + g_return_if_fail (buf != NULL); + + diracdec = GST_DIRACDEC (GST_OBJECT_PARENT (pad)); + + gst_buffer_unref (buf); +} |