diff options
author | Dave Reisner <dreisner@archlinux.org> | 2013-01-01 21:07:29 -0500 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2013-01-01 21:07:29 -0500 |
commit | 544047c06ffc7be6fa7f22f895eaab691038ee22 (patch) | |
tree | 5a1c7771e3178ed6c74e6f1ed38605151dbad003 | |
parent | 2a529357b7516922c600e5e95815da9f32dda3c9 (diff) | |
download | mirror-ponymix-544047c06ffc7be6fa7f22f895eaab691038ee22.tar.gz mirror-ponymix-544047c06ffc7be6fa7f22f895eaab691038ee22.tar.bz2 mirror-ponymix-544047c06ffc7be6fa7f22f895eaab691038ee22.zip |
fix null constructions
-rw-r--r-- | pulse.cc | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -493,7 +493,7 @@ Card::Card(const pa_card_info* info) : Device::Device(const pa_sink_info* info) : type_(DEVTYPE_SINK), index_(info->index), - name_(info->name), + name_(!info->name.empty() ? info->name : ""), desc_(info->description), mute_(info->mute) { update_volume(info->volume); @@ -508,7 +508,7 @@ Device::Device(const pa_sink_info* info) : Device::Device(const pa_source_info* info) : type_(DEVTYPE_SOURCE), index_(info->index), - name_(info->name), + name_(!info->name.empty() ? info->name : ""), desc_(info->description), mute_(info->mute) { update_volume(info->volume); @@ -523,13 +523,16 @@ Device::Device(const pa_source_info* info) : Device::Device(const pa_sink_input_info* info) : type_(DEVTYPE_SINK_INPUT), index_(info->index), - name_(info->name), - desc_(pa_proplist_gets(info->proplist, PA_PROP_APPLICATION_NAME)), + name_(!info->name.empty() ? info->name : ""), mute_(info->mute) { update_volume(info->volume); memcpy(&channels_, &info->channel_map, sizeof(pa_channel_map)); balance_ = pa_cvolume_get_balance(&volume_, &channels_) * 100.0; + const char *desc = pa_proplist_gets(info->proplist, + PA_PROP_APPLICATION_NAME); + if (desc) desc_ = desc; + ops_.SetVolume = pa_context_set_sink_input_volume; ops_.Mute = pa_context_set_sink_input_mute; ops_.Kill = pa_context_kill_sink_input; @@ -539,13 +542,16 @@ Device::Device(const pa_sink_input_info* info) : Device::Device(const pa_source_output_info* info) : type_(DEVTYPE_SOURCE_OUTPUT), index_(info->index), - name_(info->name), - desc_(pa_proplist_gets(info->proplist, PA_PROP_APPLICATION_NAME)), + name_(!info->name.empty() ? info->name : ""), mute_(info->mute) { update_volume(info->volume); volume_percent_ = volume_as_percent(&volume_); balance_ = pa_cvolume_get_balance(&volume_, &channels_) * 100.0; + const char *desc = pa_proplist_gets(info->proplist, + PA_PROP_APPLICATION_NAME); + if (desc) desc_ = desc; + ops_.SetVolume = pa_context_set_source_output_volume; ops_.Mute = pa_context_set_source_output_mute; ops_.Kill = pa_context_kill_source_output; |