AC_MSG_RESULT([no])
fi
+AC_MSG_CHECKING([whether $CC knows _Bool])
+AC_LANG_CONFTEST([int main() { _Bool b; }])
+$CC conftest.c $CFLAGS -o conftest > /dev/null 2> /dev/null
+ret=$?
+rm -f conftest.o conftest
+if test $ret -eq 0 ; then
+ AC_DEFINE([HAVE_STD_BOOL], 1, [Have _Bool.])
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+fi
+
#### libtool stuff ####
AC_LTDL_ENABLE_INSTALL
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
+/* This type is not intended to be used in exported APIs! Use classic "int" there! */
+#ifdef HAVE_STD_BOOL
+typedef _Bool pa_bool_t;
+#else
+typedef int pa_bool_t;
+#endif
+
+#ifndef FALSE
+#define FALSE ((pa_bool_t) 0)
+#endif
+
+#ifndef TRUE
+#define TRUE (!FALSE)
+#endif
+
#ifdef __GNUC__
#define PA_PRETTY_FUNCTION __PRETTY_FUNCTION__
#else
data->sample_spec = *spec;
}
-void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, int mute) {
+void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, pa_bool_t mute) {
pa_assert(data);
- data->muted_is_set = 1;
+ data->muted_is_set = TRUE;
data->muted = !!mute;
}
return &i->volume;
}
-void pa_sink_input_set_mute(pa_sink_input *i, int mute) {
+void pa_sink_input_set_mute(pa_sink_input *i, pa_bool_t mute) {
pa_assert(i);
pa_sink_input_assert_ref(i);
pa_assert(PA_SINK_INPUT_LINKED(i->state));
return !!i->muted;
}
-void pa_sink_input_cork(pa_sink_input *i, int b) {
+void pa_sink_input_cork(pa_sink_input *i, pa_bool_t b) {
pa_sink_input_assert_ref(i);
pa_assert(PA_SINK_INPUT_LINKED(i->state));
PA_SINK_INPUT_UNLINKED /*< The stream is dead */
} pa_sink_input_state_t;
-static inline int PA_SINK_INPUT_LINKED(pa_sink_input_state_t x) {
+static inline pa_bool_t PA_SINK_INPUT_LINKED(pa_sink_input_state_t x) {
return x == PA_SINK_INPUT_DRAINED || x == PA_SINK_INPUT_RUNNING || x == PA_SINK_INPUT_CORKED;
}
pa_sink_input *sync_prev, *sync_next;
pa_cvolume volume;
- int muted;
+ pa_bool_t muted;
/* Returns the chunk of audio data (but doesn't drop it
* yet!). Returns -1 on failure. Called from IO thread context. If
pa_sink_input *sync_prev, *sync_next;
pa_cvolume volume;
- int muted;
+ pa_bool_t muted;
} thread_info;
void *userdata;
pa_sink *sink;
pa_sample_spec sample_spec;
- int sample_spec_is_set;
+ pa_bool_t sample_spec_is_set;
pa_channel_map channel_map;
- int channel_map_is_set;
+ pa_bool_t channel_map_is_set;
pa_cvolume volume;
- int volume_is_set;
- int muted;
- int muted_is_set;
+ pa_bool_t volume_is_set;
+ pa_bool_t muted;
+ pa_bool_t muted_is_set;
pa_resample_method_t resample_method;
void pa_sink_input_new_data_set_sample_spec(pa_sink_input_new_data *data, const pa_sample_spec *spec);
void pa_sink_input_new_data_set_channel_map(pa_sink_input_new_data *data, const pa_channel_map *map);
void pa_sink_input_new_data_set_volume(pa_sink_input_new_data *data, const pa_cvolume *volume);
-void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, int mute);
+void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, pa_bool_t mute);
/* To be called by the implementing module only */
void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume);
const pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i);
-void pa_sink_input_set_mute(pa_sink_input *i, int mute);
+void pa_sink_input_set_mute(pa_sink_input *i, pa_bool_t mute);
int pa_sink_input_get_mute(pa_sink_input *i);
-void pa_sink_input_cork(pa_sink_input *i, int b);
+void pa_sink_input_cork(pa_sink_input *i, pa_bool_t b);
int pa_sink_input_set_rate(pa_sink_input *i, uint32_t rate);
s->n_corked = 0;
pa_cvolume_reset(&s->volume, spec->channels);
- s->muted = 0;
- s->refresh_volume = s->refresh_mute = 0;
+ s->muted = FALSE;
+ s->refresh_volume = s->refresh_mute = FALSE;
s->get_latency = NULL;
s->set_volume = NULL;
return sink_set_state(s, pa_sink_used_by(s) ? PA_SINK_RUNNING : PA_SINK_IDLE);
}
-int pa_sink_suspend(pa_sink *s, int suspend) {
+int pa_sink_suspend(pa_sink *s, pa_bool_t suspend) {
pa_sink_assert_ref(s);
pa_assert(PA_SINK_LINKED(s->state));
return &s->volume;
}
-void pa_sink_set_mute(pa_sink *s, int mute) {
+void pa_sink_set_mute(pa_sink *s, pa_bool_t mute) {
int changed;
pa_sink_assert_ref(s);
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
}
-int pa_sink_get_mute(pa_sink *s) {
- int old_muted;
+pa_bool_t pa_sink_get_mute(pa_sink *s) {
+ pa_bool_t old_muted;
pa_sink_assert_ref(s);
pa_assert(PA_SINK_LINKED(s->state));
return 0;
case PA_SINK_MESSAGE_GET_MUTE:
- *((int*) userdata) = s->thread_info.soft_muted;
+ *((pa_bool_t*) userdata) = s->thread_info.soft_muted;
return 0;
case PA_SINK_MESSAGE_PING:
return -1;
}
-int pa_sink_suspend_all(pa_core *c, int suspend) {
+int pa_sink_suspend_all(pa_core *c, pa_bool_t suspend) {
pa_sink *sink;
uint32_t idx;
int ret = 0;
PA_SINK_UNLINKED
} pa_sink_state_t;
-static inline int PA_SINK_OPENED(pa_sink_state_t x) {
+static inline pa_bool_t PA_SINK_OPENED(pa_sink_state_t x) {
return x == PA_SINK_RUNNING || x == PA_SINK_IDLE;
}
-static inline int PA_SINK_LINKED(pa_sink_state_t x) {
+static inline pa_bool_t PA_SINK_LINKED(pa_sink_state_t x) {
return x == PA_SINK_RUNNING || x == PA_SINK_IDLE || x == PA_SINK_SUSPENDED;
}
pa_source *monitor_source;
pa_cvolume volume;
- int muted;
- int refresh_volume;
- int refresh_mute;
+ pa_bool_t muted;
+ pa_bool_t refresh_volume;
+ pa_bool_t refresh_mute;
int (*set_state)(pa_sink *s, pa_sink_state_t state); /* may be NULL */
int (*set_volume)(pa_sink *s); /* dito */
pa_sink_state_t state;
pa_hashmap *inputs;
pa_cvolume soft_volume;
- int soft_muted;
+ pa_bool_t soft_muted;
} thread_info;
pa_memblock *silence;
pa_usec_t pa_sink_get_latency(pa_sink *s);
int pa_sink_update_status(pa_sink*s);
-int pa_sink_suspend(pa_sink *s, int suspend);
-int pa_sink_suspend_all(pa_core *c, int suspend);
+int pa_sink_suspend(pa_sink *s, pa_bool_t suspend);
+int pa_sink_suspend_all(pa_core *c, pa_bool_t suspend);
/* Sends a ping message to the sink thread, to make it wake up and
* check for data to process even if there is no real message is
void pa_sink_set_volume(pa_sink *sink, const pa_cvolume *volume);
const pa_cvolume *pa_sink_get_volume(pa_sink *sink);
-void pa_sink_set_mute(pa_sink *sink, int mute);
-int pa_sink_get_mute(pa_sink *sink);
+void pa_sink_set_mute(pa_sink *sink, pa_bool_t mute);
+pa_bool_t pa_sink_get_mute(pa_sink *sink);
unsigned pa_sink_linked_by(pa_sink *s); /* Number of connected streams */
unsigned pa_sink_used_by(pa_sink *s); /* Number of connected streams which are not corked */
pa_memblock_unref(rchunk.memblock);
}
-void pa_source_output_cork(pa_source_output *o, int b) {
+void pa_source_output_cork(pa_source_output *o, pa_bool_t b) {
pa_source_output_assert_ref(o);
pa_assert(PA_SOURCE_OUTPUT_LINKED(o->state));
PA_SOURCE_OUTPUT_UNLINKED
} pa_source_output_state_t;
-static inline int PA_SOURCE_OUTPUT_LINKED(pa_source_output_state_t x) {
+static inline pa_bool_t PA_SOURCE_OUTPUT_LINKED(pa_source_output_state_t x) {
return x == PA_SOURCE_OUTPUT_RUNNING || x == PA_SOURCE_OUTPUT_CORKED;
}
pa_source *source;
pa_sample_spec sample_spec;
- int sample_spec_is_set;
+ pa_bool_t sample_spec_is_set;
pa_channel_map channel_map;
- int channel_map_is_set;
+ pa_bool_t channel_map_is_set;
pa_resample_method_t resample_method;
} pa_source_output_new_data;
pa_usec_t pa_source_output_get_latency(pa_source_output *i);
-void pa_source_output_cork(pa_source_output *i, int b);
+void pa_source_output_cork(pa_source_output *i, pa_bool_t b);
int pa_source_output_set_rate(pa_source_output *o, uint32_t rate);
s->monitor_of = NULL;
pa_cvolume_reset(&s->volume, spec->channels);
- s->muted = 0;
- s->refresh_volume = s->refresh_muted = 0;
+ s->muted = FALSE;
+ s->refresh_volume = s->refresh_muted = FALSE;
s->get_latency = NULL;
s->set_volume = NULL;
return source_set_state(s, pa_source_used_by(s) ? PA_SOURCE_RUNNING : PA_SOURCE_IDLE);
}
-int pa_source_suspend(pa_source *s, int suspend) {
+int pa_source_suspend(pa_source *s, pa_bool_t suspend) {
pa_source_assert_ref(s);
pa_assert(PA_SOURCE_LINKED(s->state));
return &s->volume;
}
-void pa_source_set_mute(pa_source *s, int mute) {
+void pa_source_set_mute(pa_source *s, pa_bool_t mute) {
int changed;
pa_source_assert_ref(s);
pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
}
-int pa_source_get_mute(pa_source *s) {
- int old_muted;
+pa_bool_t pa_source_get_mute(pa_source *s) {
+ pa_bool_t old_muted;
pa_source_assert_ref(s);
pa_assert(PA_SOURCE_LINKED(s->state));
return 0;
case PA_SOURCE_MESSAGE_GET_MUTE:
- *((int*) userdata) = s->thread_info.soft_muted;
+ *((pa_bool_t*) userdata) = s->thread_info.soft_muted;
return 0;
case PA_SOURCE_MESSAGE_PING:
return -1;
}
-int pa_source_suspend_all(pa_core *c, int suspend) {
+int pa_source_suspend_all(pa_core *c, pa_bool_t suspend) {
uint32_t idx;
pa_source *source;
int ret = 0;
PA_SOURCE_UNLINKED
} pa_source_state_t;
-static inline int PA_SOURCE_OPENED(pa_source_state_t x) {
+static inline pa_bool_t PA_SOURCE_OPENED(pa_source_state_t x) {
return x == PA_SOURCE_RUNNING || x == PA_SOURCE_IDLE;
}
-static inline int PA_SOURCE_LINKED(pa_source_state_t x) {
+static inline pa_bool_t PA_SOURCE_LINKED(pa_source_state_t x) {
return x == PA_SOURCE_RUNNING || x == PA_SOURCE_IDLE || x == PA_SOURCE_SUSPENDED;
}
pa_sink *monitor_of; /* may be NULL */
pa_cvolume volume;
- int muted;
- int refresh_volume;
- int refresh_muted;
+ pa_bool_t muted;
+ pa_bool_t refresh_volume;
+ pa_bool_t refresh_muted;
int (*set_state)(pa_source*source, pa_source_state_t state); /* may be NULL */
int (*set_volume)(pa_source *s); /* dito */
pa_source_state_t state;
pa_hashmap *outputs;
pa_cvolume soft_volume;
- int soft_muted;
+ pa_bool_t soft_muted;
} thread_info;
void *userdata;
pa_usec_t pa_source_get_latency(pa_source *s);
int pa_source_update_status(pa_source*s);
-int pa_source_suspend(pa_source *s, int suspend);
-int pa_source_suspend_all(pa_core *c, int suspend);
+int pa_source_suspend(pa_source *s, pa_bool_t suspend);
+int pa_source_suspend_all(pa_core *c, pa_bool_t suspend);
void pa_source_ping(pa_source *s);
void pa_source_set_volume(pa_source *source, const pa_cvolume *volume);
const pa_cvolume *pa_source_get_volume(pa_source *source);
-void pa_source_set_mute(pa_source *source, int mute);
-int pa_source_get_mute(pa_source *source);
+void pa_source_set_mute(pa_source *source, pa_bool_t mute);
+pa_bool_t pa_source_get_mute(pa_source *source);
unsigned pa_source_linked_by(pa_source *s); /* Number of connected streams */
unsigned pa_source_used_by(pa_source *s); /* Number of connected streams that are not corked */