audiovisualizer: shorten base class name

As suggested on IRC rename to AudioVisualizer. We use custom suffix on the type
to avoid clashing with other copies for the time being.
This commit is contained in:
Stefan Sauer 2012-07-16 22:02:44 +02:00
parent 41a39d93bf
commit 124c9a7fa4
13 changed files with 303 additions and 309 deletions

View file

@ -115,7 +115,7 @@ EXTRA_HFILES = \
$(top_srcdir)/gst/aiff/aiffparse.h \
$(top_srcdir)/gst/aiff/aiffmux.h \
$(top_srcdir)/gst/autoconvert/gstautoconvert.h \
$(top_srcdir)/gst/audiovisualizers/gstbaseaudiovisualizer.h \
$(top_srcdir)/gst/audiovisualizers/gstaudiovisualizer.h \
$(top_srcdir)/gst/audiovisualizers/gstspacescope.h \
$(top_srcdir)/gst/audiovisualizers/gstspectrascope.h \
$(top_srcdir)/gst/audiovisualizers/gstsynaescope.h \

View file

@ -1,7 +1,7 @@
plugin_LTLIBRARIES = libgstaudiovisualizers.la
libgstaudiovisualizers_la_SOURCES = plugin.c \
gstbaseaudiovisualizer.c gstbaseaudiovisualizer.h \
gstaudiovisualizer.c gstaudiovisualizer.h \
gstspacescope.c gstspacescope.h \
gstspectrascope.c gstspectrascope.h \
gstsynaescope.c gstsynaescope.h \
@ -17,7 +17,7 @@ libgstaudiovisualizers_la_LIBADD = \
libgstaudiovisualizers_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstaudiovisualizers_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = gstbaseaudiovisualizer.h gstdrawhelpers.h \
noinst_HEADERS = gstaudiovisualizer.h gstdrawhelpers.h \
gstspacescope.h gstspectrascope.h gstsynaescope.h gstwavescope.h
Android.mk: Makefile.am $(BUILT_SOURCES)

View file

@ -1,7 +1,7 @@
/* GStreamer
* Copyright (C) <2011> Stefan Kost <ensonic@users.sf.net>
*
* gstbaseaudiovisualizer.h: base class for audio visualisation elements
* gstaudiovisualizer.h: base class for audio visualisation elements
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,9 +18,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* SECTION:gstbaseaudiovisualizer
* SECTION:gstaudiovisualizer
*
* A basclass for scopes (visualizers). It takes care of re-fitting the
* A baseclass for scopes (visualizers). It takes care of re-fitting the
* audio-rate to video-rate and handles renegotiation (downstream video size
* changes).
*
@ -39,12 +39,12 @@
#include <string.h>
#include "gstbaseaudiovisualizer.h"
#include "gstaudiovisualizer.h"
GST_DEBUG_CATEGORY_STATIC (base_audio_visualizer_debug);
#define GST_CAT_DEFAULT (base_audio_visualizer_debug)
GST_DEBUG_CATEGORY_STATIC (audio_visualizer_debug);
#define GST_CAT_DEFAULT (audio_visualizer_debug)
#define DEFAULT_SHADER GST_BASE_AUDIO_VISUALIZER_SHADER_FADE
#define DEFAULT_SHADER GST_AUDIO_VISUALIZER_SHADER_FADE
#define DEFAULT_SHADE_AMOUNT 0x000a0a0a
enum
@ -56,72 +56,72 @@ enum
static GstBaseTransformClass *parent_class = NULL;
static void gst_base_audio_visualizer_class_init (GstBaseAudioVisualizerClass *
klass);
static void gst_base_audio_visualizer_init (GstBaseAudioVisualizer * scope,
GstBaseAudioVisualizerClass * g_class);
static void gst_base_audio_visualizer_set_property (GObject * object,
static void gst_audio_visualizer_class_init (GstAudioVisualizerClass * klass);
static void gst_audio_visualizer_init (GstAudioVisualizer * scope,
GstAudioVisualizerClass * g_class);
static void gst_audio_visualizer_set_property (GObject * object,
guint prop_id, const GValue * value, GParamSpec * pspec);
static void gst_base_audio_visualizer_get_property (GObject * object,
static void gst_audio_visualizer_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
static void gst_base_audio_visualizer_dispose (GObject * object);
static void gst_audio_visualizer_dispose (GObject * object);
static gboolean gst_base_audio_visualizer_src_negotiate (GstBaseAudioVisualizer
* scope);
static gboolean gst_base_audio_visualizer_src_setcaps (GstBaseAudioVisualizer *
static gboolean gst_audio_visualizer_src_negotiate (GstAudioVisualizer * scope);
static gboolean gst_audio_visualizer_src_setcaps (GstAudioVisualizer *
scope, GstCaps * caps);
static gboolean gst_base_audio_visualizer_sink_setcaps (GstBaseAudioVisualizer *
static gboolean gst_audio_visualizer_sink_setcaps (GstAudioVisualizer *
scope, GstCaps * caps);
static GstFlowReturn gst_base_audio_visualizer_chain (GstPad * pad,
static GstFlowReturn gst_audio_visualizer_chain (GstPad * pad,
GstObject * parent, GstBuffer * buffer);
static gboolean gst_base_audio_visualizer_src_event (GstPad * pad,
static gboolean gst_audio_visualizer_src_event (GstPad * pad,
GstObject * parent, GstEvent * event);
static gboolean gst_base_audio_visualizer_sink_event (GstPad * pad,
static gboolean gst_audio_visualizer_sink_event (GstPad * pad,
GstObject * parent, GstEvent * event);
static gboolean gst_base_audio_visualizer_src_query (GstPad * pad,
static gboolean gst_audio_visualizer_src_query (GstPad * pad,
GstObject * parent, GstQuery * query);
static gboolean gst_base_audio_visualizer_sink_query (GstPad * pad,
static gboolean gst_audio_visualizer_sink_query (GstPad * pad,
GstObject * parent, GstQuery * query);
static GstStateChangeReturn gst_base_audio_visualizer_change_state (GstElement *
static GstStateChangeReturn gst_audio_visualizer_change_state (GstElement *
element, GstStateChange transition);
/* shading functions */
#define GST_TYPE_BASE_AUDIO_VISUALIZER_SHADER (gst_base_audio_visualizer_shader_get_type())
#define GST_TYPE_AUDIO_VISUALIZER_SHADER (gst_audio_visualizer_shader_get_type())
static GType
gst_base_audio_visualizer_shader_get_type (void)
gst_audio_visualizer_shader_get_type (void)
{
static GType shader_type = 0;
static const GEnumValue shaders[] = {
{GST_BASE_AUDIO_VISUALIZER_SHADER_NONE, "None", "none"},
{GST_BASE_AUDIO_VISUALIZER_SHADER_FADE, "Fade", "fade"},
{GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP, "Fade and move up",
{GST_AUDIO_VISUALIZER_SHADER_NONE, "None", "none"},
{GST_AUDIO_VISUALIZER_SHADER_FADE, "Fade", "fade"},
{GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP, "Fade and move up",
"fade-and-move-up"},
{GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN, "Fade and move down",
{GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN, "Fade and move down",
"fade-and-move-down"},
{GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT, "Fade and move left",
{GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT, "Fade and move left",
"fade-and-move-left"},
{GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT,
{GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT,
"Fade and move right",
"fade-and-move-right"},
{GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT,
{GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT,
"Fade and move horizontally out", "fade-and-move-horiz-out"},
{GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN,
{GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN,
"Fade and move horizontally in", "fade-and-move-horiz-in"},
{GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT,
{GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT,
"Fade and move vertically out", "fade-and-move-vert-out"},
{GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN,
{GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN,
"Fade and move vertically in", "fade-and-move-vert-in"},
{0, NULL, NULL},
};
if (G_UNLIKELY (shader_type == 0)) {
/* TODO: rename when exporting it as a library */
shader_type =
g_enum_register_static ("GstBaseAudioVisualizerShader", shaders);
g_enum_register_static
("GstAudioVisualizerShader-BadGstAudioVisualizers", shaders);
}
return shader_type;
}
@ -180,7 +180,7 @@ G_STMT_START { \
#endif
static void
shader_fade (GstBaseAudioVisualizer * scope, const guint8 * s, guint8 * d)
shader_fade (GstAudioVisualizer * scope, const guint8 * s, guint8 * d)
{
guint i, bpf = scope->bpf;
guint r = (scope->shade_amount >> 16) & 0xff;
@ -193,7 +193,7 @@ shader_fade (GstBaseAudioVisualizer * scope, const guint8 * s, guint8 * d)
}
static void
shader_fade_and_move_up (GstBaseAudioVisualizer * scope, const guint8 * s,
shader_fade_and_move_up (GstAudioVisualizer * scope, const guint8 * s,
guint8 * d)
{
guint i, j, bpf = scope->bpf;
@ -208,7 +208,7 @@ shader_fade_and_move_up (GstBaseAudioVisualizer * scope, const guint8 * s,
}
static void
shader_fade_and_move_down (GstBaseAudioVisualizer * scope, const guint8 * s,
shader_fade_and_move_down (GstAudioVisualizer * scope, const guint8 * s,
guint8 * d)
{
guint i, j, bpf = scope->bpf;
@ -223,7 +223,7 @@ shader_fade_and_move_down (GstBaseAudioVisualizer * scope, const guint8 * s,
}
static void
shader_fade_and_move_left (GstBaseAudioVisualizer * scope,
shader_fade_and_move_left (GstAudioVisualizer * scope,
const guint8 * s, guint8 * d)
{
guint i, j, k, bpf = scope->bpf;
@ -243,7 +243,7 @@ shader_fade_and_move_left (GstBaseAudioVisualizer * scope,
}
static void
shader_fade_and_move_right (GstBaseAudioVisualizer * scope,
shader_fade_and_move_right (GstAudioVisualizer * scope,
const guint8 * s, guint8 * d)
{
guint i, j, k, bpf = scope->bpf;
@ -263,7 +263,7 @@ shader_fade_and_move_right (GstBaseAudioVisualizer * scope,
}
static void
shader_fade_and_move_horiz_out (GstBaseAudioVisualizer * scope,
shader_fade_and_move_horiz_out (GstAudioVisualizer * scope,
const guint8 * s, guint8 * d)
{
guint i, j, bpf = scope->bpf / 2;
@ -283,7 +283,7 @@ shader_fade_and_move_horiz_out (GstBaseAudioVisualizer * scope,
}
static void
shader_fade_and_move_horiz_in (GstBaseAudioVisualizer * scope,
shader_fade_and_move_horiz_in (GstAudioVisualizer * scope,
const guint8 * s, guint8 * d)
{
guint i, j, bpf = scope->bpf / 2;
@ -303,7 +303,7 @@ shader_fade_and_move_horiz_in (GstBaseAudioVisualizer * scope,
}
static void
shader_fade_and_move_vert_out (GstBaseAudioVisualizer * scope,
shader_fade_and_move_vert_out (GstAudioVisualizer * scope,
const guint8 * s, guint8 * d)
{
guint i, j, k, bpf = scope->bpf;
@ -331,7 +331,7 @@ shader_fade_and_move_vert_out (GstBaseAudioVisualizer * scope,
}
static void
shader_fade_and_move_vert_in (GstBaseAudioVisualizer * scope,
shader_fade_and_move_vert_in (GstAudioVisualizer * scope,
const guint8 * s, guint8 * d)
{
guint i, j, k, bpf = scope->bpf;
@ -359,37 +359,37 @@ shader_fade_and_move_vert_in (GstBaseAudioVisualizer * scope,
}
static void
gst_base_audio_visualizer_change_shader (GstBaseAudioVisualizer * scope)
gst_audio_visualizer_change_shader (GstAudioVisualizer * scope)
{
switch (scope->shader_type) {
case GST_BASE_AUDIO_VISUALIZER_SHADER_NONE:
case GST_AUDIO_VISUALIZER_SHADER_NONE:
scope->shader = NULL;
break;
case GST_BASE_AUDIO_VISUALIZER_SHADER_FADE:
case GST_AUDIO_VISUALIZER_SHADER_FADE:
scope->shader = shader_fade;
break;
case GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP:
case GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP:
scope->shader = shader_fade_and_move_up;
break;
case GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN:
case GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN:
scope->shader = shader_fade_and_move_down;
break;
case GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT:
case GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT:
scope->shader = shader_fade_and_move_left;
break;
case GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT:
case GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT:
scope->shader = shader_fade_and_move_right;
break;
case GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT:
case GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT:
scope->shader = shader_fade_and_move_horiz_out;
break;
case GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN:
case GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN:
scope->shader = shader_fade_and_move_horiz_in;
break;
case GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT:
case GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT:
scope->shader = shader_fade_and_move_vert_out;
break;
case GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN:
case GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN:
scope->shader = shader_fade_and_move_vert_in;
break;
default:
@ -402,54 +402,55 @@ gst_base_audio_visualizer_change_shader (GstBaseAudioVisualizer * scope)
/* base class */
GType
gst_base_audio_visualizer_get_type (void)
gst_audio_visualizer_get_type (void)
{
static volatile gsize base_audio_visualizer_type = 0;
static volatile gsize audio_visualizer_type = 0;
if (g_once_init_enter (&base_audio_visualizer_type)) {
static const GTypeInfo base_audio_visualizer_info = {
sizeof (GstBaseAudioVisualizerClass),
if (g_once_init_enter (&audio_visualizer_type)) {
static const GTypeInfo audio_visualizer_info = {
sizeof (GstAudioVisualizerClass),
NULL,
NULL,
(GClassInitFunc) gst_base_audio_visualizer_class_init,
(GClassInitFunc) gst_audio_visualizer_class_init,
NULL,
NULL,
sizeof (GstBaseAudioVisualizer),
sizeof (GstAudioVisualizer),
0,
(GInstanceInitFunc) gst_base_audio_visualizer_init,
(GInstanceInitFunc) gst_audio_visualizer_init,
};
GType _type;
/* TODO: rename when exporting it as a library */
_type = g_type_register_static (GST_TYPE_ELEMENT,
"GstBaseAudioVisualizer", &base_audio_visualizer_info,
"GstAudioVisualizer-BadGstAudioVisualizers", &audio_visualizer_info,
G_TYPE_FLAG_ABSTRACT);
g_once_init_leave (&base_audio_visualizer_type, _type);
g_once_init_leave (&audio_visualizer_type, _type);
}
return (GType) base_audio_visualizer_type;
return (GType) audio_visualizer_type;
}
static void
gst_base_audio_visualizer_class_init (GstBaseAudioVisualizerClass * klass)
gst_audio_visualizer_class_init (GstAudioVisualizerClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
GstElementClass *element_class = (GstElementClass *) klass;
parent_class = g_type_class_peek_parent (klass);
GST_DEBUG_CATEGORY_INIT (base_audio_visualizer_debug, "baseaudiovisualizer",
GST_DEBUG_CATEGORY_INIT (audio_visualizer_debug, "baseaudiovisualizer",
0, "scope audio visualisation base class");
gobject_class->set_property = gst_base_audio_visualizer_set_property;
gobject_class->get_property = gst_base_audio_visualizer_get_property;
gobject_class->dispose = gst_base_audio_visualizer_dispose;
gobject_class->set_property = gst_audio_visualizer_set_property;
gobject_class->get_property = gst_audio_visualizer_get_property;
gobject_class->dispose = gst_audio_visualizer_dispose;
element_class->change_state =
GST_DEBUG_FUNCPTR (gst_base_audio_visualizer_change_state);
GST_DEBUG_FUNCPTR (gst_audio_visualizer_change_state);
g_object_class_install_property (gobject_class, PROP_SHADER,
g_param_spec_enum ("shader", "shader type",
"Shader function to apply on each frame",
GST_TYPE_BASE_AUDIO_VISUALIZER_SHADER, DEFAULT_SHADER,
GST_TYPE_AUDIO_VISUALIZER_SHADER, DEFAULT_SHADER,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_SHADE_AMOUNT,
g_param_spec_uint ("shade-amount", "shade amount",
@ -459,8 +460,8 @@ gst_base_audio_visualizer_class_init (GstBaseAudioVisualizerClass * klass)
}
static void
gst_base_audio_visualizer_init (GstBaseAudioVisualizer * scope,
GstBaseAudioVisualizerClass * g_class)
gst_audio_visualizer_init (GstAudioVisualizer * scope,
GstAudioVisualizerClass * g_class)
{
GstPadTemplate *pad_template;
@ -470,11 +471,11 @@ gst_base_audio_visualizer_init (GstBaseAudioVisualizer * scope,
g_return_if_fail (pad_template != NULL);
scope->sinkpad = gst_pad_new_from_template (pad_template, "sink");
gst_pad_set_chain_function (scope->sinkpad,
GST_DEBUG_FUNCPTR (gst_base_audio_visualizer_chain));
GST_DEBUG_FUNCPTR (gst_audio_visualizer_chain));
gst_pad_set_event_function (scope->sinkpad,
GST_DEBUG_FUNCPTR (gst_base_audio_visualizer_sink_event));
GST_DEBUG_FUNCPTR (gst_audio_visualizer_sink_event));
gst_pad_set_query_function (scope->sinkpad,
GST_DEBUG_FUNCPTR (gst_base_audio_visualizer_sink_query));
GST_DEBUG_FUNCPTR (gst_audio_visualizer_sink_query));
gst_element_add_pad (GST_ELEMENT (scope), scope->sinkpad);
pad_template =
@ -482,9 +483,9 @@ gst_base_audio_visualizer_init (GstBaseAudioVisualizer * scope,
g_return_if_fail (pad_template != NULL);
scope->srcpad = gst_pad_new_from_template (pad_template, "src");
gst_pad_set_event_function (scope->srcpad,
GST_DEBUG_FUNCPTR (gst_base_audio_visualizer_src_event));
GST_DEBUG_FUNCPTR (gst_audio_visualizer_src_event));
gst_pad_set_query_function (scope->srcpad,
GST_DEBUG_FUNCPTR (gst_base_audio_visualizer_src_query));
GST_DEBUG_FUNCPTR (gst_audio_visualizer_src_query));
gst_element_add_pad (GST_ELEMENT (scope), scope->srcpad);
scope->adapter = gst_adapter_new ();
@ -492,7 +493,7 @@ gst_base_audio_visualizer_init (GstBaseAudioVisualizer * scope,
/* properties */
scope->shader_type = DEFAULT_SHADER;
gst_base_audio_visualizer_change_shader (scope);
gst_audio_visualizer_change_shader (scope);
scope->shade_amount = DEFAULT_SHADE_AMOUNT;
/* reset the initial video state */
@ -510,15 +511,15 @@ gst_base_audio_visualizer_init (GstBaseAudioVisualizer * scope,
}
static void
gst_base_audio_visualizer_set_property (GObject * object, guint prop_id,
gst_audio_visualizer_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
GstBaseAudioVisualizer *scope = GST_BASE_AUDIO_VISUALIZER (object);
GstAudioVisualizer *scope = GST_AUDIO_VISUALIZER (object);
switch (prop_id) {
case PROP_SHADER:
scope->shader_type = g_value_get_enum (value);
gst_base_audio_visualizer_change_shader (scope);
gst_audio_visualizer_change_shader (scope);
break;
case PROP_SHADE_AMOUNT:
scope->shade_amount = g_value_get_uint (value);
@ -530,10 +531,10 @@ gst_base_audio_visualizer_set_property (GObject * object, guint prop_id,
}
static void
gst_base_audio_visualizer_get_property (GObject * object, guint prop_id,
gst_audio_visualizer_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec)
{
GstBaseAudioVisualizer *scope = GST_BASE_AUDIO_VISUALIZER (object);
GstAudioVisualizer *scope = GST_AUDIO_VISUALIZER (object);
switch (prop_id) {
case PROP_SHADER:
@ -549,9 +550,9 @@ gst_base_audio_visualizer_get_property (GObject * object, guint prop_id,
}
static void
gst_base_audio_visualizer_dispose (GObject * object)
gst_audio_visualizer_dispose (GObject * object)
{
GstBaseAudioVisualizer *scope = GST_BASE_AUDIO_VISUALIZER (object);
GstAudioVisualizer *scope = GST_AUDIO_VISUALIZER (object);
if (scope->adapter) {
g_object_unref (scope->adapter);
@ -573,7 +574,7 @@ gst_base_audio_visualizer_dispose (GObject * object)
}
static void
gst_base_audio_visualizer_reset (GstBaseAudioVisualizer * scope)
gst_audio_visualizer_reset (GstAudioVisualizer * scope)
{
gst_adapter_clear (scope->adapter);
gst_segment_init (&scope->segment, GST_FORMAT_UNDEFINED);
@ -585,8 +586,7 @@ gst_base_audio_visualizer_reset (GstBaseAudioVisualizer * scope)
}
static gboolean
gst_base_audio_visualizer_sink_setcaps (GstBaseAudioVisualizer * scope,
GstCaps * caps)
gst_audio_visualizer_sink_setcaps (GstAudioVisualizer * scope, GstCaps * caps)
{
GstAudioInfo info;
gboolean res = TRUE;
@ -612,11 +612,10 @@ wrong_caps:
}
static gboolean
gst_base_audio_visualizer_src_setcaps (GstBaseAudioVisualizer * scope,
GstCaps * caps)
gst_audio_visualizer_src_setcaps (GstAudioVisualizer * scope, GstCaps * caps)
{
GstVideoInfo info;
GstBaseAudioVisualizerClass *klass;
GstAudioVisualizerClass *klass;
GstStructure *structure;
gboolean res;
@ -630,7 +629,7 @@ gst_base_audio_visualizer_src_setcaps (GstBaseAudioVisualizer * scope,
&scope->fps_d))
goto wrong_caps;
klass = GST_BASE_AUDIO_VISUALIZER_CLASS (G_OBJECT_GET_CLASS (scope));
klass = GST_AUDIO_VISUALIZER_CLASS (G_OBJECT_GET_CLASS (scope));
scope->vinfo = info;
scope->video_format = info.finfo->format;
@ -668,7 +667,7 @@ wrong_caps:
}
static gboolean
gst_base_audio_visualizer_src_negotiate (GstBaseAudioVisualizer * scope)
gst_audio_visualizer_src_negotiate (GstAudioVisualizer * scope)
{
GstCaps *othercaps, *target;
GstStructure *structure;
@ -706,7 +705,7 @@ gst_base_audio_visualizer_src_negotiate (GstBaseAudioVisualizer * scope)
GST_DEBUG_OBJECT (scope, "final caps are %" GST_PTR_FORMAT, target);
gst_base_audio_visualizer_src_setcaps (scope, target);
gst_audio_visualizer_src_setcaps (scope, target);
/* try to get a bufferpool now */
/* find a pool for the negotiated caps now */
@ -757,7 +756,7 @@ no_format:
/* make sure we are negotiated */
static GstFlowReturn
gst_base_audio_visualizer_ensure_negotiated (GstBaseAudioVisualizer * scope)
gst_audio_visualizer_ensure_negotiated (GstAudioVisualizer * scope)
{
gboolean reconfigure;
@ -765,29 +764,29 @@ gst_base_audio_visualizer_ensure_negotiated (GstBaseAudioVisualizer * scope)
/* we don't know an output format yet, pick one */
if (reconfigure || !gst_pad_has_current_caps (scope->srcpad)) {
if (!gst_base_audio_visualizer_src_negotiate (scope))
if (!gst_audio_visualizer_src_negotiate (scope))
return GST_FLOW_NOT_NEGOTIATED;
}
return GST_FLOW_OK;
}
static GstFlowReturn
gst_base_audio_visualizer_chain (GstPad * pad, GstObject * parent,
gst_audio_visualizer_chain (GstPad * pad, GstObject * parent,
GstBuffer * buffer)
{
GstFlowReturn ret = GST_FLOW_OK;
GstBaseAudioVisualizer *scope;
GstBaseAudioVisualizerClass *klass;
GstAudioVisualizer *scope;
GstAudioVisualizerClass *klass;
GstBuffer *inbuf;
guint64 dist, ts;
guint avail, sbpf;
gpointer adata;
gboolean (*render) (GstBaseAudioVisualizer * scope, GstBuffer * audio,
gboolean (*render) (GstAudioVisualizer * scope, GstBuffer * audio,
GstBuffer * video);
gint bps, channels, rate;
scope = GST_BASE_AUDIO_VISUALIZER (parent);
klass = GST_BASE_AUDIO_VISUALIZER_CLASS (G_OBJECT_GET_CLASS (scope));
scope = GST_AUDIO_VISUALIZER (parent);
klass = GST_AUDIO_VISUALIZER_CLASS (G_OBJECT_GET_CLASS (scope));
render = klass->render;
@ -799,7 +798,7 @@ gst_base_audio_visualizer_chain (GstPad * pad, GstObject * parent,
}
/* Make sure have an output format */
ret = gst_base_audio_visualizer_ensure_negotiated (scope);
ret = gst_audio_visualizer_ensure_negotiated (scope);
if (ret != GST_FLOW_OK) {
gst_buffer_unref (buffer);
goto beach;
@ -938,13 +937,13 @@ beach:
}
static gboolean
gst_base_audio_visualizer_src_event (GstPad * pad, GstObject * parent,
gst_audio_visualizer_src_event (GstPad * pad, GstObject * parent,
GstEvent * event)
{
gboolean res;
GstBaseAudioVisualizer *scope;
GstAudioVisualizer *scope;
scope = GST_BASE_AUDIO_VISUALIZER (parent);
scope = GST_AUDIO_VISUALIZER (parent);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_QOS:
@ -983,13 +982,13 @@ gst_base_audio_visualizer_src_event (GstPad * pad, GstObject * parent,
}
static gboolean
gst_base_audio_visualizer_sink_event (GstPad * pad, GstObject * parent,
gst_audio_visualizer_sink_event (GstPad * pad, GstObject * parent,
GstEvent * event)
{
gboolean res;
GstBaseAudioVisualizer *scope;
GstAudioVisualizer *scope;
scope = GST_BASE_AUDIO_VISUALIZER (parent);
scope = GST_AUDIO_VISUALIZER (parent);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_CAPS:
@ -997,14 +996,14 @@ gst_base_audio_visualizer_sink_event (GstPad * pad, GstObject * parent,
GstCaps *caps;
gst_event_parse_caps (event, &caps);
res = gst_base_audio_visualizer_sink_setcaps (scope, caps);
res = gst_audio_visualizer_sink_setcaps (scope, caps);
break;
}
case GST_EVENT_FLUSH_START:
res = gst_pad_push_event (scope->srcpad, event);
break;
case GST_EVENT_FLUSH_STOP:
gst_base_audio_visualizer_reset (scope);
gst_audio_visualizer_reset (scope);
res = gst_pad_push_event (scope->srcpad, event);
break;
case GST_EVENT_SEGMENT:
@ -1026,13 +1025,13 @@ gst_base_audio_visualizer_sink_event (GstPad * pad, GstObject * parent,
}
static gboolean
gst_base_audio_visualizer_src_query (GstPad * pad, GstObject * parent,
gst_audio_visualizer_src_query (GstPad * pad, GstObject * parent,
GstQuery * query)
{
gboolean res = FALSE;
GstBaseAudioVisualizer *scope;
GstAudioVisualizer *scope;
scope = GST_BASE_AUDIO_VISUALIZER (parent);
scope = GST_AUDIO_VISUALIZER (parent);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_LATENCY:
@ -1085,7 +1084,7 @@ gst_base_audio_visualizer_src_query (GstPad * pad, GstObject * parent,
}
static gboolean
gst_base_audio_visualizer_sink_query (GstPad * pad, GstObject * parent,
gst_audio_visualizer_sink_query (GstPad * pad, GstObject * parent,
GstQuery * query)
{
gboolean res = FALSE;
@ -1099,17 +1098,17 @@ gst_base_audio_visualizer_sink_query (GstPad * pad, GstObject * parent,
}
static GstStateChangeReturn
gst_base_audio_visualizer_change_state (GstElement * element,
gst_audio_visualizer_change_state (GstElement * element,
GstStateChange transition)
{
GstStateChangeReturn ret;
GstBaseAudioVisualizer *scope;
GstAudioVisualizer *scope;
scope = GST_BASE_AUDIO_VISUALIZER (element);
scope = GST_AUDIO_VISUALIZER (element);
switch (transition) {
case GST_STATE_CHANGE_READY_TO_PAUSED:
gst_base_audio_visualizer_reset (scope);
gst_audio_visualizer_reset (scope);
break;
default:
break;

View file

@ -0,0 +1,125 @@
/* GStreamer
* Copyright (C) <2011> Stefan Kost <ensonic@users.sf.net>
*
* gstaudiovisualizer.c: base class for audio visualisation elements
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GST_AUDIO_VISUALIZER_H__
#define __GST_AUDIO_VISUALIZER_H__
#include <gst/gst.h>
#include <gst/base/gstbasetransform.h>
#include <gst/video/video.h>
#include <gst/audio/audio.h>
#include <gst/base/gstadapter.h>
G_BEGIN_DECLS
#define GST_TYPE_AUDIO_VISUALIZER (gst_audio_visualizer_get_type())
#define GST_AUDIO_VISUALIZER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_VISUALIZER,GstAudioVisualizer))
#define GST_AUDIO_VISUALIZER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_VISUALIZER,GstAudioVisualizerClass))
#define GST_IS_SYNAESTHESIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_VISUALIZER))
#define GST_IS_SYNAESTHESIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_VISUALIZER))
typedef struct _GstAudioVisualizer GstAudioVisualizer;
typedef struct _GstAudioVisualizerClass GstAudioVisualizerClass;
typedef void (*GstAudioVisualizerShaderFunc)(GstAudioVisualizer *scope, const guint8 *s, guint8 *d);
/**
* GstAudioVisualizerShader:
* @GST_AUDIO_VISUALIZER_SHADER_NONE: no shading
* @GST_AUDIO_VISUALIZER_SHADER_FADE: plain fading
* @GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP: fade and move up
* @GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN: fade and move down
* @GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT: fade and move left
* @GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT: fade and move right
* @GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT: fade and move horizontally out
* @GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN: fade and move horizontally in
* @GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT: fade and move vertically out
* @GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN: fade and move vertically in
*
* Different types of supported background shading functions.
*/
typedef enum {
GST_AUDIO_VISUALIZER_SHADER_NONE,
GST_AUDIO_VISUALIZER_SHADER_FADE,
GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP,
GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN,
GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT,
GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT,
GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT,
GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN,
GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT,
GST_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN
} GstAudioVisualizerShader;
struct _GstAudioVisualizer
{
GstElement parent;
/* pads */
GstPad *srcpad, *sinkpad;
GstBufferPool *pool;
GstAdapter *adapter;
GstBuffer *inbuf;
guint8 *pixelbuf;
GstAudioVisualizerShader shader_type;
GstAudioVisualizerShaderFunc shader;
guint32 shade_amount;
guint spf; /* samples per video frame */
guint req_spf; /* min samples per frame wanted by the subclass */
/* video state */
GstVideoInfo vinfo;
GstVideoFormat video_format;
gint fps_n, fps_d;
gint width;
gint height;
guint64 frame_duration;
guint bpf; /* bytes per frame */
/* audio state */
GstAudioInfo ainfo;
/* configuration mutex */
GMutex config_lock;
/* QoS stuff *//* with LOCK */
gdouble proportion;
GstClockTime earliest_time;
GstSegment segment;
};
struct _GstAudioVisualizerClass
{
GstElementClass parent_class;
/* virtual function, called whenever the format changes */
gboolean (*setup) (GstAudioVisualizer * scope);
/* virtual function for rendering a frame */
gboolean (*render) (GstAudioVisualizer * scope, GstBuffer * audio, GstBuffer * video);
};
GType gst_audio_visualizer_get_type (void);
G_END_DECLS
#endif /* __GST_AUDIO_VISUALIZER_H__ */

View file

@ -1,125 +0,0 @@
/* GStreamer
* Copyright (C) <2011> Stefan Kost <ensonic@users.sf.net>
*
* gstbaseaudiovisualizer.c: base class for audio visualisation elements
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GST_BASE_AUDIO_VISUALIZER_H__
#define __GST_BASE_AUDIO_VISUALIZER_H__
#include <gst/gst.h>
#include <gst/base/gstbasetransform.h>
#include <gst/video/video.h>
#include <gst/audio/audio.h>
#include <gst/base/gstadapter.h>
G_BEGIN_DECLS
#define GST_TYPE_BASE_AUDIO_VISUALIZER (gst_base_audio_visualizer_get_type())
#define GST_BASE_AUDIO_VISUALIZER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_BASE_AUDIO_VISUALIZER,GstBaseAudioVisualizer))
#define GST_BASE_AUDIO_VISUALIZER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_BASE_AUDIO_VISUALIZER,GstBaseAudioVisualizerClass))
#define GST_IS_SYNAESTHESIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_BASE_AUDIO_VISUALIZER))
#define GST_IS_SYNAESTHESIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_BASE_AUDIO_VISUALIZER))
typedef struct _GstBaseAudioVisualizer GstBaseAudioVisualizer;
typedef struct _GstBaseAudioVisualizerClass GstBaseAudioVisualizerClass;
typedef void (*GstBaseAudioVisualizerShaderFunc)(GstBaseAudioVisualizer *scope, const guint8 *s, guint8 *d);
/**
* GstBaseAudioVisualizerShader:
* @GST_BASE_AUDIO_VISUALIZER_SHADER_NONE: no shading
* @GST_BASE_AUDIO_VISUALIZER_SHADER_FADE: plain fading
* @GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP: fade and move up
* @GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN: fade and move down
* @GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT: fade and move left
* @GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT: fade and move right
* @GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT: fade and move horizontally out
* @GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN: fade and move horizontally in
* @GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT: fade and move vertically out
* @GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN: fade and move vertically in
*
* Different types of supported background shading functions.
*/
typedef enum {
GST_BASE_AUDIO_VISUALIZER_SHADER_NONE,
GST_BASE_AUDIO_VISUALIZER_SHADER_FADE,
GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_UP,
GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_DOWN,
GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_LEFT,
GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_RIGHT,
GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_OUT,
GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_HORIZ_IN,
GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_OUT,
GST_BASE_AUDIO_VISUALIZER_SHADER_FADE_AND_MOVE_VERT_IN
} GstBaseAudioVisualizerShader;
struct _GstBaseAudioVisualizer
{
GstElement parent;
/* pads */
GstPad *srcpad, *sinkpad;
GstBufferPool *pool;
GstAdapter *adapter;
GstBuffer *inbuf;
guint8 *pixelbuf;
GstBaseAudioVisualizerShader shader_type;
GstBaseAudioVisualizerShaderFunc shader;
guint32 shade_amount;
guint spf; /* samples per video frame */
guint req_spf; /* min samples per frame wanted by the subclass */
/* video state */
GstVideoInfo vinfo;
GstVideoFormat video_format;
gint fps_n, fps_d;
gint width;
gint height;
guint64 frame_duration;
guint bpf; /* bytes per frame */
/* audio state */
GstAudioInfo ainfo;
/* configuration mutex */
GMutex config_lock;
/* QoS stuff *//* with LOCK */
gdouble proportion;
GstClockTime earliest_time;
GstSegment segment;
};
struct _GstBaseAudioVisualizerClass
{
GstElementClass parent_class;
/* virtual function, called whenever the format changes */
gboolean (*setup) (GstBaseAudioVisualizer * scope);
/* virtual function for rendering a frame */
gboolean (*render) (GstBaseAudioVisualizer * scope, GstBuffer * audio, GstBuffer * video);
};
GType gst_base_audio_visualizer_get_type (void);
G_END_DECLS
#endif /* __GST_BASE_AUDIO_VISUALIZER_H__ */

View file

@ -104,28 +104,27 @@ static void gst_space_scope_set_property (GObject * object, guint prop_id,
static void gst_space_scope_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void render_dots (GstBaseAudioVisualizer * base, guint32 * vdata,
static void render_dots (GstAudioVisualizer * base, guint32 * vdata,
gint16 * adata, guint num_samples);
static void render_lines (GstBaseAudioVisualizer * base, guint32 * vdata,
static void render_lines (GstAudioVisualizer * base, guint32 * vdata,
gint16 * adata, guint num_samples);
static void render_color_dots (GstBaseAudioVisualizer * base, guint32 * vdata,
static void render_color_dots (GstAudioVisualizer * base, guint32 * vdata,
gint16 * adata, guint num_samples);
static void render_color_lines (GstBaseAudioVisualizer * base, guint32 * vdata,
static void render_color_lines (GstAudioVisualizer * base, guint32 * vdata,
gint16 * adata, guint num_samples);
static gboolean gst_space_scope_render (GstBaseAudioVisualizer * scope,
static gboolean gst_space_scope_render (GstAudioVisualizer * scope,
GstBuffer * audio, GstBuffer * video);
G_DEFINE_TYPE (GstSpaceScope, gst_space_scope, GST_TYPE_BASE_AUDIO_VISUALIZER);
G_DEFINE_TYPE (GstSpaceScope, gst_space_scope, GST_TYPE_AUDIO_VISUALIZER);
static void
gst_space_scope_class_init (GstSpaceScopeClass * g_class)
{
GObjectClass *gobject_class = (GObjectClass *) g_class;
GstElementClass *element_class = (GstElementClass *) g_class;
GstBaseAudioVisualizerClass *scope_class =
(GstBaseAudioVisualizerClass *) g_class;
GstAudioVisualizerClass *scope_class = (GstAudioVisualizerClass *) g_class;
gst_element_class_set_details_simple (element_class, "Stereo visualizer",
"Visualization",
@ -203,7 +202,7 @@ gst_space_scope_get_property (GObject * object, guint prop_id,
#include "gstdrawhelpers.h"
static void
render_dots (GstBaseAudioVisualizer * base, guint32 * vdata, gint16 * adata,
render_dots (GstAudioVisualizer * base, guint32 * vdata, gint16 * adata,
guint num_samples)
{
guint i, s, x, y, ox, oy;
@ -225,7 +224,7 @@ render_dots (GstBaseAudioVisualizer * base, guint32 * vdata, gint16 * adata,
}
static void
render_lines (GstBaseAudioVisualizer * base, guint32 * vdata, gint16 * adata,
render_lines (GstAudioVisualizer * base, guint32 * vdata, gint16 * adata,
guint num_samples)
{
guint i, s, x, y, ox, oy;
@ -274,7 +273,7 @@ render_lines (GstBaseAudioVisualizer * base, guint32 * vdata, gint16 * adata,
} G_STMT_END
static void
render_color_dots (GstBaseAudioVisualizer * base, guint32 * vdata,
render_color_dots (GstAudioVisualizer * base, guint32 * vdata,
gint16 * adata, guint num_samples)
{
GstSpaceScope *scope = (GstSpaceScope *) base;
@ -335,7 +334,7 @@ render_color_dots (GstBaseAudioVisualizer * base, guint32 * vdata,
}
static void
render_color_lines (GstBaseAudioVisualizer * base, guint32 * vdata,
render_color_lines (GstAudioVisualizer * base, guint32 * vdata,
gint16 * adata, guint num_samples)
{
GstSpaceScope *scope = (GstSpaceScope *) base;
@ -425,7 +424,7 @@ render_color_lines (GstBaseAudioVisualizer * base, guint32 * vdata,
}
static gboolean
gst_space_scope_render (GstBaseAudioVisualizer * base, GstBuffer * audio,
gst_space_scope_render (GstAudioVisualizer * base, GstBuffer * audio,
GstBuffer * video)
{
GstSpaceScope *scope = GST_SPACE_SCOPE (base);

View file

@ -22,7 +22,7 @@
#ifndef __GST_SPACE_SCOPE_H__
#define __GST_SPACE_SCOPE_H__
#include "gstbaseaudiovisualizer.h"
#include "gstaudiovisualizer.h"
G_BEGIN_DECLS
#define GST_TYPE_SPACE_SCOPE (gst_space_scope_get_type())
@ -33,11 +33,11 @@ G_BEGIN_DECLS
typedef struct _GstSpaceScope GstSpaceScope;
typedef struct _GstSpaceScopeClass GstSpaceScopeClass;
typedef void (*GstSpaceScopeProcessFunc) (GstBaseAudioVisualizer *, guint32 *, gint16 *, guint);
typedef void (*GstSpaceScopeProcessFunc) (GstAudioVisualizer *, guint32 *, gint16 *, guint);
struct _GstSpaceScope
{
GstBaseAudioVisualizer parent;
GstAudioVisualizer parent;
/* < private > */
GstSpaceScopeProcessFunc process;
@ -52,7 +52,7 @@ struct _GstSpaceScope
struct _GstSpaceScopeClass
{
GstBaseAudioVisualizerClass parent_class;
GstAudioVisualizerClass parent_class;
};
GType gst_space_scope_get_type (void);

View file

@ -66,21 +66,19 @@ GST_DEBUG_CATEGORY_STATIC (spectra_scope_debug);
static void gst_spectra_scope_finalize (GObject * object);
static gboolean gst_spectra_scope_setup (GstBaseAudioVisualizer * scope);
static gboolean gst_spectra_scope_render (GstBaseAudioVisualizer * scope,
static gboolean gst_spectra_scope_setup (GstAudioVisualizer * scope);
static gboolean gst_spectra_scope_render (GstAudioVisualizer * scope,
GstBuffer * audio, GstBuffer * video);
G_DEFINE_TYPE (GstSpectraScope, gst_spectra_scope,
GST_TYPE_BASE_AUDIO_VISUALIZER);
G_DEFINE_TYPE (GstSpectraScope, gst_spectra_scope, GST_TYPE_AUDIO_VISUALIZER);
static void
gst_spectra_scope_class_init (GstSpectraScopeClass * g_class)
{
GObjectClass *gobject_class = (GObjectClass *) g_class;
GstElementClass *element_class = (GstElementClass *) g_class;
GstBaseAudioVisualizerClass *scope_class =
(GstBaseAudioVisualizerClass *) g_class;
GstAudioVisualizerClass *scope_class = (GstAudioVisualizerClass *) g_class;
gobject_class->finalize = gst_spectra_scope_finalize;
@ -121,7 +119,7 @@ gst_spectra_scope_finalize (GObject * object)
}
static gboolean
gst_spectra_scope_setup (GstBaseAudioVisualizer * bscope)
gst_spectra_scope_setup (GstAudioVisualizer * bscope)
{
GstSpectraScope *scope = GST_SPECTRA_SCOPE (bscope);
guint num_freq = bscope->width + 1;
@ -163,7 +161,7 @@ add_pixel (guint32 * _p, guint32 _c)
}
static gboolean
gst_spectra_scope_render (GstBaseAudioVisualizer * bscope, GstBuffer * audio,
gst_spectra_scope_render (GstAudioVisualizer * bscope, GstBuffer * audio,
GstBuffer * video)
{
GstSpectraScope *scope = GST_SPECTRA_SCOPE (bscope);

View file

@ -22,7 +22,7 @@
#ifndef __GST_SPECTRA_SCOPE_H__
#define __GST_SPECTRA_SCOPE_H__
#include "gstbaseaudiovisualizer.h"
#include "gstaudiovisualizer.h"
#include <gst/fft/gstffts16.h>
G_BEGIN_DECLS
@ -36,7 +36,7 @@ typedef struct _GstSpectraScopeClass GstSpectraScopeClass;
struct _GstSpectraScope
{
GstBaseAudioVisualizer parent;
GstAudioVisualizer parent;
GstFFTS16 *fft_ctx;
GstFFTS16Complex *freq_data;
@ -44,7 +44,7 @@ struct _GstSpectraScope
struct _GstSpectraScopeClass
{
GstBaseAudioVisualizerClass parent_class;
GstAudioVisualizerClass parent_class;
};
GType gst_spectra_scope_get_type (void);

View file

@ -65,20 +65,19 @@ GST_DEBUG_CATEGORY_STATIC (synae_scope_debug);
static void gst_synae_scope_finalize (GObject * object);
static gboolean gst_synae_scope_setup (GstBaseAudioVisualizer * scope);
static gboolean gst_synae_scope_render (GstBaseAudioVisualizer * scope,
static gboolean gst_synae_scope_setup (GstAudioVisualizer * scope);
static gboolean gst_synae_scope_render (GstAudioVisualizer * scope,
GstBuffer * audio, GstBuffer * video);
G_DEFINE_TYPE (GstSynaeScope, gst_synae_scope, GST_TYPE_BASE_AUDIO_VISUALIZER);
G_DEFINE_TYPE (GstSynaeScope, gst_synae_scope, GST_TYPE_AUDIO_VISUALIZER);
static void
gst_synae_scope_class_init (GstSynaeScopeClass * g_class)
{
GObjectClass *gobject_class = (GObjectClass *) g_class;
GstElementClass *element_class = (GstElementClass *) g_class;
GstBaseAudioVisualizerClass *scope_class =
(GstBaseAudioVisualizerClass *) g_class;
GstAudioVisualizerClass *scope_class = (GstAudioVisualizerClass *) g_class;
gobject_class->finalize = gst_synae_scope_finalize;
@ -150,7 +149,7 @@ gst_synae_scope_finalize (GObject * object)
}
static gboolean
gst_synae_scope_setup (GstBaseAudioVisualizer * bscope)
gst_synae_scope_setup (GstAudioVisualizer * bscope)
{
GstSynaeScope *scope = GST_SYNAE_SCOPE (bscope);
guint num_freq = bscope->height + 1;
@ -201,7 +200,7 @@ add_pixel (guint32 * _p, guint32 _c)
}
static gboolean
gst_synae_scope_render (GstBaseAudioVisualizer * bscope, GstBuffer * audio,
gst_synae_scope_render (GstAudioVisualizer * bscope, GstBuffer * audio,
GstBuffer * video)
{
GstSynaeScope *scope = GST_SYNAE_SCOPE (bscope);

View file

@ -22,7 +22,7 @@
#ifndef __GST_SYNAE_SCOPE_H__
#define __GST_SYNAE_SCOPE_H__
#include "gstbaseaudiovisualizer.h"
#include "gstaudiovisualizer.h"
#include <gst/fft/gstffts16.h>
G_BEGIN_DECLS
@ -36,7 +36,7 @@ typedef struct _GstSynaeScopeClass GstSynaeScopeClass;
struct _GstSynaeScope
{
GstBaseAudioVisualizer parent;
GstAudioVisualizer parent;
GstFFTS16 *fft_ctx;
GstFFTS16Complex *freq_data_l, *freq_data_r;
@ -48,7 +48,7 @@ struct _GstSynaeScope
struct _GstSynaeScopeClass
{
GstBaseAudioVisualizerClass parent_class;
GstAudioVisualizerClass parent_class;
};
GType gst_synae_scope_get_type (void);

View file

@ -105,29 +105,28 @@ static void gst_wave_scope_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static void gst_wave_scope_finalize (GObject * object);
static void render_dots (GstBaseAudioVisualizer * scope, guint32 * vdata,
static void render_dots (GstAudioVisualizer * scope, guint32 * vdata,
gint16 * adata, guint num_samples);
static void render_lines (GstBaseAudioVisualizer * scope, guint32 * vdata,
static void render_lines (GstAudioVisualizer * scope, guint32 * vdata,
gint16 * adata, guint num_samples);
static void render_color_dots (GstBaseAudioVisualizer * base, guint32 * vdata,
static void render_color_dots (GstAudioVisualizer * base, guint32 * vdata,
gint16 * adata, guint num_samples);
static void render_color_lines (GstBaseAudioVisualizer * base, guint32 * vdata,
static void render_color_lines (GstAudioVisualizer * base, guint32 * vdata,
gint16 * adata, guint num_samples);
static gboolean gst_wave_scope_setup (GstBaseAudioVisualizer * scope);
static gboolean gst_wave_scope_render (GstBaseAudioVisualizer * base,
static gboolean gst_wave_scope_setup (GstAudioVisualizer * scope);
static gboolean gst_wave_scope_render (GstAudioVisualizer * base,
GstBuffer * audio, GstBuffer * video);
#define gst_wave_scope_parent_class parent_class
G_DEFINE_TYPE (GstWaveScope, gst_wave_scope, GST_TYPE_BASE_AUDIO_VISUALIZER);
G_DEFINE_TYPE (GstWaveScope, gst_wave_scope, GST_TYPE_AUDIO_VISUALIZER);
static void
gst_wave_scope_class_init (GstWaveScopeClass * g_class)
{
GObjectClass *gobject_class = (GObjectClass *) g_class;
GstElementClass *gstelement_class = (GstElementClass *) g_class;
GstBaseAudioVisualizerClass *scope_class =
(GstBaseAudioVisualizerClass *) g_class;
GstAudioVisualizerClass *scope_class = (GstAudioVisualizerClass *) g_class;
gobject_class->set_property = gst_wave_scope_set_property;
gobject_class->get_property = gst_wave_scope_get_property;
@ -174,7 +173,7 @@ gst_wave_scope_finalize (GObject * object)
}
static gboolean
gst_wave_scope_setup (GstBaseAudioVisualizer * bscope)
gst_wave_scope_setup (GstAudioVisualizer * bscope)
{
GstWaveScope *scope = GST_WAVE_SCOPE (bscope);
@ -235,7 +234,7 @@ gst_wave_scope_get_property (GObject * object, guint prop_id,
#include "gstdrawhelpers.h"
static void
render_dots (GstBaseAudioVisualizer * base, guint32 * vdata, gint16 * adata,
render_dots (GstAudioVisualizer * base, guint32 * vdata, gint16 * adata,
guint num_samples)
{
gint channels = GST_AUDIO_INFO_CHANNELS (&base->ainfo);
@ -260,7 +259,7 @@ render_dots (GstBaseAudioVisualizer * base, guint32 * vdata, gint16 * adata,
}
static void
render_lines (GstBaseAudioVisualizer * base, guint32 * vdata, gint16 * adata,
render_lines (GstAudioVisualizer * base, guint32 * vdata, gint16 * adata,
guint num_samples)
{
gint channels = GST_AUDIO_INFO_CHANNELS (&base->ainfo);
@ -304,7 +303,7 @@ render_lines (GstBaseAudioVisualizer * base, guint32 * vdata, gint16 * adata,
} G_STMT_END
static void
render_color_dots (GstBaseAudioVisualizer * base, guint32 * vdata,
render_color_dots (GstAudioVisualizer * base, guint32 * vdata,
gint16 * adata, guint num_samples)
{
GstWaveScope *scope = (GstWaveScope *) base;
@ -344,7 +343,7 @@ render_color_dots (GstBaseAudioVisualizer * base, guint32 * vdata,
}
static void
render_color_lines (GstBaseAudioVisualizer * base, guint32 * vdata,
render_color_lines (GstAudioVisualizer * base, guint32 * vdata,
gint16 * adata, guint num_samples)
{
GstWaveScope *scope = (GstWaveScope *) base;
@ -403,7 +402,7 @@ render_color_lines (GstBaseAudioVisualizer * base, guint32 * vdata,
}
static gboolean
gst_wave_scope_render (GstBaseAudioVisualizer * base, GstBuffer * audio,
gst_wave_scope_render (GstAudioVisualizer * base, GstBuffer * audio,
GstBuffer * video)
{
GstWaveScope *scope = GST_WAVE_SCOPE (base);

View file

@ -22,7 +22,7 @@
#ifndef __GST_WAVE_SCOPE_H__
#define __GST_WAVE_SCOPE_H__
#include "gstbaseaudiovisualizer.h"
#include "gstaudiovisualizer.h"
G_BEGIN_DECLS
#define GST_TYPE_WAVE_SCOPE (gst_wave_scope_get_type())
@ -33,11 +33,11 @@ G_BEGIN_DECLS
typedef struct _GstWaveScope GstWaveScope;
typedef struct _GstWaveScopeClass GstWaveScopeClass;
typedef void (*GstWaveScopeProcessFunc) (GstBaseAudioVisualizer *, guint32 *, gint16 *, guint);
typedef void (*GstWaveScopeProcessFunc) (GstAudioVisualizer *, guint32 *, gint16 *, guint);
struct _GstWaveScope
{
GstBaseAudioVisualizer parent;
GstAudioVisualizer parent;
/* < private > */
GstWaveScopeProcessFunc process;
@ -49,7 +49,7 @@ struct _GstWaveScope
struct _GstWaveScopeClass
{
GstBaseAudioVisualizerClass parent_class;
GstAudioVisualizerClass parent_class;
};
GType gst_wave_scope_get_type (void);