Commit Graph

39 Commits

Author SHA1 Message Date
wm4 db565ca4f8 mplayer: fix crash when muted and audio codec fails
When audio codec initialization fails, reinit_audio_chain() will call
uninit_player() to close the AO. mpctx->ao is set, but mpctx->mixer.ao
is still NULL. uninit_player() assumes both variables are always the
same, and calls mixer_uninit(), even though mpctx->mixer.ao is NULL.
That function tries to access the ao without NULL check if mute was
enabled.

Fix this in mplayer.c by not relying on the assumption that
mpctx->ao == mpctx->mixer.ao. Also, add a check for NULL to mixer.c
(function muxer_uninit()). One of the checks is redundant and only one
of them is needed, but we add both for general robustness.
2012-10-03 01:41:13 +02:00
wm4 425ac31a3b softvol, ao_pulse: prefer ao_pulse volume control by default
--softvol is enabled by default. For most audio outputs, this is a good
thing, as they have either their own (bad) soft volume implementation,
or control the system mixer. With ao_pulse, the situation is a bit
different: it supports per-application volume (i.e. volume control is
not really global). More importantly, ao_pulse uses a rather large audio
buffer, and changing the volume with mplayer's volume filter has a large
delay. With the native ao_pulse volume control, it's instant, because
PulseAudio's audio filtering happens at a later stage in its processing
pipeline (inaccessible for mplayer).

This means native volume control should really be allowed for ao_pulse,
while it's the reverse for other audio outputs. Make --softvol a choice
option, and add a new "auto" choice. This is default and will use PA's
volume control with ao_pulse, and mplayer's volume filter otherwise
(i.e. the old softvol behavior).
2012-09-23 14:57:01 +02:00
wm4 d80b84f1a0 mixer: silence message about inserting volume filter
But only if softvol is enabled. Otherwise, it should be a warning.
2012-07-30 01:46:04 +02:00
Uoti Urpala 39aa7d9846 mixer: support native audio driver mute
Make mixer support setting the mute attribute at audio driver level,
if one exists separately from volume. As of this commit, no libao2
driver exposes such an attribute yet; that will be added in later
commits.

Since the mute status can now be set externally, it's no longer
completely obvious when the player should automatically disable mute
when uninitializing an audio output. The implemented behavior is to
turn mute off at uninitialization if we turned it on and haven't
noticed it turn off (by external means) since.
2012-04-11 03:56:28 +03:00
Uoti Urpala 9624f10aa8 audio: fix unmute-at-end logic
The player tried to disable mute before exiting, so that if mute is
emulated by setting volume to 0 and the volume setting is a
system-global one, we don't leave it at 0. However, the logic doing
this at process exit was flawed, as volume settings are handled by
audio output instances and the audio output that set the mute state
may have been closed earlier. Trying to write reliably working logic
that restores volume at exit only would be tricky, so change the code
to always unmute an audio driver before closing it and restore mute
status if one is opened again later.
2012-04-11 03:52:34 +03:00
Uoti Urpala e29cb8f323 audio: restore balance setting after reinit
Restore the audio balance setting when the audio chain is
reinitialized (also after switching to another file).

Also add a note about the balance code being seriously buggy.
2012-04-11 03:50:33 +03:00
Uoti Urpala 87dad2a470 audio: restore volume setting after AO reinit if needed
MPlayer volume control was originally implemented with the assumption
that it controls a system-wide volume setting which keeps its value
even if a process closes and reopens the audio device. However, this
is not actually true for --softvol mode or some audio output APIs that
only consider volume as a per-client setting for software mixing. This
could have annoying results, as the volume would be reset to a default
value if the AO was closed and reopened, for example whem moving to a
new file or crossing ordered chapter boundaries. Add code to set the
previous volume again after audio reinitialization if the current
audio chain is known to behave this way (softvol active or the AO
driver is known to not keep persistent volume externally).

This also avoids an inconsistency with the mute flag. The frontend
assumed the mute status is persistent across file changes, but it
could be similarly lost.

The audio drivers that are assumed to not keep persistent volume are:
coreaudio, dsound, esd, nas, openal, sdl. None of these changes have
been tested. I'm guessing that ESD and NAS do per-connection
non-persistent volume settings.

Partially based on code by wm4.
2012-04-11 03:50:31 +03:00
Uoti Urpala 157a6c1e83 audio: mixer: change logic for AOs with no volume control
The volume filter was automatically inserted if setting AO volume
failed. Remove that logic, and instead enable softvol mode fully if
querying current volume (which will happen before any set attempts)
fails. Fully switching to softvol mode is more robust, and any case
where the behavior would differ (the behavior is neither that both
querying/setting always work nor that both always fail) would have
been buggy.
2012-04-11 03:35:53 +03:00
Uoti Urpala 7807f46cd1 audio: keep volume level internally (not only in AO)
Current volume was always queried from the the audio output driver (or
filter in case of --softvol). The only case where it was stored on
mixer level was that when turning off mute, volume was set to the
value it had before mute was activated. Change the mixer code to
always store the current target volume internally. It still checks for
significant changes from external sources and resets the internal
value in that case.

The main functionality changes are:

Volume will now be kept separately from mute status. Increasing or
decreasing volume will now change it relative to the original value
before mute, even if mute is implemented by setting AO level volume to
0. Volume changes no longer automatically disable mute. The exception
is relative changes up (like the volume increase key in default
keybindings); that's the only case which still disables mute.

