From patchwork Thu Jan 14 13:45:16 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: 567403 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 A86AC14029E for ; Fri, 15 Jan 2016 00:47:07 +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=MRKuia2L; dkim-atps=neutral Received: from localhost ([::1]:42515 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJiEz-0002FY-Df for incoming@patchwork.ozlabs.org; Thu, 14 Jan 2016 08:47:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35344) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJiE9-00011l-Ad for qemu-devel@nongnu.org; Thu, 14 Jan 2016 08:46:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJiE7-0003MU-Jh for qemu-devel@nongnu.org; Thu, 14 Jan 2016 08:46:13 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:36553) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJiE7-0003MO-Af for qemu-devel@nongnu.org; Thu, 14 Jan 2016 08:46:11 -0500 Received: by mail-wm0-x244.google.com with SMTP id l65so43659589wmf.3 for ; Thu, 14 Jan 2016 05:46:11 -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=i8+w2aqCgQmLI0TnHdYBqf0mF7xt7hcrGeBth1GRmf8=; b=MRKuia2LQ9dHYK8eze2Mo3vd60hSu1LY02e0LI/pfXmtV0I5wV9GG4NGLFvfXzmPlX BG6XcU1uJG6CVMawBbz7mx1qS64O1ThDQwkPiRpykB6lFRLVNbz6F3ikGEbjoA+5/D5x bAWIf+aedMXRrGUbI3SFID7uY/IZ43bam30MxQNKEhFycLxXPOgp2btc7D9+ErWbDhqd lXwqOCR0ZreUR+vbOLdWhDPZZU1U9e3aBjiYsigR7tFCguqI7jE7Dg+cw3uTPlNJC+a9 r/Mb6YeYAM0UO2VyBWjbGxnOvEaj9FPd0g3/0o9pkbUfuJcqyUKR8ow0sa5PjHuXGaim Ij5Q== 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=i8+w2aqCgQmLI0TnHdYBqf0mF7xt7hcrGeBth1GRmf8=; b=Andsu4fe96RkFCcgiTR6FwGH2wAvV9gromiEyPhPtcaW4YaksjwDrDx+Pab8FWZjZ5 /0YVIB+Fr49MbfrKp3n4ZvXpb2kY6/emXHVTEqAZ+tGgMyqtVS9+dMzCkOQDh8UX0Bsz TvFNIKbSJlLUKu6zZPzPHqb7iWBVmM2OSXv1J5zur44nfjWJG4VD474A6ZfhimF9pbyD gek7FV0bqC7kO6qjpc5yyY+z73UxoiMgrKT1KsFOn/JiLw3gWHM/9dwHuRgHjBvSTeOc 84Epd9gu09zRJlUNMa7skrUAbnjyC9DcUZpasS9lcMF0SbURtunmwYNSkJJ7rNBltFBt G0CA== X-Gm-Message-State: ALoCoQmkWPEr5OebtyACytYhKb66ACeRYsq/4Y68qlWg2pjsH4AuG784uAXwMyw0KfEkRolbRBfMFziby1+lZQl0TC2RStqgUQ== X-Received: by 10.28.88.210 with SMTP id m201mr5245671wmb.76.1452779170793; Thu, 14 Jan 2016 05:46:10 -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.09 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Jan 2016 05:46:10 -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:16 +0100 Message-Id: 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::244 Cc: Gerd Hoffmann , Markus Armbruster Subject: [Qemu-devel] [PATCH 03/51] qapi: qapi for audio backends 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 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ővágó, Zoltán --- Makefile | 6 +- qapi-schema.json | 3 + qapi/audio.json | 263 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 269 insertions(+), 3 deletions(-) create mode 100644 qapi/audio.json diff --git a/Makefile b/Makefile index d0de2d4..d87c1a9 100644 --- a/Makefile +++ b/Makefile @@ -270,9 +270,9 @@ $(SRC_PATH)/qga/qapi-schema.json $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py) " GEN $@") qapi-modules = $(SRC_PATH)/qapi-schema.json $(SRC_PATH)/qapi/common.json \ - $(SRC_PATH)/qapi/block.json $(SRC_PATH)/qapi/block-core.json \ - $(SRC_PATH)/qapi/event.json $(SRC_PATH)/qapi/introspect.json \ - $(SRC_PATH)/qapi/crypto.json + $(SRC_PATH)/qapi/audio.json $(SRC_PATH)/qapi/block.json \ + $(SRC_PATH)/qapi/block-core.json $(SRC_PATH)/qapi/event.json \ + $(SRC_PATH)/qapi/introspect.json $(SRC_PATH)/qapi/crypto.json qapi-types.c qapi-types.h :\ $(qapi-modules) $(SRC_PATH)/scripts/qapi-types.py $(qapi-py) diff --git a/qapi-schema.json b/qapi-schema.json index 2e31733..7b13cfb 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -5,6 +5,9 @@ # QAPI common definitions { 'include': 'qapi/common.json' } +# QAPI audio definitions +{ 'include': 'qapi/audio.json' } + # QAPI crypto definitions { 'include': 'qapi/crypto.json' } diff --git a/qapi/audio.json b/qapi/audio.json new file mode 100644 index 0000000..da0c2df --- /dev/null +++ b/qapi/audio.json @@ -0,0 +1,263 @@ +# -*- mode: python -*- +# +# Copyright (C) 2015 Zoltán Kővágó +# +# This work is licensed under the terms of the GNU GPL, version 2 or later. +# See the COPYING file in the top-level directory. + +## +# @AudiodevNoOptions +# +# The none, coreaudio, sdl and spice audio backend have no options. +# +# Since: 2.6 +## +{ 'struct': 'AudiodevNoOptions', + 'data': { } } + +## +# @AudiodevAlsaPerDirectionOptions +# +# Options of the alsa backend that are used for both playback and recording. +# +# @dev: #optional the name of the alsa device to use (default 'default') +# +# @try-poll: #optional attempt to use poll mode, falling back to non polling +# access on failure (default on) +# +# Since: 2.6 +## +{ 'struct': 'AudiodevAlsaPerDirectionOptions', + 'data': { + '*dev': 'str', + '*try-poll': 'bool' } } + +## +# @AudiodevAlsaOptions +# +# Options of the alsa audio backend. +# +# @alsa-in: options of the capture stream +# +# @alsa-out: options of the playback stream +# +# @threshold: #optional set the threshold (in microseconds) when playback starts +# +# Since: 2.6 +## +{ 'struct': 'AudiodevAlsaOptions', + 'data': { + 'alsa-in': 'AudiodevAlsaPerDirectionOptions', + 'alsa-out': 'AudiodevAlsaPerDirectionOptions', + '*threshold': 'int' } } + +## +# @AudiodevDsoundOptions +# +# Options of the dsound audio backend. +# +# @latency: #optional add extra latency to playback in microseconds (default +# 10000) +# +# Since: 2.6 +## +{ 'struct': 'AudiodevDsoundOptions', + 'data': { + '*latency': 'int' } } + +## +# @AudiodevOssPerDirectionOptions +# +# Options of the oss backend that are used for both playback and recording. +# +# @dev: #optional file name of the oss device (default '/dev/dsp') +# +# @try-poll: #optional attempt to use poll mode, falling back to non polling +# access on failure (default on) +# +# Since: 2.6 +## +{ 'struct': 'AudiodevOssPerDirectionOptions', + 'data': { + '*dev': 'str', + '*try-poll': 'bool' } } + +## +# @AudiodevOssOptions +# +# Options of the oss audio backend. +# +# @oss-in: options of the capture stream +# +# @oss-out: options of the playback stream +# +# @try-mmap: #optional try using memory mapped access, falling back to non +# memory mapped access on failure (default off) +# +# @exclusive: #optional open device in exclusive mode (vmix won't work) +# (default off) +# +# @dsp-policy: #optional 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: 2.6 +## +{ 'struct': 'AudiodevOssOptions', + 'data': { + 'oss-in': 'AudiodevOssPerDirectionOptions', + 'oss-out': 'AudiodevOssPerDirectionOptions', + '*try-mmap': 'bool', + '*exclusive': 'bool', + '*dsp-policy': 'int' } } + +## +# @AudiodevPaPerDirectionOptions +# +# Options of the pa backend that are used for both playback and recording. +# +# @name: #optional name of the sink/source to use +# +# Since: 2.6 +## +{ 'struct': 'AudiodevPaPerDirectionOptions', + 'data': { + '*name': 'str' } } + +## +# @AudiodevPaOptions +# +# Options of the pa (PulseAudio) audio backend. +# +# @server: #optional PulseAudio server address (default: let PulseAudio choose) +# +# @sink: sink specific options +# +# @source: source specific options +# +# Since: 2.6 +## +{ 'struct': 'AudiodevPaOptions', + 'data': { + '*server': 'str', + 'sink': 'AudiodevPaPerDirectionOptions', + 'source': 'AudiodevPaPerDirectionOptions' } } + +## +# @AudiodevWavOptions +# +# Options of the wav audio backend. +# +# @path: #optional name of the wav file to record (default 'qemu.wav') +# +# Since: 2.6 +## +{ 'struct': 'AudiodevWavOptions', + 'data': { + '*path': 'str' } } + + +## +# @AudioFormat +# +# An enumeration of possible audio formats. +# +# Since: 2.6 +## +{ 'enum': 'AudioFormat', + 'data': [ 'u8', 's8', 'u16', 's16', 'u32', 's32' ] } + +## +# @AudiodevDriver +# +# An enumeration of possible audio backend drivers. +# +# Since: 2.6 +## +{ 'enum': 'AudiodevDriver', + 'data': [ 'none', 'alsa', 'coreaudio', 'dsound', 'oss', 'pa', 'sdl', 'spice', + 'wav' ] } + +## +# @AudiodevPerDirectionOptions +# +# General audio backend options that are used for both playback and recording. +# +# @fixed-settings: #optional use fixed settings for host input/output. When +# off, frequency, channels and format must not be specified +# (default on) +# +# @frequency: #optional frequency to use when using fixed settings +# (default 44100) +# +# @channels: #optional number of channels when using fixed settings +# (default 2) +# +# @voices: #optional number of voices to use (default 1) +# +# @format: #optional sample format to use when using fixed settings +# (default s16) +# +# @buffer-len: #optional the buffer size in microseconds +# +# @buffer-count: #optional number of buffers +# +# Since: 2.6 +## +{ 'struct': 'AudiodevPerDirectionOptions', + 'data': { + '*fixed-settings': 'bool', + '*frequency': 'int', + '*channels': 'int', + '*voices': 'int', + '*format': 'AudioFormat', + '*buffer-len': 'int', + '*buffer-count': 'int' } } + +## +# @AudiodevCommonOptions +# +# Captures the common configuration of an audio backend. +# +# @id: identifier of the backend +# +# @driver: the backend driver to use +# +# @in: options of the capture stream +# +# @out: options of the playback stream +# +# @timer-period: #optional timer period (in microseconds, 0: use lowest +# possible) +# +# Since: 2.6 +## +{ 'struct': 'AudiodevCommonOptions', + 'data': { + 'id': 'str', + 'driver': 'AudiodevDriver', + 'in': 'AudiodevPerDirectionOptions', + 'out': 'AudiodevPerDirectionOptions', + '*timer-period': 'int' } } + +## +# @AudiodevBackendOptions +# +# Options of an audio backend. +# +# Since: 2.6 +## +{ 'union': 'Audiodev', + 'base': 'AudiodevCommonOptions', + 'discriminator': 'driver', + 'data': { + 'none': 'AudiodevNoOptions', + 'alsa': 'AudiodevAlsaOptions', + 'coreaudio': 'AudiodevNoOptions', + 'dsound': 'AudiodevDsoundOptions', + 'oss': 'AudiodevOssOptions', + 'pa': 'AudiodevPaOptions', + 'sdl': 'AudiodevNoOptions', + 'spice': 'AudiodevNoOptions', + 'wav': 'AudiodevWavOptions' } }