mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
hdvparse: New element for parsing private/hdv-a1 streams.
This commit is contained in:
parent
01b8bacd1b
commit
c6cd4d09e2
4 changed files with 238 additions and 0 deletions
|
@ -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
|
||||
|
|
13
gst/hdvparse/Makefile.am
Normal file
13
gst/hdvparse/Makefile.am
Normal file
|
@ -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
|
||||
|
167
gst/hdvparse/gsthdvparse.c
Normal file
167
gst/hdvparse/gsthdvparse.c
Normal file
|
@ -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/")
|
56
gst/hdvparse/gsthdvparse.h
Normal file
56
gst/hdvparse/gsthdvparse.h
Normal file
|
@ -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__ */
|
Loading…
Reference in a new issue