8c3f778c28df0fab4090a6d189153670130d17af
[platform/upstream/gstreamer.git] / gst / audioconvert / audioconvert.h
1 /* GStreamer
2  * Copyright (C) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
3  *           (C) 2015 Wim Taymans <wim.taymans@gmail.com>
4  *
5  * audioconverter.h: audio format conversion library
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_AUDIO_CONVERTER_H__
24 #define __GST_AUDIO_CONVERTER_H__
25
26 #include <gst/gst.h>
27 #include <gst/audio/audio.h>
28
29 #include "gstchannelmix.h"
30
31 typedef struct _GstAudioConverter GstAudioConverter;
32
33 /**
34  * GST_AUDIO_CONVERTER_OPT_DITHER_METHOD:
35  *
36  * #GST_TYPE_AUDIO_DITHER_METHOD, The dither method to use when
37  * changing bit depth.
38  * Default is #GST_AUDIO_DITHER_NONE.
39  */
40 #define GST_AUDIO_CONVERTER_OPT_DITHER_METHOD   "GstAudioConverter.dither-method"
41
42 /**
43  * GST_AUDIO_CONVERTER_OPT_NOISE_SHAPING_METHOD:
44  *
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.
48  */
49 #define GST_AUDIO_CONVERTER_OPT_NOISE_SHAPING_METHOD   "GstAudioConverter.noise-shaping-method"
50
51 /**
52  * GST_AUDIO_CONVERTER_OPT_QUANTIZATION:
53  *
54  * #G_TYPE_UINT, The quantization amount. Components will be
55  * quantized to multiples of this value.
56  * Default is 1
57  */
58 #define GST_AUDIO_CONVERTER_OPT_QUANTIZATION   "GstAudioConverter.quantization"
59
60
61 /**
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.
65  *
66  * Extra flags passed to gst_audio_converter_samples().
67  */
68 typedef enum {
69   GST_AUDIO_CONVERTER_FLAG_NONE            = 0,
70   GST_AUDIO_CONVERTER_FLAG_SOURCE_WRITABLE = (1 << 0)
71 } GstAudioConverterFlags;
72
73 GstAudioConverter *  gst_audio_converter_new            (GstAudioInfo *in_info,
74                                                          GstAudioInfo *out_info,
75                                                          GstStructure *config);
76
77 void                 gst_audio_converter_free           (GstAudioConverter * convert);
78
79 gboolean             gst_audio_converter_set_config     (GstAudioConverter * convert, GstStructure *config);
80 const GstStructure * gst_audio_converter_get_config     (GstAudioConverter * convert);
81
82
83 gboolean             gst_audio_converter_get_sizes      (GstAudioConverter * convert,
84                                                          gint samples,
85                                                          gint * srcsize, gint * dstsize);
86
87 gboolean             gst_audio_converter_samples        (GstAudioConverter * convert,
88                                                          GstAudioConverterFlags flags,
89                                                          gpointer src, gpointer dst,
90                                                          gint samples);
91
92 #endif /* __GST_AUDIO_CONVERTER_H__ */