summaryrefslogtreecommitdiff
path: root/ext/ladspa/gstladspautils.h
blob: 050cbaa56776f51e97bec4bb4857d7285f396c61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/* GStreamer
 * Copyright (C) 2013 Juan Manuel Borges CaƱo <juanmabcmail@gmail.com>
 *               2013 Stefan Sauer <ensonic@users.sf.net>
 *
 * gstladspautils.h: Header for LADSPA plugin utils
 *
 * 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_LADSPA_UTILS_H__
#define __GST_LADSPA_UTILS_H__

#include <gmodule.h>
#include <gst/gst.h>
#include <gst/audio/gstaudiofilter.h>
#include <gst/base/gstbasesrc.h>
#include <gst/base/gstbasesink.h>

#include <ladspa.h>

G_BEGIN_DECLS

typedef struct _GstLADSPA GstLADSPA;

typedef struct _GstLADSPAClass GstLADSPAClass;

struct _GstLADSPA
{
  GstLADSPAClass *klass;

  LADSPA_Handle *handle;
  gboolean activated;
  unsigned long rate;

  struct
  {
    struct
    {
      LADSPA_Data *in;
      LADSPA_Data *out;
    } control;

    struct
    {
      LADSPA_Data **in;
      LADSPA_Data **out;
    } audio;
  } ports;
};

struct _GstLADSPAClass
{
  guint properties;

  GModule *plugin;
  const LADSPA_Descriptor *descriptor;

  struct
  {
    struct
    {
      guint in;
      guint out;
    } control;

    struct
    {
      guint in;
      guint out;
    } audio;
  } count;

  struct
  {
    struct
    {
      unsigned long *in;
      unsigned long *out;
    } control;

    struct
    {
      unsigned long *in;
      unsigned long *out;
    } audio;
  } map;
};

gboolean
gst_ladspa_transform (GstLADSPA * ladspa, guint8 * outdata, guint samples,
    guint8 * indata);

gboolean
gst_ladspa_setup (GstLADSPA * ladspa, unsigned long rate);

gboolean
gst_ladspa_cleanup (GstLADSPA * ladspa);

void
gst_ladspa_object_set_property (GstLADSPA * ladspa, GObject * object,
    guint prop_id, const GValue * value, GParamSpec * pspec);

void
gst_ladspa_object_get_property (GstLADSPA * ladspa, GObject * object,
    guint prop_id, GValue * value, GParamSpec * pspec);

void
gst_ladspa_object_class_install_properties (GstLADSPAClass * ladspa_class,
    GObjectClass * object_class, guint offset);

void
gst_ladspa_element_class_set_metadata (GstLADSPAClass * ladspa_class,
    GstElementClass * elem_class, const gchar * ladspa_class_tags);

void
gst_ladspa_filter_type_class_add_pad_templates (GstLADSPAClass * ladspa_class,
    GstAudioFilterClass * audio_class);

void
gst_ladspa_source_type_class_add_pad_template (GstLADSPAClass * ladspa_class,
    GstBaseSrcClass * audio_class);

void
gst_ladspa_sink_type_class_add_pad_template (GstLADSPAClass * ladspa_class,
    GstBaseSinkClass * base_class);

void
gst_ladspa_init (GstLADSPA * ladspa, GstLADSPAClass * ladspa_class);

void
gst_ladspa_finalize (GstLADSPA * ladspa);

void
gst_ladspa_class_init (GstLADSPAClass * ladspa_class, GType type);

void
gst_ladspa_class_finalize (GstLADSPAClass * ladspa_class);

void
ladspa_register_element (GstPlugin * plugin, GType parent_type,
    const GTypeInfo * info, GstStructure * ladspa_meta);

G_END_DECLS

#endif /* __GST_LADSPA_UTILS_H__ */