• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  * Copyright (C) 2013 Juan Manuel Borges Caño <juanmabcmail@gmail.com>
3  *               2013 Stefan Sauer <ensonic@users.sf.net>
4  *
5  * gstladspautils.h: Header for LADSPA plugin utils
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef __GST_LADSPA_UTILS_H__
24 #define __GST_LADSPA_UTILS_H__
25 
26 #include <gmodule.h>
27 #include <gst/gst.h>
28 #include <gst/audio/gstaudiofilter.h>
29 #include <gst/base/gstbasesrc.h>
30 #include <gst/base/gstbasesink.h>
31 
32 #include <ladspa.h>
33 
34 G_BEGIN_DECLS
35 
36 typedef struct _GstLADSPA GstLADSPA;
37 
38 typedef struct _GstLADSPAClass GstLADSPAClass;
39 
40 struct _GstLADSPA
41 {
42   GstLADSPAClass *klass;
43 
44   LADSPA_Handle *handle;
45   gboolean activated;
46   unsigned long rate;
47 
48   struct
49   {
50     struct
51     {
52       LADSPA_Data *in;
53       LADSPA_Data *out;
54     } control;
55 
56     struct
57     {
58       LADSPA_Data **in;
59       LADSPA_Data **out;
60     } audio;
61   } ports;
62 };
63 
64 struct _GstLADSPAClass
65 {
66   guint properties;
67 
68   GModule *plugin;
69   const LADSPA_Descriptor *descriptor;
70 
71   struct
72   {
73     struct
74     {
75       guint in;
76       guint out;
77     } control;
78 
79     struct
80     {
81       guint in;
82       guint out;
83     } audio;
84   } count;
85 
86   struct
87   {
88     struct
89     {
90       unsigned long *in;
91       unsigned long *out;
92     } control;
93 
94     struct
95     {
96       unsigned long *in;
97       unsigned long *out;
98     } audio;
99   } map;
100 };
101 
102 gboolean
103 gst_ladspa_transform (GstLADSPA * ladspa, guint8 * outdata, guint samples,
104     guint8 * indata);
105 
106 gboolean
107 gst_ladspa_setup (GstLADSPA * ladspa, unsigned long rate);
108 
109 gboolean
110 gst_ladspa_cleanup (GstLADSPA * ladspa);
111 
112 void
113 gst_ladspa_object_set_property (GstLADSPA * ladspa, GObject * object,
114     guint prop_id, const GValue * value, GParamSpec * pspec);
115 
116 void
117 gst_ladspa_object_get_property (GstLADSPA * ladspa, GObject * object,
118     guint prop_id, GValue * value, GParamSpec * pspec);
119 
120 void
121 gst_ladspa_object_class_install_properties (GstLADSPAClass * ladspa_class,
122     GObjectClass * object_class, guint offset);
123 
124 void
125 gst_ladspa_element_class_set_metadata (GstLADSPAClass * ladspa_class,
126     GstElementClass * elem_class, const gchar * ladspa_class_tags);
127 
128 void
129 gst_ladspa_filter_type_class_add_pad_templates (GstLADSPAClass * ladspa_class,
130     GstAudioFilterClass * audio_class);
131 
132 void
133 gst_ladspa_source_type_class_add_pad_template (GstLADSPAClass * ladspa_class,
134     GstBaseSrcClass * audio_class);
135 
136 void
137 gst_ladspa_sink_type_class_add_pad_template (GstLADSPAClass * ladspa_class,
138     GstBaseSinkClass * base_class);
139 
140 void
141 gst_ladspa_init (GstLADSPA * ladspa, GstLADSPAClass * ladspa_class);
142 
143 void
144 gst_ladspa_finalize (GstLADSPA * ladspa);
145 
146 void
147 gst_ladspa_class_init (GstLADSPAClass * ladspa_class, GType type);
148 
149 void
150 gst_ladspa_class_finalize (GstLADSPAClass * ladspa_class);
151 
152 void
153 ladspa_register_element (GstPlugin * plugin, GType parent_type,
154     const GTypeInfo * info, GstStructure * ladspa_meta);
155 
156 G_END_DECLS
157 
158 #endif /* __GST_LADSPA_UTILS_H__ */
159