23 #define __AUDIO_CONVERT_H__ |
23 #define __AUDIO_CONVERT_H__ |
24 |
24 |
25 #include <gst/gst.h> |
25 #include <gst/gst.h> |
26 #include <gst/audio/multichannel.h> |
26 #include <gst/audio/multichannel.h> |
27 |
27 |
|
28 /** |
|
29 * GstAudioConvertDithering: |
|
30 * @DITHER_NONE: No dithering |
|
31 * @DITHER_RPDF: Rectangular dithering |
|
32 * @DITHER_TPDF: Triangular dithering (default) |
|
33 * @DITHER_TPDF_HF: High frequency triangular dithering |
|
34 * |
|
35 * Set of available dithering methods when converting audio. |
|
36 */ |
28 typedef enum |
37 typedef enum |
29 { |
38 { |
30 DITHER_NONE = 0, |
39 DITHER_NONE = 0, |
31 DITHER_RPDF, |
40 DITHER_RPDF, |
32 DITHER_TPDF, |
41 DITHER_TPDF, |
33 DITHER_TPDF_HF |
42 DITHER_TPDF_HF |
34 } DitherType; |
43 } GstAudioConvertDithering; |
35 |
44 |
|
45 /** |
|
46 * GstAudioConvertNoiseShaping: |
|
47 * @NOISE_SHAPING_NONE: No noise shaping (default) |
|
48 * @NOISE_SHAPING_ERROR_FEEDBACK: Error feedback |
|
49 * @NOISE_SHAPING_SIMPLE: Simple 2-pole noise shaping |
|
50 * @NOISE_SHAPING_MEDIUM: Medium 5-pole noise shaping |
|
51 * @NOISE_SHAPING_HIGH: High 8-pole noise shaping |
|
52 * |
|
53 * Set of available noise shaping methods |
|
54 */ |
36 typedef enum |
55 typedef enum |
37 { |
56 { |
38 NOISE_SHAPING_NONE = 0, |
57 NOISE_SHAPING_NONE = 0, |
39 NOISE_SHAPING_ERROR_FEEDBACK, |
58 NOISE_SHAPING_ERROR_FEEDBACK, |
40 NOISE_SHAPING_SIMPLE, |
59 NOISE_SHAPING_SIMPLE, |
41 NOISE_SHAPING_MEDIUM, |
60 NOISE_SHAPING_MEDIUM, |
42 NOISE_SHAPING_HIGH |
61 NOISE_SHAPING_HIGH |
43 } NoiseShapingType; |
62 } GstAudioConvertNoiseShaping; |
44 |
63 |
45 typedef struct _AudioConvertCtx AudioConvertCtx; |
64 typedef struct _AudioConvertCtx AudioConvertCtx; |
46 typedef struct _AudioConvertFmt AudioConvertFmt; |
65 typedef struct _AudioConvertFmt AudioConvertFmt; |
47 |
66 |
48 struct _AudioConvertFmt |
67 struct _AudioConvertFmt |
96 gint out_scale; |
116 gint out_scale; |
97 |
117 |
98 AudioConvertMix channel_mix; |
118 AudioConvertMix channel_mix; |
99 |
119 |
100 AudioConvertQuantize quantize; |
120 AudioConvertQuantize quantize; |
101 DitherType dither; |
121 |
102 NoiseShapingType ns; |
122 GstAudioConvertDithering dither; |
103 /* random number generate for dither noise */ |
123 GstAudioConvertNoiseShaping ns; |
104 GRand *dither_random; |
|
105 /* last random number generated per channel for hifreq TPDF dither */ |
124 /* last random number generated per channel for hifreq TPDF dither */ |
106 gpointer last_random; |
125 gpointer last_random; |
107 /* contains the past quantization errors, error[out_channels][count] */ |
126 /* contains the past quantization errors, error[out_channels][count] */ |
108 gdouble *error_buf; |
127 gdouble *error_buf; |
109 }; |
128 }; |
117 IMPORT_C |
136 IMPORT_C |
118 #endif |
137 #endif |
119 |
138 |
120 |
139 |
121 gboolean audio_convert_prepare_context (AudioConvertCtx * ctx, |
140 gboolean audio_convert_prepare_context (AudioConvertCtx * ctx, |
122 AudioConvertFmt * in, AudioConvertFmt * out, DitherType dither, |
141 AudioConvertFmt * in, AudioConvertFmt * out, |
123 NoiseShapingType ns); |
142 GstAudioConvertDithering dither, GstAudioConvertNoiseShaping ns); |
124 #ifdef __SYMBIAN32__ |
143 #ifdef __SYMBIAN32__ |
125 IMPORT_C |
144 IMPORT_C |
126 #endif |
145 #endif |
127 |
146 |
128 gboolean audio_convert_get_sizes (AudioConvertCtx * ctx, gint samples, |
147 gboolean audio_convert_get_sizes (AudioConvertCtx * ctx, gint samples, |