From patchwork Thu Jan 14 13:45:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?UTF-8?B?Wm9sdMOhbiBLxZF2w6Fnw7M=?= X-Patchwork-Id: 567436 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id B787514029E for ; Fri, 15 Jan 2016 00:53:39 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=QoQqmHmn; dkim-atps=neutral Received: from localhost ([::1]:42576 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJiLJ-0004PQ-Nh for incoming@patchwork.ozlabs.org; Thu, 14 Jan 2016 08:53:37 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJiEJ-0001FK-Ip for qemu-devel@nongnu.org; Thu, 14 Jan 2016 08:46:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJiEG-0003QO-92 for qemu-devel@nongnu.org; Thu, 14 Jan 2016 08:46:23 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:35677) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJiEG-0003PO-1K for qemu-devel@nongnu.org; Thu, 14 Jan 2016 08:46:20 -0500 Received: by mail-wm0-x242.google.com with SMTP id f206so43693000wmf.2 for ; Thu, 14 Jan 2016 05:46:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=uzBV+rtHMdUYOzHayel/cJCy+iTmR5/w8T0xEwiQL/I=; b=QoQqmHmnxEW5GbxDeZXMt2XRaMU8KFSK6+Z2Dv77DoK310ZL45uWexVCzbEW0tXfvI Ywxv9CZJGFf+aPTmVw0QsNQm3vBm++i8eyyMmiHZKmSnHoUrhU7EHPe5HKlXFhStlBF0 iOq/MZpfnB7QBtcxohIpppqeCC8GQxtoNKtTn4Wm2JTGmkCvFyWMu1wf+/KMy7qAMz3k BTqKUNRQyenSyMZSygdTCGhueDDGe8BhiNRybBFteiwVEBQQj/0ORZTrGK0aVojvggXk O+8l+ftOpK5ZKAETrra+otxMo9icEBmKSKFkzSIJgeJOIFD5bcCyfq3GsPOI1ZIYQPMP 770g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=uzBV+rtHMdUYOzHayel/cJCy+iTmR5/w8T0xEwiQL/I=; b=W4/sueNzUGsHfBBUkihnJFq99IFddqnHyVyVYy2qg+xbp2mTzijeE9bGw3/MOOf7sf b6cvsGxo4rbI+8X8p5kdzJ4f8zhBoGLiLBrYlrl7+XbRKjqp0egkfrzgYmTUikLu6pSZ p/izUehawkVs7ePT320PNRQXN5dOQWxrCm2t2eEG8kHz5yMp/+F5glWeQA9Bac22Wu6t I5Cc2TDP1e0FV8nnHApVzuHGelPYC9DJm813pSiBlQMRmvjpVeiKltKWexoNL/D6lFPi xlxoL7oWdTRK0/C9oBJXIsskdMf6cBVZqHgZkixKlltp3ONpo68sSvCbmfirip0fWDRa OApg== X-Gm-Message-State: ALoCoQl6hGXHps3afvHQ1X1aZZfdnLJzRHdGGzCfqhNiMtNbIH/l9/TmW0OI9xaNCtMNzs74eTH/yrKtf33zzk3E6EBmr8ZvXA== X-Received: by 10.194.172.35 with SMTP id az3mr4983842wjc.64.1452779179528; Thu, 14 Jan 2016 05:46:19 -0800 (PST) Received: from nullptr.home.dirty-ice.org (188-143-126-18.pool.digikabel.hu. [188.143.126.18]) by smtp.gmail.com with ESMTPSA id 79sm7398061wmo.7.2016.01.14.05.46.18 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Jan 2016 05:46:19 -0800 (PST) From: "=?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?=" X-Google-Original-From: =?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?= To: qemu-devel@nongnu.org Date: Thu, 14 Jan 2016 14:45:26 +0100 Message-Id: <9e579e4c14dedba4fa77b80d41a4f6fdfa96d318.1452776884.git.DirtY.iCE.hu@gmail.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 13/51] sdlaudio: port to -audiodev config 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: Kővágó, Zoltán --- audio/audio_legacy.c | 7 +++++++ audio/sdlaudio.c | 22 ++++------------------ 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/audio/audio_legacy.c b/audio/audio_legacy.c index 3eab2b9..4d8e2b9 100644 --- a/audio/audio_legacy.c +++ b/audio/audio_legacy.c @@ -100,6 +100,11 @@ SimpleEnvMap pa_map[] = { { /* End of list */ } }; +SimpleEnvMap sdl_map[] = { + { "QEMU_SDL_SAMPLES", "buffer-len", ENV_TRANSFORM_SAMPLES_TO_USECS_OUT }, + { /* End of list */ } +}; + static unsigned long long toull(const char *str) { unsigned long long ret; @@ -278,6 +283,8 @@ static void legacy_opt(const char *drv) handle_env_opts(opts, oss_map); } else if (strcmp(drv, "pa") == 0) { handle_env_opts(opts, pa_map); + } else if (strcmp(drv, "sdl") == 0) { + handle_env_opts(opts, sdl_map); } } diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index 580c613..796238a 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -44,18 +44,13 @@ typedef struct SDLVoiceOut { int decr; } SDLVoiceOut; -static struct { - int nb_samples; -} conf = { - .nb_samples = 1024 -}; - static struct SDLAudioState { int exit; SDL_mutex *mutex; SDL_sem *sem; int initialized; bool driver_created; + Audiodev *dev; } glob_sdl; typedef struct SDLAudioState SDLAudioState; @@ -347,7 +342,7 @@ static int sdl_init_out(HWVoiceOut *hw, struct audsettings *as, req.freq = as->freq; req.format = aud_to_sdlfmt (as->fmt); req.channels = as->nchannels; - req.samples = conf.nb_samples; + req.samples = audio_buffer_samples(s->dev->out, as, 11610); req.callback = sdl_callback; req.userdata = sdl; @@ -420,6 +415,7 @@ static void *sdl_audio_init(Audiodev *dev) } s->driver_created = true; + s->dev = dev; return s; } @@ -431,18 +427,9 @@ static void sdl_audio_fini (void *opaque) SDL_DestroyMutex (s->mutex); SDL_QuitSubSystem (SDL_INIT_AUDIO); s->driver_created = false; + s->dev = NULL; } -static struct audio_option sdl_options[] = { - { - .name = "SAMPLES", - .tag = AUD_OPT_INT, - .valp = &conf.nb_samples, - .descr = "Size of SDL buffer in samples" - }, - { /* End of list */ } -}; - static struct audio_pcm_ops sdl_pcm_ops = { .init_out = sdl_init_out, .fini_out = sdl_fini_out, @@ -454,7 +441,6 @@ static struct audio_pcm_ops sdl_pcm_ops = { struct audio_driver sdl_audio_driver = { .name = "sdl", .descr = "SDL http://www.libsdl.org", - .options = sdl_options, .init = sdl_audio_init, .fini = sdl_audio_fini, .pcm_ops = &sdl_pcm_ops,