~ubuntu-branches/ubuntu/quantal/gst-plugins-bad-multiverse0.10/quantal

« back to all changes in this revision

Viewing changes to gst/equalizer/gstiirequalizernbands.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2007-05-03 19:52:54 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20070503195254-4dovmz251nut3yrt
Tags: 0.10.4+cvs20070502-1
* New CVS snapshot.
* debian/rules,
  debian/build-deps.in:
  + Update build dependencies.
* debian/gstreamer-plugins-bad-multiverse.install:
  + Add x264 plugin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GStreamer
 
2
 * Copyright (C) <2004> Benjamin Otte <otte@gnome.org>
 
3
 *               <2007> Stefan Kost <ensonic@users.sf.net>
 
4
 *
 
5
 * This library is free software; you can redistribute it and/or
 
6
 * modify it under the terms of the GNU Library General Public
 
7
 * License as published by the Free Software Foundation; either
 
8
 * version 2 of the License, or (at your option) any later version.
 
9
 *
 
10
 * This library is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
 * Library General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU Library General Public
 
16
 * License along with this library; if not, write to the
 
17
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
18
 * Boston, MA 02111-1307, USA.
 
19
 */
 
20
 
 
21
/**
 
22
 * SECTION:element-equalizer-nbands
 
23
 *
 
24
 * <refsect2>
 
25
 * <title>Example launch line</title>
 
26
 * <para>
 
27
 * The n-band equalizer element changes the frequency spectrum of the audio data.
 
28
 * </para>
 
29
 * <para>
 
30
 * <programlisting>
 
31
 * gst-launch filesrc location=song.ogg ! oggdemux ! vorbisdec ! audioconvert ! equalizer-nbands num-bands=15 band5::gain=-1.0 ! alsasink
 
32
 * </programlisting>
 
33
 * This make the equalizer use 15 bands and lowers the volume of the 5th band by FIXME db.
 
34
 * </para>
 
35
 * </refsect2>
 
36
 */
 
37
 
 
38
#ifdef HAVE_CONFIG_H
 
39
#include "config.h"
 
40
#endif
 
41
 
 
42
#include "gstiirequalizer.h"
 
43
#include "gstiirequalizernbands.h"
 
44
 
 
45
 
 
46
enum
 
47
{
 
48
  ARG_NUM_BANDS = 1
 
49
};
 
50
 
 
51
static void gst_iir_equalizer_nbands_set_property (GObject * object,
 
52
    guint prop_id, const GValue * value, GParamSpec * pspec);
 
53
static void gst_iir_equalizer_nbands_get_property (GObject * object,
 
54
    guint prop_id, GValue * value, GParamSpec * pspec);
 
55
 
 
56
GST_DEBUG_CATEGORY_EXTERN ()(equalizer_debug);
 
57
#define GST_CAT_DEFAULT equalizer_debug
 
58
 
 
59
GST_BOILERPLATE (GstIirEqualizerNBands, gst_iir_equalizer_nbands,
 
60
    GstIirEqualizer, GST_TYPE_IIR_EQUALIZER);
 
61
 
 
62
/* equalizer implementation */
 
63
 
 
64
static void
 
65
gst_iir_equalizer_nbands_base_init (gpointer g_class)
 
66
{
 
67
  GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
 
68
  const GstElementDetails iir_equalizer_details =
 
69
      GST_ELEMENT_DETAILS ("N Band Equalizer",
 
70
      "Filter/Effect/Audio",
 
71
      "Direct Form IIR equalizer",
 
72
      "Benjamin Otte <otte@gnome.org>," " Stefan Kost <ensonic@users.sf.net>");
 
73
 
 
74
  gst_element_class_set_details (element_class, &iir_equalizer_details);
 
75
}
 
76
 
 
77
static void
 
78
gst_iir_equalizer_nbands_class_init (GstIirEqualizerNBandsClass * klass)
 
79
{
 
80
  GObjectClass *gobject_class = (GObjectClass *) klass;
 
81
 
 
82
  gobject_class->set_property = gst_iir_equalizer_nbands_set_property;
 
83
  gobject_class->get_property = gst_iir_equalizer_nbands_get_property;
 
84
 
 
85
  g_object_class_install_property (gobject_class, ARG_NUM_BANDS,
 
86
      g_param_spec_uint ("num-bands", "num-bands",
 
87
          "number of different bands to use", 2, 64, 10,
 
88
          G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 
89
}
 
90
 
 
91
static void
 
92
gst_iir_equalizer_nbands_init (GstIirEqualizerNBands * equ_n,
 
93
    GstIirEqualizerNBandsClass * g_class)
 
94
{
 
95
  GstIirEqualizer *equ = GST_IIR_EQUALIZER (equ_n);
 
96
 
 
97
  gst_iir_equalizer_compute_frequencies (equ, 10);
 
98
}
 
99
 
 
100
static void
 
101
gst_iir_equalizer_nbands_set_property (GObject * object, guint prop_id,
 
102
    const GValue * value, GParamSpec * pspec)
 
103
{
 
104
  GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
 
105
 
 
106
  GST_EQUALIZER_TRANSFORM_LOCK (equ);
 
107
  GST_OBJECT_LOCK (equ);
 
108
  switch (prop_id) {
 
109
    case ARG_NUM_BANDS:
 
110
      gst_iir_equalizer_compute_frequencies (equ, g_value_get_uint (value));
 
111
      break;
 
112
    default:
 
113
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 
114
      break;
 
115
  }
 
116
  GST_OBJECT_UNLOCK (equ);
 
117
  GST_EQUALIZER_TRANSFORM_UNLOCK (equ);
 
118
}
 
119
 
 
120
static void
 
121
gst_iir_equalizer_nbands_get_property (GObject * object, guint prop_id,
 
122
    GValue * value, GParamSpec * pspec)
 
123
{
 
124
  GstIirEqualizer *equ = GST_IIR_EQUALIZER (object);
 
125
 
 
126
  switch (prop_id) {
 
127
    case ARG_NUM_BANDS:
 
128
      g_value_set_uint (value, equ->freq_band_count);
 
129
      break;
 
130
    default:
 
131
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 
132
      break;
 
133
  }
 
134
}