PulseAudio  9.0
format.h
Go to the documentation of this file.
00001 #ifndef fooformathfoo
00002 #define fooformathfoo
00003 
00004 /***
00005   This file is part of PulseAudio.
00006 
00007   Copyright 2011 Intel Corporation
00008   Copyright 2011 Collabora Multimedia
00009   Copyright 2011 Arun Raghavan <arun.raghavan@collabora.co.uk>
00010 
00011   PulseAudio is free software; you can redistribute it and/or modify
00012   it under the terms of the GNU Lesser General Public License as published
00013   by the Free Software Foundation; either version 2.1 of the License,
00014   or (at your option) any later version.
00015 
00016   PulseAudio is distributed in the hope that it will be useful, but
00017   WITHOUT ANY WARRANTY; without even the implied warranty of
00018   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00019   General Public License for more details.
00020 
00021   You should have received a copy of the GNU Lesser General Public License
00022   along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
00023 ***/
00024 
00025 #include <pulse/cdecl.h>
00026 #include <pulse/gccmacro.h>
00027 #include <pulse/proplist.h>
00028 #include <pulse/sample.h>
00029 #include <pulse/channelmap.h>
00030 
00034 PA_C_DECL_BEGIN
00035 
00037 typedef enum pa_encoding {
00038     PA_ENCODING_ANY,
00041     PA_ENCODING_PCM,
00044     PA_ENCODING_AC3_IEC61937,
00047     PA_ENCODING_EAC3_IEC61937,
00050     PA_ENCODING_MPEG_IEC61937,
00053     PA_ENCODING_DTS_IEC61937,
00056     PA_ENCODING_MPEG2_AAC_IEC61937,
00059     PA_ENCODING_MAX,
00062     PA_ENCODING_INVALID = -1,
00064 } pa_encoding_t;
00065 
00067 #define PA_ENCODING_ANY PA_ENCODING_ANY
00068 #define PA_ENCODING_PCM PA_ENCODING_PCM
00069 #define PA_ENCODING_AC3_IEC61937 PA_ENCODING_AC3_IEC61937
00070 #define PA_ENCODING_EAC3_IEC61937 PA_ENCODING_EAC3_IEC61937
00071 #define PA_ENCODING_MPEG_IEC61937 PA_ENCODING_MPEG_IEC61937
00072 #define PA_ENCODING_DTS_IEC61937 PA_ENCODING_DTS_IEC61937
00073 #define PA_ENCODING_MPEG2_AAC_IEC61937 PA_ENCODING_MPEG2_AAC_IEC61937
00074 #define PA_ENCODING_MAX PA_ENCODING_MAX
00075 #define PA_ENCODING_INVALID PA_ENCODING_INVALID
00076 
00079 const char *pa_encoding_to_string(pa_encoding_t e) PA_GCC_CONST;
00080 
00082 pa_encoding_t pa_encoding_from_string(const char *encoding);
00083 
00085 typedef struct pa_format_info {
00086     pa_encoding_t encoding;
00089     pa_proplist *plist;
00091 } pa_format_info;
00092 
00094 pa_format_info* pa_format_info_new(void);
00095 
00097 pa_format_info* pa_format_info_copy(const pa_format_info *src);
00098 
00100 void pa_format_info_free(pa_format_info *f);
00101 
00103 int pa_format_info_valid(const pa_format_info *f);
00104 
00106 int pa_format_info_is_pcm(const pa_format_info *f);
00107 
00115 int pa_format_info_is_compatible(const pa_format_info *first, const pa_format_info *second);
00116 
00122 #define PA_FORMAT_INFO_SNPRINT_MAX 256
00123 
00125 char *pa_format_info_snprint(char *s, size_t l, const pa_format_info *f);
00126 
00129 pa_format_info* pa_format_info_from_string(const char *str);
00130 
00143 pa_format_info* pa_format_info_from_sample_spec(const pa_sample_spec *ss, const pa_channel_map *map);
00144 
00150 int pa_format_info_to_sample_spec(const pa_format_info *f, pa_sample_spec *ss, pa_channel_map *map);
00151 
00153 typedef enum pa_prop_type_t {
00154     PA_PROP_TYPE_INT,
00157     PA_PROP_TYPE_INT_RANGE,
00160     PA_PROP_TYPE_INT_ARRAY,
00163     PA_PROP_TYPE_STRING,
00166     PA_PROP_TYPE_STRING_ARRAY,
00169     PA_PROP_TYPE_INVALID = -1,
00171 } pa_prop_type_t;
00172 
00174 #define PA_PROP_TYPE_INT PA_PROP_TYPE_INT
00175 #define PA_PROP_TYPE_INT_RANGE PA_PROP_TYPE_INT_RANGE
00176 #define PA_PROP_TYPE_INT_ARRAY PA_PROP_TYPE_INT_ARRAY
00177 #define PA_PROP_TYPE_STRING PA_PROP_TYPE_STRING
00178 #define PA_PROP_TYPE_STRING_ARRAY PA_PROP_TYPE_STRING_ARRAY
00179 #define PA_PROP_TYPE_INVALID PA_PROP_TYPE_INVALID
00180 
00183 pa_prop_type_t pa_format_info_get_prop_type(const pa_format_info *f, const char *key);
00184 
00186 int pa_format_info_get_prop_int(const pa_format_info *f, const char *key, int *v);
00189 int pa_format_info_get_prop_int_range(const pa_format_info *f, const char *key, int *min, int *max);
00193 int pa_format_info_get_prop_int_array(const pa_format_info *f, const char *key, int **values, int *n_values);
00196 int pa_format_info_get_prop_string(const pa_format_info *f, const char *key, char **v);
00200 int pa_format_info_get_prop_string_array(const pa_format_info *f, const char *key, char ***values, int *n_values);
00201 
00203 void pa_format_info_free_string_array(char **values, int n_values);
00204 
00206 void pa_format_info_set_prop_int(pa_format_info *f, const char *key, int value);
00208 void pa_format_info_set_prop_int_array(pa_format_info *f, const char *key, const int *values, int n_values);
00210 void pa_format_info_set_prop_int_range(pa_format_info *f, const char *key, int min, int max);
00212 void pa_format_info_set_prop_string(pa_format_info *f, const char *key, const char *value);
00214 void pa_format_info_set_prop_string_array(pa_format_info *f, const char *key, const char **values, int n_values);
00215 
00225 void pa_format_info_set_sample_format(pa_format_info *f, pa_sample_format_t sf);
00226 
00236 void pa_format_info_set_rate(pa_format_info *f, int rate);
00237 
00247 void pa_format_info_set_channels(pa_format_info *f, int channels);
00248 
00258 void pa_format_info_set_channel_map(pa_format_info *f, const pa_channel_map *map);
00259 
00260 PA_C_DECL_END
00261 
00262 #endif