Commit Graph

300 Commits

Author SHA1 Message Date
wm4 a17b5364ea ao_alsa: return negative value on error in play()
No functional change, because the only user of ao_play() ignores return
values below 1.
2013-10-30 22:19:15 +01:00
wm4 7abc1bef40 af: replace macros with too generic names
Defining names like min, max etc. in an often used header is not really
a good idea.

Somewhat similar to MPlayer svn commit 36491, but don't use libavutil,
because that typically causes us sorrow.
2013-10-26 15:05:59 +02:00
wm4 6ac5474790 af_volume: some more cosmetics 2013-10-26 14:04:38 +02:00
wm4 13fcb1925a af_volume: switch to new option parsing 2013-10-26 13:36:46 +02:00
wm4 f2660c0a29 af_volume: uncrustify
Also, use more C99 and remove "register" keywords.
2013-10-26 13:36:46 +02:00
wm4 b890093c44 af_volume: don't change volume if nothing is to be changed
On the float path. Note that this skips clipping, but we expect that
everything on the audio-path is pre-clipped anyway.
2013-10-26 13:36:34 +02:00
wm4 3b5657f0c1 af_volume: remove unused features
Roughly follows MPlayer svn commits 36492 and 36493. We also remove
the volume peak reporting. (There are much better libavfilter filters
for this, I think.)
2013-10-26 13:36:34 +02:00
wm4 d8896f0dba ao_alsa: don't include alloca.h
It's true that ALSA uses alloca() in some of its API functions, but
since this is hidden behind macros in the ALSA headers, we have no
reason to include alloca.h ourselves.

Might help with portability (FreeBSD).
2013-10-25 21:25:54 +02:00
wm4 d58d4ec93c audio/out: remove useless info struct and redundant fields 2013-10-23 19:30:02 +02:00
wm4 b08617ff71 audio/filter: remove useless af_info fields
Drop the author and comment fields. They were completely unused - not
even printed in verbose mode, just dead weight.

Also use designated initializers and drop redundant flags.
2013-10-23 19:30:01 +02:00
wm4 a46453347f af_force: set format early for better debug output
Set the input/output format in filter init. This doesn't change anything
functionally, but it makes the forced format show up in the filter chain
init verbose output (which sometimes prints the filter chain before all
filters have been configured).
2013-10-23 19:30:01 +02:00
wm4 247c89d6ba af_force: minor simplifications 2013-10-23 19:30:01 +02:00
wm4 943c785619 audio/filter: rename af_force.c to af_format.c
The filter itself was already renamed earlier - but rename the file too.
2013-10-23 19:29:30 +02:00
wm4 e60b8f181d audio/filter: split af_format into separate filters, rename af_force
af_format is the old audio conversion filter. It could do all possible
conversions supported by the audio chain. However, ever since the
addition of af_lavrresample, most conversions are done by
libav/swresample, and af_format is used as fallback.

Separate out the fallback cases and remove af_format. af_convert24 does
24 bit <-> 32 bit conversions, while af_convertsignendian does sign and
endian conversions. Maybe the way the conversions are split sounds a bit
odd. But the former changes the size of the audio data, while the latter
is fully in-place, so there's at least different buffer management.

This requires a quite complicated algorithm to make sure all these
"partial" conversion filters can actually get from one format to
another. E.g. s24le->s32be always requires convertsignendian and
convert24, but af.c has no idea what the intermediate format should
be. So I added a graph search (trying every possible format and
filter) to determine required format and filter. When I wrote this,
it seemed this was still better than messing everything into
af_lavrresample, but maybe this is overkill and I'll change my
opinion. For now, it seems nice to get rid of af_format though.

The AC3->IEC61937 conversion isn't supported anymore, but I don't think
this is needed anywhere. Most AOs test all formats explicitly, or use
the AF_FORMAT_IS_IEC61937() macro (which includes AC3).

One positive consequence of this change is that conversions always
include dithering (done by libav/swresample), instead of possibly going
through af_format, which doesn't do anything fancy.

Rename af_force to af_format. It's essentially compatible with command
line uses of af_format. We retain a compatibility alias for af_force.
2013-10-23 10:04:12 +02:00
wm4 33707c6d63 audio/format: add some helper functions 2013-10-22 01:01:41 +02:00
wm4 bb5fe4d874 ao_pcm: big endian AC3 in wav doesn't work
At least not with ffmpeg.

Honestly, I have no idea how little endian AC3 works at all, since
ao_pcm doesn't do anything special about it, and treats it like s16le.
Maybe it's broken and ffmpeg has special logic to detect it.
2013-10-22 01:01:07 +02:00
wm4 c01feaaa79 af_lavrresample: actually free resampler
Fixes #304.
2013-10-19 13:19:35 +02:00
wm4 e046fa584a mp_msg: remove gettext() support
Was disabled by default, was never used, internal support was
inconsistent and poor, and there has been virtually no interest in
creating translations.

