From patchwork Wed Feb 20 21:37:40 2019 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: 1045571 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="QHLTOxH/"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 444WFg5mJfz9s6w for ; Thu, 21 Feb 2019 08:39:03 +1100 (AEDT) Received: from localhost ([127.0.0.1]:49231 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwZa1-0006H1-NG for incoming@patchwork.ozlabs.org; Wed, 20 Feb 2019 16:39:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwZZ6-0006Da-5Q for qemu-devel@nongnu.org; Wed, 20 Feb 2019 16:38:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gwZZ4-0000o7-OX for qemu-devel@nongnu.org; Wed, 20 Feb 2019 16:38:04 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:45652) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gwZZ2-0000bo-PZ for qemu-devel@nongnu.org; Wed, 20 Feb 2019 16:38:01 -0500 Received: by mail-wr1-x443.google.com with SMTP id w17so27662207wrn.12 for ; Wed, 20 Feb 2019 13:37:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sUrvUdsJS81ik52fvDkraOkbNDIy7RhT7EKhtk4mtEw=; b=QHLTOxH/0Ec3JQ+dSZ4s64Td6ylr9JfgqsuStjLot9qCfjC1Sp+9J/meEKzkfcA321 eEFQndEGtkbCxf3By9ll0SdwvO+2L95POzOlA+WjMss/xOgBVmECng3cH3R9IbKs3oG3 qTzivfblaNiowJ5sE3TUy4KuaHozX/L7IqDcOgchQS2xNk7IUSAakdnre+2oPOPIJuNA 7JJDnA1G53XAdEiQipV2oc7r/0LABmhB/G0M2QurC1c/ZEWW2KKiu4/dFl9u3Xm5ezg7 9z6K5qW0bMSsvbqzQmjAejDJJCMxmzwqNEZI1a52Ozn+6PqtnQXlF3WN6tRWE37G46Ha ZD5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sUrvUdsJS81ik52fvDkraOkbNDIy7RhT7EKhtk4mtEw=; b=VldX79P8IOdaxYIUq0JtyHKORbuoGqQhbgbhNfvgAHUgm7hVKTXdTpFJqbFFYZcltO cLP2ohjCeXnlHBZVYb82IvgLm4nrzspkgeyVw0RiqR3SWXK/MsWct80PX9HisXwQsDLr A1Ih4e77mMTIEm/PjaLbafm9hRFCHBnbfTHOGOZlSW2OjhkT7WGYK4kDjo8ykMiYvmM1 urFZgdeTs+UaLvIYUCGw/LddQjKZp+HJmPqU1jWAUOuaR7j4Q7DkOfP3cx11qRCnHU8Q C7qGFgcK0apQ3LKkyiSvthmmZHmrJbi5wEvsvXfkBTpyazdfBGyVc+JbBCczRX6XMM9r lvkw== X-Gm-Message-State: AHQUAubdOMizT6kZKsySD+HoM0SGNtmqVBQd+JjmorTeGcBFjZKCz4Tj eo6jTPfCCwVELc+ZU3BQoM+Fk1M3FOo= X-Google-Smtp-Source: AHgI3IYiV9Wcia+Xc+pkNtQPhA2knb/4nQwiCPreqKXTxzB8PCFAwOUbXlsQC/JEDg4YPz5LTj6gRg== X-Received: by 2002:a5d:4e8c:: with SMTP id e12mr25416033wru.21.1550698675768; Wed, 20 Feb 2019 13:37:55 -0800 (PST) Received: from nullptr.home.dirty-ice.org (2a01-036c-0113-6fd0-0000-0000-0000-0005.pool6.digikabel.hu. [2a01:36c:113:6fd0::5]) by smtp.gmail.com with ESMTPSA id o18sm66452489wrg.40.2019.02.20.13.37.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Feb 2019 13:37:55 -0800 (PST) From: "=?UTF-8?q?K=C5=91v=C3=A1g=C3=B3=2C=20Zolt=C3=A1n?=" X-Google-Original-From: =?utf-8?b?S8WRdsOhZ8OzLCBab2x0w6Fu?= To: qemu-devel@nongnu.org Date: Wed, 20 Feb 2019 22:37:40 +0100 Message-Id: <640df9b8b69ecf08ba846edff3dd6fdd34a1eca4.1550698466.git.DirtY.iCE.hu@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::443 Subject: [Qemu-devel] [PATCH v5 11/14] sdlaudio: port to -audiodev config X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Kővágó, Zoltán --- audio/audio_legacy.c | 12 ++++++++++++ audio/sdlaudio.c | 22 ++++------------------ 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/audio/audio_legacy.c b/audio/audio_legacy.c index 6e99975f63..f730aa5bd6 100644 --- a/audio/audio_legacy.c +++ b/audio/audio_legacy.c @@ -279,6 +279,14 @@ static void handle_pa(Audiodev *dev) get_str("QEMU_PA_SERVER", &dev->u.pa.server, &dev->u.pa.has_server); } +/* SDL */ +static void handle_sdl(Audiodev *dev) +{ + /* SDL is output only */ + get_samples_to_usecs("QEMU_SDL_SAMPLES", &dev->u.sdl.out->buffer_len, + &dev->u.sdl.out->has_buffer_len, dev->u.sdl.out); +} + /* general */ static void handle_per_direction( AudiodevPerDirectionOptions *pdo, const char *prefix) @@ -340,6 +348,10 @@ static AudiodevListEntry *legacy_opt(const char *drvname) handle_pa(e->dev); break; + case AUDIODEV_DRIVER_SDL: + handle_sdl(e->dev); + break; + default: break; } diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index 097841fde1..71aedaa9ef 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -49,12 +49,6 @@ typedef struct SDLVoiceOut { int decr; } SDLVoiceOut; -static struct { - int nb_samples; -} conf = { - .nb_samples = 1024 -}; - static struct SDLAudioState { int exit; #if USE_SEMAPHORE @@ -63,6 +57,7 @@ static struct SDLAudioState { #endif int initialized; bool driver_created; + Audiodev *dev; } glob_sdl; typedef struct SDLAudioState SDLAudioState; @@ -392,7 +387,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->u.sdl.out, as, 11610); req.callback = sdl_callback; req.userdata = sdl; @@ -467,6 +462,7 @@ static void *sdl_audio_init(Audiodev *dev) #endif s->driver_created = true; + s->dev = dev; return s; } @@ -480,18 +476,9 @@ static void sdl_audio_fini (void *opaque) #endif 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, @@ -503,7 +490,6 @@ static struct audio_pcm_ops sdl_pcm_ops = { static 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,