1
mirror of https://github.com/mpv-player/mpv synced 2024-08-24 07:21:49 +02:00
Commit Graph

37 Commits

Author SHA1 Message Date
wm4
7d0c4c3c31 mixer: remove useless includes
These have been unneeded ever since 2004.
2012-03-19 22:55:41 +01:00
wm4
06b1de2687 mixer, libao: add proper mute control
The mixer frontend code can now make use of a proper system mixer mute
toggle, if the audio output driver supports it.

The consequence is that, if support is available, mplayer will no longer
temporarily set the system volume to 0 if mute is enabled.

Generally, the code now deals with the following combinations of available
AO features:
- software volume control forced by user (--softvol / soft_vol flag)
  => if enabled, never touch the "hardware" controls
- "hardware"/driver volume control available (whether
  AOCONTROL_GET/SET_VOLUME works)
  => if not available, enable volume controls by enabling softvol
- "hardware"/driver mute control (AOCONTROL_GET/SET_MUTE)
  => if not available, emulate by setting volume to 0
- whether the volume+mute controls are kept or not when the AO is closed
  (indicated by ao->no_persistent_volume)
  => if not persistent, restore the volume/mute next time the AO is opened
2012-01-18 04:21:46 +01:00
wm4
b338b16be7 audio: reset mplayer's mute state when the system mixer volume changes
Before this commit, the mute state was only reset when either mute was
explicitly cleared, or the volume was changed via mplayer controls. If
the volume controls are connected to the system mixer, and the system
mixer volume is changed otherwise (e.g. with alsamixer), the mute
setting was inconsistent.

Avoid this by checking the volume. If the returned volume is not 0, the
mute flag is considered invalid. This relies on system mixers always
returning a volume of 0 when mplayer has set the volume 0.

Possible caveat: if the audio output's volume control don't return a
volume of exactly 0 after 0 was written, enabling mute basically won't
work. It will set the volume to silence, forget the previous volume, and
report that mute is disabled.
2012-01-18 04:21:45 +01:00
wm4
6afaf948cd audio: pretend muting doesn't set volume to 0
Muting audio is implemented by setting the volume controls to 0. This
has the annoying consequence that attempting to change the volume while
the audio is muted will reset the user's volume setting. E.g. increasing
the volume while muted will start from 0, instead from the volume that
was set before muting. Changing the volume while muted effectively resets
the volume to 0 (which is not very useful), with no possibility of
restoring the old voume.

This commit makes mplayer always report the volume that was set when mute
was enabled while mute is still active.

Caveat: this might be have confusing effects when the volume control is
directly connected with a system wide mixer setting. Now it's even less
obvious (and thus more confusing) that muting will set the mixer volume
to 0.

Also always clip input volumes, and remove some minor code duplication.
2012-01-18 04:21:45 +01:00
wm4
aae97b7e25 audio: properly restore audio volume on exit when mute is used
When you mute audio, mplayer is supposed to restore the volume controls
on exit. This affects when --softvol isn't used and the audio output
driver volume controls directly affect the system wide volume controls.

This wasn't done in some cases.
2012-01-18 04:21:45 +01:00
wm4
29effe9593 mixer: restore volume with audio output drivers without persistent volume
Some audio outputs don't provide access to a system-wide mixer control, and
do per-application audio mixing. Further, some of these forget the volume
as soon as the audio device is closed. This can be annoying, because
mplayer will "forget" the volume when playing a new file or when crossing
ordered chapter boundaries. Support restoring the volume on audio
reinitialization if an audio output driver knowingly behaves this way.
(This doesn't change that mplayer never writes any settings into the config
file, including volume settings.)

This commit doesn't yet change any actual output driver to use this code.

Hopefully make some logic in the volume restore code a bit more robust.
2012-01-18 04:21:45 +01:00
wm4
7e3a4578bd mixer: keep balance setting
Similarly to the last commit, restore the balance setting when switching
to a new file. Unlike the volume setting, balance is always implemented
as filter, so this affects usage without --softvol too.
2012-01-07 16:43:35 +01:00
wm4
685fbf25fe mixer: keep user volume setting when --softvol is used
When --softvol is enabled, the volume set by the "volume" property is
reset when changing to a new file or crossing ordered chapter boundaries.

Fix this by explicitly restoring the volume on audio reinitialization.
Now the behavior with --softvol should be the same as if a system mixer
is used, and the volume should be persistent across file changes.

This also works around an inconsistency with the mute flag. The frontend
assumed the mute flag is persistent across file changes, which was not
true with --softvol.

If not resetting the volume on playing new files is undesired, it can
be avoided by putting volume=100 in the mplayer config file.
2012-01-07 16:42:30 +01:00
wm4
670e72506a mixer: reindent/cosmetic changes
There should be no real semantic changes.

Remove the mixer_setbothvolume macro, as it was unused.
2011-12-26 01:55:00 +01: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