From nobody Sun Nov 9 14:50:03 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 1550699308223346.32761977523046; Wed, 20 Feb 2019 13:48:28 -0800 (PST) Received: from localhost ([127.0.0.1]:49376 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwZj7-00063t-52 for importer@patchew.org; Wed, 20 Feb 2019 16:48:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gwZZA-0006Ez-Nm for qemu-devel@nongnu.org; Wed, 20 Feb 2019 16:38:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gwZZ5-0000rT-U2 for qemu-devel@nongnu.org; Wed, 20 Feb 2019 16:38:08 -0500 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]:35132) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gwZZ5-0000Bm-BR for qemu-devel@nongnu.org; Wed, 20 Feb 2019 16:38:03 -0500 Received: by mail-wr1-x441.google.com with SMTP id t18so27792819wrx.2 for ; Wed, 20 Feb 2019 13:37:47 -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.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Feb 2019 13:37:45 -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=7HQRNL6LRrb80P4AJB/2fxb+K5PpN3lBEq3bPhXYeXI=; b=oAhRTVTH51KtNfZx+f5fBc+al5bNgWARzK97L0UmD8do0URr3LH8OhWD/p+QEF0C0i SwoY3XlXAJGJvE7MGcyDoABqbRVTdTwhNR9CGzp3kl3RY1bYGRdWztHeKJElk+qOeSfz BOZz0RCXNUX0AcpzWUzTYlQc+FtG7t24CGfVvM2AMICR2Tisijvi9qNpCBK8EE6vZ6Hy t2Q1FUIefSL7mzwRRWLlpKeyO//XZovv2pVSHRA8EhmXuEn6/uerEYTzvOqg7k72/wFv fbTAqxiRtD0hU5TVRwMcNV8hyAXfc/mgroMPZKIb33KWq6HAVg87lvfa4LeTQ/Yuxr4f kbUQ== 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=7HQRNL6LRrb80P4AJB/2fxb+K5PpN3lBEq3bPhXYeXI=; b=BzA7uqIwUBOqnYxq5V5hZh0GKwrsu1dFZWK+aMJAXss+LyVVzuhAuwiWW4SFDhOgb+ vd5qBisradINGIzts33L6IFqnpjAkZlSVqfoCAwdQbwt6zMNDTWgl4AQ87q1xXR5zEoR eYIpKZrBk3SJPgoOuwvxpbzPXSoKOfhvwYivRHQdMvYet2B5s2E9P5KrR2z+TWovuKbk m3uIg/XikaiBpwzTh9p8ty7LlRRVRHFCMbP0G86VynVytqIi7QNz6Ir8DJ6cD6Esl9KF M7NT1pX4A+a/BoNUNw5spWegcgBLQjS4cGnnMyyqItCRQMJLzY6IttuM64PAGCrcr7aU JooQ== X-Gm-Message-State: AHQUAubUXgSdhfleot16Yu0ERQ7e4uKQw1VCHQEErG+HegZWlx6m1BvZ ov5YP5SRSo960lgl2uoSjfDCjuzv X-Google-Smtp-Source: AHgI3IZc4IJHMWJqAdSzDGujfOTeYHoHWB22SwZ51nRSRNd3V4i0Lj4zdUmqi1lsYEpB791g8guErA== X-Received: by 2002:a5d:6542:: with SMTP id z2mr25782282wrv.237.1550698665776; Wed, 20 Feb 2019 13:37:45 -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: Wed, 20 Feb 2019 22:37:30 +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 v5 01/14] qapi: qapi for audio backends 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: Michael Roth , Gerd Hoffmann , Markus Armbruster Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) This patch adds structures into qapi to replace the existing configuration structures used by audio backends currently. This qapi will be the base of the -audiodev command line parameter (that replaces the old environment variables based config). This is not a 1:1 translation of the old options, I've tried to make them much more consistent (e.g. almost every backend had an option to specify buffer size, but the name was different for every backend, and some backends required usecs, while some other required frames, samples or bytes). Also tried to reduce the number of abbreviations used by the config keys. Some of the more important changes: * use `in` and `out` instead of `ADC` and `DAC`, as the former is more user friendly imho * moved buffer settings into the global setting area (so it's the same for all backends that support it. Backends that can't change buffer size will simply ignore them). Also using usecs, as it's probably more user friendly than samples or bytes. * try-poll is now an alsa backend specific option (as all other backends currently ignore it) Signed-off-by: K=C5=91v=C3=A1g=C3=B3, Zolt=C3=A1n Reviewed-by: Markus Armbruster --- Notes: Changes from v4: =20 * documentation fixes * renamed pa's source/sink to pa-in/pa-out * per-direction options changed per Markus Armbruster's comments =20 Changes from v2: =20 * update copyright, version numbers * remove #optional * per-direction options are now optional (needed for qobject_object_vis= itor_new_str) * removed unnecessary AudiodevNoOptions * changed integers to unsigned qapi/audio.json | 304 ++++++++++++++++++++++++++++++++++++++++++ qapi/qapi-schema.json | 1 + qapi/Makefile.objs | 6 +- 3 files changed, 308 insertions(+), 3 deletions(-) create mode 100644 qapi/audio.json diff --git a/qapi/audio.json b/qapi/audio.json new file mode 100644 index 0000000000..2f203462c7 --- /dev/null +++ b/qapi/audio.json @@ -0,0 +1,304 @@ +# -*- mode: python -*- +# +# Copyright (C) 2015-2019 Zolt=C3=A1n K=C5=91v=C3=A1g=C3=B3 +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. +# See the COPYING file in the top-level directory. + +## +# @AudiodevPerDirectionOptions: +# +# General audio backend options that are used for both playback and +# recording. +# +# @fixed-settings: use fixed settings for host input/output. When off, +# frequency, channels and format must not be +# specified (default true) +# +# @frequency: frequency to use when using fixed settings +# (default 44100) +# +# @channels: number of channels when using fixed settings (default 2) +# +# @voices: number of voices to use (default 1) +# +# @format: sample format to use when using fixed settings +# (default s16) +# +# @buffer-len: the buffer size in microseconds +# +# Since: 4.0 +## +{ 'struct': 'AudiodevPerDirectionOptions', + 'data': { + '*fixed-settings': 'bool', + '*frequency': 'uint32', + '*channels': 'uint32', + '*voices': 'uint32', + '*format': 'AudioFormat', + '*buffer-len': 'uint32' } } + +## +# @AudiodevGenericOptions: +# +# Generic driver-specific options. +# +# @in: options of the capture stream +# +# @out: options of the playback stream +# +# Since: 4.0 +## +{ 'struct': 'AudiodevGenericOptions', + 'data': { + '*in': 'AudiodevPerDirectionOptions', + '*out': 'AudiodevPerDirectionOptions' } } + +## +# @AudiodevAlsaPerDirectionOptions: +# +# Options of the alsa backend that are used for both playback and +# recording. +# +# @dev: the name of the alsa device to use (default 'default') +# +# @period-len: the period length in microseconds +# +# @try-poll: attempt to use poll mode, falling back to non-polling +# access on failure (default true) +# +# Since: 4.0 +## +{ 'struct': 'AudiodevAlsaPerDirectionOptions', + 'base': 'AudiodevPerDirectionOptions', + 'data': { + '*dev': 'str', + '*period-len': 'uint32', + '*try-poll': 'bool' } } + +## +# @AudiodevAlsaOptions: +# +# Options of the alsa audio backend. +# +# @in: options of the capture stream +# +# @out: options of the playback stream +# +# @threshold: set the threshold (in microseconds) when playback starts +# +# Since: 4.0 +## +{ 'struct': 'AudiodevAlsaOptions', + 'data': { + '*in': 'AudiodevAlsaPerDirectionOptions', + '*out': 'AudiodevAlsaPerDirectionOptions', + '*threshold': 'uint32' } } + +## +# @AudiodevCoreaudioPerDirectionOptions: +# +# Options of the coreaudio backend that are used for both playback and +# recording. +# +# @buffer-count: number of buffers +# +# Since: 4.0 +## +{ 'struct': 'AudiodevCoreaudioPerDirectionOptions', + 'base': 'AudiodevPerDirectionOptions', + 'data': { + '*buffer-count': 'uint32' } } + +## +# @AudiodevCoreaudioOptions: +# +# Options of the coreaudio audio backend. +# +# @in: options of the capture stream +# +# @out: options of the playback stream +# +# Since: 4.0 +## +{ 'struct': 'AudiodevCoreaudioOptions', + 'data': { + '*in': 'AudiodevCoreaudioPerDirectionOptions', + '*out': 'AudiodevCoreaudioPerDirectionOptions' } } + +## +# @AudiodevDsoundOptions: +# +# Options of the dsound audio backend. +# +# @in: options of the capture stream +# +# @out: options of the playback stream +# +# @latency: add extra latency to playback in microseconds +# (default 10000) +# +# Since: 4.0 +## +{ 'struct': 'AudiodevDsoundOptions', + 'data': { + '*in': 'AudiodevPerDirectionOptions', + '*out': 'AudiodevPerDirectionOptions', + '*latency': 'uint32' } } + +## +# @AudiodevOssPerDirectionOptions: +# +# Options of the oss backend that are used for both playback and +# recording. +# +# @dev: file name of the oss device (default '/dev/dsp') +# +# @buffer-count: number of buffers +# +# @try-poll: attempt to use poll mode, falling back to non-polling +# access on failure (default true) +# +# Since: 4.0 +## +{ 'struct': 'AudiodevOssPerDirectionOptions', + 'base': 'AudiodevPerDirectionOptions', + 'data': { + '*dev': 'str', + '*buffer-count': 'uint32', + '*try-poll': 'bool' } } + +## +# @AudiodevOssOptions: +# +# Options of the oss audio backend. +# +# @in: options of the capture stream +# +# @out: options of the playback stream +# +# @try-mmap: try using memory-mapped access, falling back to +# non-memory-mapped access on failure (default true) +# +# @exclusive: open device in exclusive mode (vmix won't work) +# (default false) +# +# @dsp-policy: set the timing policy of the device (between 0 and 10, +# where smaller number means smaller latency but higher +# CPU usage) or -1 to use fragment mode (option ignored +# on some platforms) (default 5) +# +# Since: 4.0 +## +{ 'struct': 'AudiodevOssOptions', + 'data': { + '*in': 'AudiodevOssPerDirectionOptions', + '*out': 'AudiodevOssPerDirectionOptions', + '*try-mmap': 'bool', + '*exclusive': 'bool', + '*dsp-policy': 'uint32' } } + +## +# @AudiodevPaPerDirectionOptions: +# +# Options of the pa backend that are used for both playback and +# recording. +# +# @name: name of the sink/source to use +# +# Since: 4.0 +## +{ 'struct': 'AudiodevPaPerDirectionOptions', + 'base': 'AudiodevPerDirectionOptions', + 'data': { + '*name': 'str' } } + +## +# @AudiodevPaOptions: +# +# Options of the pa (PulseAudio) audio backend. +# +# @in: options of the capture stream +# +# @out: options of the playback stream +# +# @server: PulseAudio server address (default: let PulseAudio choose) +# +# Since: 4.0 +## +{ 'struct': 'AudiodevPaOptions', + 'data': { + '*in': 'AudiodevPaPerDirectionOptions', + '*out': 'AudiodevPaPerDirectionOptions', + '*server': 'str' } } + +## +# @AudiodevWavOptions: +# +# Options of the wav audio backend. +# +# @in: options of the capture stream +# +# @out: options of the playback stream +# +# @path: name of the wav file to record (default 'qemu.wav') +# +# Since: 4.0 +## +{ 'struct': 'AudiodevWavOptions', + 'data': { + '*in': 'AudiodevPerDirectionOptions', + '*out': 'AudiodevPerDirectionOptions', + '*path': 'str' } } + + +## +# @AudioFormat: +# +# An enumeration of possible audio formats. +# +# Since: 4.0 +## +{ 'enum': 'AudioFormat', + 'data': [ 'u8', 's8', 'u16', 's16', 'u32', 's32' ] } + +## +# @AudiodevDriver: +# +# An enumeration of possible audio backend drivers. +# +# Since: 4.0 +## +{ 'enum': 'AudiodevDriver', + 'data': [ 'none', 'alsa', 'coreaudio', 'dsound', 'oss', 'pa', 'sdl', + 'spice', 'wav' ] } + +## +# @Audiodev: +# +# Options of an audio backend. +# +# @id: identifier of the backend +# +# @driver: the backend driver to use +# +# @timer-period: timer period (in microseconds, 0: use lowest possible) +# +# Since: 4.0 +## +{ 'union': 'Audiodev', + 'base': { + 'id': 'str', + 'driver': 'AudiodevDriver', + '*timer-period': 'uint32' }, + 'discriminator': 'driver', + 'data': { + 'none': 'AudiodevGenericOptions', + 'alsa': 'AudiodevAlsaOptions', + 'coreaudio': 'AudiodevCoreaudioOptions', + 'dsound': 'AudiodevDsoundOptions', + 'oss': 'AudiodevOssOptions', + 'pa': 'AudiodevPaOptions', + 'sdl': 'AudiodevGenericOptions', + 'spice': 'AudiodevGenericOptions', + 'wav': 'AudiodevWavOptions' } } diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json index db61bfd688..5a8bb276d5 100644 --- a/qapi/qapi-schema.json +++ b/qapi/qapi-schema.json @@ -98,3 +98,4 @@ { 'include': 'introspect.json' } { 'include': 'misc.json' } { 'include': 'target.json' } +{ 'include': 'audio.json' } diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs index 87e4df1660..5061bee978 100644 --- a/qapi/Makefile.objs +++ b/qapi/Makefile.objs @@ -5,9 +5,9 @@ util-obj-y +=3D opts-visitor.o qapi-clone-visitor.o util-obj-y +=3D qmp-event.o util-obj-y +=3D qapi-util.o =20 -QAPI_COMMON_MODULES =3D block-core block char common crypto introspect -QAPI_COMMON_MODULES +=3D job migration misc net rdma rocker run-state -QAPI_COMMON_MODULES +=3D sockets tpm trace transaction ui +QAPI_COMMON_MODULES =3D audio block-core block char common crypto +QAPI_COMMON_MODULES +=3D introspect job migration misc net rdma rocker +QAPI_COMMON_MODULES +=3D run-state sockets tpm trace transaction ui QAPI_TARGET_MODULES =3D target QAPI_MODULES =3D $(QAPI_COMMON_MODULES) $(QAPI_TARGET_MODULES) =20 --=20 2.20.1