diff options
author | Michal Ratajsky <[email protected]> | 2014-11-20 20:43:42 +0100 |
---|---|---|
committer | Michal Ratajsky <[email protected]> | 2014-11-20 20:43:42 +0100 |
commit | dcfd02b63f5d90b84d20e8b068df340ba8857ecc (patch) | |
tree | 4655dda6339e0650b37072cdcfe23d4166ae55a5 /backends/pulse/pulse-ext-stream.c | |
parent | 700e96a656a0fdd8893b1a280f6e2f685ff43daf (diff) | |
download | libmatemixer-dcfd02b63f5d90b84d20e8b068df340ba8857ecc.tar.bz2 libmatemixer-dcfd02b63f5d90b84d20e8b068df340ba8857ecc.tar.xz |
pulse: Optimize conversion of channel constants
Diffstat (limited to 'backends/pulse/pulse-ext-stream.c')
-rw-r--r-- | backends/pulse/pulse-ext-stream.c | 15 |
1 files changed, 8 insertions, 7 deletions
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; |