PulseAudio 2.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, write to the Free Software
00023   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024   USA.
00025 ***/
00026 
00027 #include <pulse/cdecl.h>
00028 #include <pulse/gccmacro.h>
00029 #include <pulse/proplist.h>
00030 #include <pulse/sample.h>
00031 #include <pulse/channelmap.h>
00032 
00036 PA_C_DECL_BEGIN
00037 
00039 typedef enum pa_encoding {
00040     PA_ENCODING_ANY,
00043     PA_ENCODING_PCM,
00046     PA_ENCODING_AC3_IEC61937,
00049     PA_ENCODING_EAC3_IEC61937,
00052     PA_ENCODING_MPEG_IEC61937,
00055     PA_ENCODING_DTS_IEC61937,
00058     PA_ENCODING_MAX,
00061     PA_ENCODING_INVALID = -1,
00063 } pa_encoding_t;
00064 
00066 const char *pa_encoding_to_string(pa_encoding_t e) PA_GCC_CONST;
00067 
00069 pa_encoding_t pa_encoding_from_string(const char *encoding);
00070 
00072 typedef struct pa_format_info {
00073     pa_encoding_t encoding;
00076     pa_proplist *plist;
00078 } pa_format_info;
00079 
00081 pa_format_info* pa_format_info_new(void);
00082 
00084 pa_format_info* pa_format_info_copy(const pa_format_info *src);
00085 
00087 void pa_format_info_free(pa_format_info *f);
00088 
00090 int pa_format_info_valid(const pa_format_info *f);
00091 
00093 int pa_format_info_is_pcm(const pa_format_info *f);
00094 
00102 int pa_format_info_is_compatible(pa_format_info *first, pa_format_info *second);
00103 
00109 #define PA_FORMAT_INFO_SNPRINT_MAX 256
00110 
00112 char *pa_format_info_snprint(char *s, size_t l, const pa_format_info *f);
00113 
00116 pa_format_info* pa_format_info_from_string(const char *str);
00117 
00119 pa_format_info* pa_format_info_from_sample_spec(pa_sample_spec *ss, pa_channel_map *map);
00120 
00126 int pa_format_info_to_sample_spec(pa_format_info *f, pa_sample_spec *ss, pa_channel_map *map);
00127 
00129 typedef enum pa_prop_type_t {
00130     PA_PROP_TYPE_INT,
00133     PA_PROP_TYPE_INT_RANGE,
00136     PA_PROP_TYPE_INT_ARRAY,
00139     PA_PROP_TYPE_STRING,
00142     PA_PROP_TYPE_STRING_ARRAY,
00145     PA_PROP_TYPE_INVALID = -1,
00147 } pa_prop_type_t;
00148 
00150 pa_prop_type_t pa_format_info_get_prop_type(pa_format_info *f, const char *key);
00151 
00153 int pa_format_info_get_prop_int(pa_format_info *f, const char *key, int *v);
00156 int pa_format_info_get_prop_int_range(pa_format_info *f, const char *key, int *min, int *max);
00160 int pa_format_info_get_prop_int_array(pa_format_info *f, const char *key, int **values, int *n_values);
00163 int pa_format_info_get_prop_string(pa_format_info *f, const char *key, char **v);
00167 int pa_format_info_get_prop_string_array(pa_format_info *f, const char *key, char ***values, int *n_values);
00168 
00170 void pa_format_info_free_string_array(char **values, int n_values);
00171 
00173 void pa_format_info_set_prop_int(pa_format_info *f, const char *key, int value);
00175 void pa_format_info_set_prop_int_array(pa_format_info *f, const char *key, const int *values, int n_values);
00177 void pa_format_info_set_prop_int_range(pa_format_info *f, const char *key, int min, int max);
00179 void pa_format_info_set_prop_string(pa_format_info *f, const char *key, const char *value);
00181 void pa_format_info_set_prop_string_array(pa_format_info *f, const char *key, const char **values, int n_values);
00182 
00184 void pa_format_info_set_sample_format(pa_format_info *f, pa_sample_format_t sf);
00186 void pa_format_info_set_rate(pa_format_info *f, int rate);
00188 void pa_format_info_set_channels(pa_format_info *f, int channels);
00190 void pa_format_info_set_channel_map(pa_format_info *f, const pa_channel_map *map);
00191 
00192 PA_C_DECL_END
00193 
00194 #endif