[pulseaudio-discuss] [PATCH 1/3] cardwidget: Add a port class

Tanu Kaskinen tanuk at iki.fi
Tue Jul 24 23:33:11 PDT 2012


On Sun, 2012-07-22 at 15:23 +0200, poljar (Damir Jelić) wrote:
> diff --git a/src/mainwindow.cc b/src/mainwindow.cc
> index dc84682..b167943 100644
> --- a/src/mainwindow.cc
> +++ b/src/mainwindow.cc
> @@ -290,6 +290,25 @@ void MainWindow::updateCard(const pa_card_info &info) {
>  
>      w->activeProfile = info.active_profile ? info.active_profile->name : "";
>  
> +    w->ports.clear();
> +    if (pa_context_get_server_protocol_version(get_context()) >= 26) {
> +        for (uint32_t i = 0; i < info.n_ports; ++i) {

I don't think you need to check for the protocol version. libpulse will
initialize the card info with sane defaults (in this case, n_ports will
be 0, so the code that accesses the port data will not get executed).

-- 
Tanu



More information about the pulseaudio-discuss mailing list