Keeping the value internally avoids problems with granularity of
possible volume values supported by AO. Increase/decrease keys could
work unsymmetrically, or when specifying a smaller than default
--volstep, even fail completely. In one case occurring in practice, if
the AO only supports changing volume in steps of about 2 and rounds
down the requested volume, then volume down key would decrease by 4
but volume up would increase by 2 (previous volume plus or minus the
default change of 3, rounded down to a multiple of 2). Now, the
internal value will keep full precision.
2012-04-11 00:13:11 +03:00
Uoti Urpala ec58e5a384 options: move mixer.h options to struct 2012-03-20 14:51:32 +02:00
wm4 7a699cea28 mixer: reindent/cosmetic changes
There should be no real semantic changes.

Remove the mixer_setbothvolume macro, as it was unused.
2012-03-20 14:51:32 +02:00
Uoti Urpala 2a7c5a1365 audio: change external AO interface to "ao_[method](ao, ...)"
Make the outside interface of audio output handling similar to the
video output one. An AO object is first created, and then methods
called with ao_[methodname](ao, args...). However internally libao2/
still holds all data in globals, and trying to create multiple
simultaneous AO instances won't work.
2011-04-09 03:03:22 +03:00
Uoti Urpala 00323c06e2 Delete things related to old translation system
Remove the help/ subdirectory, configure code to create toplevel
help_mp.h, and all the '#include "help_mp.h"' lines from .c files.
2010-03-10 03:47:14 +02:00
Uoti Urpala 12d3caebc7 Merge svn changes up to r30475 2010-03-09 19:18:43 +02:00
diego 99c1bbca2a Add license header to all top-level files missing them.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30471 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-30 23:24:23 +00:00
Uoti Urpala 0eb321bf2c Remove trailing whitespace from most files 2009-07-07 02:34:35 +03:00
Amar Takhar e306174952 Translation system changes part 2: replace macros by strings
Replace all MSGTR_ macros in the source by the corresponding English
string.
2009-07-07 01:38:20 +03:00
Amar Takhar b5972d6f14 Translation system changes part 1: wrap translated strings
Replace mp_msg() calls which have a translated string as the format
argument with mp_tmsg and add _() around all other translated strings.
2009-07-07 01:28:07 +03:00
diego 6e9cbdc104 whitespace cosmetics: Remove all trailing whitespace.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-05-13 02:58:57 +00:00
zuxy be09bd1c04 The audio balance feature implemented with af_pan.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23588 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-06-20 02:26:20 +00:00
reimar e2f2ca1cbb allow forcing of software volume control and setting maximum amplification.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13934 b3059339-0415-0410-9bf9-f77b7e298cf2
2004-11-14 11:27:58 +00:00
reimar bb98df0456 automatic loading of af_volume, original patch by Dan Christiansen (danchr (at) daimi (dot) au (dot) dk)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12909 b3059339-0415-0410-9bf9-f77b7e298cf2
2004-07-28 12:17:50 +00:00
alex f238f58d93 1000l
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12689 b3059339-0415-0410-9bf9-f77b7e298cf2
2004-06-26 12:47:00 +00:00
alex ba3c4568fb New 'Mixer API' with ability to change volume through libaf (this part was written by Reimar Doffinger) and lesser global variables
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12673 b3059339-0415-0410-9bf9-f77b7e298cf2
2004-06-26 09:14:20 +00:00
attila a4ac1dc9a4 add option to select mixer channel
patch by Catalin Muresan <catalin.muresan@astral.ro>


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11838 b3059339-0415-0410-9bf9-f77b7e298cf2
2004-01-24 11:53:52 +00:00
faust3 a66cc22948 MINGW32 port
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9773 b3059339-0415-0410-9bf9-f77b7e298cf2
2003-03-31 17:32:46 +00:00
alex d65c8518de 64bit libao2 fix by Jens Axboe <mplayer-dev@kernel.dk>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9634 b3059339-0415-0410-9bf9-f77b7e298cf2
2003-03-21 16:42:50 +00:00
pontscho 08b4af80fa add mute support ( step 1 ) and fixed panscan bugs (1000l for me)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6312 b3059339-0415-0410-9bf9-f77b7e298cf2
2002-06-06 07:13:57 +00:00
anders ee2ed8567e Moved HW dependent mixer stuff to libao and removed master switch
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4789 b3059339-0415-0410-9bf9-f77b7e298cf2
2002-02-21 16:02:26 +00:00
arpi 9915772774 DVB mixer control added (very big messy hack)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4750 b3059339-0415-0410-9bf9-f77b7e298cf2
2002-02-17 20:43:24 +00:00
atmos4 581a81f98e Applied fix for mixercontrol w/alsa ossemu by Christian Ohm.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1882 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-09-11 16:26:41 +00:00
arpi_esp e2fac92b09 patch by Jürgen Keil
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1062 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-06-08 23:36:58 +00:00
arpi_esp 5c50d3e7dd applied solaris8/netbsd/other fixes patch by Jürgen Keil <jk@tools.de>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1039 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-06-05 18:40:44 +00:00
arpi_esp 460fac7462 Solaris 8 support - patch by Marcus Comstedt <marcus@idonex.se>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1021 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-06-05 02:26:56 +00:00
szabii 3e9f04bdde warnings killed
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@606 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-04-23 23:46:24 +00:00
arpi_esp 158e68356b using /dev/mixer as default
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@557 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-04-21 00:15:19 +00:00
pontscho 05d3596822 some code cleanup
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@513 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-04-18 20:39:04 +00:00
pontscho 999ff33abd init release
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@462 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-04-16 00:23:38 +00:00
gabucino 005b7e2844 ups, I missed'em..
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@442 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-04-15 18:37:07 +00:00