qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PULL 22/26] audio: extract audio_define_default
Date: Fri,  6 Oct 2023 13:14:08 +0200	[thread overview]
Message-ID: <20231006111412.13130-23-pbonzini@redhat.com> (raw)
In-Reply-To: <20231006111412.13130-1-pbonzini@redhat.com>

It will be used soon to define a default audio device from the
command line.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 audio/audio.c | 19 ++++++++++++-------
 audio/audio.h |  1 +
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/audio/audio.c b/audio/audio.c
index 67a7e25254d..887219e0ce4 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1686,8 +1686,6 @@ static const VMStateDescription vmstate_audio = {
     }
 };
 
-static void audio_validate_opts(Audiodev *dev, Error **errp);
-
 void audio_create_default_audiodevs(void)
 {
     const char *drvname = getenv("QEMU_AUDIO_DRV");
@@ -1706,7 +1704,6 @@ void audio_create_default_audiodevs(void)
         if (audio_driver_lookup(audio_prio_list[i])) {
             QDict *dict = qdict_new();
             Audiodev *dev = NULL;
-            AudiodevListEntry *e;
             Visitor *v;
 
             qdict_put_str(dict, "driver", audio_prio_list[i]);
@@ -1717,10 +1714,7 @@ void audio_create_default_audiodevs(void)
             visit_type_Audiodev(v, NULL, &dev, &error_fatal);
             visit_free(v);
 
-            audio_validate_opts(dev, &error_abort);
-            e = g_new0(AudiodevListEntry, 1);
-            e->dev = dev;
-            QSIMPLEQ_INSERT_TAIL(&default_audiodevs, e, next);
+            audio_define_default(dev, &error_abort);
         }
     }
 }
@@ -2165,6 +2159,17 @@ void audio_define(Audiodev *dev)
     QSIMPLEQ_INSERT_TAIL(&audiodevs, e, next);
 }
 
+void audio_define_default(Audiodev *dev, Error **errp)
+{
+    AudiodevListEntry *e;
+
+    audio_validate_opts(dev, errp);
+
+    e = g_new0(AudiodevListEntry, 1);
+    e->dev = dev;
+    QSIMPLEQ_INSERT_TAIL(&default_audiodevs, e, next);
+}
+
 void audio_init_audiodevs(void)
 {
     AudiodevListEntry *e;
diff --git a/audio/audio.h b/audio/audio.h
index 53b1d7e6227..6da5e8f6f0f 100644
--- a/audio/audio.h
+++ b/audio/audio.h
@@ -169,6 +169,7 @@ void audio_sample_from_uint64(void *samples, int pos,
                             uint64_t left, uint64_t right);
 
 void audio_define(Audiodev *audio);
+void audio_define_default(Audiodev *dev, Error **errp);
 void audio_parse_option(const char *opt);
 void audio_create_default_audiodevs(void);
 void audio_init_audiodevs(void);
-- 
2.41.0



  parent reply	other threads:[~2023-10-06 11:16 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06 11:13 [PULL 00/26] Audio, source reorg, HVF changes for 2023-10-06 Paolo Bonzini
2023-10-06 11:13 ` [PULL 01/26] target/i386/hvf: Remove unused includes in 'hvf-i386.h' Paolo Bonzini
2023-10-06 11:13 ` [PULL 02/26] sysemu/kvm: Restrict hvf_get_supported_cpuid() to x86 targets Paolo Bonzini
2023-10-06 11:13 ` [PULL 03/26] util/log: re-allow switching away from stderr log file Paolo Bonzini
2023-10-06 11:13 ` [PULL 04/26] target/i386: Check for USER_ONLY definition instead of SOFTMMU one Paolo Bonzini
2023-10-06 11:13 ` [PULL 05/26] softmmu/trace-events: Fix a typo Paolo Bonzini
2023-10-06 11:13 ` [PULL 06/26] travis-ci: Correct invalid mentions of 'softmmu' by 'system' Paolo Bonzini
2023-10-06 11:13 ` [PULL 07/26] cpu: Correct invalid mentions of 'softmmu' by 'system-mode' Paolo Bonzini
2023-10-06 11:13 ` [PULL 08/26] fuzz: Correct invalid mentions of 'softmmu' by 'system' Paolo Bonzini
2023-10-06 11:13 ` [PULL 09/26] tcg: Correct invalid mentions of 'softmmu' by 'system-mode' Paolo Bonzini
2023-10-06 11:13 ` [PULL 10/26] accel: Rename accel_softmmu* -> accel_system* Paolo Bonzini
2023-10-06 11:13 ` [PULL 11/26] gdbstub: Rename 'softmmu' -> 'system' Paolo Bonzini
2023-10-06 11:13 ` [PULL 12/26] semihosting: Rename softmmu_FOO_user() -> uaccess_FOO_user() Paolo Bonzini
2023-10-06 11:13 ` [PULL 13/26] target/i386: Rename i386_softmmu_kvm_ss -> i386_kvm_ss Paolo Bonzini
2023-10-06 11:14 ` [PULL 14/26] hw/virtio/meson: Rename softmmu_virtio_ss -> system_virtio_ss Paolo Bonzini
2023-10-06 11:14 ` [PULL 15/26] meson: Rename softmmu_mods -> system_mods Paolo Bonzini
2023-10-06 11:14 ` [PULL 16/26] meson: Rename target_softmmu_arch -> target_system_arch Paolo Bonzini
2023-10-06 11:14 ` [PULL 17/26] system: Rename softmmu/ directory as system/ Paolo Bonzini
2023-10-06 11:14 ` [PULL 18/26] configure: change $softmmu to $system Paolo Bonzini
2023-10-06 11:14 ` [PULL 19/26] cutils: squelch compiler warnings with custom paths Paolo Bonzini
2023-10-06 11:14 ` [PULL 20/26] audio: error hints need a trailing \n Paolo Bonzini
2023-10-06 11:14 ` [PULL 21/26] audio: disable default backends if -audio/-audiodev is used Paolo Bonzini
2023-10-06 11:14 ` Paolo Bonzini [this message]
2023-10-06 11:14 ` [PULL 23/26] audio: extend -audio to allow creating a default backend Paolo Bonzini
2023-10-06 11:14 ` [PULL 24/26] audio: do not use first -audiodev as default audio device Paolo Bonzini
2023-10-06 11:14 ` [PULL 25/26] audio: reintroduce default audio backend for VNC Paolo Bonzini
2023-10-06 11:14 ` [PULL 26/26] audio, qtest: get rid of QEMU_AUDIO_DRV Paolo Bonzini
2023-10-08  6:13 ` [PULL 00/26] Audio, source reorg, HVF changes for 2023-10-06 Paolo Bonzini

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=20231006111412.13130-23-pbonzini@redhat.com \
    --to=pbonzini@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).