[gst-cvs] gst-plugins-bad: hdvparse: New element for parsing private/hdv-a1 streams.

Edward Hervey bilboed at kemper.freedesktop.org
Sun May 31 09:26:03 PDT 2009


Module: gst-plugins-bad
Branch: master
Commit: c6cd4d09e2ebfc424e73f5153328ce6260a9da3f
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=c6cd4d09e2ebfc424e73f5153328ce6260a9da3f

Author: Edward Hervey <bilboed at bilboed.com>
Date:   Sun May 31 14:15:11 2009 +0200

hdvparse: New element for parsing private/hdv-a1 streams.

---

 configure.ac               |    2 +
 gst/hdvparse/Makefile.am   |   13 ++++
 gst/hdvparse/gsthdvparse.c |  167 ++++++++++++++++++++++++++++++++++++++++++++
 gst/hdvparse/gsthdvparse.h |   56 +++++++++++++++
 4 files changed, 238 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 6c47bc8..6222af2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -266,6 +266,7 @@ AG_GST_CHECK_PLUGIN(dvdspu)
 AG_GST_CHECK_PLUGIN(festival)
 AG_GST_CHECK_PLUGIN(freeze)
 AG_GST_CHECK_PLUGIN(h264parse)
+AG_GST_CHECK_PLUGIN(hdvparse)
 AG_GST_CHECK_PLUGIN(id3tag)
 AG_GST_CHECK_PLUGIN(librfb)
 AG_GST_CHECK_PLUGIN(liveadder)
@@ -1581,6 +1582,7 @@ gst/dvdspu/Makefile
 gst/festival/Makefile
 gst/freeze/Makefile
 gst/h264parse/Makefile
+gst/hdvparse/Makefile
 gst/id3tag/Makefile
 gst/librfb/Makefile
 gst/mpegdemux/Makefile
