From patchwork Thu May 3 20:41:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 156773 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 60D63B6FC8 for ; Fri, 4 May 2012 06:41:47 +1000 (EST) Received: from localhost ([::1]:40351 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQ2qP-0001So-4K for incoming@patchwork.ozlabs.org; Thu, 03 May 2012 16:41:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34042) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQ2qH-0001SW-Q6 for qemu-devel@nongnu.org; Thu, 03 May 2012 16:41:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SQ2qF-0007zN-UC for qemu-devel@nongnu.org; Thu, 03 May 2012 16:41:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57231) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SQ2qF-0007yw-Ky for qemu-devel@nongnu.org; Thu, 03 May 2012 16:41:35 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q43KfU8C021733 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 3 May 2012 16:41:30 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-68.ams2.redhat.com [10.36.116.68]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q43KfTe5001584; Thu, 3 May 2012 16:41:30 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id CC25D42940; Thu, 3 May 2012 22:41:28 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 3 May 2012 22:41:28 +0200 Message-Id: <1336077688-27078-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH] fix build with pulseaudio versions older than 0.9.11 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Gerd Hoffmann --- audio/paaudio.c | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-) diff --git a/audio/paaudio.c b/audio/paaudio.c index aa15f16..8b69778 100644 --- a/audio/paaudio.c +++ b/audio/paaudio.c @@ -56,6 +56,26 @@ static void GCC_FMT_ATTR (2, 3) qpa_logerr (int err, const char *fmt, ...) AUD_log (AUDIO_CAP, "Reason: %s\n", pa_strerror (err)); } +#ifndef PA_CONTEXT_IS_GOOD +static inline int PA_CONTEXT_IS_GOOD(pa_context_state_t x) +{ + return + x == PA_CONTEXT_CONNECTING || + x == PA_CONTEXT_AUTHORIZING || + x == PA_CONTEXT_SETTING_NAME || + x == PA_CONTEXT_READY; +} +#endif + +#ifndef PA_STREAM_IS_GOOD +static inline int PA_STREAM_IS_GOOD(pa_stream_state_t x) +{ + return + x == PA_STREAM_CREATING || + x == PA_STREAM_READY; +} +#endif + #define CHECK_SUCCESS_GOTO(c, rerror, expression, label) \ do { \ if (!(expression)) { \ @@ -481,12 +501,16 @@ static pa_stream *qpa_simple_new ( if (dir == PA_STREAM_PLAYBACK) { r = pa_stream_connect_playback (stream, dev, attr, PA_STREAM_INTERPOLATE_TIMING +#ifdef PA_STREAM_ADJUST_LATENCY |PA_STREAM_ADJUST_LATENCY +#endif |PA_STREAM_AUTO_TIMING_UPDATE, NULL, NULL); } else { r = pa_stream_connect_record (stream, dev, attr, PA_STREAM_INTERPOLATE_TIMING +#ifdef PA_STREAM_ADJUST_LATENCY |PA_STREAM_ADJUST_LATENCY +#endif |PA_STREAM_AUTO_TIMING_UPDATE); } @@ -681,7 +705,9 @@ static int qpa_ctl_out (HWVoiceOut *hw, int cmd, ...) pa_cvolume v; paaudio *g = &glob_paaudio; - pa_cvolume_init (&v); +#ifdef PA_CHECK_VERSION /* macro is present in 0.9.16+ */ + pa_cvolume_init (&v); /* function is present in 0.9.13+ */ +#endif switch (cmd) { case VOICE_VOLUME: @@ -731,7 +757,9 @@ static int qpa_ctl_in (HWVoiceIn *hw, int cmd, ...) pa_cvolume v; paaudio *g = &glob_paaudio; +#ifdef PA_CHECK_VERSION pa_cvolume_init (&v); +#endif switch (cmd) { case VOICE_VOLUME: