summaryrefslogtreecommitdiff
path: root/gst/hdvparse
diff options
context:
space:
mode:
authorEdward Hervey <bilboed@bilboed.com>2009-05-31 14:15:11 +0200
committerEdward Hervey <bilboed@bilboed.com>2009-05-31 14:15:43 +0200
commitc6cd4d09e2ebfc424e73f5153328ce6260a9da3f (patch)
tree24715c0fb06e3f17c11163774c27ebcea4db9e5b /gst/hdvparse
parent01b8bacd1b1d1c0793db475fb593cb705143e981 (diff)
downloadgstreamer-plugins-bad-c6cd4d09e2ebfc424e73f5153328ce6260a9da3f.tar.gz
hdvparse: New element for parsing private/hdv-a1 streams.
Diffstat (limited to 'gst/hdvparse')
-rw-r--r--gst/hdvparse/Makefile.am13
-rw-r--r--gst/hdvparse/gsthdvparse.c167
-rw-r--r--gst/hdvparse/gsthdvparse.h56
3 files changed, 236 insertions, 0 deletions
diff --git a/gst/hdvparse/Makefile.am b/gst/hdvparse/Makefile.am
new file mode 100644
index 000000000..d7eb4d282
--- /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 000000000..0ea5cd20e
--- /dev/null
+++ b/gst/hdvparse/gsthdvparse.c
@@ -0,0 +1,167 @@
+/*
+ * GStreamer
+ * Copyright (C) 2009 Edward Hervey <bilboed@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@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 000000000..824634f64
--- /dev/null
+++ b/gst/hdvparse/gsthdvparse.h
@@ -0,0 +1,56 @@
+/*
+ * GStreamer
+ * Copyright (C) 2009 Edward Hervey <bilboed@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__ */