qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Kővágó, Zoltán" <dirty.ice.hu@gmail.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH v4 06/14] audio: audiodev= parameters no longer optional when -audiodev present
Date: Mon, 19 Aug 2019 01:06:51 +0200	[thread overview]
Message-ID: <9072b955acffda13976bca7b61f86d7f708c9269.1566168923.git.DirtY.iCE.hu@gmail.com> (raw)
In-Reply-To: <cover.1566168923.git.DirtY.iCE.hu@gmail.com>

This means you should probably stop using -soundhw (as it doesn't allow
you to specify any options) and add the device manually with -device.
The exception is pcspk, it's currently not possible to manually add it.
To use it with audiodev, use something like this:

    -audiodev id=foo,... -global isa-pcspk.audiodev=foo -soundhw pcspk

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
---

Notes:
    Changes from v1:
    
    * Split off paaudio changes to a different commit.

 audio/audio.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/audio/audio.c b/audio/audio.c
index 8e9ccd0ac4..7267cab9d7 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -101,6 +101,8 @@ const struct mixeng_volume nominal_volume = {
 #endif
 };
 
+static bool legacy_config = true;
+
 #ifdef AUDIO_IS_FLAWLESS_AND_NO_CHECKS_ARE_REQURIED
 #error No its not
 #else
@@ -1392,7 +1394,7 @@ static AudiodevListEntry *audiodev_find(
  * if dev == NULL => legacy implicit initialization, return the already created
  *   state or create a new one
  */
-static AudioState *audio_init(Audiodev *dev)
+static AudioState *audio_init(Audiodev *dev, const char *name)
 {
     static bool atexit_registered;
     size_t i;
@@ -1406,12 +1408,13 @@ static AudioState *audio_init(Audiodev *dev)
 
     if (dev) {
         /* -audiodev option */
+        legacy_config = false;
         drvname = AudiodevDriver_str(dev->driver);
     } else if (!QTAILQ_EMPTY(&audio_states)) {
-        /*
-         * todo: check for -audiodev once we have normal audiodev selection
-         * support
-         */
+        if (!legacy_config) {
+            dolog("You must specify an audiodev= for the device %s\n", name);
+            exit(1);
+        }
         return QTAILQ_FIRST(&audio_states);
     } else {
         /* legacy implicit initialization */
@@ -1518,7 +1521,7 @@ void audio_free_audiodev_list(AudiodevListHead *head)
 void AUD_register_card (const char *name, QEMUSoundCard *card)
 {
     if (!card->state) {
-        card->state = audio_init(NULL);
+        card->state = audio_init(NULL, name);
     }
 
     card->name = g_strdup (name);
@@ -1544,8 +1547,11 @@ CaptureVoiceOut *AUD_add_capture(
     struct capture_callback *cb;
 
     if (!s) {
-        /* todo: remove when we have normal audiodev selection support */
-        s = audio_init(NULL);
+        if (!legacy_config) {
+            dolog("You must specify audiodev when trying to capture\n");
+            return NULL;
+        }
+        s = audio_init(NULL, NULL);
     }
 
     if (audio_validate_settings (as)) {
@@ -1776,7 +1782,7 @@ void audio_init_audiodevs(void)
     AudiodevListEntry *e;
 
     QSIMPLEQ_FOREACH(e, &audiodevs, next) {
-        audio_init(e->dev);
+        audio_init(e->dev, NULL);
     }
 }
 
-- 
2.22.0



  parent reply	other threads:[~2019-08-18 23:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-18 23:06 [Qemu-devel] [PATCH v4 00/14] Multiple simultaneous audio backends Kővágó, Zoltán
2019-08-18 23:06 ` [Qemu-devel] [PATCH v4 01/14] audio: reduce glob_audio_state usage Kővágó, Zoltán
2019-08-18 23:06 ` [Qemu-devel] [PATCH v4 02/14] audio: basic support for multi backend audio Kővágó, Zoltán
2019-08-18 23:06 ` [Qemu-devel] [PATCH v4 03/14] audio: add audiodev property to vnc and wav_capture Kővágó, Zoltán
2019-08-18 23:06 ` [Qemu-devel] [PATCH v4 04/14] audio: add audiodev properties to frontends Kővágó, Zoltán
2019-08-18 23:06 ` [Qemu-devel] [PATCH v4 05/14] paaudio: prepare for multiple audiodev Kővágó, Zoltán
2019-08-18 23:06 ` Kővágó, Zoltán [this message]
2019-08-18 23:06 ` [Qemu-devel] [PATCH v4 07/14] paaudio: do not move stream when sink/source name is specified Kővágó, Zoltán
2019-08-18 23:06 ` [Qemu-devel] [PATCH v4 08/14] paaudio: properly disconnect streams in fini_* Kővágó, Zoltán
2019-08-18 23:06 ` [Qemu-devel] [PATCH v4 09/14] audio: remove audio_MIN, audio_MAX Kővágó, Zoltán
2019-08-18 23:06 ` [Qemu-devel] [PATCH v4 10/14] audio: do not run each backend in audio_run Kővágó, Zoltán
2019-08-18 23:06 ` [Qemu-devel] [PATCH v4 11/14] paaudio: fix playback glitches Kővágó, Zoltán
2019-08-18 23:06 ` [Qemu-devel] [PATCH v4 12/14] audio: remove read and write pcm_ops Kővágó, Zoltán
2019-08-18 23:06 ` [Qemu-devel] [PATCH v4 13/14] audio: use size_t where makes sense Kővágó, Zoltán
2019-08-18 23:06 ` [Qemu-devel] [PATCH v4 14/14] audio: fix memory leak reported by ASAN Kővágó, Zoltán
2019-08-18 23:25   ` Philippe Mathieu-Daudé
2019-08-19  2:05     ` Zoltán Kővágó
2019-08-19 11:21       ` Philippe Mathieu-Daudé
2019-08-18 23:35 ` [Qemu-devel] [PATCH v4 00/14] Multiple simultaneous audio backends no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9072b955acffda13976bca7b61f86d7f708c9269.1566168923.git.DirtY.iCE.hu@gmail.com \
    --to=dirty.ice.hu@gmail.com \
    --cc=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).