current version.. forgot to commit
This commit is contained in:
253
gst/gstbeatdetector.c.old
Executable file
253
gst/gstbeatdetector.c.old
Executable file
@@ -0,0 +1,253 @@
|
||||
/* 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)
|
||||
|
||||
51
gst/gstbeatdetector.h.old
Executable file
51
gst/gstbeatdetector.h.old
Executable file
@@ -0,0 +1,51 @@
|
||||
/* 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., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef _GST_BEATDETECTOR_H_
|
||||
#define _GST_BEATDETECTOR_H_
|
||||
|
||||
#include <gst/base/gstbasetransform.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_BEATDETECTOR (gst_beatdetector_get_type())
|
||||
#define GST_BEATDETECTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BEATDETECTOR,GstBeatDetector))
|
||||
#define GST_BEATDETECTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BEATDETECTOR,GstBeatDetectorClass))
|
||||
#define GST_IS_BEATDETECTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BEATDETECTOR))
|
||||
#define GST_IS_BEATDETECTOR_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BEATDETECTOR))
|
||||
|
||||
typedef struct _GstBeatDetector GstBeatDetector;
|
||||
typedef struct _GstBeatDetectorClass GstBeatDetectorClass;
|
||||
|
||||
struct _GstBeatDetector
|
||||
{
|
||||
GstBaseTransform base_beatdetector;
|
||||
|
||||
};
|
||||
|
||||
struct _GstBeatDetectorClass
|
||||
{
|
||||
GstBaseTransformClass base_beatdetector_class;
|
||||
};
|
||||
|
||||
GType gst_beatdetector_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
170
gst/plugin.cpp
Executable file
170
gst/plugin.cpp
Executable file
@@ -0,0 +1,170 @@
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <gst/gst.h>
|
||||
#include <gst/audio/audio.h>
|
||||
#include <iostream>
|
||||
|
||||
#include "plugin.h"
|
||||
|
||||
|
||||
#include "../lib/BeatDetection.h"
|
||||
static BeatDetection<float> beatDetection;
|
||||
|
||||
#include "../lib/BassDetection.h"
|
||||
static BassDetection<float> bassDetection;
|
||||
|
||||
#include "../lib/BeatDetection2.h"
|
||||
static BeatDetection2<float> beatDetection2;
|
||||
|
||||
GST_DEBUG_CATEGORY_STATIC (beat_detector_debug);
|
||||
#define GST_CAT_DEFAULT beat_detector_debug
|
||||
|
||||
static GstStaticPadTemplate sink_template_factory =
|
||||
GST_STATIC_PAD_TEMPLATE ("sink",
|
||||
GST_PAD_SINK,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw, "
|
||||
"format = (string) " GST_AUDIO_NE (S16) ", "
|
||||
"rate = (int) [ 1, MAX ], "
|
||||
"channels = (int) [ 1, MAX ]"
|
||||
)
|
||||
);
|
||||
|
||||
static GstStaticPadTemplate src_template_factory =
|
||||
GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("audio/x-raw, "
|
||||
"format = (string) " GST_AUDIO_NE (S16) ", "
|
||||
"rate = (int) [ 1, MAX ], "
|
||||
"channels = (int) [ 1, MAX ]"
|
||||
)
|
||||
);
|
||||
|
||||
#define gst_beat_detector_parent_class parent_class
|
||||
G_DEFINE_TYPE (GstBeatDetector, gst_beat_detector, GST_TYPE_BASE_TRANSFORM);
|
||||
|
||||
|
||||
|
||||
static void gst_beat_detector_finalize(GObject* obj);
|
||||
|
||||
|
||||
|
||||
static gboolean gst_level_set_caps (GstBaseTransform* trans, GstCaps* in, GstCaps* out) {
|
||||
GstBeatDetector* filter = GST_BEAT_DETECTOR(trans);
|
||||
|
||||
return gst_audio_info_from_caps(&filter->info, in);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static GstFlowReturn gst_beat_detector_transform_ip(GstBaseTransform* trans, GstBuffer* in) {
|
||||
|
||||
GstBeatDetector *filter = GST_BEAT_DETECTOR(trans);
|
||||
GstMapInfo map;
|
||||
gst_buffer_map (in, &map, GST_MAP_READ);
|
||||
|
||||
gint channels = GST_AUDIO_INFO_CHANNELS (&filter->info);
|
||||
gint bps = GST_AUDIO_INFO_BPS (&filter->info);
|
||||
//gint rate = GST_AUDIO_INFO_RATE (&filter->info);
|
||||
guint num_samples = map.size / bps;
|
||||
//guint num_frames = num_samples / channels;
|
||||
|
||||
//std::cout << channels << " " << bps << " " << rate << std::endl;
|
||||
//std::cout << filter->info.layout << std::endl;
|
||||
|
||||
// map signed-16-bit data
|
||||
const int16_t* data = (const int16_t*) map.data;
|
||||
|
||||
static size_t samples = 0; ++samples;
|
||||
|
||||
// process 2 interleaved channels
|
||||
for (guint i = 0; i < num_samples; i += 2) {
|
||||
|
||||
const int left = data[i+0];
|
||||
const int right = data[i+1];
|
||||
const int sample = (left+right)/2;
|
||||
|
||||
//const bool beat = beatDetection.add(sample);
|
||||
//if (beat) {std::cout << "beat" << i << std::endl;}
|
||||
|
||||
//const float res = bassDetection.add(sample);
|
||||
//if (res > 0) {std::cout << res << std::endl;}
|
||||
|
||||
const bool beat = beatDetection2.add(left, right);
|
||||
if (beat) {std::cout << "beat" << i << std::endl << std::flush;}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// done
|
||||
return GST_FLOW_OK;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static void gst_beat_detector_class_init(GstBeatDetectorClass* klass) {
|
||||
std::cout << "hallo!" << std::endl;
|
||||
GObjectClass* gobject_class = G_OBJECT_CLASS (klass);
|
||||
GstElementClass* element_class = GST_ELEMENT_CLASS (klass);
|
||||
GstBaseTransformClass* trans_class = GST_BASE_TRANSFORM_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = gst_beat_detector_finalize;
|
||||
|
||||
GST_DEBUG_CATEGORY_INIT (beat_detector_debug, "beat_detector", 0, "Beat detection");
|
||||
|
||||
gst_element_class_add_static_pad_template (element_class, &sink_template_factory);
|
||||
gst_element_class_add_static_pad_template (element_class, &src_template_factory);
|
||||
gst_element_class_set_static_metadata (element_class, "BeatDetector",
|
||||
"Filter/Analyzer/Audio",
|
||||
"BeatDetector operating of a stream of audio/raw",
|
||||
"Unknown");
|
||||
|
||||
trans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_beat_detector_transform_ip);
|
||||
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_level_set_caps);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void gst_beat_detector_init(GstBeatDetector* filter) {
|
||||
|
||||
gst_audio_info_init (&filter->info);
|
||||
std::cout << "Init audio info." << std::endl;
|
||||
gst_base_transform_set_gap_aware (GST_BASE_TRANSFORM (filter), TRUE);
|
||||
|
||||
// filterBass.setLowPass(150, 1.5, 44100);
|
||||
// filterSnare.setBandPass(5000, 1.5, 44100);
|
||||
beatDetection.setSampleRate(44100);
|
||||
bassDetection.setSampleRate(44100);
|
||||
beatDetection2.setSampleRate(44100);
|
||||
|
||||
}
|
||||
|
||||
static void gst_beat_detector_finalize(GObject* obj) {
|
||||
//GstBeatDetector *filter = GST_BEAT_DETECTOR (obj);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* REGISTER PLUGIN */
|
||||
|
||||
static gboolean plugin_init(GstPlugin* plugin) {
|
||||
return gst_element_register(plugin, "beat_detector", GST_RANK_NONE, GST_TYPE_BEAT_DETECTOR);
|
||||
}
|
||||
|
||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
||||
GST_VERSION_MINOR,
|
||||
beat_detector,
|
||||
"Audio beat detecting plugin",
|
||||
plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
|
||||
89
gst/plugin.h
Executable file
89
gst/plugin.h
Executable file
@@ -0,0 +1,89 @@
|
||||
/* GStreamer
|
||||
* Copyright (C) 1999 Erik Walthinsen <omega@cse.ogi.edu>
|
||||
* Copyright (C) 2000,2001,2002,2003,2005
|
||||
* Thomas Vander Stichele <thomas at apestaart dot 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., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __GST_BEAT_DETECTOR_H__
|
||||
#define __GST_BEAT_DETECTOR_H__
|
||||
|
||||
#define VERSION "1"
|
||||
#define GST_PACKAGE_NAME "package"
|
||||
#define GST_PACKAGE_ORIGIN "unknown"
|
||||
#define GST_LICENSE "LGPL"
|
||||
#define PACKAGE "gst-beat-detector"
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/base/gstbasetransform.h>
|
||||
#include <gst/audio/audio.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GST_TYPE_BEAT_DETECTOR \
|
||||
(gst_beat_detector_get_type())
|
||||
#define GST_BEAT_DETECTOR(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BEAT_DETECTOR,GstBeatDetector))
|
||||
#define GST_BEAT_DETECTOR_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BEAT_DETECTOR,GstBeatDetectorClass))
|
||||
#define GST_BEAT_DETECTOR_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_BEAT_DETECTOR,GstBeatDetectorClass))
|
||||
#define GST_IS_BEAT_DETECTOR(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BEAT_DETECTOR))
|
||||
#define GST_IS_BEAT_DETECTOR_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BEAT_DETECTOR))
|
||||
|
||||
|
||||
typedef struct _GstBeatDetector GstBeatDetector;
|
||||
typedef struct _GstBeatDetectorClass GstBeatDetectorClass;
|
||||
|
||||
/**
|
||||
* GstBeatDetector:
|
||||
*
|
||||
* Opaque data structure.
|
||||
*/
|
||||
struct _GstBeatDetector {
|
||||
GstBaseTransform element;
|
||||
|
||||
/* properties */
|
||||
gboolean post_messages; /* whether or not to post messages */
|
||||
guint64 interval; /* how many nanoseconds between emits */
|
||||
gdouble decay_peak_ttl; /* time to live for peak in nanoseconds */
|
||||
gdouble decay_peak_falloff; /* falloff in dB/sec */
|
||||
|
||||
GstAudioInfo info;
|
||||
gint num_frames; /* frame count (1 sample per channel)
|
||||
* since last emit */
|
||||
gint interval_frames; /* after how many frame to sent a message */
|
||||
GstClockTime message_ts; /* starttime for next message */
|
||||
|
||||
void (*process)(gpointer, guint, guint, gdouble*, gdouble*);
|
||||
};
|
||||
|
||||
struct _GstBeatDetectorClass {
|
||||
GstBaseTransformClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_beat_detector_get_type (void);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
#endif /* __GST_BEAT_DETECTOR_H__ */
|
||||
Reference in New Issue
Block a user