From patchwork Mon Jan 28 22:43:34 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: 1032298 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="m+bSl+Am"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43pQ8S3Fr8z9sDB for ; Tue, 29 Jan 2019 10:00:40 +1100 (AEDT) Received: from localhost ([127.0.0.1]:39836 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goFtO-0003Jy-EL for incoming@patchwork.ozlabs.org; Mon, 28 Jan 2019 18:00:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1goFdD-0007rh-Lm for qemu-devel@nongnu.org; Mon, 28 Jan 2019 17:43:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1goFd9-0003Sh-6b for qemu-devel@nongnu.org; Mon, 28 Jan 2019 17:43:54 -0500 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:36643) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1goFd8-0003RV-Sa for qemu-devel@nongnu.org; Mon, 28 Jan 2019 17:43:51 -0500 Received: by mail-wr1-x443.google.com with SMTP id u4so19968666wrp.3 for ; Mon, 28 Jan 2019 14:43:50 -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=deAd8dOPwdCqLDQYNQLT4suKt6RwB9UGY3ls6YzM4WU=; b=m+bSl+AmZtNhy+t9a3V6Mx7XDZVg9T07+etPhnIwSzU3gvT3JAyhmBh90k2SHznBwM kF5AnrKCbTHNVu+92UeDHJ3CNnyicSlXINJrQYSd6yVfvrC03u21+hZ09xb/zO0uDC2D isMwISjr2wmaD+R1WxPr00UdomP3lWf2qqD0qZbeYUE1+vgH45EU75oLr4F7HkHQxaFm sM5lex6R1jYcwmRQod+3jsKY0RRe+qNuKpOTlH9m7+o9Eb/rcg1/WOEmUYVA2Rz7RWE6 t20jkhTzmZIax6159HO4epKNpZ+43senu7/Nx7P3MxT3Tn5SyTiF84WaIaS4o6p0HxEB U+6A== 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=deAd8dOPwdCqLDQYNQLT4suKt6RwB9UGY3ls6YzM4WU=; b=PFbXsP543YVkCd3sgbQgYfZmYx16kXQmlbqLX4W6j2YSd+FBw3xPXrhO8SdU6Ucd8b 2dUFas4mAKg5pBDh72KePpdPIwNMBlNmXg7j/Qjdb7vRsYocCztY2ha61zWgB0Ldr3pI lgZ3iS1G5Zpe6F15Mv0JsaEMrds9x/9MQuksbNeMXbpk9LLWjnzFPM7N3eKlz0mgzKsY whTwIEKWEym4npPui4j01PXbqz1LASkns/0XMm9JOVKq4xXLuY3iIAnMC8cju29NKLfV gTgr1shJEvfvQA64VR7QbNmNB2wzEsuKlnhh2heJw5i1zae4lGShoELA1Sngx8+CRjO0 hoJA== X-Gm-Message-State: AJcUuke/4ODK0rAvSN/8wn7bqCQaeJgp4y1GqvpxF4797OeQiNqEWV7G vrEtn3msGPrvNrCJPA7VknImjSziVmIYpg== X-Google-Smtp-Source: ALg8bN4JivzVQsDAec8hazqHW+/Xc4H9FWn2zg71bXA9bVOOL0ILB+puI84R9WIaT/vkdI0Cnkaj7g== X-Received: by 2002:adf:900f:: with SMTP id h15mr23461060wrh.18.1548715429374; Mon, 28 Jan 2019 14:43:49 -0800 (PST) Received: from nullptr.home.dirty-ice.org (2a01-036c-0113-2152-0000-0000-0000-0005.pool6.digikabel.hu. [2a01:36c:113:2152::5]) by smtp.gmail.com with ESMTPSA id k7sm100088187wrl.51.2019.01.28.14.43.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Jan 2019 14:43:48 -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: Mon, 28 Jan 2019 23:43:34 +0100 Message-Id: <0e99034cf5499c02bd66b80aa83774d0cb68dba7.1548714862.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 v4 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 d8cd5e27f6..214774b947 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); } +/* 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 *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..cf6ac19927 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->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,