From patchwork Thu Jun 4 13:39:38 2015 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: 480742 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 2CB40140218 for ; Thu, 4 Jun 2015 23:39:58 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=X/NiIQUU; dkim-atps=neutral Received: from localhost ([::1]:42562 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0VND-00005d-No for incoming@patchwork.ozlabs.org; Thu, 04 Jun 2015 09:39:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35550) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0VMs-0008Gb-ED for qemu-devel@nongnu.org; Thu, 04 Jun 2015 09:39:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z0VMn-0001pP-Cv for qemu-devel@nongnu.org; Thu, 04 Jun 2015 09:39:34 -0400 Received: from mail-wi0-x229.google.com ([2a00:1450:400c:c05::229]:34010) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z0VMn-0001p1-1q for qemu-devel@nongnu.org; Thu, 04 Jun 2015 09:39:29 -0400 Received: by wibut5 with SMTP id ut5so21898558wib.1 for ; Thu, 04 Jun 2015 06:39:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=p/lC4ke796Tkiwxrq2BVOwWgqxrZ5XET6Xh1iy/pMLI=; b=X/NiIQUU0bhtq9zN+IpN2LzBg4AbZr0CeZmZiXVeLqZ2/I6NM8RVTzpaaar/EP+JY5 vrMPCVaSLomjffSeovNp2AcVk7U3VshG9X/AfzcxFTKfwD6jBd7nReEfIzj7LVcdTZ2U tcbLwxGhTn22OnFac7hCNR5jB0CXmWKSa+TF3jF9gvpSqmwMfCT7z8oGsoE4b1IQPChm cXSgHYO/l63t0/VI6lgN+8aMVvEskxi4HTvsDYjzpbd6C6FBkpX3FZSjZjlq/HZFV83b 3SWGJFWh/nW0bufwDsDgVVy4yO8D9Pis00lifQtsytSPtDht2CAWjBS8QgCL0sOYNaKV mxRw== X-Received: by 10.180.210.171 with SMTP id mv11mr51264130wic.61.1433425168393; Thu, 04 Jun 2015 06:39:28 -0700 (PDT) Received: from nullptr.home.dirty-ice.org (94-21-43-102.pool.digikabel.hu. [94.21.43.102]) by mx.google.com with ESMTPSA id tl3sm5829872wjc.20.2015.06.04.06.39.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Jun 2015 06:39:27 -0700 (PDT) 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: eblake@redhat.com, qemu-devel@nongnu.org Date: Thu, 4 Jun 2015 15:39:38 +0200 Message-Id: <2e2fabdd19c4c81d40535244813fe42646557089.1433424889.git.DirtY.iCE.hu@gmail.com> X-Mailer: git-send-email 2.4.2 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::229 Cc: Gerd Hoffmann Subject: [Qemu-devel] [RFC PATCH v2] 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 Changes from v1: * fixed style issues * moved definitions into a separate file * documented undocumented options (hopefully) * removed plive option. It was useless even years ago so it can probably safely go away: https://lists.nongnu.org/archive/html/qemu-devel/2012-03/msg02427.html * removed verbose, debug options. Backends should use trace events instead. * removed *_retries options from dsound. It's a kludge. * moved buffer_usecs and buffer_count to the global config options. Some driver might ignore it (as they do not expose API to change them). * wav backend: removed frequecy, format, channels as AudiodevPerDirectionOptions already have them. Not sure about this one, so it's not yet in this patch: * remove poll_mode: another obscure setting, and it's only matter of time until the code bitrots enough to break it. This is a proposal to add structures into qapi to replace the existing configuration structures used by audio backends currently. I'm going to use it to implement a new way to specify audio backend options (an -audiodev command line option, instead of environment variables. This will also allow us to use multiple audio backends in one qemu instance), so the structure used here will be the basis of the command line syntax. This is currently more or less a direct translation of the current audio backend options. I've changed some names, trying to accomplish a more consistent naming scheme. I wouldn't be surprised if there were options that doesn't work if you set their value to anything other than the default (for example, log to monitor can crash qemu, QEMU_DSOUND_RESTOURE_RETRIES has a typo, so probably nobody used it, etc). I've also tried to reduce copy-paste, when the same set of options can be given to output and input (QEMU_*_DAC_* and QEMU_*_ADC_* options), also using in and out instead of ADC and DAC, as in the world of SPDIF and HDMI it's completely possible that your computer has nothing to do with analog converters. Plus a non technician user probably has no idea what ADC and DAC stands for. Any comment is appreciated. Signed-off-by: Kővágó, Zoltán --- qapi-schema.json | 3 + qapi/audio.json | 225 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 228 insertions(+) create mode 100644 qapi/audio.json diff --git a/qapi-schema.json b/qapi-schema.json index 0662a9b..ebec127 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 block definitions { 'include': 'qapi/block.json' } diff --git a/qapi/audio.json b/qapi/audio.json new file mode 100644 index 0000000..c864a77 --- /dev/null +++ b/qapi/audio.json @@ -0,0 +1,225 @@ +# -*- mode: python -*- + +## +# @AudiodevNoneOptions +# +# The none, coreaudio, sdl and spice audio backend has no options. +# +# Since: 2.4 +## +{ 'struct': 'AudiodevNoneOptions', + '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 +# +# Since: 2.4 +## +{ 'struct': 'AudiodevAlsaPerDirectionOptions', + 'data': { + '*dev': 'str' } } + +## +# @AudiodevAlsaOptions +# +# Options of the alsa audio backend. +# +# @in: #optional options of the capture stream +# +# @out: #optional options of the playback stream +# +# @threshold: #optional set the threshold (in frames) when playback starts +# +# Since: 2.4 +## +{ 'struct': 'AudiodevAlsaOptions', + 'data': { + '*in': 'AudiodevAlsaPerDirectionOptions', + '*out': 'AudiodevAlsaPerDirectionOptions', + '*threshold': 'int' } } + +## +# @AudiodevDsoundOptions +# +# Options of the dsound audio backend. +# +# @set-primary: #optional set the parameters of primary buffer +# +# @latency-millis: #optional add extra latency to playback +# +# @primary-frequency: #optional primary buffer frequency +# +# @primary-channels: #optional primary buffer number of channels +# +# @primary-format: #optional primary buffer format +# +# Since: 2.4 +## +{ 'struct': 'AudiodevDsoundOptions', + 'data': { + '*set-primary': 'bool', + '*latency-millis': 'int', + '*primary-frequency': 'int', + '*primary-channels': 'int', + '*primary-format': 'AudioFormat' } } + +## +# @AudiodevOssPerDirectionOptions +# +# Options of the oss backend that are used for both playback and recording. +# +# @dev: #optional path of the oss device +# +# Since: 2.4 +## +{ 'struct': 'AudiodevOssPerDirectionOptions', + 'data': { + '*dev': 'str' } } + +## +# @AudiodevOssOptions +# +# Options of the oss audio backend. +# +# @in: #optional options of the capture stream +# +# @out: #optional options of the playback stream +# +# @mmap: #optional try using memory mapped access +# +# @exclusive: #optional open device in exclusive mode (vmix wont work) +# +# @dsp-policy: #optional set the timing policy of the device, -1 to use fragment +# mode (option ignored on some platforms) +# +# Since: 2.4 +## +{ 'struct': 'AudiodevOssOptions', + 'data': { + '*in': 'AudiodevOssPerDirectionOptions', + '*out': 'AudiodevOssPerDirectionOptions', + '*mmap': 'bool', + '*exclusive': 'bool', + '*dsp-policy': 'int' } } + +## +# @AudiodevPaOptions +# +# Options of the pa (PulseAudio) audio backend. +# +# @server: #optional PulseAudio server address +# +# @sink: #optional sink device name +# +# @source: #optional source device name +# +# Since: 2.4 +## +{ 'struct': 'AudiodevPaOptions', + 'data': { + '*server': 'str', + '*sink': 'str', + '*source': 'str' } } + +## +# @AudiodevWavOptions +# +# Options of the wav audio backend. +# +# @path: #optional path of the wav file to record +# +# Since: 2.4 +## +{ 'struct': 'AudiodevWavOptions', + 'data': { + '*path': 'str' } } + + +## +# @AudiodevBackendOptions +# +# A discriminated record of audio backends. +# +# Since: 2.4 +## +{ 'union': 'AudiodevBackendOptions', + 'data': { + 'none': 'AudiodevNoneOptions', + 'alsa': 'AudiodevAlsaOptions', + 'coreaudio': 'AudiodevNoneOptions', + 'dsound': 'AudiodevDsoundOptions', + 'oss': 'AudiodevOssOptions', + 'pa': 'AudiodevPaOptions', + 'sdl': 'AudiodevNoneOptions', + 'spice': 'AudiodevNoneOptions', + 'wav': 'AudiodevWavOptions' } } + +## +# @AudioFormat +# +# An enumeration of possible audio formats. +# +# Since: 2.4 +## +{ 'enum': 'AudioFormat', + 'data': [ 'u8', 's8', 'u16', 's16', 'u32', 's32' ] } + +## +# @AudiodevPerDirectionOptions +# +# General audio backend options that are used for both playback and recording. +# +# @fixed-settings: #optional use fixed settings for host DAC/ADC +# +# @frequency: #optional frequency to use when using fixed settings +# +# @channels: #optional number of channels when using fixed settings +# +# @format: #optional sample fortmat to use when using fixed settings +# +# @buffer-usecs: #optional the buffer size in microseconds +# +# @buffer-count: #optional nuber of buffers +# +# @try-poll: #optional attempt to use poll mode +# +# Since: 2.4 +## +{ 'struct': 'AudiodevPerDirectionOptions', + 'data': { + '*fixed-settings': 'bool', + '*frequency': 'int', + '*channels': 'int', + '*format': 'AudioFormat', + '*buffer-usecs': 'int', + '*buffer-count': 'int', + '*try-poll': 'bool' } } + +## +# @Audiodev +# +# Captures the configuration of an audio backend. +# +# @id: identifier of the backend +# +# @in: #optional options of the capture stream +# +# @out: #optional options of the playback stream +# +# @timer-period: #optional timer period in HZ (0 - use lowest possible) +# +# @opts: audio backend specific options +# +# Since: 2.4 +## +{ 'struct': 'Audiodev', + 'data': { + 'id': 'str', + '*in': 'AudiodevPerDirectionOptions', + '*out': 'AudiodevPerDirectionOptions', + '*timer-period': 'int', + 'opts': 'AudiodevBackendOptions' } }