Commit Graph

40 Commits

Author SHA1 Message Date
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
Rudolf Polzer f5b8b6ac12 encode: video encoding now supported using mencoder-like options 2012-09-18 21:08:20 +02:00
wm4 f113e20794 ao_pulse: don't always print error message if PulseAudio unavailable
PulseAudio is rather high on the auto proving order (to avoid using an
emulated sound API), but it prints an annoying error message if the
PA client library can't connect to a server. On the other hand, we do
want this error message printed if the user explicitly selects the
pulse audio output driver.

Add a flag to indicate that an AO is opened due to auto probing.
ao_pulse checks that flag, and if it's set, do not print if the
initialization error is PA_ERR_CONNECTIONREFUSED, whcih I assume is
the error signalling PulseAudio unavailability. (This error happens
if no PulseAudio server is installed.)
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 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 3a01606dc0 libao2: change control() types to enum, remove unused ones
Change the audio driver control() command argument from "int" to "enum
aocontrol". Remove unused control types (SET_DEVICE, GET_DEVICE,
QUERY_FORMAT, SET_PLUGIN_DRIVER, SET_PLUGIN_LIST). The QUERY_FORMAT
one looks like there's a possibility such functionality could be
useful in the future, but as ao_oss was the only driver to have an
actual implementation of it, the current code wasn't worth keeping.
2012-04-08 16:35:09 +03:00
Uoti Urpala a0de4bc500 ao_pulse, core: make pulse thread wake up core for more data
For ao_pulse, the current latency is not a good indicator of how soon
the AO requires new data to avoid underflow. Add an internal pipe that
can be used to wake up the input loop from select(), and make the
pulseaudio main loop (which runs in a separate thread) use this
mechanism when pulse requests more data. The wakeup signal currently
contains no information about the reason for the wakup, but audio
buffers are always filled when the event loop wakes up.

Also, request a latency of 1 second from the Pulseaudio server. The
default is normally significantly higher. We don't need low latency,
while higher latency helps prevent underflows reduces need for
wakeups.
2012-03-26 03:55:31 +03:00
Uoti Urpala ec58e5a384 options: move mixer.h options to struct 2012-03-20 14:51:32 +02:00
Uoti Urpala 9d25699c58 audio: export audio pts to AO drivers
Currently the pts value is not directly used by any AO. Will be used
by encoding code.
2011-07-31 16:31:07 +03:00
Uoti Urpala c8b3088c18 audio: move ready-for-ao data buffer from decoder to AO
Move the buffer storing audio data ready to be fed to the audio output
driver from the audio decoder object to the AO object. This will help
encoding code deal with end of input, and may also be useful to
improve other general gapless audio behavior (as AOs which do not
accept chunks smaller than a certain size may keep them in the buffer
while the decoder changes).

Less data may be dropped now when changing audio filters or switching
timeline parts.
2011-07-02 09:22:32 +03:00
Uoti Urpala 40f6ab5064 ao_pcm, core: use new API in ao_pcm, change timing with it
Change ao_pcm to use the new audio output driver API and clean up some
of the code. Rewrite the logic controlling how playback timing works
when using -ao pcm. Deprecate the "fast" suboption; its only effect
now is to print a warning, but it's still accepted so that specifying
it is not an error.