And I don't even think that a terminal program should be translated.
This is something for (hypothetical) GUIs.
2013-10-18 22:38:10 +02:00
wm4 20988ee607 command: don't allow changing volume if no audio initialized
Changing volume when audio is disabled was a feature request (github
issue #215), and was introduced with commit 327a779.

But trying to fix github issue #280 (volume is not correct in no-audio
mode, and if audio is re-enabled, the volume set in no-audio mode isn't
set), I concluded that it's not worth the trouble and the current
implementation is questionable all around. (For example, you can't
change the real volume in no-audio mode, even if the AO is open - this
could happen with gapless audio.) It's hard to get right, and the
current mixer code is already hilariously overcomplicated. (Virtually
all of mixer.c is an amalgamation of various obscure corner cases.)

So just remove this feature again.

Note that "options/volume" and "options/mute" still can be used in
idle mode to adjust the volume used next time, though these properties
can't be used during playback and thus not in audio-only mode.

Querying the volume still "works" in audio-only mode, though it can
return bogus values.
2013-10-12 18:57:02 +02:00
Thomas Orgis 55883943c5 ad_mpeg123: support in-stream format changes
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@36461 b3059339-0415-0410-9bf9-f77b7e298cf2

Fixes playback of http://mpg123.org/test/44and22.mp3

Cherry-picked from MPlayer SVN rev. #36461, a patch by
Thomas Orgis, committed by by Reimar Döffinger.
2013-10-06 23:41:18 +02:00
Stefano Pigozzi 683e212a77 ao_coreaudio: clear output buffer on buffer underrun
Output silence to the output buffer during underruns. This removes small
occasional glitches that happen before the AUHAL is actually paused from the
`audio_pause` call.

Fixes #269
2013-10-03 23:43:07 +02:00
Christian Neukirchen 3289473678 audio/out: add sndio support
Based on an earlier patch for mplayer by Alexandre Ratchov <alex@caoua.org>
2013-10-03 23:14:03 +02:00
wm4 ef9c5300ef cosmetics: replace "CTRL" defines by enums
Because why not.
2013-10-02 21:19:16 +02:00
Stefano Pigozzi 94d6babb95 ao_coreaudio: fetch device name only for verbose log level
The previous code fetched the device name regardless of log level and then
only printed it if log level was verbose.
2013-10-01 11:00:43 +02:00
Martin Herkt f210244a1c ao_jack: don’t force exact client name
Trying to connect multiple mpv clients to JACK with the
JackUseExactName option would fail unless the user manually
specifies a unique client name. This changes the behavior
to automatically generate a unique name if the requested
one is already in use.
2013-09-30 14:42:55 +02:00
Paul B Mahol 20b2d7cb6f ao_oss: add support for SNDCTL_DSP_RESET and use it when pausing
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: wm4 <wm4@nowhere>
2013-09-23 01:21:37 +02:00
Johan Kiviniemi 912f609403 ao_pulse: bug fix: goto the correct error handler 2013-09-20 13:50:45 +02:00
Johan Kiviniemi e5710ccc5d ao_pulse: set the property media.role=video 2013-09-20 13:50:13 +02:00
wm4 542086dd45 af: merge af_reinit() and fix_output_format()
Calling them separately doesn't really make sense, and all existing
calls to them usually combined them. One subtitle difference was that
af_init() didn't wipe the filter chain if initialization of the chain
itself failed, but that didn't really make sense anyway.

Also remove af_init() from the code for setting balance in mixer.c. The
mixer should be in the initialized state only if audio is fully
initialized, so the af_init() call made no sense.

Note that the filter "editing" code in command.c doesn't really do a
nice job of handling errors in case recreating an _old_ (known to work)
filter chain unexpectedly fails, and this obscure/rare case might be
differently handled after this change.
2013-09-20 13:43:00 +02:00
wm4 0162271725 mixer: make struct opaque
Also remove stray include statements from ao_alsa and ao_oss.
2013-09-20 13:23:25 +02:00
wm4 b8e42ae13c mixer: restore volume with playback resume
Note that this is intentionally never done if the AO or softvolume is
different, or if the current volume control method is thought to control
system wide volume (such as ALSA) or otherwise user controllable (such
as PulseAudio). The intention is to keep things robust and to avoid
messing with the user's audio settings as far as possible, while still
providing the ability to resume volume if it makes sense.
2013-09-20 13:23:25 +02:00
wm4 234d967bed mixer: don't unmute audio when raising volume
This is rather strange behavior, away with it.
2013-09-19 14:32:25 +02:00
wm4 38b2c97fd6 mixer: refactor, fix some aspects of --volume handling
Refactor how mixer.c does volume/mute restoration and initialization.
Move to handling of --volume and --mute to mixer.c. Simplify the
implementation of these and hopefully fix bugs/strange behavior related
to using them as file-local options (this uses a somewhat dirty trick:
the option values are reverted to "auto" after initialization). Put most
code related to initialization and volume restoring in probe_softvol()
and restore_volume(). Having this code all in one place is less
confusing.

