Add support for the spice audio interface. With this patch applied
audio can be forwarded over the network from/to the spice client. Both
recording and playback is supported.
The driver is first in the driver list, but the can_be_default flag is
set only in case spice is active. So if you have the spice protocol
enabled the spice audio driver is the default one, otherwise whatever
comes first after spice in the list. Overriding the default using
QEMU_AUDIO_DRV works in any case.
[ v2: audio codestyle: add spaces before open parenthesis ]
[ v2: add const to silence array ]
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: malc <av1474@comtv.ru>
Signed-off-by: malc <av1474@comtv.ru>
snd_pcm_start() starts the capture process and ensures that the events
are delivered to the poll handler. Without the call, capture can be started
only when there is simultaneous playback running.
Signed-off-by: Jindrich Makovicka <makovick@gmail.com>
Signed-off-by: malc <av1474@comtv.ru>
Playback control function did not disable polling when playback stops.
Caused busy spinning of the main loop due to unprocessed events.
Signed-off-by: Jindrich Makovicka <makovick@gmail.com>
Signed-off-by: malc <av1474@comtv.ru>
Since version 4.4.x, gcc supports additional format attributes.
__attribute__ ((format (gnu_printf, 1, 2)))
should be used instead of
__attribute__ ((format (printf, 1, 2))
because QEMU always uses standard format strings (even with mingw32).
The patch replaces format attribute printf / __printf__ by macro
GCC_FMT_ATTR which uses gnu_printf if supported.
It also removes an #ifdef __GNUC__ (not needed any longer).
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Fix a rpos coordination bug between qpa_run_out() and qpa_thread_out(),
which shows up as playback noises.
qpa_run_out()
qpa_thread_out loop N critical section 1
qpa_run_out() qpa_thread_out loop N doing pa_simple_write()
qpa_run_out() qpa_thread_out loop N doing pa_simple_write()
qpa_thread_out loop N critical section 2
qpa_thread_out loop N+1 critical section 1
qpa_run_out() qpa_thread_out loop N+1 doing pa_simple_write()
In the above scheme, "qpa_thread_out loop N+1 critical section 1" will
get the same rpos as the one used by "qpa_thread_out loop N critical
section 1". So it will be reading dead samples from the old rpos.
The rpos can only be updated back to qpa_thread_out when there is a
qpa_run_out() run between two qpa_thread_out loops.
normal sequence:
qpa_thread_out:
hw->rpos (X0) => local rpos => pa->rpos (X1)
qpa_run_out:
pa->rpos (X1) => hw->rpos (X1)
qpa_thread_out:
hw->rpos (X1) => local rpos => pa->rpos (X2)
buggy sequence:
qpa_thread_out:
hw->rpos (X0) => local rpos => pa->rpos (X1)
qpa_thread_out:
hw->rpos (X0) => local rpos => pa->rpos (X1')
Obviously qpa_run_out() shall be called at least once between any two
qpa_thread_out loops (after pa->rpos is set), in order for the new
qpa_thread_out loop to see the updated rpos.
Setting pa->live to 0 does the trick. The next loop will have to wait
for one qpa_run_out() invocation in order to get a non-zero pa->live
and proceed.
Signed-off-by: malc <av1474@comtv.ru>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
By moving the definition of GCC_ATTR and GCC_FMT_ATTR
from audio_int.h to qemu-common.h these macros are
now generally available for further patches which add
the gcc format attribute.
Newer gcc versions support format gnu_printf which is
better suited for use in QEMU than format printf
(QEMU always uses standard format strings (even with mingw32)).
V2: Use correct operator '==' (instead of '=')
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
When available, we'd like to be able to access the DeviceState
when registering a savevm. For buses with a get_dev_path()
function, this will allow us to create more unique savevm
id strings.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Remove unused 'shift' variable spotted by clang.
Also clean up aud_to_sdlfmt which used to get the value
of shift.
Signed-off-by: Serge Ziryukin <ftrvxmtrx@gmail.com>
Signed-off-by: malc <av1474@comtv.ru>
Commits 376253ec..731b0364 introduced global variable cur_mon, which
points to the "default monitor" (if any), except during execution of
monitor_read() or monitor_control_read() it points to the monitor from
which we're reading instead (the "current monitor"). Monitor command
handlers run within monitor_read() or monitor_control_read().
Default monitor and current monitor are really separate things, and
squashing them together is confusing and error-prone.
For instance, usb_host_scan() can run both in "info usbhost" and
periodically via usb_host_auto_check(). It prints to cur_mon, which
is what we want in the former case: the monitor executing "info
usbhost". But since that's the default monitor in the latter case, it
periodically spams the default monitor there.
A few places use cur_mon to log stuff to the default monitor. If we
ever log something while cur_mon points to current monitor instead of
default monitor, the log temporarily "jumps" to another monitor.
Whether that can or cannot happen isn't always obvious.
Maybe logging to the default monitor (which may not even exist) is a
bad idea, and we should log to stderr or a logfile instead. But
that's outside the scope of this commit.
Change cur_mon to point to the current monitor. Create new
default_mon to point to the default monitor. Update users of cur_mon
accordingly.
This fixes the periodical spamming of the default monitor by
usb_host_scan(). It also stops "log jumping", should that problem
exist.
This reverts commit 4839abe78f.
The commit was badly broken, Gentoo has sdl as the default driver,
consequently 5 gentoo users have hit the breakage and were kind enough
to report, so thank you:
Claes Gyllenswrd
vekin
Chris
But above all thanks to Toralf Foerster who actually provied enough
information to pinpoint the breakage to sdlaudio.
http://bugs.gentoo.org/show_bug.cgi?id=294269
Turns out on those versions of FreeBSD (>= 7.x) that know OSS_GETVERSION
the ioctl doesn't actually work yet (except in the Linuxolator), so if
building on FreeBSD assume the sound drivers are new enough if the ioctl
returns the errno it does currently on FreeBSD.
(Rev 2 after private discussion with malc.)
Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: malc <av1474@comtv.ru>
Previous patch introduced subtle regression, in cases when
OSS_GETVERSION fails the code wasn't falling back to
SNDCTL_DSP_SETFRAGMENT.
Signed-off-by: malc <av1474@comtv.ru>
We're seeing various issues with the SDL audio backend and want to
switch to the pulseaudio backend. See e.g.
https://bugzilla.redhat.com/495964https://bugzilla.redhat.com/519540https://bugzilla.redhat.com/496627
The pulseaudio backend seems to work well, so we should allow it to be
selected as the default.
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
Additional argument (whether to try poll mode) is only passed with
VOICE_ENABLE command.
Thanks to Markus Armbruster for noticing the potential breakage.
pcm_ops.run_out now takes number of live samples (which will be always
greater than zero) as a second argument, every driver was calling
audio_pcm_hw_get_live_out anyway with exception of fmod which used
audio_pcm_hw_get_live_out2 for no good reason.
Signed-off-by: malc <av1474@comtv.ru>
a. Use SNDCTL_DSP_POLICY instead of SNDCTL_DSP_SETFRAGMENT
b. Add ability to open device in exclusive mode, thus bypassing vmix
Signed-off-by: malc <av1474@comtv.ru>
Problem: Our file sys-queue.h is a copy of the BSD file, but there are
some additions and it's not entirely compatible. Because of that, there have
been conflicts with system headers on BSD systems. Some hacks have been
introduced in the commits 15cc923584,
f40d753718,
96555a96d7 and
3990d09adf but the fixes were fragile.
Solution: Avoid the conflict entirely by renaming the functions and the
file. Revert the previous hacks.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
audio/esdaudio.c: In function 'qesd_thread_out':
audio/esdaudio.c:136: error: format '%d' expects type 'int', but
argument 3 has type 'ssize_t'
audio/esdaudio.c: In function 'qesd_thread_in':
audio/esdaudio.c:366: error: format '%d' expects type 'int', but
argument 3 has type 'ssize_t'
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: malc <av1474@comtv.ru>
Dsound currently does not compile due to the typos in the code. This
patch makes it compile again.{PATCH}
Signed-off-by: Alex Ivanov <void@aleksoft.net>
Signed-off-by: malc <av1474@comtv.ru>
Both input and output streams may be in SND_PCM_STATE_SUSPENDED
after the host is suspended and resumed, meaning "Hardware is
suspended". snd_pcm_readi() and snd_pcm_writei() will return
-ESTRPIPE if called while the stream is in this state.
Call snd_pcm_resume() to enable audio output and capture after
host resume.
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: malc <av1474@comtv.ru>
Generate CONFIG_AUDIO_DRIVERS. Order is important here, because the
first driver in the list is the one used by default.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
/usr/include/alsa/pcm.h contains:
#define snd_pcm_sw_params_alloca(ptr) do { assert(ptr); *ptr = (snd_pcm_sw_params_t *) alloca(snd_pcm_sw_params_sizeof()); memset(*ptr, 0, snd_pcm_sw_params_sizeof()); } while (0)
The assert generates: "error: the address of 'sw_params' will always
evaluate as 'true'" which combined with -Werror prevents alsaaudio.o
from being built with certain versions of GCC.
Failure to initialize the audio subsystem is not handled consistently.
Where it is handled it has guest visible effects, which is wrong.
We already have a "nosound" audio driver as a last resort, so trying to
proceed without an audio backend seems pointless.
Also protect against multiple calls to AUD_init so that this can be
pushed down into individual devices.
Signed-off-by: Paul Brook <paul@codesourcery.com>
Suppress a warning
audio/dsoundaudio.c:35:1: warning: "WIN32_LEAN_AND_MEAN" redefined
<command line>:4:1: warning: this is the location of the previous definition
Signed-off-by: Alex Ivanov <void@aleksoft.net>
Refactor the monitor API and prepare it for decoupled terminals:
term_print functions are renamed to monitor_* and all monitor services
gain a new parameter (mon) that will once refer to the monitor instance
the output is supposed to appear on. However, the argument remains
unused for now. All monitor command callbacks are also extended by a mon
parameter so that command handlers are able to pass an appropriate
reference to monitor output services.
For the case that monitor outputs so far happen without clearly
identifiable context, the global variable cur_mon is introduced that
shall once provide a pointer either to the current active monitor (while
processing commands) or to the default one. On the mid or long term,
those use case will be obsoleted so that this variable can be removed
again.
Due to the broad usage of the monitor interface, this patch mostly deals
with converting users of the monitor API. A few of them are already
extended to pass 'mon' from the command handler further down to internal
functions that invoke monitor_printf.
At this chance, monitor-related prototypes are moved from console.h to
a new monitor.h. The same is done for the readline API.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6711 c046a42c-6fe2-441c-8c8c-71466251a162
Change from v1:
Avoid changing the existing coding style in certain files.
Signed-off-by: Stuart Brady <stuart.brady@gmail.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6120 c046a42c-6fe2-441c-8c8c-71466251a162
when compiling on NetBSD:
warning: array subscript has type 'char'
Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5727 c046a42c-6fe2-441c-8c8c-71466251a162
The issue was first noticed/addressed by Laurent Vivier in his QEMU on
AIX patches.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5712 c046a42c-6fe2-441c-8c8c-71466251a162