qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Vassili Karpov (malc)" <av1474@comtv.ru>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Kővágó, Zoltán" <DirtY.iCE.hu@gmail.com>
Subject: [Qemu-devel] [PULL 12/12] sdlaudio: do not allow multiple instances
Date: Tue,  9 Jun 2015 12:47:31 +0200	[thread overview]
Message-ID: <1433846851-20552-13-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1433846851-20552-1-git-send-email-kraxel@redhat.com>

From: Kővágó, Zoltán <dirty.ice.hu@gmail.com>

Since SDL uses a lot of global data, we can't create independent
instances of sdl audio backend.

Signed-off-by: Kővágó, Zoltán <DirtY.iCE.hu@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 audio/sdlaudio.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c
index b95a7e0..1140f2e 100644
--- a/audio/sdlaudio.c
+++ b/audio/sdlaudio.c
@@ -55,6 +55,7 @@ static struct SDLAudioState {
     SDL_mutex *mutex;
     SDL_sem *sem;
     int initialized;
+    bool driver_created;
 } glob_sdl;
 typedef struct SDLAudioState SDLAudioState;
 
@@ -393,6 +394,10 @@ static int sdl_ctl_out (HWVoiceOut *hw, int cmd, ...)
 static void *sdl_audio_init (void)
 {
     SDLAudioState *s = &glob_sdl;
+    if (s->driver_created) {
+        sdl_logerr("Can't create multiple sdl backends\n");
+        return NULL;
+    }
 
     if (SDL_InitSubSystem (SDL_INIT_AUDIO)) {
         sdl_logerr ("SDL failed to initialize audio subsystem\n");
@@ -414,6 +419,7 @@ static void *sdl_audio_init (void)
         return NULL;
     }
 
+    s->driver_created = true;
     return s;
 }
 
@@ -424,6 +430,7 @@ static void sdl_audio_fini (void *opaque)
     SDL_DestroySemaphore (s->sem);
     SDL_DestroyMutex (s->mutex);
     SDL_QuitSubSystem (SDL_INIT_AUDIO);
+    s->driver_created = false;
 }
 
 static struct audio_option sdl_options[] = {
-- 
1.8.3.1

  parent reply	other threads:[~2015-06-09 10:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-09 10:47 [Qemu-devel] [PULL 00/12] audio patch queue Gerd Hoffmann
2015-06-09 10:47 ` [Qemu-devel] [PULL 01/12] audio: remove esd backend Gerd Hoffmann
2015-06-09 10:47 ` [Qemu-devel] [PULL 02/12] audio: remove fmod backend Gerd Hoffmann
2015-06-09 10:47 ` [Qemu-devel] [PULL 03/12] audio: remove winwave audio driver Gerd Hoffmann
2015-06-09 10:47 ` [Qemu-devel] [PULL 04/12] audio: expose drv_opaque to init_out and init_in Gerd Hoffmann
2015-06-09 10:47 ` [Qemu-devel] [PULL 05/12] paaudio: do not use global variables Gerd Hoffmann
2015-06-09 10:47 ` [Qemu-devel] [PULL 06/12] alsaaudio: " Gerd Hoffmann
2015-06-09 10:47 ` [Qemu-devel] [PULL 07/12] ossaudio: " Gerd Hoffmann
2015-06-09 10:47 ` [Qemu-devel] [PULL 08/12] wavaudio: " Gerd Hoffmann
2015-06-09 10:47 ` [Qemu-devel] [PULL 09/12] paaudio: fix possible resource leak Gerd Hoffmann
2015-06-09 10:47 ` [Qemu-devel] [PULL 10/12] dsoundaudio: do not use global variables Gerd Hoffmann
2015-06-09 10:47 ` [Qemu-devel] [PULL 11/12] coreaudio: do not use global variables where possible Gerd Hoffmann
2015-06-09 10:47 ` Gerd Hoffmann [this message]
2015-06-09 13:03 ` [Qemu-devel] [PULL 00/12] audio patch queue Peter Maydell
2015-06-09 14:13   ` Kővágó Zoltán
2015-06-09 14:29     ` Peter Maydell
2015-06-10  6:57       ` Gerd Hoffmann
2015-06-10  7:09       ` Gerd Hoffmann
2015-06-10  6:50   ` Gerd Hoffmann

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=1433846851-20552-13-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=DirtY.iCE.hu@gmail.com \
    --cc=av1474@comtv.ru \
    --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).