Before, timing with -ao pcm and video enabled had two possible
modes. In the default mode playback speed was rather arbitrary - not
realtime, but not particularly fast. -ao pcm:fast tried to play back
at maximum video playback speed - mostly succeeding, but not quite
guaranteed to work in all cases. Now the default is to play at
realtime speed. The -benchmark option can now be used to get faster
playback (same as the video-only case). In the audio-only case
playback is always maximum speed.
2011-05-05 21:34:17 +03:00
Uoti Urpala 3a5fd15fa2 audio output: add a new AO driver API
Add a new audio output driver API. The main change is the addition of
a context struct where data can be kept instead of using globals. The
old API remains available. This commit does not yet convert any driver
to use the new API.
2011-05-05 01:39:53 +03:00
Uoti Urpala df7825eb31 cleanup: reindent audio_out.[ch]
Reindent audio_out.c and audio_out.h. Also remove trailing '_s' from
two struct names (which are not currently used anywhere) and make the
audio_out_drivers[] table static.
2011-05-04 21:09:08 +03: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 0eb321bf2c Remove trailing whitespace from most files 2009-07-07 02:34:35 +03:00
Uoti Urpala e0172b96e3 Merge svn changes up to r28862 2009-03-07 01:04:41 +02:00
reimar d6bf2e318e Make ao_info_t structs const.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28858 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-03-06 19:43:12 +00:00
Uoti Urpala ccf4d9e96c Merge svn changes up to r28403 2009-01-31 04:52:15 +02:00
diego c1cd81818a Add standard license headers.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28378 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-01-26 15:06:44 +00:00
Uoti Urpala 0e757bf9da Remove _s/_st suffix from some struct names
Since the names are always used after the keyword "struct" having a
suffix as in "struct demuxer_st" is almost completely pointless.
2008-04-25 03:34:22 +03:00
diego 8efb2fa21c Add MPLAYER_ prefix to multiple inclusion guards.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26061 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-02-22 09:09:46 +00:00
reimar 6921ab9e24 ao_functions_t should be const, part 1
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25945 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-02-01 20:11:14 +00:00
diego fba0b66ff9 Add explanatory comments to the #endif part of multiple inclusion guards.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25563 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-31 16:15:50 +00:00
diego 3e9e4acd8d Do not use leading underscores in multiple inclusion guards, they are reserved.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23709 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-07-02 22:34:45 +00:00
uau bd4a9d25bf Rewrite audio EOF handling logic fixing some problems that could cause
truncation of output, set flag AOPLAY_FINAL_CHUNK in play call to tell
ao there will be no more data beyond what's in current buffer.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18738 b3059339-0415-0410-9bf9-f77b7e298cf2
2006-06-16 21:52:25 +00:00
rathann e7db4ccf1a Patch by Stefan Huehner / stefan % huehner ! org \
patch replaces '()' for the correct '(void)' in function
declarations/prototypes which have no parameters. The '()' syntax tell
thats there is a variable list of arguments, so that the compiler cannot
check this. The extra CFLAG '-Wstrict-declarations' shows those cases.

Comments about a similar patch applied to ffmpeg:

That in C++ these mean the same, but in ANSI C the semantics are
different; function() is an (obsolete) K&R C style forward declaration,
it basically means that the function can have any number and any types
of parameters, effectively completely preventing the compiler from doing
any sort of type checking. -- Erik Slagter

Defining functions with unspecified arguments is allowed but bad.
With arguments unspecified the compiler can't report an error/warning
if the function is called with incorrect arguments. -- Måns Rullgård


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17567 b3059339-0415-0410-9bf9-f77b7e298cf2
2006-02-09 14:08:03 +00:00
alex c95c1533a1 unused definitions removed
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14619 b3059339-0415-0410-9bf9-f77b7e298cf2
2005-01-31 11:18:31 +00:00
alex 504270e549 uninit immed flag
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12146 b3059339-0415-0410-9bf9-f77b7e298cf2
2004-04-06 17:55:36 +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
arpi 1acee84acd audio out driver list support (example: -ao alsa9,sdl:esd,oss,sdl:oss,)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7564 b3059339-0415-0410-9bf9-f77b7e298cf2
2002-09-29 22:57:54 +00:00
pontscho dde3c15266 - add some control (ao_oss, pl_extrastereo)
- cosmetic


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6796 b3059339-0415-0410-9bf9-f77b7e298cf2
2002-07-25 20:28:47 +00:00
iive 98f2828d5a added audio_out_format_bits to calc len alignment
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@6027 b3059339-0415-0410-9bf9-f77b7e298cf2
2002-05-09 07:39:33 +00:00
anders 0470bface7 Changes to audio out plugin, first plugin added
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3108 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-11-25 14:29:54 +00:00
anders 242aa6ebd4 interface to libao2 changed ao_plugin added
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3096 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-11-24 05:21:22 +00:00
arpi 38128eab95 ao_mpegpes
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2709 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-11-05 03:01:11 +00:00
al3x d18ea939ef ao_subdevice implemented
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1186 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-06-21 22:34:58 +00:00
al3x fa1d83cbb5 audio_out_format_name prototype added, ao_control_vol_t for aocontrol_get/set_volume added
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1128 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-06-14 15:25:00 +00:00
al3x ce96e9bd56 uj aocontrol valtozok
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1049 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-06-07 13:06:30 +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 7a2eec4b59 audio out drivers
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@955 b3059339-0415-0410-9bf9-f77b7e298cf2
2001-06-02 23:25:43 +00:00