1 | /* GStreamer |
2 | * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu> |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Library General Public |
6 | * License as published by the Free Software Foundation; either |
7 | * version 2 of the License, or (at your option) any later version. |
8 | * |
9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Library General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU Library General Public |
15 | * License along with this library; if not, write to the |
16 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
17 | * Boston, MA 02110-1301, USA. |
18 | */ |
19 | |
20 | #ifndef __GST_AUDIO_AUDIO_H__ |
21 | #include <gst/audio/audio.h> |
22 | #endif |
23 | |
24 | #ifndef __GST_AUDIO_FILTER_H__ |
25 | #define __GST_AUDIO_FILTER_H__ |
26 | |
27 | #include <gst/gst.h> |
28 | #include <gst/base/gstbasetransform.h> |
29 | |
30 | G_BEGIN_DECLS |
31 | |
32 | typedef struct _GstAudioFilter GstAudioFilter; |
33 | typedef struct _GstAudioFilterClass GstAudioFilterClass; |
34 | |
35 | #define GST_TYPE_AUDIO_FILTER \ |
36 | (gst_audio_filter_get_type()) |
37 | #define GST_AUDIO_FILTER(obj) \ |
38 | (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_FILTER,GstAudioFilter)) |
39 | #define GST_AUDIO_FILTER_CAST(obj) \ |
40 | ((GstAudioFilter *) (obj)) |
41 | #define GST_AUDIO_FILTER_CLASS(klass) \ |
42 | (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_FILTER,GstAudioFilterClass)) |
43 | #define GST_AUDIO_FILTER_CLASS_CAST(klass) \ |
44 | ((GstAudioFilterClass *) (klass)) |
45 | #define GST_AUDIO_FILTER_GET_CLASS(obj) \ |
46 | (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_AUDIO_FILTER,GstAudioFilterClass)) |
47 | #define GST_IS_AUDIO_FILTER(obj) \ |
48 | (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_FILTER)) |
49 | #define GST_IS_AUDIO_FILTER_CLASS(klass) \ |
50 | (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_FILTER)) |
51 | |
52 | /** |
53 | * GstAudioFilter: |
54 | * |
55 | * Base class for audio filters with the same format for input and output. |
56 | */ |
57 | struct _GstAudioFilter { |
58 | GstBaseTransform basetransform; |
59 | |
60 | /*< protected >*/ |
61 | GstAudioInfo info; /* currently configured format */ |
62 | |
63 | /*< private >*/ |
64 | gpointer _gst_reserved[GST_PADDING]; |
65 | }; |
66 | |
67 | #define GST_AUDIO_FILTER_INFO(filter) (&GST_AUDIO_FILTER_CAST(filter)->info) |
68 | |
69 | #define GST_AUDIO_FILTER_FORMAT(filter) (GST_AUDIO_INFO_FORMAT(GST_AUDIO_FILTER_INFO(filter))) |
70 | #define GST_AUDIO_FILTER_RATE(filter) (GST_AUDIO_INFO_RATE(GST_AUDIO_FILTER_INFO(filter))) |
71 | #define GST_AUDIO_FILTER_CHANNELS(filter) (GST_AUDIO_INFO_CHANNELS(GST_AUDIO_FILTER_INFO(filter))) |
72 | #define GST_AUDIO_FILTER_BPF(filter) (GST_AUDIO_INFO_BPF(GST_AUDIO_FILTER_INFO(filter))) |
73 | #define GST_AUDIO_FILTER_BPS(filter) (GST_AUDIO_INFO_BPS(GST_AUDIO_FILTER_INFO(filter))) |
74 | |
75 | /** |
76 | * GstAudioFilterClass: |
77 | * @basetransformclass: parent class |
78 | * @setup: virtual function called whenever the format changes |
79 | * |
80 | * In addition to the @setup virtual function, you should also override the |
81 | * GstBaseTransform::transform and/or GstBaseTransform::transform_ip virtual |
82 | * function. |
83 | */ |
84 | |
85 | struct _GstAudioFilterClass { |
86 | GstBaseTransformClass basetransformclass; |
87 | |
88 | /* virtual function, called whenever the format changes */ |
89 | gboolean (*setup) (GstAudioFilter * filter, const GstAudioInfo * info); |
90 | |
91 | /*< private >*/ |
92 | gpointer _gst_reserved[GST_PADDING]; |
93 | }; |
94 | |
95 | GST_AUDIO_API |
96 | GType gst_audio_filter_get_type (void); |
97 | |
98 | GST_AUDIO_API |
99 | void gst_audio_filter_class_add_pad_templates (GstAudioFilterClass * klass, |
100 | GstCaps * allowed_caps); |
101 | |
102 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioFilter, gst_object_unref) |
103 | |
104 | G_END_DECLS |
105 | |
106 | #endif /* __GST_AUDIO_FILTER_H__ */ |
107 | |
108 | |