From dcfd02b63f5d90b84d20e8b068df340ba8857ecc Mon Sep 17 00:00:00 2001 From: Michal Ratajsky Date: Thu, 20 Nov 2014 20:43:42 +0100 Subject: pulse: Optimize conversion of channel constants --- backends/pulse/pulse-ext-stream.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'backends/pulse/pulse-ext-stream.c') diff --git a/backends/pulse/pulse-ext-stream.c b/backends/pulse/pulse-ext-stream.c index 8e503b2..5922ef5 100644 --- a/backends/pulse/pulse-ext-stream.c +++ b/backends/pulse/pulse-ext-stream.c @@ -524,15 +524,17 @@ pulse_ext_stream_get_channel_position (MateMixerStreamControl *mmsc, guint chann if (channel >= ext->priv->channel_map.channels) return MATE_MIXER_CHANNEL_UNKNOWN; - return pulse_convert_position_from_pulse (ext->priv->channel_map.map[channel]); + if (ext->priv->channel_map.map[channel] == PA_CHANNEL_POSITION_INVALID) + return MATE_MIXER_CHANNEL_UNKNOWN; + + return pulse_channel_map_from[ext->priv->channel_map.map[channel]]; } static gboolean pulse_ext_stream_has_channel_position (MateMixerStreamControl *mmsc, MateMixerChannelPosition position) { - PulseExtStream *ext; - pa_channel_position_t p; + PulseExtStream *ext; g_return_val_if_fail (PULSE_IS_EXT_STREAM (mmsc), FALSE); @@ -540,12 +542,11 @@ pulse_ext_stream_has_channel_position (MateMixerStreamControl *mmsc, /* Handle invalid position as a special case, otherwise this function would * return TRUE for e.g. unknown index in a default channel map */ - p = pulse_convert_position_to_pulse (position); - - if (p == PA_CHANNEL_POSITION_INVALID) + if (pulse_channel_map_to[position] == PA_CHANNEL_POSITION_INVALID) return FALSE; - if (pa_channel_map_has_position (&ext->priv->channel_map, p) != 0) + if (pa_channel_map_has_position (&ext->priv->channel_map, + pulse_channel_map_to[position]) != 0) return TRUE; else return FALSE; -- cgit v1.2.1