pulse: use #ifdef rather than #if conditionals

This commit is contained in:
Mark Nauwelaerts 2010-03-18 12:44:53 +01:00
parent fd5164af96
commit 5a082af3aa
3 changed files with 25 additions and 25 deletions

View file

@ -212,7 +212,7 @@ gst_pulseringbuffer_init (GstPulseRingBuffer * pbuf,
pbuf->context = NULL; pbuf->context = NULL;
pbuf->stream = NULL; pbuf->stream = NULL;
#if HAVE_PULSE_0_9_13 #ifdef HAVE_PULSE_0_9_13
pa_sample_spec_init (&pbuf->sample_spec); pa_sample_spec_init (&pbuf->sample_spec);
#else #else
pbuf->sample_spec.format = PA_SAMPLE_INVALID; pbuf->sample_spec.format = PA_SAMPLE_INVALID;
@ -255,7 +255,7 @@ gst_pulsering_destroy_context (GstPulseRingBuffer * pbuf)
/* Make sure we don't get any further callbacks */ /* Make sure we don't get any further callbacks */
pa_context_set_state_callback (pbuf->context, NULL, NULL); pa_context_set_state_callback (pbuf->context, NULL, NULL);
#if HAVE_PULSE_0_9_12 #ifdef HAVE_PULSE_0_9_12
pa_context_set_subscribe_callback (pbuf->context, NULL, NULL); pa_context_set_subscribe_callback (pbuf->context, NULL, NULL);
#endif #endif
@ -327,7 +327,7 @@ gst_pulsering_context_state_cb (pa_context * c, void *userdata)
} }
} }
#if HAVE_PULSE_0_9_12 #ifdef HAVE_PULSE_0_9_12
static void static void
gst_pulsering_context_subscribe_cb (pa_context * c, gst_pulsering_context_subscribe_cb (pa_context * c,
pa_subscription_event_type_t t, uint32_t idx, void *userdata) pa_subscription_event_type_t t, uint32_t idx, void *userdata)
@ -389,7 +389,7 @@ gst_pulseringbuffer_open_device (GstRingBuffer * buf)
/* register some essential callbacks */ /* register some essential callbacks */
pa_context_set_state_callback (pbuf->context, pa_context_set_state_callback (pbuf->context,
gst_pulsering_context_state_cb, pbuf); gst_pulsering_context_state_cb, pbuf);
#if HAVE_PULSE_0_9_12 #ifdef HAVE_PULSE_0_9_12
pa_context_set_subscribe_callback (pbuf->context, pa_context_set_subscribe_callback (pbuf->context,
gst_pulsering_context_subscribe_cb, pbuf); gst_pulsering_context_subscribe_cb, pbuf);
#endif #endif
@ -557,7 +557,7 @@ gst_pulsering_stream_latency_cb (pa_stream * s, void *userdata)
GST_LOG_OBJECT (psink, "latency update (information unknown)"); GST_LOG_OBJECT (psink, "latency update (information unknown)");
return; return;
} }
#if HAVE_PULSE_0_9_11 #ifdef HAVE_PULSE_0_9_11
sink_usec = info->configured_sink_usec; sink_usec = info->configured_sink_usec;
#else #else
sink_usec = 0; sink_usec = 0;
@ -586,7 +586,7 @@ gst_pulsering_stream_suspended_cb (pa_stream * p, void *userdata)
GST_DEBUG_OBJECT (psink, "stream resumed"); GST_DEBUG_OBJECT (psink, "stream resumed");
} }
#if HAVE_PULSE_0_9_11 #ifdef HAVE_PULSE_0_9_11
static void static void
gst_pulsering_stream_started_cb (pa_stream * p, void *userdata) gst_pulsering_stream_started_cb (pa_stream * p, void *userdata)
{ {
@ -600,7 +600,7 @@ gst_pulsering_stream_started_cb (pa_stream * p, void *userdata)
} }
#endif #endif
#if HAVE_PULSE_0_9_15 #ifdef HAVE_PULSE_0_9_15
static void static void
gst_pulsering_stream_event_cb (pa_stream * p, const char *name, gst_pulsering_stream_event_cb (pa_stream * p, const char *name,
pa_proplist * pl, void *userdata) pa_proplist * pl, void *userdata)
@ -640,7 +640,7 @@ gst_pulseringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
const pa_buffer_attr *actual; const pa_buffer_attr *actual;
pa_channel_map channel_map; pa_channel_map channel_map;
pa_operation *o = NULL; pa_operation *o = NULL;
#if HAVE_PULSE_0_9_20 #ifdef HAVE_PULSE_0_9_20
pa_cvolume v; pa_cvolume v;
#endif #endif
pa_cvolume *pv = NULL; pa_cvolume *pv = NULL;
@ -698,11 +698,11 @@ gst_pulseringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
gst_pulsering_stream_latency_cb, pbuf); gst_pulsering_stream_latency_cb, pbuf);
pa_stream_set_suspended_callback (pbuf->stream, pa_stream_set_suspended_callback (pbuf->stream,
gst_pulsering_stream_suspended_cb, pbuf); gst_pulsering_stream_suspended_cb, pbuf);
#if HAVE_PULSE_0_9_11 #ifdef HAVE_PULSE_0_9_11
pa_stream_set_started_callback (pbuf->stream, pa_stream_set_started_callback (pbuf->stream,
gst_pulsering_stream_started_cb, pbuf); gst_pulsering_stream_started_cb, pbuf);
#endif #endif
#if HAVE_PULSE_0_9_15 #ifdef HAVE_PULSE_0_9_15
pa_stream_set_event_callback (pbuf->stream, pa_stream_set_event_callback (pbuf->stream,
gst_pulsering_stream_event_cb, pbuf); gst_pulsering_stream_event_cb, pbuf);
#endif #endif
@ -720,7 +720,7 @@ gst_pulseringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
GST_INFO_OBJECT (psink, "prebuf: %d", wanted.prebuf); GST_INFO_OBJECT (psink, "prebuf: %d", wanted.prebuf);
GST_INFO_OBJECT (psink, "minreq: %d", wanted.minreq); GST_INFO_OBJECT (psink, "minreq: %d", wanted.minreq);
#if HAVE_PULSE_0_9_20 #ifdef HAVE_PULSE_0_9_20
/* configure volume when we changed it, else we leave the default */ /* configure volume when we changed it, else we leave the default */
if (psink->volume_set) { if (psink->volume_set) {
GST_LOG_OBJECT (psink, "have volume of %f", psink->volume); GST_LOG_OBJECT (psink, "have volume of %f", psink->volume);
@ -734,12 +734,12 @@ gst_pulseringbuffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
/* construct the flags */ /* construct the flags */
flags = PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE | flags = PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE |
#if HAVE_PULSE_0_9_11 #ifdef HAVE_PULSE_0_9_11
PA_STREAM_ADJUST_LATENCY | PA_STREAM_ADJUST_LATENCY |
#endif #endif
PA_STREAM_START_CORKED; PA_STREAM_START_CORKED;
#if HAVE_PULSE_0_9_12 #ifdef HAVE_PULSE_0_9_12
if (psink->mute_set && psink->mute) if (psink->mute_set && psink->mute)
flags |= PA_STREAM_START_MUTED; flags |= PA_STREAM_START_MUTED;
#endif #endif
@ -1448,7 +1448,7 @@ gst_pulsesink_init_interfaces (GType type)
NULL, NULL,
NULL, NULL,
}; };
#if HAVE_PULSE_0_9_12 #ifdef HAVE_PULSE_0_9_12
static const GInterfaceInfo svol_iface_info = { static const GInterfaceInfo svol_iface_info = {
NULL, NULL, NULL NULL, NULL, NULL
}; };
@ -1486,7 +1486,7 @@ gst_pulsesink_base_init (gpointer g_class)
"width = (int) 32, " "width = (int) 32, "
"depth = (int) 32, " "depth = (int) 32, "
"rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 32 ];" "rate = (int) [ 1, MAX ], " "channels = (int) [ 1, 32 ];"
#if HAVE_PULSE_0_9_15 #ifdef HAVE_PULSE_0_9_15
"audio/x-raw-int, " "audio/x-raw-int, "
"endianness = (int) { " ENDIANNESS " }, " "endianness = (int) { " ENDIANNESS " }, "
"signed = (boolean) TRUE, " "signed = (boolean) TRUE, "
@ -1574,7 +1574,7 @@ gst_pulsesink_class_init (GstPulseSinkClass * klass)
"Human-readable name of the sound device", DEFAULT_DEVICE_NAME, "Human-readable name of the sound device", DEFAULT_DEVICE_NAME,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
#if HAVE_PULSE_0_9_12 #ifdef HAVE_PULSE_0_9_12
g_object_class_install_property (gobject_class, g_object_class_install_property (gobject_class,
PROP_VOLUME, PROP_VOLUME,
g_param_spec_double ("volume", "Volume", g_param_spec_double ("volume", "Volume",
@ -1692,7 +1692,7 @@ gst_pulsesink_finalize (GObject * object)
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
#if HAVE_PULSE_0_9_12 #ifdef HAVE_PULSE_0_9_12
static void static void
gst_pulsesink_set_volume (GstPulseSink * psink, gdouble volume) gst_pulsesink_set_volume (GstPulseSink * psink, gdouble volume)
{ {
@ -2042,7 +2042,7 @@ gst_pulsesink_set_property (GObject * object,
g_free (pulsesink->device); g_free (pulsesink->device);
pulsesink->device = g_value_dup_string (value); pulsesink->device = g_value_dup_string (value);
break; break;
#if HAVE_PULSE_0_9_12 #ifdef HAVE_PULSE_0_9_12
case PROP_VOLUME: case PROP_VOLUME:
gst_pulsesink_set_volume (pulsesink, g_value_get_double (value)); gst_pulsesink_set_volume (pulsesink, g_value_get_double (value));
break; break;
@ -2073,7 +2073,7 @@ gst_pulsesink_get_property (GObject * object,
case PROP_DEVICE_NAME: case PROP_DEVICE_NAME:
g_value_take_string (value, gst_pulsesink_device_description (pulsesink)); g_value_take_string (value, gst_pulsesink_device_description (pulsesink));
break; break;
#if HAVE_PULSE_0_9_12 #ifdef HAVE_PULSE_0_9_12
case PROP_VOLUME: case PROP_VOLUME:
g_value_set_double (value, gst_pulsesink_get_volume (pulsesink)); g_value_set_double (value, gst_pulsesink_get_volume (pulsesink));
break; break;
@ -2129,7 +2129,7 @@ name_failed:
} }
} }
#if HAVE_PULSE_0_9_11 #ifdef HAVE_PULSE_0_9_11
static void static void
gst_pulsesink_change_props (GstPulseSink * psink, GstTagList * l) gst_pulsesink_change_props (GstPulseSink * psink, GstTagList * l)
{ {
@ -2250,7 +2250,7 @@ gst_pulsesink_event (GstBaseSink * sink, GstEvent * event)
g_free (description); g_free (description);
g_free (buf); g_free (buf);
#if HAVE_PULSE_0_9_11 #ifdef HAVE_PULSE_0_9_11
gst_pulsesink_change_props (pulsesink, l); gst_pulsesink_change_props (pulsesink, l);
#endif #endif

View file

@ -262,7 +262,7 @@ gst_pulsesrc_init (GstPulseSrc * pulsesrc, GstPulseSrcClass * klass)
pulsesrc->read_buffer = NULL; pulsesrc->read_buffer = NULL;
pulsesrc->read_buffer_length = 0; pulsesrc->read_buffer_length = 0;
#if HAVE_PULSE_0_9_13 #ifdef HAVE_PULSE_0_9_13
pa_sample_spec_init (&pulsesrc->sample_spec); pa_sample_spec_init (&pulsesrc->sample_spec);
#else #else
pulsesrc->sample_spec.format = PA_SAMPLE_INVALID; pulsesrc->sample_spec.format = PA_SAMPLE_INVALID;
@ -533,7 +533,7 @@ gst_pulsesrc_stream_latency_update_cb (pa_stream * s, void *userdata)
"latency update (information unknown)"); "latency update (information unknown)");
return; return;
} }
#if HAVE_PULSE_0_9_11 #ifdef HAVE_PULSE_0_9_11
source_usec = info->configured_source_usec; source_usec = info->configured_source_usec;
#else #else
source_usec = 0; source_usec = 0;
@ -971,7 +971,7 @@ gst_pulsesrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec)
if (pa_stream_connect_record (pulsesrc->stream, pulsesrc->device, &wanted, if (pa_stream_connect_record (pulsesrc->stream, pulsesrc->device, &wanted,
PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_INTERPOLATE_TIMING |
PA_STREAM_AUTO_TIMING_UPDATE | PA_STREAM_NOT_MONOTONOUS | PA_STREAM_AUTO_TIMING_UPDATE | PA_STREAM_NOT_MONOTONOUS |
#if HAVE_PULSE_0_9_11 #ifdef HAVE_PULSE_0_9_11
PA_STREAM_ADJUST_LATENCY | PA_STREAM_ADJUST_LATENCY |
#endif #endif
PA_STREAM_START_CORKED) < 0) { PA_STREAM_START_CORKED) < 0) {

View file

@ -91,7 +91,7 @@ gst_pulse_fill_sample_spec (GstRingBufferSpec * spec, pa_sample_spec * ss)
ss->format = PA_SAMPLE_S32LE; ss->format = PA_SAMPLE_S32LE;
else if (spec->format == GST_S32_BE && spec->width == 32) else if (spec->format == GST_S32_BE && spec->width == 32)
ss->format = PA_SAMPLE_S32BE; ss->format = PA_SAMPLE_S32BE;
#if HAVE_PULSE_0_9_15 #ifdef HAVE_PULSE_0_9_15
else if (spec->format == GST_S24_3LE && spec->width == 24) else if (spec->format == GST_S24_3LE && spec->width == 24)
ss->format = PA_SAMPLE_S24LE; ss->format = PA_SAMPLE_S24LE;
else if (spec->format == GST_S24_3BE && spec->width == 24) else if (spec->format == GST_S24_3BE && spec->width == 24)