From nobody Fri Nov 7 03:56:43 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547682171636360.49331887608184; Wed, 16 Jan 2019 15:42:51 -0800 (PST) Received: from localhost ([127.0.0.1]:60507 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjupS-0007qZ-Tj for importer@patchew.org; Wed, 16 Jan 2019 18:42:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gjuks-00046w-4h for qemu-devel@nongnu.org; Wed, 16 Jan 2019 18:37:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gjukk-0002v9-5o for qemu-devel@nongnu.org; Wed, 16 Jan 2019 18:37:52 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:42513) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gjukj-0002ik-Qy for qemu-devel@nongnu.org; Wed, 16 Jan 2019 18:37:46 -0500 Received: by mail-wr1-x441.google.com with SMTP id q18so8927777wrx.9 for ; Wed, 16 Jan 2019 15:37:36 -0800 (PST) Received: from nullptr.home.dirty-ice.org (2a01-036c-0113-e4b0-0000-0000-0000-0005.pool6.digikabel.hu. [2a01:36c:113:e4b0::5]) by smtp.gmail.com with ESMTPSA id s66sm30760437wmf.34.2019.01.16.15.37.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 Jan 2019 15:37:34 -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=u6ZAZabkyvPqDFL2JNe3x51ANLXtVEqROa82KNWp6DA=; b=vbqLK5aM168IoLu3PAtj4Pv1Otgv9+K1DeAMgHTAngfa0pv2Fo+hV833xnabeggfK2 Bp8etncg3dYbSIfwXcsnjuMUFv4z6yQCXRGFAyq7hKxiaopMIvfqumQCoc7VGIufG/MH GxWq1DBftoRLQG1a2mg4Epz8a0NeeMl3oYmJYt5fqOWsRLCTdWa3mbohquPvZjj98Y7o 6ahT9egecaTQ7d2rXCpWEFaD9TS/dG4BjK3vje4GyDUh34GK8OX5G78lw7VcLSO758id ComPwBJ1fyl1I2COaEDjRw2uC+mzW6eYuTdbw/rlrdR4Ohm2MBDIUNyT4fXbp6C2uVBu IWYw== 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=u6ZAZabkyvPqDFL2JNe3x51ANLXtVEqROa82KNWp6DA=; b=mOZ446+uvXdrkNTcKbTSjMuDi39fax/EMXvH960hy4gzIIA6jQMTn0NlSGQjLvs8T8 OyCYUP3ADyR+qDLRewHWb6CiXfhY9jrVdLVJR6zn+j/3NRg7Fsx6MuL830apAx68hNdL Gh3hAt8SbVfccfCFSSuKADgUscm3/w2cZn0zfGeEtzZTT/coc+u+KwXb3Tih5C9arYzw P1UEM6uIG/5bqKFADQRMhwARTZ8uEI4HWWfcHFvrmDdtMBrWDnmIRaAxkTRub38mdlMd xuu18iS+FgRMNUd9eFHf2wqVQ4ZUi1vuDGdg1Drap6nKzkh/XP0SjLtR/UK9G5BVMi/t eNhQ== X-Gm-Message-State: AJcUukfAIMj+JtHqprLJDwSyHLXNxvUMSxYLS5OmIwmHYid6piafsB1T F1aFXbFuqN8QST7vbBRfuaOMywZPt8c= X-Google-Smtp-Source: ALg8bN5SFiQyuGphFaCROPWZCo8ZRJBYyEptlHqme9DQdzWjzuEIs2mHh+EJF0ujFub2l6R+0RifUA== X-Received: by 2002:adf:f550:: with SMTP id j16mr9381203wrp.258.1547681855304; Wed, 16 Jan 2019 15:37:35 -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, 17 Jan 2019 00:36:44 +0100 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::441 Subject: [Qemu-devel] [PATCH v3 11/50] 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+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Signed-off-by: K=C5=91v=C3=A1g=C3=B3, Zolt=C3=A1n --- 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 d173ff042e..aa6c789096 100644 --- a/audio/audio_legacy.c +++ b/audio/audio_legacy.c @@ -285,6 +285,14 @@ static void handle_pa(Audiodev *dev) get_str("QEMU_PA_SERVER", &dev->u.pa.server, &dev->u.pa.has_server); } =20 +/* SDL */ +static void handle_sdl(Audiodev *dev) +{ + /* SDL is output only */ + get_samples_to_usecs("QEMU_SDL_SAMPLES", &dev->out->buffer_len, + &dev->out->has_buffer_len, dev->out); +} + /* general */ static void handle_per_direction( AudiodevPerDirectionOptions *pdo, const char *prefix) @@ -348,6 +356,10 @@ static AudiodevListEntry *legacy_opt(const char *drvna= me) handle_pa(e->dev); break; =20 + case AUDIODEV_DRIVER_SDL: + handle_sdl(e->dev); + break; + default: break; } diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index 097841fde1..cf6ac19927 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -49,12 +49,6 @@ typedef struct SDLVoiceOut { int decr; } SDLVoiceOut; =20 -static struct { - int nb_samples; -} conf =3D { - .nb_samples =3D 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; =20 @@ -392,7 +387,7 @@ static int sdl_init_out(HWVoiceOut *hw, struct audsetti= ngs *as, req.freq =3D as->freq; req.format =3D aud_to_sdlfmt (as->fmt); req.channels =3D as->nchannels; - req.samples =3D conf.nb_samples; + req.samples =3D audio_buffer_samples(s->dev->out, as, 11610); req.callback =3D sdl_callback; req.userdata =3D sdl; =20 @@ -467,6 +462,7 @@ static void *sdl_audio_init(Audiodev *dev) #endif =20 s->driver_created =3D true; + s->dev =3D dev; return s; } =20 @@ -480,18 +476,9 @@ static void sdl_audio_fini (void *opaque) #endif SDL_QuitSubSystem (SDL_INIT_AUDIO); s->driver_created =3D false; + s->dev =3D NULL; } =20 -static struct audio_option sdl_options[] =3D { - { - .name =3D "SAMPLES", - .tag =3D AUD_OPT_INT, - .valp =3D &conf.nb_samples, - .descr =3D "Size of SDL buffer in samples" - }, - { /* End of list */ } -}; - static struct audio_pcm_ops sdl_pcm_ops =3D { .init_out =3D sdl_init_out, .fini_out =3D sdl_fini_out, @@ -503,7 +490,6 @@ static struct audio_pcm_ops sdl_pcm_ops =3D { static struct audio_driver sdl_audio_driver =3D { .name =3D "sdl", .descr =3D "SDL http://www.libsdl.org", - .options =3D sdl_options, .init =3D sdl_audio_init, .fini =3D sdl_audio_fini, .pcm_ops =3D &sdl_pcm_ops, --=20 2.20.1