254 lines
7.0 KiB
C
Executable File
254 lines
7.0 KiB
C
Executable File
/* GStreamer
|
|
* Copyright (C) 2017 FIXME <fixme@example.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., 51 Franklin Street, Suite 500,
|
|
* Boston, MA 02110-1335, USA.
|
|
*/
|
|
/**
|
|
* SECTION:element-gstbeatdetector
|
|
*
|
|
* The beatdetector element does FIXME stuff.
|
|
*
|
|
* <refsect2>
|
|
* <title>Example launch line</title>
|
|
* |[
|
|
* gst-launch -v fakesrc ! beatdetector ! FIXME ! fakesink
|
|
* ]|
|
|
* FIXME Describe what the pipeline does.
|
|
* </refsect2>
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include "config.h"
|
|
#endif
|
|
|
|
#include <gst/gst.h>
|
|
#include <gst/base/gstbasetransform.h>
|
|
#include "gstbeatdetector.h"
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_beatdetector_debug_category);
|
|
#define GST_CAT_DEFAULT gst_beatdetector_debug_category
|
|
|
|
/* prototypes */
|
|
|
|
static GstCaps *gst_beatdetector_transform_caps (GstBaseTransform * trans,
|
|
GstPadDirection direction, GstCaps * caps);
|
|
static void
|
|
gst_beatdetector_fixate_caps (GstBaseTransform * trans,
|
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
|
|
static gboolean
|
|
gst_beatdetector_transform_size (GstBaseTransform * trans,
|
|
GstPadDirection direction,
|
|
GstCaps * caps, guint size, GstCaps * othercaps, guint * othersize);
|
|
static gboolean
|
|
gst_beatdetector_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
|
|
guint * size);
|
|
static gboolean
|
|
gst_beatdetector_set_caps (GstBaseTransform * trans, GstCaps * incaps,
|
|
GstCaps * outcaps);
|
|
static gboolean gst_beatdetector_start (GstBaseTransform * trans);
|
|
static gboolean gst_beatdetector_stop (GstBaseTransform * trans);
|
|
static gboolean gst_beatdetector_event (GstBaseTransform * trans, GstEvent * event);
|
|
static GstFlowReturn
|
|
gst_beatdetector_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|
GstBuffer * outbuf);
|
|
static GstFlowReturn
|
|
gst_beatdetector_transform_ip (GstBaseTransform * trans, GstBuffer * buf);
|
|
static GstFlowReturn
|
|
gst_beatdetector_prepare_output_buffer (GstBaseTransform * trans,
|
|
GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf);
|
|
static gboolean
|
|
gst_beatdetector_src_event (GstBaseTransform * trans, GstEvent * event);
|
|
static void
|
|
gst_beatdetector_before_transform (GstBaseTransform * trans, GstBuffer * buffer);
|
|
|
|
enum
|
|
{
|
|
PROP_0
|
|
};
|
|
|
|
/* pad templates */
|
|
|
|
|
|
/* class initialization */
|
|
|
|
#define DEBUG_INIT(bla) \
|
|
GST_DEBUG_CATEGORY_INIT (gst_beatdetector_debug_category, "beatdetector", 0, \
|
|
"debug category for beatdetector element");
|
|
|
|
GST_BOILERPLATE_FULL (GstBeatDetector, gst_beatdetector, GstBaseTransform,
|
|
GST_TYPE_BASE_TRANSFORM, DEBUG_INIT);
|
|
|
|
static void
|
|
gst_beatdetector_base_init (gpointer g_class)
|
|
{
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
|
|
gst_element_class_set_details_simple (element_class, "FIXME Long name",
|
|
"Generic", "FIXME Description", "FIXME <fixme@example.com>");
|
|
}
|
|
|
|
static void
|
|
gst_beatdetector_class_init (GstBeatDetectorClass * klass)
|
|
{
|
|
GstBaseTransformClass *base_transform_class = GST_BASE_TRANSFORM_CLASS (klass);
|
|
|
|
base_transform_class->transform_caps = GST_DEBUG_FUNCPTR (gst_beatdetector_transform_caps);
|
|
base_transform_class->fixate_caps = GST_DEBUG_FUNCPTR (gst_beatdetector_fixate_caps);
|
|
base_transform_class->transform_size = GST_DEBUG_FUNCPTR (gst_beatdetector_transform_size);
|
|
base_transform_class->get_unit_size = GST_DEBUG_FUNCPTR (gst_beatdetector_get_unit_size);
|
|
base_transform_class->set_caps = GST_DEBUG_FUNCPTR (gst_beatdetector_set_caps);
|
|
base_transform_class->start = GST_DEBUG_FUNCPTR (gst_beatdetector_start);
|
|
base_transform_class->stop = GST_DEBUG_FUNCPTR (gst_beatdetector_stop);
|
|
base_transform_class->event = GST_DEBUG_FUNCPTR (gst_beatdetector_event);
|
|
base_transform_class->transform = GST_DEBUG_FUNCPTR (gst_beatdetector_transform);
|
|
base_transform_class->transform_ip = GST_DEBUG_FUNCPTR (gst_beatdetector_transform_ip);
|
|
base_transform_class->prepare_output_buffer = GST_DEBUG_FUNCPTR (gst_beatdetector_prepare_output_buffer);
|
|
base_transform_class->src_event = GST_DEBUG_FUNCPTR (gst_beatdetector_src_event);
|
|
base_transform_class->before_transform = GST_DEBUG_FUNCPTR (gst_beatdetector_before_transform);
|
|
|
|
}
|
|
|
|
static void
|
|
gst_beatdetector_init (GstBeatDetector * beatdetector, GstBeatDetectorClass * beatdetector_class)
|
|
{
|
|
}
|
|
|
|
static GstCaps *
|
|
gst_beatdetector_transform_caps (GstBaseTransform * trans,
|
|
GstPadDirection direction, GstCaps * caps)
|
|
{
|
|
|
|
return NULL;
|
|
}
|
|
|
|
static void
|
|
gst_beatdetector_fixate_caps (GstBaseTransform * trans,
|
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
|
|
{
|
|
|
|
}
|
|
|
|
static gboolean
|
|
gst_beatdetector_transform_size (GstBaseTransform * trans,
|
|
GstPadDirection direction,
|
|
GstCaps * caps, guint size, GstCaps * othercaps, guint * othersize)
|
|
{
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static gboolean
|
|
gst_beatdetector_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
|
|
guint * size)
|
|
{
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static gboolean
|
|
gst_beatdetector_set_caps (GstBaseTransform * trans, GstCaps * incaps,
|
|
GstCaps * outcaps)
|
|
{
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static gboolean
|
|
gst_beatdetector_start (GstBaseTransform * trans)
|
|
{
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static gboolean
|
|
gst_beatdetector_stop (GstBaseTransform * trans)
|
|
{
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static gboolean
|
|
gst_beatdetector_event (GstBaseTransform * trans, GstEvent * event)
|
|
{
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static GstFlowReturn
|
|
gst_beatdetector_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
|
GstBuffer * outbuf)
|
|
{
|
|
|
|
return GST_FLOW_ERROR;
|
|
}
|
|
|
|
static GstFlowReturn
|
|
gst_beatdetector_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
|
|
{
|
|
|
|
return GST_FLOW_ERROR;
|
|
}
|
|
|
|
static GstFlowReturn
|
|
gst_beatdetector_prepare_output_buffer (GstBaseTransform * trans,
|
|
GstBuffer * input, gint size, GstCaps * caps, GstBuffer ** buf)
|
|
{
|
|
|
|
return GST_FLOW_ERROR;
|
|
}
|
|
|
|
static gboolean
|
|
gst_beatdetector_src_event (GstBaseTransform * trans, GstEvent * event)
|
|
{
|
|
|
|
return FALSE;
|
|
}
|
|
|
|
static void
|
|
gst_beatdetector_before_transform (GstBaseTransform * trans, GstBuffer * buffer)
|
|
{
|
|
|
|
}
|
|
|
|
static gboolean
|
|
plugin_init (GstPlugin * plugin)
|
|
{
|
|
|
|
return gst_element_register (plugin, "beatdetector", GST_RANK_NONE,
|
|
GST_TYPE_BEATDETECTOR);
|
|
}
|
|
|
|
#ifndef VERSION
|
|
#define VERSION "0.0.FIXME"
|
|
#endif
|
|
#ifndef PACKAGE
|
|
#define PACKAGE "FIXME_package"
|
|
#endif
|
|
#ifndef PACKAGE_NAME
|
|
#define PACKAGE_NAME "FIXME_package_name"
|
|
#endif
|
|
#ifndef GST_PACKAGE_ORIGIN
|
|
#define GST_PACKAGE_ORIGIN "http://FIXME.org/"
|
|
#endif
|
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
GST_VERSION_MINOR,
|
|
"beatdetector",
|
|
"FIXME plugin description",
|
|
plugin_init, VERSION, "LGPL", PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|
|
|