2 * Copyright (C) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
3 * (C) 2015 Wim Taymans <wim.taymans@gmail.com>
5 * audioconverter.h: audio format conversion library
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.
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.
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.
23 #ifndef __GST_AUDIO_CONVERTER_H__
24 #define __GST_AUDIO_CONVERTER_H__
27 #include <gst/audio/audio.h>
29 #include "gstchannelmix.h"
31 typedef struct _GstAudioConverter GstAudioConverter;
34 * GST_AUDIO_CONVERTER_OPT_DITHER_METHOD:
36 * #GST_TYPE_AUDIO_DITHER_METHOD, The dither method to use when
38 * Default is #GST_AUDIO_DITHER_NONE.
40 #define GST_AUDIO_CONVERTER_OPT_DITHER_METHOD "GstAudioConverter.dither-method"
43 * GST_AUDIO_CONVERTER_OPT_NOISE_SHAPING_METHOD:
45 * #GST_TYPE_AUDIO_NOISE_SHAPING_METHOD, The noise shaping method to use
46 * to mask noise from quantization errors.
47 * Default is #GST_AUDIO_NOISE_SHAPING_NONE.
49 #define GST_AUDIO_CONVERTER_OPT_NOISE_SHAPING_METHOD "GstAudioConverter.noise-shaping-method"
52 * GST_AUDIO_CONVERTER_OPT_QUANTIZATION:
54 * #G_TYPE_UINT, The quantization amount. Components will be
55 * quantized to multiples of this value.
58 #define GST_AUDIO_CONVERTER_OPT_QUANTIZATION "GstAudioConverter.quantization"
62 * @GST_AUDIO_CONVERTER_FLAG_NONE: no flag
63 * @GST_AUDIO_CONVERTER_FLAG_SOURCE_WRITABLE: the source is writable and can be
64 * used as temporary storage during conversion.
66 * Extra flags passed to gst_audio_converter_samples().
69 GST_AUDIO_CONVERTER_FLAG_NONE = 0,
70 GST_AUDIO_CONVERTER_FLAG_SOURCE_WRITABLE = (1 << 0)
71 } GstAudioConverterFlags;
73 GstAudioConverter * gst_audio_converter_new (GstAudioInfo *in_info,
74 GstAudioInfo *out_info,
75 GstStructure *config);
77 void gst_audio_converter_free (GstAudioConverter * convert);
79 gboolean gst_audio_converter_set_config (GstAudioConverter * convert, GstStructure *config);
80 const GstStructure * gst_audio_converter_get_config (GstAudioConverter * convert);
83 gboolean gst_audio_converter_get_sizes (GstAudioConverter * convert,
85 gint * srcsize, gint * dstsize);
87 gboolean gst_audio_converter_samples (GstAudioConverter * convert,
88 GstAudioConverterFlags flags,
89 gpointer src, gpointer dst,
92 #endif /* __GST_AUDIO_CONVERTER_H__ */