Instead of trying to detect whether to use softvol at runtime, detect it
at initialization time using AOCONTROL_GET_VOLUME (same with mute,
AOCONTROL_GET_MUTE). This implies we expect SET_VOLUME/SET_MUTE to work
if the GET variants work. Hopefully this is always the case.

This is also preparation for being able to change volume/mute settings
if audio is disabled, and for allowing restoring value with playback
resume.
2013-09-19 14:32:09 +02:00
wm4 4ba52a9e82 mixer, af_volume: use linear values instead of dB
Softvol always used a linear multiplier for volume control. This was
converted to dB, and then back to linear in af_volume. Remove this non-
sense. We still try to keep the command line argument to af_volume in
dB, though.
2013-09-19 14:31:55 +02:00
wm4 296531ad00 mixer: minor refactoring
Let struct mixer access access MPOpts to simplify some things. Rename
some variables and functions. There should be no functional changes.
2013-09-19 14:31:43 +02:00
wm4 69e272dad7 af_export: fix compilation warning
Blargh.
2013-09-19 14:30:53 +02:00
wm4 5249cccfcf Config path functions can return NULL
It's quite unlikely, but functions like mp_find_user_config_file() can
return NULL, e.g. if $HOME is unset.

Fix all the code that didn't check for this correctly yet.
2013-09-18 19:56:15 +02:00
wm4 570826448a audio: fix playback of Musepack SV8 files
This is basically a libavcodec API oddity: it can happen that
avcodec_decode_audio4() returns 0 (meaning 0 bytes were consumed). It
requires you to feed the complete packet again to decode the full
packet, and to successfully decode the following packets.

We ignored this case with the argument that there's the danger of an
endless decode loop (because nothing of that packet is apparently
decoded, so it would retry forever), but change it in order to decode
mpc8 files correctly.

Also add some comments to explain the mess.
2013-09-01 20:17:50 +02:00
wm4 ddc9733446 audio: don't allow setting unknown formats from command line
af_str2fmt_short(), which is used by the command line option parser,
allowed passing a hex number. The user could set arbitrary integers as
internal audio formats, even formats which don't exist or make no sense.
This is not very useful, so get rid of it.
2013-08-26 10:09:44 +02:00
wm4 53b5227270 audio: make internal audio format 0 an invalid format
Having to use -1 for that is generally quite annoying.

Audio formats are created from bitmasks, and it can't be excluded that
0 is not a valid format. Fix this by adjusting AF_FORMAT_I so that it
is never 0. Along with AF_FORMAT_F and the special formats, all valid
formats are covered and guaranteed to be non-0.

It's possible that this commit will cause some regressions, as the
check for invalid audio formats changes a bit.
2013-08-26 10:09:41 +02:00
wm4 0d8a62c08d Some more mp_msg conversions
Also add a note to mp_msg.h, since it might be not clear which of the
two mechanisms is preferred.
2013-08-23 23:30:09 +02:00
wm4 edd36a3afc audio/out: do some mp_msg conversions
Use the new MP_ macros for some AOs instead of mp_msg.

Not all AOs are converted, and some only partially. In some cases, some
additional cosmetic changes are made.
2013-08-22 23:12:35 +02:00
wm4 cb54c2dda8 ao: remove some leftovers 2013-08-22 22:45:24 +02:00
Stefano Pigozzi 406241005e core: move contents to mpvcore (2/2)
Followup commit. Fixes all the files references.
2013-08-06 22:52:31 +02:00
Diogo Franco 57ec67a6cc Merge pull request #154 from rossy2401/wasapi-pause
WASAPI stops working after pause
2013-08-05 18:22:46 -07:00
wm4 ee2e3b3374 core: change speed option/property to double
The --speed option and the speed property used float. Change them to
double.

Change the commands that manipulate the property (speed_mult/add) to
double as well. Since the cycle command shares code with the add
command, we change that as well.

The reason for this change is that this allows better control over
speed, such as stepping by semitones. Using floats is also just plain
unnecessary.
2013-08-05 00:00:26 +02:00
Stefano Pigozzi 0bd09da570 ao_coreaudio: move to new log API 2013-08-01 20:32:49 +02:00
Stefano Pigozzi 5cd5f0cf70 ao_coreaudio: remove useless defines
They are already defined in the header file
2013-08-01 20:32:49 +02:00
Stefano Pigozzi 3449e893e1 audio/out: add support for new logging API 2013-08-01 20:32:49 +02:00
Jonathan Yong 29b0be400c Fix some warnings 2013-07-30 11:05:39 -03:00