qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: KJ Liew <liewkj@yahoo.com>
To: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Fixed unknown audio format with SDL2
Date: Thu, 16 Jan 2020 10:27:54 -0800	[thread overview]
Message-ID: <E1is9u1-0000BR-Th@eggs.gnu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 920 bytes --]


SDL2 (version >=2.0) prefers float32 audio format over integer audio format. QEMU sdlaudio.c does not handle any kind of AUDIO_F32 formats, but SDL_OpenAudio(req, obt) will return float32 audio format in obt and QEMU prints error about unknown format 33056 (0x8120).

The following simple patch fix the error by forcing SDL2 internal audio format conversion.

diff -ru ../orig/qemu-4.2.0/audio/sdlaudio.c ../qemu-4.2.0/audio/sdlaudio.c
--- ../orig/qemu-4.2.0/audio/sdlaudio.c 2019-12-12 10:20:47.000000000 -0800
+++ ../qemu-4.2.0/audio/sdlaudio.c      2020-01-15 15:56:25.059841600 -0800
@@ -147,10 +147,11 @@
     }
 #endif

-    status = SDL_OpenAudio (req, obt);
+    status = SDL_OpenAudio (req, NULL);
     if (status) {
         sdl_logerr ("SDL_OpenAudio failed\n");
     }
+    memcpy(obt, req, sizeof(SDL_AudioSpec));

 #ifndef _WIN32
     err = pthread_sigmask (SIG_SETMASK, &old, NULL);

[-- Attachment #2: Type: text/html, Size: 2578 bytes --]

                 reply	other threads:[~2020-01-16 18:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=E1is9u1-0000BR-Th@eggs.gnu.org \
    --to=liewkj@yahoo.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).