diff --git a/gst/hdvparse/Makefile.am b/gst/hdvparse/Makefile.am
new file mode 100644
index 0000000..d7eb4d2
--- /dev/null
+++ b/gst/hdvparse/Makefile.am
@@ -0,0 +1,13 @@
+plugin_LTLIBRARIES = libgsthdvparse.la
+
+libgsthdvparse_la_SOURCES = \
+	gsthdvparse.c
+
+noinst_HEADERS = \
+	gsthdvparse.h
+
+libgsthdvparse_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS)
+libgsthdvparse_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS)
+libgsthdvparse_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgsthdvparse_la_LIBTOOLFLAGS = --tag=disable-static
+
diff --git a/gst/hdvparse/gsthdvparse.c b/gst/hdvparse/gsthdvparse.c
new file mode 100644
index 0000000..0ea5cd2
--- /dev/null
+++ b/gst/hdvparse/gsthdvparse.c
@@ -0,0 +1,167 @@
+/*
+ * GStreamer
+ * Copyright (C) 2009 Edward Hervey <bilboed at bilboed.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-HDVParse
+ *
+ * <refsect2>
+ * <title>Example launch line</title>
+ * <para>
+ * <programlisting>
+ * gst-launch -v -m filesrc ! mpegtsdemux ! hdvparse ! fakesink silent=TRUE
+ * </programlisting>
+ * </para>
+ * </refsect2>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gst/gst.h>
+#include <gst/base/gstbasetransform.h>
+
+#include "gsthdvparse.h"
+
+GST_DEBUG_CATEGORY_STATIC (gst_hdvparse_debug);
+#define GST_CAT_DEFAULT gst_hdvparse_debug
+
+/* Filter signals and args */
+enum
+{
+  /* FILL ME */
+  LAST_SIGNAL
+};
+
+enum
+{
+  PROP_0,
+};
+
+/* the capabilities of the inputs and outputs.
+ *
+ * describe the real formats here.
+ */
+static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
+    GST_PAD_SINK,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("private/hdv-a1")
+    );
+
+static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
+    GST_PAD_SRC,
+    GST_PAD_ALWAYS,
+    GST_STATIC_CAPS ("private/hdv-a1,parsed=(boolean)True")
+    );
+
+/* debug category for fltering log messages
+ *
+ * exchange the string 'Template HDVParse' with your description
+ */
+#define DEBUG_INIT(bla) \
+  GST_DEBUG_CATEGORY_INIT (gst_hdvparse_debug, "hdvparse", 0, "HDV private stream parser");
+
+GST_BOILERPLATE_FULL (GstHDVParse, gst_hdvparse, GstBaseTransform,
+    GST_TYPE_BASE_TRANSFORM, DEBUG_INIT);
+
+static GstFlowReturn gst_hdvparse_transform_ip (GstBaseTransform * base,
+    GstBuffer * outbuf);
+
+/* GObject vmethod implementations */
+
+static void
+gst_hdvparse_base_init (gpointer klass)
+{
+  static GstElementDetails element_details = {
+    "HDVParser",
+    "Data/Parser",
+    "HDV private stream Parser",
+    "Edward Hervey <bilboed at bilboed.com>"
+  };
+  GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
+
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&src_template));
+  gst_element_class_add_pad_template (element_class,
+      gst_static_pad_template_get (&sink_template));
+  gst_element_class_set_details (element_class, &element_details);
+}
+
+/* initialize the HDVParse's class */
+static void
+gst_hdvparse_class_init (GstHDVParseClass * klass)
+{
+  GST_BASE_TRANSFORM_CLASS (klass)->transform_ip =
+      GST_DEBUG_FUNCPTR (gst_hdvparse_transform_ip);
+}
+
+/* initialize the new element
+ * initialize instance structure
+ */
+static void
+gst_hdvparse_init (GstHDVParse * filter, GstHDVParseClass * klass)
+{
+  GstBaseTransform *transform = GST_BASE_TRANSFORM (filter);
+
+  gst_base_transform_set_in_place (transform, TRUE);
+  gst_base_transform_set_passthrough (transform, TRUE);
+}
+
+static void
+gst_hdvparse_parse (GstHDVParse * filter, GstBuffer * buf)
+{
+  GST_MEMDUMP_OBJECT (filter, "BUFFER", GST_BUFFER_DATA (buf),
+      GST_BUFFER_SIZE (buf));
+  return;
+}
+
+/* GstBaseTransform vmethod implementations */
+
+static GstFlowReturn
+gst_hdvparse_transform_ip (GstBaseTransform * base, GstBuffer * outbuf)
+{
+  GstHDVParse *filter = GST_HDVPARSE (base);
+
+  gst_hdvparse_parse (filter, outbuf);
+
+  return GST_FLOW_OK;
+}
+
+
+/* entry point to initialize the plug-in
+ * initialize the plug-in itself
+ * register the element factories and other features
+ */
+static gboolean
+HDVParse_init (GstPlugin * HDVParse)
+{
+  return gst_element_register (HDVParse, "hdvparse", GST_RANK_PRIMARY,
+      GST_TYPE_HDVPARSE);
+}
+
+/* gstreamer looks for this structure to register HDVParses
+ *
+ * exchange the string 'Template HDVParse' with you HDVParse description
+ */
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+    GST_VERSION_MINOR,
+    "hdvparse",
+    "HDV private stream parser",
+    HDVParse_init, VERSION, "LGPL", "GStreamer", "http://gstreamer.net/")
diff --git a/gst/hdvparse/gsthdvparse.h b/gst/hdvparse/gsthdvparse.h
new file mode 100644
index 0000000..824634f
--- /dev/null
+++ b/gst/hdvparse/gsthdvparse.h
@@ -0,0 +1,56 @@
+/* 
+ * GStreamer
+ * Copyright (C) 2009 Edward Hervey <bilboed at bilboed.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 __GST_HDVPARSE_H__
+#define __GST_HDVPARSE_H__
+
+#include <gst/gst.h>
+#include <gst/base/gstbasetransform.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_HDVPARSE \
+  (gst_hdvparse_get_type())
+#define GST_HDVPARSE(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_HDVPARSE,GstHDVParse))
+#define GST_HDVPARSE_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_HDVPARSE,GstHDVParseClass))
+#define GST_IS_HDVPARSE(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_HDVPARSE))
+#define GST_IS_HDVPARSE_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_HDVPARSE))
+
+typedef struct _GstHDVParse      GstHDVParse;
+typedef struct _GstHDVParseClass GstHDVParseClass;
+
+struct _GstHDVParse {
+  GstBaseTransform element;
+
+};
+
+struct _GstHDVParseClass {
+  GstBaseTransformClass parent_class;
+};
+
+GType gst_hdvparse_get_type (void);
+
+G_END_DECLS
+
+#endif /* __GST_HDVPARSE_H__ */





More information about the Gstreamer-commits mailing list